Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

repository initialized

  • Loading branch information...
commit e613829b751b838f0effb830f0b5aac0309faecc 0 parents
Edward Kmett authored July 25, 2011
2  .gitignore
... ...
@@ -0,0 +1,2 @@
  1
+_darcs
  2
+dist
28  Data/Profunctor/Corepresentable.hs
... ...
@@ -0,0 +1,28 @@
  1
+{-# LANGUAGE TypeFamilies #-}
  2
+module Data.Profunctor.Corepresentable 
  3
+  ( RepresentableProfunctor(..) 
  4
+  ) where
  5
+
  6
+import Data.Profunctor
  7
+import Control.Arrow
  8
+import Control.Monad.Identity
  9
+
  10
+class Functor (Corep k) => CorepresentableProfunctor k where
  11
+  type Corep k :: * -> *
  12
+  cotabulatePro :: (d -> Corep k c) -> k d c
  13
+  coindexPro :: k d c -> d -> Corep k c 
  14
+  
  15
+instance CorepresentableProfunctor (->) where
  16
+  type Corep (->) = Identity
  17
+  cotabulatePro f = runIdentity . f
  18
+  indexPro f = Identity . f 
  19
+
  20
+instance Functor w => CorepresentableProfunctor (Kleisli w) where
  21
+  type Rep (Kleisli m) = m
  22
+  cotabulatePro = Kleisli
  23
+  coindexPro = runKleisli 
  24
+
  25
+instance Functor w => CorepresentableProfunctor (UpStar f) where
  26
+  type Rep (DownStar f) = f
  27
+  cotabulatePro = UpStar
  28
+  coindexPro = runUpStar
28  Data/Profunctor/Representable.hs
... ...
@@ -0,0 +1,28 @@
  1
+{-# LANGUAGE TypeFamilies #-}
  2
+module Data.Profunctor.Representable 
  3
+  ( RepresentableProfunctor(..) 
  4
+  ) where
  5
+
  6
+import Data.Profunctor
  7
+import Control.Comonad
  8
+import Control.Monad.Identity
  9
+
  10
+class Functor (Rep k) => RepresentableProfunctor k where
  11
+  type Rep k :: * -> *
  12
+  tabulatePro :: (Rep k d -> c) -> k d c
  13
+  indexPro :: k d c -> Rep k d -> c 
  14
+  
  15
+instance RepresentableProfunctor (->) where
  16
+  type Rep (->) = Identity
  17
+  tabulatePro f = f . runIdentity
  18
+  indexPro f (Identity d) = f d
  19
+
  20
+instance Functor w => RepresentableProfunctor (Cokleisli w) where
  21
+  type Rep (Cokleisli w) = w 
  22
+  tabulatePro = Cokleisli
  23
+  indexPro = runCokleisli 
  24
+
  25
+instance Functor w => RepresentableProfunctor (DownStar f) where
  26
+  type Rep (DownStar f) = f
  27
+  tabulatePro = DownStar
  28
+  indexPro = runDownStar
30  LICENSE
... ...
@@ -0,0 +1,30 @@
  1
+Copyright 2011 Edward Kmett
  2
+
  3
+All rights reserved.
  4
+
  5
+Redistribution and use in source and binary forms, with or without
  6
+modification, are permitted provided that the following conditions
  7
+are met:
  8
+
  9
+1. Redistributions of source code must retain the above copyright
  10
+   notice, this list of conditions and the following disclaimer.
  11
+
  12
+2. Redistributions in binary form must reproduce the above copyright
  13
+   notice, this list of conditions and the following disclaimer in the
  14
+   documentation and/or other materials provided with the distribution.
  15
+
  16
+3. Neither the name of the author nor the names of his contributors
  17
+   may be used to endorse or promote products derived from this software
  18
+   without specific prior written permission.
  19
+
  20
+THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
  21
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  22
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  23
+DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
  24
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26
+OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  28
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  29
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30
+POSSIBILITY OF SUCH DAMAGE.
7  Setup.lhs
... ...
@@ -0,0 +1,7 @@
  1
+#!/usr/bin/runhaskell
  2
+> module Main (main) where
  3
+
  4
+> import Distribution.Simple
  5
+
  6
+> main :: IO ()
  7
+> main = defaultMain
32  representable-profunctors.cabal
... ...
@@ -0,0 +1,32 @@
  1
+name:          representable-profunctors
  2
+category:      Control, Categories
  3
+version:       0.1
  4
+license:       BSD3
  5
+cabal-version: >= 1.6
  6
+license-file:  LICENSE
  7
+author:        Edward A. Kmett
  8
+maintainer:    Edward A. Kmett <ekmett@gmail.com>
  9
+stability:     experimental
  10
+homepage:      git://github.com/ekmett/representable-profunctors/
  11
+copyright:     Copyright (C) 2011 Edward A. Kmett
  12
+synopsis:      Representable profunctors
  13
+description:   Representable profunctors
  14
+build-type:    Simple
  15
+
  16
+source-repository head
  17
+  type: git
  18
+  location: git://github.com/ekmett/representable-profunctors.git
  19
+
  20
+library
  21
+  build-depends: 
  22
+    base >= 4 && < 5,
  23
+    semigroupoids >= 1.2.2 && <= 1.3,
  24
+    comonad >= 1.1 && < 1.2,
  25
+    profunctors >= 0.1.1 && < 0.2,
  26
+    profunctor-extras >= 0.1.1 && < 0.2
  27
+
  28
+  exposed-modules:
  29
+    Data.Profunctor.Representable
  30
+    Data.Profunctor.Corepresentable
  31
+
  32
+  ghc-options:      -Wall 

0 notes on commit e613829

Please sign in to comment.
Something went wrong with that request. Please try again.