summaryrefslogtreecommitdiff
path: root/testsuite/tests/tcplugins/Definitions.hs
blob: 70d04b0296d60e860858beaa5e75f6736f663bfe (plain)
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
{-# LANGUAGE Haskell2010 #-}

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}

module Definitions where

-- base
import Data.Kind
  ( Type, Constraint )
import Numeric.Natural
  ( Natural )

--------------------------------------------------------------------------------

-- This module defines some common types/classes that the various type-checking
-- plugins in this test-suite will be interested in manipulating.

type Nullary :: Constraint
class Nullary where { }

type MyClass :: Type -> Constraint
class MyClass a where
  methC :: a

type MyTyFam :: Type -> Type -> Type
type family MyTyFam a b where

type CtId :: Constraint -> Constraint
type family CtId a where

data Nat = Zero | Succ Nat

type Add :: Nat -> Nat -> Nat
type family Add a b where
  Add   Zero     b = b
  Add ( Succ a ) b = Succ ( Add a b )