[Haskell-beginners] Is ghc 6.8.2 useful?

Thomas Davie tom.davie at gmail.com
Thu Jan 22 04:39:10 EST 2009


On 22 Jan 2009, at 09:42, Erik de Castro Lopo wrote:

> Hi all,
>
> I'm using hoogle (http://www.haskell.org/hoogle/) as my main Haskell
> documentations source, but I'm stuck on using ghc 6.8.2 and I keep
> finding stuff listed in hoogle that isn't available in 6.8.2.
>
> Is there any solution other than installing a more recent version of
> ghc?

Are you sure that you're finding things that are unavailable in  
6.8.2?  There's been very little change to the APIs exposed to  
beginners since then.  It may be that you're not importing the module  
required, when hoogle gives you a result like this:

Data.Map	insert :: Ord k => k -> a -> Map k a -> Map k a
containers	
O(log n). Insert a new key and value in the map. If the key is already  
present in the map, the associated value is replaced with the supplied  
value. insert is equivalent to insertWith const.> insert 5  
'x' (fromList [(5,'a'), (3,'b')]) ==
you must use an import in your file to get access to it, as follows:

import Data.Map (insert)

or you can import the whole module like this:

import Data.Map

but this causes namespace polution, so it's not a great idea.  You can  
also import it so that you have to qualify all your uses of the  
functions:

import qualified Data.Map

f x y = Data.Map.insert 5 x y

-- or

import qualified Data.Map as M

f x y = M.insert 5 x y

Sorry if I just taught my granny to suck eggs.  If you are doing this  
and really are coming up against APIs that aren't in 6.8, then yes,  
you need to upgrade your compiler.  There's no real disadvantage to  
doing this though, except possibly that you lose support for one or  
two libraries that are taking a while to update (gtk2hs springs to  
mind).  You do however gain access to libraries that need newer  
compiler features (vector-space springs to mind).

Bob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090122/7e2f4e2f/attachment.htm


More information about the Beginners mailing list