[Haskell-cafe] A type level puzzle
tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Sat Aug 15 13:12:57 UTC 2015
On Sat, Aug 15, 2015 at 02:35:53PM +0200, Silvio Frischknecht wrote:
> I'm not going to do the whole thing for you but I can help start you off.
> The type level string you think of is called Symbol. Symbol is a kind on
> it's own and not (*) it has a type for every string. You can use the
> functions in the following link to work with them.
> so you might have
> newtype (symbol :: Symbol) ::: value = Field value
> you can basically use any typelevel combinator you want for Sum e.g.
> ("foo" ::: Int) `(,)` ("bar" ::: Char) `(,)` ...
> or make your own
> You will have to use type families which are basically type level
> functions to merge two sums.
> If you run into trouble you can have a look at the following link which
> does some similar things.
> P.S. Prepare for a headache
A good headache or a bad headache? If it's hard to learn but ultimately
satisfying and useful then I'm all up for it. If it's hard to learn because
Haskell doesn't really support it naturally then I'll probably avoid it.
More information about the Haskell-Cafe