Reputation: 163
A symbol combined (:.) of cons following by a dot.
Taken from here:
-- The custom list type
data List t =
Nil
| t :. List t
deriving (Eq, Ord)
-- Right-associative
infixr 5 :.
Taken from here: https://github.com/tonymorris/fp-course
Upvotes: 2
Views: 256
Reputation: 476594
In short: the code constructs an alterative version of a list, and (:.)
is one of the two data constructors.
Well it is a data constructor of the List t
data type. For example the standard list [a]
has two data constructors []
and (:)
, here the code introduces a new data constructor (:.)
, but it acts completely the same way as the "cons" of the standard list (:)
.
So the code defines it as:
data List t = Nil | (:.) t (List t) deriving (Eq, Ord)
and like any data constructor, we can do pattern matching on it, construct new lists, etc.
Upvotes: 6