Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does `... | a b -> c` in typeclass declaration mean? [duplicate]

Possible Duplicate:
What’s the “|” for in a Haskell class definition?

In the following (from Data.HList.HListPrelude, how do I interpret the | l l' -> l'' part?

class HAppend l l' l'' | l l' -> l''
 where
  hAppend :: l -> l' -> l''

And is it a part of standard Haskell (i.e. Haskell 2010) or an extension?

like image 805
ErikR Avatar asked Feb 18 '23 11:02

ErikR


1 Answers

It is an extension called Functional Dependencies which you can spot in future by looking at the top of the file.

It essentially says l'' is uniquely determined from l and l'.

It is required because HAppend is a multiparameter typeclass (which is also an extension).

like image 104
Pubby Avatar answered Mar 03 '23 11:03

Pubby