I try to learn free monads. I found following:
data Free f r = Free (f (Free f r)) | Pure r
What does Pure mean? And why do I need r with Pure?
I try to learn free monads. I found following:
data Free f r = Free (f (Free f r)) | Pure r
What does Pure mean? And why do I need r with Pure?
Copyright © 2021 Jogjafile Inc.
Purecorresponds to thereturnoperation -- conceptually it attaches to your functor the ability to "inject" a value. TheFreeconstructor corresponds to "join".If you want to understand why you "need"
Pure, try to remove it and give theMonadinstance and see where you get stuck!