This answer is to address the clarification that you gave in the comments:
the given definition is of type and the answer is of data, which I don't understand yet how this can happen.
Haskell has a few different ways of declaring types.
The type keyword is used to declare a type alias - similar to typedef or using in C++. One could, theoretically, as an exercise in futility, declare Sheep as an alias of String, with the implied understanding that the String would signify the sheep's name, and then there is a "global" list of parents for each sheep, which the mother and father functions would use for lookup:
type Sheep = String
allParents :: [(Sheep, (Sheep, Sheep))]
allParents =
[ ("dolly", ("rufus", "peggy"))
, ("peggy", ("ramses", "woolly"))
, ...
]
mother :: Sheep -> Maybe Sheep
mother s = fst <$> lookup s allParents
father :: Sheep -> Maybe Sheep
father s = snd <$> lookup s allParents
But this would be very unusual and not functional at all. I think this would be a prime example of a gorilla holding a banana and the entire jungle.
A more Haskell way of modeling the situation would be to declare Sheep as a data structure with (at least) two fields - mother and father. For this sort of thing, one uses the keyword data:
data Sheep = Sheep (Maybe Sheep) (Maybe Sheep)
father :: Sheep -> Maybe Sheep
father (Sheep f _) = f
mother :: Sheep -> Maybe Sheep
mother (Sheep _ m) = m
But defining these accessor functions for every field of your type is quite mundane, so Haskell has a shorter syntax for it:
data Sheep = Sheep { father :: Maybe Sheep, mother :: Maybe Sheep }
this would declare the same structure with two fields, plus automatically create the accessor functions that work the same way as in the previous example.
To preempt your next question, I should also mention a third way of defining types - newtype, which is like data, but only for structures with exactly one field, and is just a performance optimization.
Don't get hung up on the specific keyword used. The article just needed to make a point that there is this type and two functions to go with it, and it doesn't really matter how they're defined. The article had to use some keyword to make this point, and they chose type. A more or less arbitrary choice.