[Haskell-cafe] Lifting a value into a DataKind

Richard Eisenberg rae at cs.brynmawr.edu
Wed Feb 8 01:55:27 UTC 2017


The singletons library's `toSing` (or `withSing`) may be what you want. Note that if you use Proxy, you won't be able to make any runtime decisions on the choice of `b`.

Richard

> On Feb 7, 2017, at 6:55 PM, Ivan Lazar Miljenovic <ivan.miljenovic at gmail.com> wrote:
> 
> Is it possible to automatically lift an arbitrary value into a type?
> i.e. I'm after a function of type `a -> Proxy (b :: a)`.
> 
> More specifically, I'm wanting to be able to write a function that can
> convert an Enum (e.g. Bool or Ord) into such a Proxy, so I can
> actually write a function that looks like: `a -> (forall b. Proxy (b
> :: a) -> r) -> r` and use the `a` type as a selector value (to e.g.
> choose between type class instances).
> 
> -- 
> Ivan Lazar Miljenovic
> Ivan.Miljenovic at gmail.com
> http://IvanMiljenovic.wordpress.com
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.



More information about the Haskell-Cafe mailing list