diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-29 09:37:41 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:32 +0100 |
commit | 3827f2557a52c78ead03350d9e8576278b649745 (patch) | |
tree | 0cf818fdfe67b3db64c12bd09102e2092cf24a8d /html-test/src/Instances.hs | |
parent | 467b07ecf9b22e3492b014dbae64f2f7d9b73f02 (diff) |
Add basic tests for associated types in instances test case.
Diffstat (limited to 'html-test/src/Instances.hs')
-rw-r--r-- | html-test/src/Instances.hs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/html-test/src/Instances.hs b/html-test/src/Instances.hs index 58bdc873..b7bc8921 100644 --- a/html-test/src/Instances.hs +++ b/html-test/src/Instances.hs @@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ImpredicativeTypes #-} +{-# LANGUAGE TypeFamilies #-} module Instances where @@ -63,3 +64,30 @@ data Quux a b c = Qx a | Qux a b | Quux a b c instance Foo (Quux a b) instance Bar (Quux a c) (Quux a b c) instance Baz (Quux a b c) + + +class Norf a b where + + type Plugh a c b + data Thud a c + + norf :: Plugh a c b -> a -> (a -> c) -> b + + norf = undefined + + +instance Norf Int Bool where + + type Plugh Int [a] Bool = a + type Plugh Int (a, b) Bool = (a, [b]) + + data Thud Int (Quux a [a] c) = Thuud a | Thuuud Int Int + data Thud Int [a] = Thuuuud Bool + + +instance Norf [a] [b] where + + type Plugh [a] (Maybe a) [b] = a + type Plugh [a] [b] [b] = Quux a b (a, b) + + data Thud [a] (a, a, a) = Thd a |