I am reading this monad tutorial. I am trying to implement Sheep that will work with this tutorial.
I tried this
-- No Sheep or Name, Father Sheep, Mother Sheep
data Sheep = Nothing | String Sheep Sheep
but it isn’t working.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The first part of a constructor definition is the name of the constructor. The types of its arguments come after that. Also if a constructor has no argument, the name isn’t followed by anything, so no “Nothing”. So if we were to name your constructors “NoSheep” and “Sheep”, it would be: