Ticket #3018: B.hs

File B.hs, 0.7 KB (added by ben.kavanagh, 3 years ago)

This is the same program with (Monad m) constraint removed. It compiles.

Line 
1{-# LANGUAGE OverlappingInstances , UndecidableInstances, EmptyDataDecls #-}
2{-# LANGUAGE Rank2Types, KindSignatures, MultiParamTypeClasses, FlexibleInstances #-}
3
4
5module InstFail where
6
7-- minimal Data/Rep classes
8data Rep ctx a
9
10class Data (ctx :: * -> *) a where rep :: Rep ctx a 
11
12class Sat a where dict :: a
13
14
15
16-- Substitution class
17-- substitute [a -> t] t'.
18class Subst a t t' where
19    subst :: a -> t -> t' -> t'
20
21data SubstD a t t' = SubstD {substD:: a -> t -> t' -> t'}
22
23-- allow override dictionary verion with implementation of type class Subst
24instance Subst a t t' => Sat (SubstD a t t') where
25    dict = SubstD {substD = subst}
26
27-- generic instance
28instance Data (SubstD a t) t' => Subst a t t' where
29    subst = undefined
30