[Haskell-beginners] What is operator :| ?

Francesco Ariis fa-ml at ariis.it
Fri Mar 28 06:48:28 UTC 2014


On Fri, Mar 28, 2014 at 12:54:03AM -0500, John M. Dlugosz wrote:
> More generally, is there some effective way to search for
> non-alphabetical Haskell things?  Google just ignores the
> "punctuation".
> 

You can find :| on Hayoo [1], the other handy place where to
look for APIs stuff being Hoogle [2] (Hoogle is more focused on
'standard' Haskell libraries, Hayoo searches in all Hackage,
both have their usefulness).
>From there, if I need to search, say, a blog post, I will refer
to the name of the typeclass/module/data and feed it to a search
engine (so in this case "data NonEmpty etc. etc.").
Apparently Google ignores punctuation in most cases [3].

Back to the original question

> What is the meaning of :| ?

Clicking on the first occurrence in Hoogle brings me to
Data.List.NonEmpty, where the specific operator is listed as
the lone constructor of |data NonEmpty|.
If the conspicuous name were not enough, checking the code:

    data NonEmpty a = a :| [a]

we can see this looks like a list without the empty-list
constructor.
Does that answer your question?


[1] http://holumbus.fh-wedel.de/hayoo/hayoo.html#0:%3A|
[2] http://www.haskell.org/hoogle/
[3] https://support.google.com/websearch/answer/2466433
[4] http://hackage.haskell.org/package/semigroups-0.12.2/docs/Data-List-NonEmpty.html#v::-124-


More information about the Beginners mailing list