Ignore:
Timestamp:
May 5, 2014, 3:10:33 PM (12 years ago)
Author:
gobi
Message:

new files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sizechecking/branches/macs/Ops.hs

    r25 r27  
    77import qualified Prelude 
    88import Lambda 
     9import Data.Lens.Light 
    910 
    1011-- infix operatorok, ezek beagyazasa picit necces, lasd a type family kesobb 
     
    3233    fun _ = Q 
    3334 
    34 instance LOps S where 
    35     fun name _ = S (\_ p -> Prelude.showsPrec p name) 
     35instance (SContext s) => LOps (S s) where 
     36    fun name _ = S (\ctx -> Prelude.showsPrec (getL prec ctx) name) 
    3637 
    37     infixopl name prec _ lhs rhs = S(\s p -> 
    38         let (s1, s2) = S.split2 s 
    39         in Prelude.showParen (p Prelude.> prec) $ 
    40             unS lhs s1 prec . 
     38    infixopl name p _ lhs rhs = S(\ctx -> 
     39        let (s1, s2) = S.split2 (getL supply ctx) 
     40        in Prelude.showParen ((getL prec ctx) Prelude.> p) $ 
     41            unS lhs (setL supply s1 $ setL prec p ctx) . 
    4142            Prelude.showString name . 
    42             unS rhs s2 (Prelude.succ prec) 
     43            unS rhs (setL supply s2 $ setL prec (Prelude.succ p) ctx) 
    4344        ) 
    44     infixop name prec _ lhs rhs = S(\s p -> 
    45         let (s1, s2) = S.split2 s 
    46         in Prelude.showParen (p Prelude.> prec) $ 
    47             unS lhs s1 (Prelude.succ prec) . 
     45 
     46    infixop  name p _ lhs rhs = S(\ctx -> 
     47        let (s1, s2) = S.split2 (getL supply ctx) 
     48        in Prelude.showParen ((getL prec ctx) Prelude.> p) $ 
     49            unS lhs (setL supply s1 $ setL prec (Prelude.succ p) ctx) . 
    4850            Prelude.showString name . 
    49             unS rhs s2 (Prelude.succ prec) 
     51            unS rhs (setL supply s2 $ setL prec (Prelude.succ p) ctx) 
    5052        ) 
    51     infixopr name prec _ lhs rhs = S(\s p -> 
    52         let (s1, s2) = S.split2 s 
    53         in Prelude.showParen (p Prelude.> prec) $ 
    54             unS lhs s1 (Prelude.succ prec) . 
     53 
     54    infixopr name p _ lhs rhs = S(\ctx -> 
     55        let (s1, s2) = S.split2 (getL supply ctx) 
     56        in Prelude.showParen ((getL prec ctx) Prelude.> p) $ 
     57            unS lhs (setL supply s1 $ setL prec (Prelude.succ p) ctx) . 
    5558            Prelude.showString name . 
    56             unS rhs s2 prec 
     59            unS rhs (setL supply s2 $ setL prec p ctx) 
    5760        ) 
Note: See TracChangeset for help on using the changeset viewer.