1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 18:23:44 +03:00

Note the custom error message.

This commit is contained in:
Rob Rix 2019-10-08 15:40:23 -04:00
parent f27729ab14
commit 31ba6be9d8
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -7,7 +7,7 @@ module AST.Element
import GHC.Generics ((:+:)(..)) import GHC.Generics ((:+:)(..))
import GHC.TypeLits (ErrorMessage(..), TypeError) import GHC.TypeLits (ErrorMessage(..), TypeError)
-- | Projection of an element out of a tree of sums, particularly suitable for use with highly branching (e.g. balanced) trees. -- | Projection of an element out of a tree of sums, particularly suitable for use with highly branching (e.g. balanced) trees. This provides custom type errors when the tree is known statically, rather than provided via a constraint passed on to callers.
class Element sub sup where class Element sub sup where
-- | Project one element out of a sum type. -- | Project one element out of a sum type.
prj :: sup a -> Maybe (sub a) prj :: sup a -> Maybe (sub a)