Re: [Haskell-cafe] ghci's choice of names for type variables

Just from observing the behaviour (not the source) - it seems that ghci tries to use the variables from the declaration of the/a function, type, or class that is being used. Prelude> data T c = T c Prelude> h x y = (T x, T y) Prelude> :t h h :: c1 -> c2 -> (T c1, T c2) Prelude> f :: foo -> foo ; f x = x Prelude> g = f Prelude> :t g g :: foo -> foo In the Haskell Standard, type variables are a, b, ... mostly (always?), hence you get `a` for anything with lists and Num. If there's no type to refer to, then your examples show that it's using t or p, but I don't know how. Prelude> i x = x Prelude> :t i i :: p -> p Prelude> k x y = x Prelude> :t k k :: p1 -> p2 -> p1 Prelude> s x y z = x z (y z) Prelude> :t s s :: (t1 -> t2 -> t3) -> (t1 -> t2) -> t1 -> t3 interesting! - J.W.

it's using `p` for "pristine" (unused) variables, and `t` for everything that went through the unifier because of usage in some function call? Prelude> f a b c d e = b d Prelude> :t f f :: p1 -> (t1 -> t2) -> p2 -> t1 -> p3 -> t2 - J.W.
participants (1)
-
Johannes Waldmann