On Aug 31, 2010, at 12:03 PM, michael rice wrote:

I tried creating an instance earlier but

*Main> :t (->) Int Char

<interactive>:1:1: parse error on input `->'

Try:

Prelude> :info (->)
data (->) a b        -- Defined in GHC.Prim

If you want type-information about values, use :t. If you want information about types (and the "type-level language"), use :info. This includes stuff like class definitions and instances in scope. For example, if I include Control.Monad:

Prelude Control.Monad.Instances> :info (->)
data (->) a b        -- Defined in GHC.Prim
instance Monad ((->) r) -- Defined in Control.Monad.Instances
instance Functor ((->) r) -- Defined in Control.Monad.Instances

:info is pretty cool:

Prelude Control.Monad.Instances> :info Monad
class Monad m where
  (>>=) :: m a -> (a -> m b) -> m b
  (>>) :: m a -> m b -> m b
  return :: a -> m a
  fail :: String -> m a
        -- Defined in GHC.Base
instance Monad ((->) r) -- Defined in Control.Monad.Instances
instance Monad Maybe -- Defined in Data.Maybe
instance Monad [] -- Defined in GHC.Base
instance Monad IO -- Defined in GHC.Base

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to