[Haskell-cafe] Re: Class Instances

2009-02-14 Thread Cetin Sert
Thank you Benedikt! Thanks to your help I also figured out the way to do it using type families yesterday: class Pro p where type I p type O p re :: p → [I p → O p] instance Pro (b → c) where type I (b → c) = b type O (b → c) = c re = repeat instance Pro [b → c] where

[Haskell-cafe] Re: Class Instances

2009-02-13 Thread Benedikt Huber
Cetin Sert schrieb: Hi, class Processor a where ready :: (forall b c. a → [b → c]) instance Processor (b → c) where ready = repeat ... --- Why can I not declare the above instances and always get: Hi Cetin, in your class declaration you state that a

[Haskell-cafe] Re: Class Instances

2009-02-13 Thread Cetin Sert
module Main where import Control.Monad import Control.Concurrent class Processor p where ready :: p b c → [b → c] instance Processor (→) where ready = repeat --instance Processor [b → c] where --ready = id newtype FunList b c = FunList [b → c] instance Processor FunList where ready

[Haskell-cafe] Re: Class Instances

2009-02-13 Thread Benedikt Huber
Cetin Sert schrieb: Thank you for your answer! This comes close to solving the problem but in the last line of the above I want to be able to say: either print $ broadcast id [1..10] or print $ broadcast [ (x +) | x ← [1..10] ] [1..10] both need to be possible*. So is there