Changeset 9


Ignore:
Timestamp:
Nov 14, 2012, 8:02:20 AM (13 years ago)
Author:
gobi
Message:

finishing arrow type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sizechecking/L.hs

    r8 r9  
    1111{- Lambda calculus without free variables -} 
    1212type Arr repr a b = repr a -> repr b 
     13--type family Arr (repr :: * -> *) (a :: *) (b :: *) :: * 
    1314 
    1415class Lambda l where 
     
    118119 
    119120newtype RList a = RList { unList :: (Int, Int -> a)  } 
    120 --instance (Show a) => Show (RList a) where 
    121 --  show (RList (s,f)) = show (map f [0..s-1]) 
     121instance (Show a) => Show (RList a) where 
     122  show (RList (s,f)) = show (map f [0..s-1]) 
    122123 
    123124instance SizeExp R where 
     
    126127  unsized     = R $ () 
    127128  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 
    131131 
    132132-- Type level int to count arity 
     
    151151type IntExp = Exp Zero 
    152152data Condition = Eq IntExp IntExp | Gt IntExp IntExp | Lt IntExp IntExp 
    153 type SExp = ([Condition], IntExp) 
    154 newtype Compile a = Compile { unCompile :: SExp } 
     153type SExp a = ([Condition], IntExp) 
     154newtype Compile a = Compile { unCompile :: SExp a } 
    155155 
    156156--instance Lambda Compile where 
Note: See TracChangeset for help on using the changeset viewer.