[Haskell-cafe] Problems interpreting

Carajillu crespi.albert at gmail.com
Mon Sep 18 05:51:34 EDT 2006


Hi, I'm a student and I have to do a program with Haskell. This is the first
time I use this languaje, and I'm having problems with the indentation. I
want to check if this function is correct, but when I try to make the GHCi
interpret it, I get "line 18:parse error (possibly incorrect indentation)"

The function is:

-- Replaces a wildcard in a list with the list given as the third argument
substitute :: Eq a => a -> [a] -> [a] -> [a]
substitute e l1 l2= [check_elem c | c <- l1] where
	check_elem::Eq a => a -> [a]
	check_elem x = 
		if x == e then return l2

-- Tries to match two lists. If they match, the result consists of the
sublist
-- bound to the wildcard in the pattern list.
(line 18) match :: Eq a => a -> [a] -> [a] -> Maybe [a]
match _ _ _ = Nothing
{- TO BE WRITTEN -}

Thank you for your attention!
-- 
View this message in context: http://www.nabble.com/Problems-interpreting-tf2290155.html#a6360687
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.



More information about the Haskell-Cafe mailing list