<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Tillman,<br><br>Prelude Control.Monad Control.Monad.Instances Control.Applicative&gt; let f = \x -&gt; x:[]<br>Prelude Control.Monad Control.Monad.Instances Control.Applicative&gt; :t f<br>f :: a -&gt; [a]<br>Prelude Control.Monad Control.Monad.Instances Control.Applicative&gt; let g = \x -&gt; Just x<br>Prelude Control.Monad Control.Monad.Instances Control.Applicative&gt; :t g<br>g :: a -&gt; Maybe a<br><br>Prelude Control.Monad Control.Monad.Instances Control.Applicative&gt; :t z<br>z :: Integer -&gt; Integer<br><br>Prelude Control.Monad Control.Monad.Instances Control.Applicative Data.Char&gt; :t y<br>y :: Char -&gt; Int<br><br><br>Can you think of a situation for<br><br>&nbsp;\x -&gt; f x<br><br>that would require x to have a declared type, or is it always inferred by the type of f?<br><br><br>Michael<br><br><br>--- On <b>Wed, 9/1/10, Tillmann Rendel
 <i>&lt;rendel@Mathematik.Uni-Marburg.de&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Tillmann Rendel &lt;rendel@Mathematik.Uni-Marburg.de&gt;<br>Subject: Re: [Haskell-cafe] On to applicative<br>To: "michael rice" &lt;nowgate@yahoo.com&gt;<br>Cc: haskell-cafe@haskell.org<br>Date: Wednesday, September 1, 2010, 5:28 PM<br><br><div class="plainMail">michael rice wrote:<br>&gt; Prelude Data.Either&gt; let m = Just 7<br>&gt; Prelude Data.Either&gt; :t m<br>&gt; m :: Maybe Integer<br><br>So to create a value of type (Maybe ...), you can use Just.<br><br>&gt; Prelude Data.Either&gt; let l = 2:[]<br>&gt; Prelude Data.Either&gt; :t l<br>&gt; l :: [Integer]<br><br>So to create a value of type [...], you can use (:) and [].<br><br>&gt; Prelude Data.Either&gt; let g = getLine<br>&gt; Prelude Data.Either&gt; :t g<br>&gt; g :: IO String<br><br>So to create a value of type (IO ...),
 you can use getLine.<br><br>&gt; Prelude Data.Either&gt; let e = Right "abc"<br>&gt; Prelude Data.Either&gt; :t e<br>&gt; e :: Either a [Char]<br><br>So to create a value of type (Either ... ...), you can use Right.<br><br>&gt; How can I similarly create an instance of (-&gt;) [...] ?<br><br>An "instance of (-&gt;)" is usually called a function. And functions are created by lambda abstraction:<br><br>&nbsp; Prelude&gt; let f = \x -&gt; x<br>&nbsp; Prelude&gt; :t f<br>&nbsp; f :: t -&gt; t<br><br>So to create a value of type (... -&gt; ...), you can use \.<br><br><br>Just like Either, -&gt; is a binary type constructor. Just like (Either a b) is a type, (a -&gt; b) is a type. And very much like you can create (Either a b) values with Left and Right, you can create (a -&gt; b) values with \.<br><br>&nbsp; Tillmann<br><br>PS. After studying how to construct values, it may be instructive to study how to take them apart. For example, Bool values can be taken
 apart by if-then-else expressions. What about Either, IO and -&gt; values?<br></div></blockquote></td></tr></table><br>