blob: e92e2664d3bca3a4cb4076ae19720f6add81967e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-}
module Main where
class Foo a b | a -> b where
foo :: a -> Maybe b
foo x = Nothing
bar :: a -> b
instance Foo (Maybe a) a where
bar (Just x) = x
main = do { print (foo (Just 'x'))
; print (bar (Just 'y')) }
|