Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --mapMyList f Empty = Empty
- --mapMyList f (x :-: xs) = f x :-: mapMyList f xs
- tailRecursionEngine termCond termFn wayAheadFn =
- tailRecursiveFn
- where tailRecursiveFn y
- | termCond y = termFn y
- | otherwise = (tailRecursiveFn (wayAheadFn y))
- -- :: (t1 -> Bool) -> (t1 -> t) -> (t1 -> t1) -> t1 -> t
- data List a = Empty | a :-: List a deriving (Read, Eq, Ord)
- mapMyList1 :: (t -> a) -> List t -> List a
- myNull Empty = True ; myNull (x :-: xs) = False
- mapMyList1 f xs =
- tailRecursionEngine
- (myNull ) --- termination Condition
- (\_ -> f(head :-: xs))
- (:-:) --- Error message is in this line
- Error Message
- Couldn't match expected type `List t'
- against inferred type `List (List t) -> List (List t)'
- In the third argument of `tailRecursionEngine', namely `(:-:)'
- In the expression:
- tailRecursionEngine (myNull) (\ _ -> f (head :-: xs)) (:-:)
- In the definition of `mapMyList1':
- mapMyList1 f xs
- = tailRecursionEngine (myNull) (\ _ -> f (head :-: xs)) (:-:)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement