Declaring and working with types in Haskell
I recently played with a Haskell function -XDataKinds
and found that I want to create a view.
I'm not sure if my wishes can come true, but from the constraint package it seems like it is a declared view Constraint
(with a type BOX
) that says it is defined in GHC.Prim
, but I couldn't find it.
Is there a way to manually declare a view in Haskell or GHC? This will probably require manual confirmation that the datatypes declared with data
will have the proper appearance. My idea looks something like this:
data Foo :: BOX
data Bar a :: Foo where
Bar :: a -> Bar a
+3
source to share