[RFC] Bang constraint

Roman Cheplyaka roma at ro-che.info
Wed Apr 3 23:31:57 CEST 2013


So, what exactly does this constraint mean outside of data declarations?

E.g. how do we interpret

  f :: (!a) => a -> a -> a

?

* Gabor Greif <ggreif at gmail.com> [2013-04-03 20:06:03+0200]
> Now that Constraint kinds are pretty much into the mainstream, can we
> consider the '!' annotation in data declarations as a magic
> constraint? Not unlike NFData, but only ensuring that said value is in
> WHNF.
> 
> So the following definitions would be semantically identical
> 
> > newtype Foo a = Foo a
> 
> > data Foo a = Foo !a
> 
> > data Foo a = (!a) => Foo a
> 
> > data FooC :: (* -> Constraint) -> * -> * where
> >   Foo :: c a => a -> FooC c a
> > type Foo a = FooC ! a
> 
> It just occured to me and seemed plausible at first thought, but feel
> free to flame me because of the magic-ness.
> 
> Cheers,
> 
>     Gabor
> 
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://www.haskell.org/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list