[Haskell-cafe] Re: (!!) operator usage

Tom Davies tomdavies at exemail.com.au
Fri Mar 24 17:42:38 EST 2006


Neil Rutland <neilrutland2 <at> hotmail.com> writes:

[snip]
> type Bob = [(Int, Int)]
> newLine :: Bob
> newLine = [(1,4)]
> 
> i have tried to use the follwing but it returns the error below it.
> 
> newLine !! 0 - (so that should give it the newLine list and try and return 
> the 1st element of the list)
> 
> the error reads thus
> 
> ERROR file:.\VicotriaLine.txt:107 - Type error in final generator
> *** Term           : newLine !! 0
> *** Type           : (Int,Int)
> *** Does not match : IO a

newLine is already defined -- call it 'x' instead and !! will do what you expect.

Tom




More information about the Haskell-Cafe mailing list