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

Custom deriving(Read,Show) for enum type

Let's say I have this enumeration type: data TVShow = BobsBurgers | MrRobot | BatmanTAS and I want to define instances for Read and Show with the following behavior: show BobsBurgers = "Bob's Burgers" show MrRobot = "Mr. Robot" show BatmanTAS = "Batman: The Animated Series" read "Bob's Burgers" =...