[Haskell-cafe] Extending the idea of a general Num to other types?

Peter Verswyvelen bf3 at telenet.be
Tue Sep 4 10:06:19 EDT 2007


Henning Thielemann wrote:
> If you are happy with writing "do {1;2;3;4}" you are certainly also happy
> with "cv [1,2,3,4]", where cv means 'convert' and is a method of a class
> for converting between lists and another sequence type.
>
> class ListCompatible lc where
>    cv :: [a] -> lc a
>    rt :: lc a -> [a]   {- restore :-) -}
>
> Better don't adapt the names, but the idea would work, wouldn't it?
>
>   
Oh but I will not write "do {1;2;3;4}", this was just an idea :-) Yep, 
your approach certainly works, but I just found it was a bit of a 
discrepancy in Haskell (numbers getting better lifting support than lists).






More information about the Haskell-Cafe mailing list