[Haskell-cafe] Why do we want levity polymorphism?

David Menendez dave at zednenem.com
Wed Feb 10 21:23:57 UTC 2016


For context, there’s currently a big thread about the type of ($), which is
going to be more complicated in GHC 8.0 due to levity/runtime rep
polymorphism. As I understand it, the intention is that this more complex
type will be hidden unless a levity polymorphism flag is active. From my
perspective, makes the question of whether this type is too complicated for
beginners moot.

What puzzles me is that I still don’t understand what this feature is
*for*. According to [1], levity polymorphism is a more principled
replacement for OpenKind, which was a bit of hack. Fine.

[1] https://ghc.haskell.org/trac/ghc/wiki/NoSubKinds

OpenKind exists because developers wanted to use ($), undefined, and error
with unboxed types. That’s understandable, but it doesn’t seem worth all
this effort. Surely, having to use error# instead of error when working
with unboxed or unlifed types is a small thing next to all the other
differences.

OpenKind is also used when doing type inference, because arguments to
functions might be * or #. That’s more compelling, but doesn’t seem like
something that needs to be exposed to the programmer.

So, is that it? Are there less-trivial levity-polymorphic functions? Is
this a step on a road to new features, like [2]? Is there an article or
something that makes the case for this?

[2] https://ghc.haskell.org/trac/ghc/wiki/UnliftedDataTypes


-- 
Dave Menendez <dave at zednenem.com>
<http://www.eyrie.org/~zednenem/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160210/dc447098/attachment.html>


More information about the Haskell-Cafe mailing list