Evaluating type expressions in GHCi

Daniel Fischer daniel.is.fischer at googlemail.com
Wed Sep 21 01:31:24 CEST 2011

On Wednesday 21 September 2011, 01:02:52, wagnerdm at seas.upenn.edu wrote:
> Would it be possible to have no command at all? Types are  
> distinguished by upper-case letters, so it should be possible to tell  
> whether a given expression is a value-level or a type-level expression.

Unless I'm misunderstanding, no:

{-# LANGUAGE TypeFamilies #-}
module TFEx where

type family F a
type instance F Int = Bool
type instance F Bool = Int
type instance F (a, b) = (F a, F b)

data Foo a = F a deriving Show
data Moo = Int | Bool deriving Show

*TFEx> F (Int,Bool)
F (Int,Bool)
*TFEx> :t F (Int,Bool)
F (Int,Bool) :: Foo (Moo, Moo)
*TFEx> :t undefined :: F (Int,Bool)
undefined :: F (Int,Bool) :: (Bool, Int)

More information about the Glasgow-haskell-users mailing list