aboutsummaryrefslogtreecommitdiff
path: root/html-test/src/Minimal.hs
blob: 9df03cca255b1631ca51e8684d9de2b004ac25a7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
-- | This tests the new MINIMAL pragma present in GHC 7.8
module Minimal
  ( Foo(..)
  , Weird(..)
  , NoMins(..)
  , FullMin(..)
  , PartialMin(ccc)
  , EmptyMin(..)
  ) where

class Foo a where
  -- | Any two of these are required...
  foo :: a
  bar :: a
  bat :: a

  -- | .. or just this
  fooBarBat :: (a,a,a)

  {-# MINIMAL (foo, bar) | (bar, bat) | (foo, bat) | fooBarBat #-}

class Weird a where
  a :: a
  b :: a
  c :: a
  d :: a
  e :: a
  f :: a
  g :: a

  {-# MINIMAL ((a, b), c | (d | (e, (f | g)))) #-}

class NoMins a where
  x :: a
  y :: a
  z :: a

  -- | Has a default implementation!
  z = x

class FullMin a where
  aaa :: a
  bbb :: a

class PartialMin a where
  ccc :: a
  ddd :: a

class EmptyMin a where
  eee :: a
  fff :: a
  eee = fff
  fff = undefined