Why is `Sheep` not defined on 'All About Monads' on the Haskell Wiki

I’m currently reading All About Monads in this site. And the Sheep definition is not defined. It’s defined as
type Sheep = ...

A lot of the examples use the type definition Sheep but it’s defined as:

type Sheep = ...

father :: Sheep -> Maybe Sheep
father = ...

mother :: Sheep -> Maybe Sheep
mother = ...

I can’t continue with the exercises, Is it supposed to be an exercise? I’m confused because I can’t follow along the examples provided. The type is used throughout the page, and the Sheep definition is repeatedly used. GHCi does not allow the definition, so I’m a bit lost. The example is near the top of the page under the An Example page. If anyone can explain why this is, or how I can get around it, I would appreciate it.

1 Like

The top of that wiki page has some links that might interest you.

The definition of Sheep isn’t meant to be important to the reader, so it’s elided. Any type would do; define it as Int if you want.

2 Likes

I wouldn’t necessarily recommend using the wiki as a first learning resource. It isn’t (at least this is my impression) curated towards being a polished resource for someone learning the language (as examples like this show, and tbh, I wish it had a big disclaimer on it to avoid this sort of confusion).

There are lots of great Haskell intros for beginners (e.g. https://learnyouahaskell.com/ or CIS194) which I’d recommend instead.

1 Like

This is great. Thanks. I’ll probably defined Sheep :: String.

Yeah, I’ve been through them so I’m not a complete beginner. I’m just trying to figure out Functors, Monads, Monoids, Category Theory etc. at the moment.

In that case, I recommend https://smunix.github.io/dev.stephendiehl.com/hask/tutorial.pdf, which has a section on categories, and lots of other really great info, and if you are curious about the category-theoretic origins of monads, I recommend: From Adjunctions to Monads

1 Like

Thanks, I use Reader version on Safari so I must have missed them!