[Haskell-cafe] On to applicative

Alexander Solla ajs at 2piix.com
Tue Aug 31 15:41:08 EDT 2010


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100831/56b3c9d3/attachment.html


More information about the Haskell-Cafe mailing list