haskell - Partially applying fst and snd using let in GHCi gives a strange type signature -


i'm implementing vanilla binary tree, , i'm implementing insertwith function, such can insert values transforming existing values "keys" - may allow to, say, store tuple of (key, value) , compare keys when inserting new "nodes". implementation following:

insertwith :: (ord b) => (a -> b) -> bintree -> -> bintree insertwith _ emptytree    y = node y emptytree emptytree insertwith f (node x l r) y =     case compare (f y) (f x) of         lt -> node x (insertwith f l y) r         eq -> node x l r         gt -> node x l (insertwith f r y) 

when partially apply fst using let in ghci, following:

let insertwith_ = insertwith fst :t insertwith_ insertwith_ :: bintree ((), b) -> ((), b) -> bintree ((), b) 

however, leaving out let step gives following:

:t insertwith fst insertwith fst   :: (ord a) => bintree (a, b) -> (a, b) -> bintree (a, b) 

i think has (ord b) in type signature, i'm wondering why ghci transforms type signature when using let? in advance answers.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -