-
Notifications
You must be signed in to change notification settings - Fork 667
Closed
Labels
Description
As a driving example, the Dict class doesn't make sense without typeclasses. Right now, it's unclear how exactly the Dict implementation gets the "compare" function - it looks like duck typing.
Without type classes, passing in an Ord instance is preferable to duck typing.
e.g.
instead of:
singleton :: k -> v -> Dict k v
do this:
data Ordering = LT | EQ | GT
data Ord a = Ord (a -> Ordering)
singleton :: Ord k -> k -> v -> Dict k v
Alternatives include generalised implicit parameters.
I think, given Elm's Haskell heritage, Haskell-style type classes would be nice.
test2426021684, ashishnegi, toastal, gurdiga, hkjels and 8 more