DeepArrow 0.2 → 0.3.2
raw patch · 3 files changed
+29/−12 lines, 3 filesdep ~TypeComposedep ~base
Dependency ranges changed: TypeCompose, base
Files
- DeepArrow.cabal +5/−6
- src/Data/DDeepArrow.hs +21/−5
- src/Data/FunArr.hs +3/−1
DeepArrow.cabal view
@@ -1,5 +1,5 @@ Name: DeepArrow-Version: 0.2+Version: 0.3.2 Synopsis: Arrows for "deep application" Category: Combinators, Control Description:@@ -16,8 +16,8 @@ * Application of deep arrows for composable interfaces in the TV library: <http://haskell.org/haskellwiki/TV> .- * The motivating idea and paper "Functional Programming by Interacting- with Tangible Values": <http://conal.net/papers/Eros>+ * The motivating idea and paper "Tangible Functional Programming":+ <http://conal.net/papers/Eros> . This page and the module documentation pages have links to colorized source code and to wiki pages where you can read and contribute /user@@ -37,11 +37,10 @@ Package-Url: http://darcs.haskell.org/packages/DeepArrow License: BSD3 Stability: experimental-Copyright: (c) 2007 by Conal Elliott+Copyright: (c) 2007,2009 by Conal Elliott Build-type: Simple Hs-Source-Dirs: src-Build-Depends: base, mtl, TypeCompose>=0.2, haskell-src-Extensions: CPP, UndecidableInstances+Build-Depends: base<5, mtl, TypeCompose>=0.6.5, haskell-src Exposed-Modules: Control.Arrow.DeepArrow Data.FunArr
src/Data/DDeepArrow.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GADTs, TypeOperators, KindSignatures, MultiParamTypeClasses #-}+{-# LANGUAGE GADTs, TypeOperators, KindSignatures, MultiParamTypeClasses, CPP #-} -- For ghc 6.6 compatibility -- {-# OPTIONS -fglasgow-exts -Wall #-} @@ -21,13 +21,21 @@ DArrow(..), DVal(..) ) where +#if __GLASGOW_HASKELL__ >= 609+import Control.Category+import Prelude hiding ((.), id)+#endif+ import Control.Arrow+#if __GLASGOW_HASKELL__ < 610+ hiding (pure)+#endif -- haskell-src import Language.Haskell.Syntax -- TypeCompose-import Data.Pair (Pair(..))+import Data.Zip (Zip(..)) import Language.Haskell.ToHs import Control.Arrow.DeepArrow@@ -58,9 +66,17 @@ SndA :: (a,b) `DArrow` b SwapA :: (a,b) `DArrow` (b,a) +#if __GLASGOW_HASKELL__ >= 609+instance Category DArrow where+ id = IdA+ (.) = flip Compose+#endif+ instance Arrow DArrow where arr = error "no arr/pure for DDeepArrow"+#if __GLASGOW_HASKELL__ < 609 (>>>) = Compose+#endif first = First second = Second @@ -84,9 +100,9 @@ data DVal :: * -> * where ExpDV :: HsExp -> DVal a AppDA :: a `DArrow` b -> DVal a -> DVal b- PairDV :: DVal a -> DVal b -> DVal (a,b)+ ZipDV :: DVal a -> DVal b -> DVal (a,b) -instance Pair DVal where pair = PairDV+instance Zip DVal where zip = ZipDV instance ToHsExp (DArrow a b) where toHsExp (Arr dvFun) = toHsExp dvFun@@ -111,7 +127,7 @@ toHsExp (ExpDV expr) = expr toHsExp (AppDA ar dv) = toHsExp ar `HsApp` toHsExp dv -- toHsInfix (HsSymbol "$$") ar dv- toHsExp (PairDV a b) = HsTuple [toHsExp a, toHsExp b]+ toHsExp (ZipDV a b) = HsTuple [toHsExp a, toHsExp b] instance FunArr DArrow DVal where
src/Data/FunArr.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE TypeOperators, MultiParamTypeClasses, FunctionalDependencies #-}+{-# LANGUAGE TypeOperators, MultiParamTypeClasses, FunctionalDependencies+ , UndecidableInstances+ #-} -- For ghc 6.6 compatibility -- {-# OPTIONS -fglasgow-exts -fallow-undecidable-instances #-}