Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread Brent Yorgey
On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So if you understand ATs then you understand TFs

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread Andrew Coppin
Brent Yorgey wrote: On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So if you understand

Re: [Haskell-cafe] More experiments with ATs

2010-07-05 Thread wren ng thornton
Andrew Coppin wrote: Brent Yorgey wrote: On Sun, Jul 04, 2010 at 10:31:34AM +0100, Andrew Coppin wrote: I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. ATs are just TFs which happen to be associated with a particular class. So

Re: [Haskell-cafe] More experiments with ATs

2010-07-04 Thread Andrew Coppin
Sjoerd Visscher wrote: On Jul 3, 2010, at 4:39 PM, Andrew Coppin wrote: class Container c = Functor c where fmap :: (Functor cx, Functor cy, Element cx ~ x, Element cy ~ y) = (x - y) - (cx - cy) However, this fails horribly: The type signature fails to mention c. You have to

Re: [Haskell-cafe] More experiments with ATs

2010-07-04 Thread Sjoerd Visscher
On Jul 4, 2010, at 11:31 AM, Andrew Coppin wrote: type family F f a :: * class RFunctor f where (%) :: f a b - (a - b) - F f a - F f b I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no sense to me. (For this reason, most if not all of

Re: [Haskell-cafe] More experiments with ATs

2010-07-04 Thread Steffen Schuldenzucker
On 07/04/2010 01:49 PM, Sjoerd Visscher wrote: On Jul 4, 2010, at 11:31 AM, Andrew Coppin wrote: type family F f a :: * class RFunctor f where (%) :: f a b - (a - b) - F f a - F f b I have literally no idea what a type family is. I understand ATs (I think!), but TFs make no

Re: [Haskell-cafe] More experiments with ATs

2010-07-04 Thread Sjoerd Visscher
On Jul 4, 2010, at 1:58 PM, Steffen Schuldenzucker wrote: This works (on my ghc-6.12.2): class Rfunctor f where type F f :: * - * (%) :: f a b - (a - b) - F f a - F f b Yes, but then this isn't allowed: data BSFunctor :: * - * - * where BS :: BSFunctor Word8 Word8 instance

Re: [Haskell-cafe] More experiments with ATs

2010-07-03 Thread Ivan Lazar Miljenovic
Andrew Coppin andrewcop...@btinternet.com writes: Currently we have class Functor c where fmap :: (x - y) - (c x - c y) This relies on c having kind * - *. For example, Bytestring cannot be an instance of Functor. A cleaner solution would be to have something like class Container

Re: [Haskell-cafe] More experiments with ATs

2010-07-03 Thread Stephen Tetley
Hello Andrew The non-type-changing map is sometimes useful as a type class - in my graphics lib Wumpus, I call it pointwise: class Pointwise sh where type Pt sh :: * pointwise :: (Pt sh - Pt sh) - sh - sh For the graphics I want objects to be parametric on unit (which is usually Double),

Re: [Haskell-cafe] More experiments with ATs

2010-07-03 Thread Sjoerd Visscher
On Jul 3, 2010, at 4:39 PM, Andrew Coppin wrote: class Container c = Functor c where fmap :: (Functor cx, Functor cy, Element cx ~ x, Element cy ~ y) = (x - y) - (cx - cy) However, this fails horribly: The type signature fails to mention c. You have to mention c, this means an extra