Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
General purpose Haskell functions
-- a function that's equivalent to the standard library's sequence function
myseq ms = foldr k ([[]]) ms
where k m m' = [x:xs | x <- m, xs <- m']
-- another variant of the sequence function, uses return [] instead of [[]]
myseq1 ms = foldr k (return []) ms
where k m m' = [x:xs | x <- m, xs <- m']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.