Changeset 9
- Timestamp:
- Nov 14, 2012, 8:02:20 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sizechecking/L.hs
r8 r9 11 11 {- Lambda calculus without free variables -} 12 12 type Arr repr a b = repr a -> repr b 13 --type family Arr (repr :: * -> *) (a :: *) (b :: *) :: * 13 14 14 15 class Lambda l where … … 118 119 119 120 newtype RList a = RList { unList :: (Int, Int -> a) } 120 --instance (Show a) => Show (RList a) where121 --show (RList (s,f)) = show (map f [0..s-1])121 instance (Show a) => Show (RList a) where 122 show (RList (s,f)) = show (map f [0..s-1]) 122 123 123 124 instance SizeExp R where … … 126 127 unsized = R $ () 127 128 list s f = R $ RList (unR s, unR . (unR f) . R ) 128 --aabs :: Arr l Int (Arr l (Arr l Int a) b) -> l (Arr l (List l a) b) 129 -- aabs e = R $ \(RList (s,f)) -> unR (e (R s) (R f)) 130 -- shift a s c = R $ \i -> if i<(unR s) then unR a i else unR c i 129 aabs e = R $ ( \(RList (s,f)) -> (e (R s) (R (R . f . unR))) ) . unR 130 shift a s c = R $ \i -> if (unR i)<(unR s) then unR a i else unR c i 131 131 132 132 -- Type level int to count arity … … 151 151 type IntExp = Exp Zero 152 152 data Condition = Eq IntExp IntExp | Gt IntExp IntExp | Lt IntExp IntExp 153 type SExp = ([Condition], IntExp)154 newtype Compile a = Compile { unCompile :: SExp }153 type SExp a = ([Condition], IntExp) 154 newtype Compile a = Compile { unCompile :: SExp a } 155 155 156 156 --instance Lambda Compile where
Note: See TracChangeset
for help on using the changeset viewer.