Module
Data.Undefined.NoProblem.Open
- Package
- purescript-undefined-is-not-a-problem
- Repository
- paluh/purescript-undefined-is-not-a-problem
#CoerceProps Source
class CoerceProps :: RowList Type -> RowList Type -> SList -> Constraint
class CoerceProps (given :: RowList Type) (expected :: RowList Type) (debugPath :: SList) | given -> debugPath
Instances
CoerceProps Nil Nil any
(CoerceProp a b (SCons n debugPath), CoerceProps t t' debugPath) => CoerceProps (Cons n a t) (Cons n b t') debugPath
(CoerceProps t t' debugPath) => CoerceProps t (Cons n (Opt a) t') debugPath
(RenderPath p p', Fail (Above (Beside (Text "Field mismatch on the path ") p') (Above (Text "") (Above (Beside (Text " * Maybe you have provided an extra field: ") (Beside (QuoteLabel n) (Text " ?"))) (Above (Text "") (Beside (Text " * Maybe you have skipped required field: ") (Beside (QuoteLabel m) (Text " ?")))))))) => CoerceProps (Cons n b y) (Cons m a x) p
(RenderPath (SCons n p) p', Fail (Above (Beside (Text "Missing required field: ") (QuoteLabel n)) (Above (Text "") (Beside (Text "The full path is: ") p')))) => CoerceProps Nil (Cons n a t) p
(RenderPath p p', Fail (Above (Beside (Text "Unexpected field provided: ") (QuoteLabel n)) (Beside (Text "The full path is: ") p'))) => CoerceProps (Cons n a t) Nil p
#CoerceProp Source
class CoerceProp :: Type -> Type -> SList -> Constraint
class CoerceProp (given :: Type) (expected :: Type) (debugPath :: SList) | expected -> debugPath
Check if given type can be coerced safely to the expected one.
Instances
(TypeEquals a b) => CoerceProp a (Req b) p
CoerceProp a (Opt a) p
CoerceProp (Opt a) (Opt a) p
(CoerceProp a b p) => CoerceProp (Opt a) (Opt b) p
(CoerceProp a b p) => CoerceProp a (Opt b) p
(RowToList e el, RowToList g gl, CoerceProps gl el p) => CoerceProp (Record g) (Record e) p
CoerceProp a a p
(CoerceProp a b (SCons "Array" p)) => CoerceProp (Array a) (Array b) p
(CoerceProp a b (SCons "Maybe" p)) => CoerceProp (Maybe a) (Maybe b) p
(CoerceProp a1 b1 (SCons "Either.Left" p), CoerceProp a2 b2 (SCons "Either.Right" p)) => CoerceProp (Either a1 a2) (Either b1 b2) p
(CoerceProp a1 b1 (SCons "Tuple.fst" p), CoerceProp a2 b2 (SCons "Tuple.snd" p)) => CoerceProp (Tuple a1 a2) (Tuple b1 b2) p
(CoerceProp a b (SCons "Effect" p)) => CoerceProp (Effect a) (Effect b) p
(RenderPath p p', TypeMismatchErr a Int p msg, Fail msg) => CoerceProp a Int p
(RenderPath p p', TypeMismatchErr Int a p msg, Fail msg) => CoerceProp Int a p
(RenderPath p p', TypeMismatchErr a String p msg, Fail msg) => CoerceProp a String p
(RenderPath p p', TypeMismatchErr String a p msg, Fail msg) => CoerceProp String a p
(RenderPath p p', TypeMismatchErr a Number p msg, Fail msg) => CoerceProp a Number p
(RenderPath p p', TypeMismatchErr Number a p msg, Fail msg) => CoerceProp Number a p
(RenderPath p p', TypeMismatchErr a Boolean p msg, Fail msg) => CoerceProp a Boolean p
(RenderPath p p', TypeMismatchErr Boolean a p msg, Fail msg) => CoerceProp Boolean a p
#Coerce Source
class (CoerceProp given expected SNil) <= Coerce given expected
Still experimenting with the finall API
Instances
(CoerceProp given expected SNil) => Coerce given expected