Ignore:
Timestamp:
Nov 16, 2012, 4:26:26 PM (13 years ago)
Author:
gobi
Message:

new solver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sizechecking_branches/LL.hs

    r10 r15  
    1 {-# Language GADTs,  
    2         FlexibleInstances,  
    3         FlexibleContexts,  
    4         ScopedTypeVariables,  
    5         TypeFamilies,  
     1{-# Language GADTs, 
     2        FlexibleInstances, 
     3        FlexibleContexts, 
     4        ScopedTypeVariables, 
     5        TypeFamilies, 
    66        NoMonomorphismRestriction, 
    77        OverlappingInstances #-} 
     8module LL where 
    89 
    910import Data.Char 
     
    1415  deriving Show 
    1516 
    16 type family Arr (repr :: * -> *) (a :: *) (b :: *) :: * 
    1717 
    1818class Lambda l where 
     19    type Arr l (a :: *) (b :: *) :: * 
    1920    labs    :: (l a -> l b) -> l (Arr l a b) 
    2021    app     :: l (Arr l a b) -> l a -> l b 
     
    4950 
    5051newtype LPrint a = LPrint { unPrint :: Int -> Int -> ShowS } 
    51 type instance Arr LPrint a b = a -> b 
    5252 
    5353instance Lambda LPrint where 
     54  type Arr LPrint a b = a -> b 
    5455  lit x      = LPrint $ \_ -> return $ shows x 
    5556  op m opc n = LPrint $ \p -> do 
     
    7576{- Evaluating -} 
    7677newtype R a = R { unR :: a } 
    77 type instance Arr R a b = R a -> R b 
    7878 
    7979instance Lambda R where 
     80  type Arr R a b = R a -> R b 
    8081  labs        = R 
    8182  app         = unR 
     
    9495eval = unR 
    9596 
    96 z = labs ( \s -> s + 1) `app` ( 1 + lit 2) 
     97z = labs (\s -> s + lit 1) `app` (lit 1 + 2) 
Note: See TracChangeset for help on using the changeset viewer.