<div dir="ltr">Hello,<div><br></div><div>actually the definition with data keyword is right there:</div><br>infixr 5 :-: <br>data List a = Empty | a :-: (List a) deriving (Show, Read, Eq, Ord) <br><br><div class="gmail_extra"><div class="gmail_quote">it could be written in prefix form as</div><div class="gmail_quote"><br></div><div class="gmail_quote">data List a = Empty | Cons a (List a) deriving (....)</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">Petr</div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote"><br></div><div class="gmail_quote">On Mon, Dec 21, 2015 at 7:56 PM, Olumide <span dir="ltr"><<a href="mailto:50295@web.de" target="_blank">50295@web.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
On chapter 7 of LYH there's an example of a user-defined operator .++<br>
<br>
infixr 5 .++<br>
(.++) :: List a -> List a -> List a<br>
Empty .++ ys = ys<br>
(x :-: xs) .++ ys = x :-: (xs .++ ys)<br>
<br>
which is used as follows<br>
<br>
let a = 3 :-: 4 :-: 5 :-: Empty<br>
let b = 6 :-: 7 :-: Empty<br>
a .++ b<br>
(:-:) 3 ((:-:) 4 ((:-:) 5 ((:-:) 6 ((:-:) 7 Empty))))<br>
<br>
Following this the text reads:<br>
<br>
"Notice how we pattern matched on (x :-: xs). That works because pattern matching is actually about matching constructors. We can match on :-: because it is a constructor for our own list type ..."<br>
Source: <a href="http://learnyouahaskell.com/making-our-own-types-and-typeclasses#recursive-data-structures" rel="noreferrer" target="_blank">http://learnyouahaskell.com/making-our-own-types-and-typeclasses#recursive-data-structures</a><br>
<br>
Is the operator :-: a constructor? I'm confused because the definition of :-: is not prefixed by the data keyword?<br>
<br>
- Olumide<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div></div>