[Haskell-cafe] Eta Reduction

John Lato jwlato at gmail.com
Wed Apr 2 21:25:55 UTC 2014


On Apr 2, 2014 4:32 PM, "Niklas Haas" <haskell at nand.wakku.to> wrote:
>
> On Wed, 2 Apr 2014 09:51:46 -0400, Edward Kmett <ekmett at gmail.com> wrote:
> > We're not storing the instance as a slot in the constructor, so this
isn't.
> >
> > data Foo a where
> >    Foo :: Seq a => Int -> a -> Foo a
> >
> > or equivalently
> >
> > data Foo a = Seq a => Foo !Int !a
>
> Why not? Say we define Seq to something like
>
> > type family Seq (a :: *) :: Constraint where
> >   Seq (a -> b) = 1 ~ 0
> >   Seq t = ()
>
> What would be the drawback in this scenario?

I think that would be acceptable if we posit the existence of a valid Seq a
dictionary.  I think that would be possible for all builtin types and
anything defined via data.  But what about e.g.

  newtype F = F (forall x. Show x => x-> String)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140402/bc77b25f/attachment.html>


More information about the Haskell-Cafe mailing list