Advertisement
Guest User

monad stuff

a guest
Jul 24th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. readFile = (handle, filename) ->
  2.   fs.readFile filename, 'utf8', (err, data) ->
  3.         handle(err,data)
  4.  
  5. monadStuff = (f) -> (andThen) -> (err, data) ->
  6.     if err then (andThen err) else (andThen undefined, (f data))
  7.  
  8. processTraces = (processor, filepath) ->
  9.   readFile(monadStuff(parse.manyTraces)(processor), filepath)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement