Advertisement
trigone

ADT or callback?

Jul 24th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- two options
  2.  
  3. -- #1 -- i could replace (,,) with a special ADT but the principle is the same
  4.  
  5. f :: Input -> (A,B,C)
  6. g :: (A,B,C) -> Output
  7. program :: Input -> Output
  8. program = g . f
  9.  
  10. --- #2, what i call "callback style" probably incorrectly
  11. type WithInput a = X -> Y -> Z -> a
  12. f :: WithInput Output -> Input -> Output
  13. g :: WithInput Output
  14. program :: Input -> Output
  15. program = f g
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement