[Haskell-cafe] [Q] Using Class
mail at andrebetz.de
Fri Feb 13 16:53:23 EST 2004
I'm a really beginner to haskell and I have a question about using classes.
I don't now really what this function does. So I will try to use it to see
what it will put out
position :: ( Enum a , Eq b ) => b -> [b] -> [a]
position x = position_snd . zip ( enumFrom $ toEnum 1 )
where position_snd  = 
position_snd ((p,y):ys) | x == y = p : position_snd ys
| otherwise = position_snd ys
My roblem is now that I don't know how to use it.
I tried "head position 2 [1,2,3,4]" but I always get an error.
Thanks for help
More information about the Haskell-Cafe