FAQ Database Discussion Community

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

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...

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

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...

List of any `DataKind` in GADT

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...