Thanks. I know we can only derive built-in classes.
Since Stream is just a newtype  and
ListLike [a] a is an instance, so I hope ListLike (Stream a) a would work given extensions.

Unforturnately, newtype derivation requires the _last_ type variable to be newtype

Thank you
于 11-7-25 下午6:14, Ivan Lazar Miljenovic 写道:
On 26 July 2011 04:30, bob zhang<[email protected]>  wrote:
Hi, all,
newtype Stream a = Stream [a]

I wanna derive ListLike [a] a automatically, but did not find a solution,
I tried
deriving instance ListLile (Stream a) a -- does not work
You can only derive certain in-built classes (Eq, Ord, Show, etc.) and
- with extensions - some other classes (e.g. Functor).  You _cannot_
derive ListLike.  That said, it may be possible to extend either
derive [1] or DrIFT [2] to be able to generate these instances for
you.

[1]: http://hackage.haskell.org/package/derive
[2]: http://hackage.haskell.org/package/DrIFT-cabalized



_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to