[Haskell-beginners] Let the compiler do the work

Elias Diem lists at webconect.ch
Mon Jan 19 14:29:11 UTC 2015


Hi there

I'm referring to a post from Stefan Höck and will quote from 
there:

http://article.gmane.org/gmane.comp.lang.haskell.beginners/14198

<quote>
Now, load this into GHCi or compile with GHC. If it compiles, you're
on the right track. Now, you want to implement it using a fold
(try both, foldl and foldr):

  last5 :: [a] -> Maybe a
  last5 xs = foldr _ _ xs

The underscores are 'type holes'. This tells the compiler to give you
some information about what is supposed to be placed at the two
positions. For the moment, we are only interested in the types of the
things that go there. The compiler will tell you, that
the hole at the first position is of type

  a -> Maybe a -> Maybe a
</quote>

How does the compiler tell me this? I didn't find any flags 
for GHC to turn this on. What do I miss?

-- 
Greetings
Elias




More information about the Beginners mailing list