Changes to Typeable

Bas van Dijk v.dijk.bas at gmail.com
Sat Feb 11 01:35:10 CET 2012


On 11 February 2012 00:30, John Meacham <john at repetae.net> wrote:
> Would it be useful to make 'Proxy' an unboxed type itself? so
>
> Proxy :: forall k . k -> #
>
> This would statically ensure that no one accidentally passes ⊥ as a parameter
> or will get anything other than the unit 'Proxy' when trying to evaluate it.
> So the compiler can unconditionally elide the parameter at runtime. Pretty
> much exactly how State# gets dropped which has almost the same definition.

Or don't use an argument at all:

class Typeable t where
  typeRep :: Tagged t TypeRep

newtype Tagged s b = Tagged { unTagged :: b }

See:

http://hackage.haskell.org/packages/archive/tagged/0.2.3.1/doc/html/Data-Tagged.html

Bas



More information about the Glasgow-haskell-users mailing list