FAQ Database Discussion Community


List of any `DataKind` in GADT

haskell,gadt,data-kinds
Disclaimer GADTs & DataKinds are unexplored territory for me, so some of the limitations and capabilities of them are unknown to me. The Question So I'm writing an AST for a JavaScript code emitter, and I've identified one edge case between expressions and that is that they can either be...

Constructor that lifts (via DataKinds) to * -> A

haskell,data-kinds
Given an ADT like data K = A | B Bool the DataKinds extension allows us to lift it into kinds and types/type constructors K :: BOX 'A :: K 'B :: 'Bool -> K Is there a way to add a constructor to K that lifts to the type...

How can I automatically derive Typeable instance for DataKinds derived types?

haskell,types,deriving,data-kinds
I had some types like this: data Currency = USD | EUR deriving (Show, Typeable) data Money :: Currency -> * where Money :: Int -> Money c deriving (Show, Typeable) And I wanted to use typeOf with them in this function: findRate :: Money a -> Rates -> Maybe...