January 2018

S M T W T F S
  123456
78910111213
14151617181920
21222324252627
28293031   

Style Credit

Expand Cut Tags

No cut tags
Monday, August 20th, 2007 08:01 am (UTC)
In Haskell, you're right, you do this by putting every primitive function in its own typeclass.

I think it's a bit harder than that: you'd need a typeclass for every function's interface and every intersection of those interfaces that occurs. So if you had
foo buffy = spoffle buffy (winnow buffy)
bar angel = spodify angel (winnow angel)
then you'd need typeclasses as follows:
class Winnow where
    winnow :: a -> Winnowed a

class Fooable where
    spoffle :: Winnow a => a->(Winnowed a)->(Foo a)

class Barable where
    spodify :: Winnow a => a->(Winnowed a)->(Bar a)

Reply

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting