indexed (empty) → 0.1
raw patch · 8 files changed
+211/−0 lines, 8 filesdep +basesetup-changed
Dependencies added: base
Files
- Control/Comonad/Indexed.hs +26/−0
- Control/Monad/Indexed.hs +47/−0
- Control/Monad/Indexed/Fix.hs +20/−0
- Control/Monad/Indexed/Trans.hs +18/−0
- Data/Functor/Indexed.hs +33/−0
- LICENSE +30/−0
- Setup.hs +2/−0
- indexed.cabal +35/−0
+ Control/Comonad/Indexed.hs view
@@ -0,0 +1,26 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Comonad.Indexed+-- Copyright : (C) 2008 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Reiner Pope <reiner.pope@gmail.com+-- Stability : experimental+-- Portability : portable +--+----------------------------------------------------------------------------+module Control.Comonad.Indexed + ( IxFunctor(..)+ , IxCopointed(..)+ , IxComonad(..)+ , iduplicate+ ) where++import Data.Functor.Indexed++class IxCopointed w => IxComonad w where+ iextend :: (w j k a -> b) -> w i k a -> w i j b++iduplicate :: IxComonad w => w i k a -> w i j (w j k a)+iduplicate = iextend id+
+ Control/Monad/Indexed.hs view
@@ -0,0 +1,47 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Monad.Indexed+-- Copyright : (C) 2008 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Reiner Pope <reiner.pope@gmail.com>+-- Stability : experimental+-- Portability : portable+--+----------------------------------------------------------------------------+module Control.Monad.Indexed + ( IxFunctor(..)+ , IxPointed(..)+ , IxApplicative(..)+ , IxMonad(..)+ , IxMonadZero(..)+ , IxMonadPlus(..)+ , ijoin, (>>>=), (=<<<)+ , iapIxMonad+ ) where++import Data.Functor.Indexed++class IxApplicative m => IxMonad m where+ ibind :: (a -> m j k b) -> m i j a -> m i k b++ijoin :: IxMonad m => m i j (m j k a) -> m i k a +ijoin = ibind id++infixr 1 =<<<+infixl 1 >>>=++(>>>=) :: IxMonad m => m i j a -> (a -> m j k b) -> m i k b+m >>>= k = ibind k m ++(=<<<) :: IxMonad m => (a -> m j k b) -> m i j a -> m i k b+(=<<<) = ibind++iapIxMonad :: IxMonad m => m i j (a -> b) -> m j k a -> m i k b+iapIxMonad f x = f >>>= \ f' -> x >>>= \x' -> ireturn (f' x')++class IxMonad m => IxMonadZero m where+ imzero :: m i j a++class IxMonadZero m => IxMonadPlus m where+ implus :: m i j a -> m i j a -> m i j a
+ Control/Monad/Indexed/Fix.hs view
@@ -0,0 +1,20 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Monad.Indexed.Fix+-- Copyright : (C) 2008 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Reiner Pope <reiner.pope@gmail.com>+-- Stability : experimental+-- Portability : portable+--+----------------------------------------------------------------------------+module Control.Monad.Indexed.Fix+ ( IxMonadFix(..)+ ) where++import Control.Monad.Indexed++class IxMonad m => IxMonadFix m where+ imfix :: (a -> m i i a) -> m i i a+
+ Control/Monad/Indexed/Trans.hs view
@@ -0,0 +1,18 @@+-----------------------------------------------------------------------------+-- |+-- Module : Control.Monad.Indexed.Trans+-- Copyright : (C) 2008 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Reiner Pope <reiner.pope@gmail.com>+-- Stability : experimental +-- Portability : portable+--+-- TODO: figure out a meaningful way for indexed monads to transform indexed +-- monads+----------------------------------------------------------------------------+module Control.Monad.Indexed.Trans where++class IxMonadTrans t where+ ilift :: Monad m => m a -> t m i i a +
+ Data/Functor/Indexed.hs view
@@ -0,0 +1,33 @@+-----------------------------------------------------------------------------+-- |+-- Module : Data.Functor.Indexed+-- Copyright : (C) 2008 Edward Kmett+-- License : BSD-style (see the file LICENSE)+--+-- Maintainer : Reiner Pope <reiner.pope@gmail.com>+-- Stability : experimental+-- Portability : portable+--+----------------------------------------------------------------------------+module Data.Functor.Indexed + ( IxFunctor(..)+ , IxCopointed(..)+ , IxPointed(..)+ , IxApplicative(..)+ ) where++class IxFunctor f where+ imap :: (a -> b) -> f j k a -> f j k b++class IxPointed m => IxApplicative m where+ iap :: m i j (a -> b) -> m j k a -> m i k b++class IxFunctor m => IxPointed m where+ ireturn :: a -> m i i a++class IxFunctor w => IxCopointed w where+ iextract :: w i i a -> a++{-# RULES+"iextract/ireturn" iextract . ireturn = id+ #-}
+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c)2012, Edward A. Kmett++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++ * Redistributions of source code must retain the above copyright+ notice, this list of conditions and the following disclaimer.++ * Redistributions in binary form must reproduce the above+ copyright notice, this list of conditions and the following+ disclaimer in the documentation and/or other materials provided+ with the distribution.++ * Neither the name of Edward A. Kmett nor the names of other+ contributors may be used to endorse or promote products derived+ from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ indexed.cabal view
@@ -0,0 +1,35 @@+Name: indexed+Version: 0.1+Synopsis: Haskell98 indexed functors, monads, comonads+Description: Haskell98 indexed functors, monads, comonads+License: BSD3+License-file: LICENSE+Author: Edward A. Kmett+Maintainer: Reiner Pope <reiner.pope@gmail.com>+Copyright: + Copyright (C) 2012 Reiner Pope,+ Copyright (C) 2008 Edward A. Kmett, + Copyright (C) 2004--2008 Dave Menendez, + Copyright (C) 2007 Iavor Diatchki+Category: Control+Build-type: Simple+Cabal-version: >=1.6+homepage: https://github.com/reinerp/indexed+bug-reports: https://github.com/reinerp/indexed/issues++source-repository head+ type: git+ location: git://github.com/reinerp/indexed.git++Library+ Exposed-modules: + Data.Functor.Indexed, + Control.Monad.Indexed, + Control.Monad.Indexed.Fix, + Control.Monad.Indexed.Trans+ Control.Comonad.Indexed+ Build-depends:+ base < 5+ ghc-options:+ -Wall+