diff options
author | Ćukasz Hanuszczak <lukasz.hanuszczak@gmail.com> | 2015-07-13 19:26:45 +0200 |
---|---|---|
committer | Mateusz Kowalczyk <fuuzetsu@fuuzetsu.co.uk> | 2015-08-21 18:22:29 +0100 |
commit | 6e0fe19f52445f0a231073b3eff116924d631588 (patch) | |
tree | 2b09e2364bedff264b34d4a5c6e8bbfd5e7dc31c /html-test | |
parent | 79f475a93be3de376bc264c53d2ba8eb61ffea42 (diff) |
Add basic HTML test case for checking instance specialization.
Diffstat (limited to 'html-test')
-rw-r--r-- | html-test/src/Instances.hs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/html-test/src/Instances.hs b/html-test/src/Instances.hs new file mode 100644 index 00000000..d0d68dc3 --- /dev/null +++ b/html-test/src/Instances.hs @@ -0,0 +1,36 @@ +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} + + +module Instances where + + +class Foo f where + + foo :: f Int -> a -> f a + foo' :: f (f a) -> Int -> f (f Int) + + foo = undefined + foo' = undefined + +instance Foo Maybe +instance Foo [] +instance (Eq a, Foo f) => Foo ((,) (f a)) +instance Foo (Either a) +instance Foo ((,,) a a) + + +class Foo f => Bar f a where + + bar :: f a -> f Bool -> a + bar' :: f (f a) -> f (f (f b)) + + bar = undefined + bar' = undefined + +instance Bar Maybe Bool +instance Bar Maybe [a] +instance Bar [] (a, a) +instance Foo f => Bar (Either a) (f a) +instance Foo ((,,) a b) => Bar ((,,) a b) (a, b, a) |