Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial files

  • Loading branch information...
commit 6ba9935b7a113607612267647729796d7f7b3b0b 0 parents
@spl authored
Showing with 107 additions and 0 deletions.
  1. +28 −0 LICENSE
  2. +35 −0 ligd.cabal
  3. +44 −0 src/Generics/LIGD/Base.hs
28 LICENSE
@@ -0,0 +1,28 @@
+Copyright (c) 2008, 2009 Universiteit Utrecht
+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 Universiteit Utrecht nor the names of its 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.
+
35 ligd.cabal
@@ -0,0 +1,35 @@
+name: ligd
+version: 0.1
+synopsis: Lightweight Implementation of Generics and Dynamics
+description:
+
+ This is the basic representation types for the LIGD library. It is currently
+ incomplete with respect to the paper. We hope to rectify that in the future.
+
+ See the following publication for details.
+
+ J. Cheney and R. Hinze. "A lightweight implementation of generics and
+ dynamics." In Haskell 2002. pp. 90-104.
+
+category: Generics
+copyright: (c) 2011 Universiteit Utrecht
+license: BSD3
+license-file: LICENSE
+author: Sean Leather
+maintainer: Sean Leather <leather@cs.uu.nl>
+stability: experimental
+build-type: Simple
+cabal-version: >= 1.2
+
+--------------------------------------------------------------------------------
+
+Library
+ hs-source-dirs: src
+
+ exposed-modules: Generics.LIGD.Base
+
+ build-depends: base
+
+ ghc-options: -Wall
+ ghc-options: -O2
+
44 src/Generics/LIGD/Base.hs
@@ -0,0 +1,44 @@
+{-# LANGUAGE TypeOperators #-}
+{-# LANGUAGE GADTs #-}
+
+module Generics.LIGD.Base where
+
+data Unit = Unit deriving Show
+data a :+: b = Inl a | Inr b deriving Show
+data a :*: b = a :*: b deriving Show
+
+infixr 5 :+:
+infixr 6 :*:
+
+data EP b c = EP { from :: (b -> c), to :: (c -> b) }
+
+data Rep t where
+ RChar :: Rep Char
+ RInt :: Rep Int
+ RString :: Rep String
+ RUnit :: Rep Unit
+ RSum :: Rep a -> Rep b -> Rep (a :+: b)
+ RProd :: Rep a -> Rep b -> Rep (a :*: b)
+ RCon :: String -> Rep a -> Rep a
+ RType :: EP b a -> Rep a -> Rep b
+
+data Rep1 g a where
+ RChar1 :: Rep1 g Char
+ RInt1 :: Rep1 g Int
+ RUnit1 :: Rep1 g Unit
+ RSum1 :: Rep1 g a -> Rep1 g b -> Rep1 g (a :+: b)
+ RProd1 :: Rep1 g a -> Rep1 g b -> Rep1 g (a :*: b)
+ RCon1 :: String -> Rep1 g a -> Rep1 g a
+ RType1 :: EP b a -> Rep1 g a -> Rep1 g b
+ RVar1 :: g a -> Rep1 g a
+
+data Rep2 g a b where
+ RChar2 :: Rep2 g Char Char
+ RInt2 :: Rep2 g Int Int
+ RUnit2 :: Rep2 g Unit Unit
+ RSum2 :: Rep2 g a b -> Rep2 g c d -> Rep2 g (a :+: c) (b :+: d)
+ RProd2 :: Rep2 g a b -> Rep2 g c d -> Rep2 g (a :*: c) (b :*: d)
+ RCon2 :: String -> Rep2 g a b -> Rep2 g a b
+ RType2 :: EP a c -> EP b d -> Rep2 g c d -> Rep2 g a b
+ RVar2 :: g a b -> Rep2 g a b
+
Please sign in to comment.
Something went wrong with that request. Please try again.