typeclass - Haskell Type Class Implied -


i want able types b

class g   f :: g -> int  class b g   h :: g -> int  instance g => b g     h = f 

i'm getting compile error:

illegal instance declaration `b g' …       (all instance types must of form (t a1 ... an)        a1 ... *distinct type variables*,        , each type variable appears @ once in instance head. 

you should not this. however, it's reasonable write like

class b g => g   f :: g -> int 

this produces useful entailment. defaultsignatures extension (which dislike various reasons), can write

class b g   h :: g -> int   default h :: g => g -> int   h = f 

Comments

Popular posts from this blog

r - how do you merge two data frames the best way? -

How to debug "expected android.widget.TextView but found java.lang.string" in Android? -

php - mySQL problems with this code? -