07.01.2014 Views

The Glorious Glasgow Haskell Compilation System User's Guide ...

The Glorious Glasgow Haskell Compilation System User's Guide ...

The Glorious Glasgow Haskell Compilation System User's Guide ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> <strong>Glorious</strong> <strong>Glasgow</strong> <strong>Haskell</strong><br />

<strong>Compilation</strong> <strong>System</strong> User’s <strong>Guide</strong>,<br />

Version 6.10.4<br />

x<br />

7.5.4.2 A more precise specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141<br />

7.6 Class and instances declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141<br />

7.6.1 Class declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141<br />

7.6.1.1 Multi-parameter type classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142<br />

7.6.1.2 <strong>The</strong> superclasses of a class declaration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142<br />

7.6.1.3 Class method types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142<br />

7.6.2 Functional dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142<br />

7.6.2.1 Rules for functional dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143<br />

7.6.2.2 Background on functional dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143<br />

7.6.2.2.1 An attempt to use constructor classes . . . . . . . . . . . . . . . . . . . . . . . . . . 144<br />

7.6.2.2.2 Adding functional dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144<br />

7.6.3 Instance declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146<br />

7.6.3.1 Relaxed rules for instance declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146<br />

7.6.3.2 Undecidable instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147<br />

7.6.3.3 Overlapping instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148<br />

7.6.3.4 Type synonyms in the instance head . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150<br />

7.6.4 Overloaded string literals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150<br />

7.7 Type families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151<br />

7.7.1 Data families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151<br />

7.7.1.1 Data family declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151<br />

7.7.1.1.1 Associated data family declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . 152<br />

7.7.1.2 Data instance declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152<br />

7.7.1.2.1 Associated data instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153<br />

7.7.1.2.2 Scoping of class parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153<br />

7.7.1.2.3 Type class instances of family instances . . . . . . . . . . . . . . . . . . . . . . . . 153<br />

7.7.1.2.4 Overlap of data instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153<br />

7.7.1.3 Import and export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />

7.7.1.3.1 Associated families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />

7.7.1.3.2 Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />

7.7.1.3.3 Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />

7.7.2 Synonym families . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154<br />

7.7.2.1 Type family declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155<br />

7.7.2.1.1 Associated type family declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 155<br />

7.7.2.2 Type instance declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155<br />

7.7.2.2.1 Associated type instance declarations . . . . . . . . . . . . . . . . . . . . . . . . . . 156<br />

7.7.2.2.2 Overlap of type synonym instances . . . . . . . . . . . . . . . . . . . . . . . . . . . 156<br />

7.7.2.2.3 Decidability of type synonym instances . . . . . . . . . . . . . . . . . . . . . . . . 156<br />

7.7.2.3 Equality constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157<br />

7.8 Other type system extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!