Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

repository initialized

  • Loading branch information...
commit e613829b751b838f0effb830f0b5aac0309faecc 0 parents
@ekmett authored
2  .gitignore
@@ -0,0 +1,2 @@
+_darcs
+dist
28 Data/Profunctor/Corepresentable.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE TypeFamilies #-}
+module Data.Profunctor.Corepresentable
+ ( RepresentableProfunctor(..)
+ ) where
+
+import Data.Profunctor
+import Control.Arrow
+import Control.Monad.Identity
+
+class Functor (Corep k) => CorepresentableProfunctor k where
+ type Corep k :: * -> *
+ cotabulatePro :: (d -> Corep k c) -> k d c
+ coindexPro :: k d c -> d -> Corep k c
+
+instance CorepresentableProfunctor (->) where
+ type Corep (->) = Identity
+ cotabulatePro f = runIdentity . f
+ indexPro f = Identity . f
+
+instance Functor w => CorepresentableProfunctor (Kleisli w) where
+ type Rep (Kleisli m) = m
+ cotabulatePro = Kleisli
+ coindexPro = runKleisli
+
+instance Functor w => CorepresentableProfunctor (UpStar f) where
+ type Rep (DownStar f) = f
+ cotabulatePro = UpStar
+ coindexPro = runUpStar
28 Data/Profunctor/Representable.hs
@@ -0,0 +1,28 @@
+{-# LANGUAGE TypeFamilies #-}
+module Data.Profunctor.Representable
+ ( RepresentableProfunctor(..)
+ ) where
+
+import Data.Profunctor
+import Control.Comonad
+import Control.Monad.Identity
+
+class Functor (Rep k) => RepresentableProfunctor k where
+ type Rep k :: * -> *
+ tabulatePro :: (Rep k d -> c) -> k d c
+ indexPro :: k d c -> Rep k d -> c
+
+instance RepresentableProfunctor (->) where
+ type Rep (->) = Identity
+ tabulatePro f = f . runIdentity
+ indexPro f (Identity d) = f d
+
+instance Functor w => RepresentableProfunctor (Cokleisli w) where
+ type Rep (Cokleisli w) = w
+ tabulatePro = Cokleisli
+ indexPro = runCokleisli
+
+instance Functor w => RepresentableProfunctor (DownStar f) where
+ type Rep (DownStar f) = f
+ tabulatePro = DownStar
+ indexPro = runDownStar
30 LICENSE
@@ -0,0 +1,30 @@
+Copyright 2011 Edward 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:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. 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.
+
+3. Neither the name of the author nor the names of his contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``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 AUTHORS 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.
7 Setup.lhs
@@ -0,0 +1,7 @@
+#!/usr/bin/runhaskell
+> module Main (main) where
+
+> import Distribution.Simple
+
+> main :: IO ()
+> main = defaultMain
32 representable-profunctors.cabal
@@ -0,0 +1,32 @@
+name: representable-profunctors
+category: Control, Categories
+version: 0.1
+license: BSD3
+cabal-version: >= 1.6
+license-file: LICENSE
+author: Edward A. Kmett
+maintainer: Edward A. Kmett <ekmett@gmail.com>
+stability: experimental
+homepage: git://github.com/ekmett/representable-profunctors/
+copyright: Copyright (C) 2011 Edward A. Kmett
+synopsis: Representable profunctors
+description: Representable profunctors
+build-type: Simple
+
+source-repository head
+ type: git
+ location: git://github.com/ekmett/representable-profunctors.git
+
+library
+ build-depends:
+ base >= 4 && < 5,
+ semigroupoids >= 1.2.2 && <= 1.3,
+ comonad >= 1.1 && < 1.2,
+ profunctors >= 0.1.1 && < 0.2,
+ profunctor-extras >= 0.1.1 && < 0.2
+
+ exposed-modules:
+ Data.Profunctor.Representable
+ Data.Profunctor.Corepresentable
+
+ ghc-options: -Wall
Please sign in to comment.
Something went wrong with that request. Please try again.