species 0.3.2.3 → 0.3.2.4
raw patch · 8 files changed
+122/−118 lines, 8 filesdep ~basedep ~numeric-preludedep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, numeric-prelude, template-haskell
API changes (from Hackage documentation)
- Math.Combinatorics.Species.Structures: instance (Typeable1 f, Typeable1 g) => Typeable1 (f :*: g)
- Math.Combinatorics.Species.Structures: instance (Typeable1 f, Typeable1 g) => Typeable1 (f :+: g)
- Math.Combinatorics.Species.Structures: instance (Typeable1 f, Typeable1 g) => Typeable1 (f :.: g)
- Math.Combinatorics.Species.Structures: instance Typeable x => Typeable1 (Const x)
- Math.Combinatorics.Species.Structures: instance Typeable1 Cycle
- Math.Combinatorics.Species.Structures: instance Typeable1 Id
- Math.Combinatorics.Species.Structures: instance Typeable1 Set
- Math.Combinatorics.Species.Structures: instance Typeable1 Star
- Math.Combinatorics.Species.Structures: instance Typeable1 Unit
- Math.Combinatorics.Species.Structures: instance Typeable1 Void
- Math.Combinatorics.Species.Structures: instance Typeable2 Const
- Math.Combinatorics.Species.Structures: instance Typeable2 Mu
+ Math.Combinatorics.Species.Structures: instance Typeable (:*:)
+ Math.Combinatorics.Species.Structures: instance Typeable (:+:)
+ Math.Combinatorics.Species.Structures: instance Typeable (:.:)
+ Math.Combinatorics.Species.Structures: instance Typeable Const
+ Math.Combinatorics.Species.Structures: instance Typeable Cycle
+ Math.Combinatorics.Species.Structures: instance Typeable Id
+ Math.Combinatorics.Species.Structures: instance Typeable Mu
+ Math.Combinatorics.Species.Structures: instance Typeable Set
+ Math.Combinatorics.Species.Structures: instance Typeable Star
+ Math.Combinatorics.Species.Structures: instance Typeable Unit
+ Math.Combinatorics.Species.Structures: instance Typeable Void
- Math.Combinatorics.Species: (:*:) :: f a -> g a -> :*: f g a
+ Math.Combinatorics.Species: (:*:) :: f a -> g a -> (:*:) f g a
- Math.Combinatorics.Species: Comp :: (f (g a)) -> :.: f g a
+ Math.Combinatorics.Species: Comp :: (f (g a)) -> (:.:) f g a
- Math.Combinatorics.Species: Inl :: (f a) -> :+: f g a
+ Math.Combinatorics.Species: Inl :: (f a) -> (:+:) f g a
- Math.Combinatorics.Species: Inr :: (g a) -> :+: f g a
+ Math.Combinatorics.Species: Inr :: (g a) -> (:+:) f g a
- Math.Combinatorics.Species: apply :: (ASTFunctor f, Typeable1 g) => f -> TSpeciesAST g -> TSpeciesAST (Interp f g)
+ Math.Combinatorics.Species: apply :: (ASTFunctor f, Typeable g) => f -> TSpeciesAST g -> TSpeciesAST (Interp f g)
- Math.Combinatorics.Species: class (Typeable f, Show f, Typeable1 (Interp f (Mu f))) => ASTFunctor f
+ Math.Combinatorics.Species: class (Typeable f, Show f, Typeable (Interp f (Mu f))) => ASTFunctor f
- Math.Combinatorics.Species: class Typeable1 (StructTy f) => Enumerable (f :: * -> *) where type family StructTy f :: * -> *
+ Math.Combinatorics.Species: class Typeable (StructTy f) => Enumerable (f :: * -> *) where type family StructTy f :: * -> *
- Math.Combinatorics.Species: unComp :: :.: f g a -> (f (g a))
+ Math.Combinatorics.Species: unComp :: (:.:) f g a -> (f (g a))
- Math.Combinatorics.Species: unwrap :: Typeable1 s => ESpeciesAST -> TSpeciesAST s
+ Math.Combinatorics.Species: unwrap :: Typeable s => ESpeciesAST -> TSpeciesAST s
- Math.Combinatorics.Species: wrap :: Typeable1 s => TSpeciesAST s -> ESpeciesAST
+ Math.Combinatorics.Species: wrap :: Typeable s => TSpeciesAST s -> ESpeciesAST
- Math.Combinatorics.Species.AST: apply :: (ASTFunctor f, Typeable1 g) => f -> TSpeciesAST g -> TSpeciesAST (Interp f g)
+ Math.Combinatorics.Species.AST: apply :: (ASTFunctor f, Typeable g) => f -> TSpeciesAST g -> TSpeciesAST (Interp f g)
- Math.Combinatorics.Species.AST: class (Typeable f, Show f, Typeable1 (Interp f (Mu f))) => ASTFunctor f
+ Math.Combinatorics.Species.AST: class (Typeable f, Show f, Typeable (Interp f (Mu f))) => ASTFunctor f
- Math.Combinatorics.Species.AST: unwrap :: Typeable1 s => ESpeciesAST -> TSpeciesAST s
+ Math.Combinatorics.Species.AST: unwrap :: Typeable s => ESpeciesAST -> TSpeciesAST s
- Math.Combinatorics.Species.AST: wrap :: Typeable1 s => TSpeciesAST s -> ESpeciesAST
+ Math.Combinatorics.Species.AST: wrap :: Typeable s => TSpeciesAST s -> ESpeciesAST
- Math.Combinatorics.Species.Enumerate: class Typeable1 (StructTy f) => Enumerable (f :: * -> *) where type family StructTy f :: * -> *
+ Math.Combinatorics.Species.Enumerate: class Typeable (StructTy f) => Enumerable (f :: * -> *) where type family StructTy f :: * -> *
- Math.Combinatorics.Species.Structures: (:*:) :: f a -> g a -> :*: f g a
+ Math.Combinatorics.Species.Structures: (:*:) :: f a -> g a -> (:*:) f g a
- Math.Combinatorics.Species.Structures: Comp :: (f (g a)) -> :.: f g a
+ Math.Combinatorics.Species.Structures: Comp :: (f (g a)) -> (:.:) f g a
- Math.Combinatorics.Species.Structures: Inl :: (f a) -> :+: f g a
+ Math.Combinatorics.Species.Structures: Inl :: (f a) -> (:+:) f g a
- Math.Combinatorics.Species.Structures: Inr :: (g a) -> :+: f g a
+ Math.Combinatorics.Species.Structures: Inr :: (g a) -> (:+:) f g a
- Math.Combinatorics.Species.Structures: unComp :: :.: f g a -> (f (g a))
+ Math.Combinatorics.Species.Structures: unComp :: (:.:) f g a -> (f (g a))
Files
- CHANGES +7/−0
- Math/Combinatorics/Species.hs +13/−13
- Math/Combinatorics/Species/AST.hs +5/−5
- Math/Combinatorics/Species/Class.hs +22/−24
- Math/Combinatorics/Species/Enumerate.hs +9/−9
- Math/Combinatorics/Species/Structures.hs +26/−27
- Math/Combinatorics/Species/TH.hs +31/−30
- species.cabal +9/−10
CHANGES view
@@ -1,3 +1,10 @@+0.3.2.4 17 April 2015+ * update to work with GHC 7.8 and 7.10+ * drop support for GHC < 7.8+ * allow base-4.7 or 4.8+ * allow numeric-prelude-0.4+ * allow template-haskell-2.9+ 0.3.2.3 18 Oct 2012 * drop support for GHC < 7.4, and update to work with 7.4 and 7.6
Math/Combinatorics/Species.hs view
@@ -12,11 +12,11 @@ -- For a friendly introduction to combinatorial species in general -- and this library in particular, see my series of blog posts: ----- * <http://byorgey.wordpress.com/2009/07/24/introducing-math-combinatorics-species/>+-- * <http://byorgey.wordpress.com/2009/07/24/introducing-math-combinatorics-species/> ----- * <http://byorgey.wordpress.com/2009/07/30/primitive-species-and-species-operations/>+-- * <http://byorgey.wordpress.com/2009/07/30/primitive-species-and-species-operations/> ----- * <http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/>+-- * <http://byorgey.wordpress.com/2009/07/31/primitive-species-and-species-operations-part-ii/> -- -- For a good reference (really, the -- only English-language reference!) on combinatorial species, see@@ -112,16 +112,16 @@ ) where -import Math.Combinatorics.Species.Class-import Math.Combinatorics.Species.Labeled-import Math.Combinatorics.Species.Unlabeled-import Math.Combinatorics.Species.Structures-import Math.Combinatorics.Species.Enumerate-import Math.Combinatorics.Species.AST-import Math.Combinatorics.Species.AST.Instances-import Math.Combinatorics.Species.TH-import Math.Combinatorics.Species.Simplify-import Math.Combinatorics.Species.NewtonRaphson+import Math.Combinatorics.Species.AST+import Math.Combinatorics.Species.AST.Instances+import Math.Combinatorics.Species.Class+import Math.Combinatorics.Species.Enumerate+import Math.Combinatorics.Species.Labeled+import Math.Combinatorics.Species.NewtonRaphson+import Math.Combinatorics.Species.Simplify+import Math.Combinatorics.Species.Structures+import Math.Combinatorics.Species.TH+import Math.Combinatorics.Species.Unlabeled -- $DSL -- The combinatorial species DSL consists of the 'Species' type class,
Math/Combinatorics/Species/AST.hs view
@@ -196,18 +196,18 @@ -- | An existential wrapper to hide the phantom type parameter to -- 'SizedSpeciesAST', so we can make it an instance of 'Species'. data ESpeciesAST where- Wrap :: Typeable1 s => SizedSpeciesAST s -> ESpeciesAST+ Wrap :: Typeable s => SizedSpeciesAST s -> ESpeciesAST -- | Construct an 'ESpeciesAST' from a 'TSpeciesAST' by adding an -- appropriate interval annotation and hiding the type.-wrap :: Typeable1 s => TSpeciesAST s -> ESpeciesAST+wrap :: Typeable s => TSpeciesAST s -> ESpeciesAST wrap = Wrap . annI -- | Unwrap an existential wrapper to get out a typed AST. You can -- get out any type you like as long as it is the right one. -- -- CAUTION: Don't try this at home!-unwrap :: Typeable1 s => ESpeciesAST -> TSpeciesAST s+unwrap :: Typeable s => ESpeciesAST -> TSpeciesAST s unwrap (Wrap f) = gcast1' . stripI $ f@@ -292,8 +292,8 @@ -- species expressions. The 'apply' method allows such codes to be -- applied to a species AST. The indirection is needed to implement -- recursive species.-class (Typeable f, Show f, Typeable1 (Interp f (Mu f))) => ASTFunctor f where- apply :: Typeable1 g => f -> TSpeciesAST g -> TSpeciesAST (Interp f g)+class (Typeable f, Show f, Typeable (Interp f (Mu f))) => ASTFunctor f where+ apply :: Typeable g => f -> TSpeciesAST g -> TSpeciesAST (Interp f g) ------------------------------------------------------------ -- Miscellaneous AST operations --------------------------
Math/Combinatorics/Species/Class.hs view
@@ -1,6 +1,5 @@-{-# LANGUAGE NoImplicitPrelude- , CPP- #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE NoImplicitPrelude #-} ----------------------------------------------------------------------------- -- |@@ -31,8 +30,8 @@ -- | It can be grammatically convenient to define plural -- versions of species as synonyms for the singular versions.- -- For example, we can use @'set' ``o`` 'nonEmpty' 'sets'@- -- instead of @'set' ``o`` 'nonEmpty' 'set'@.+ -- For example, we can use @'set' `o` 'nonEmpty' 'sets'@+ -- instead of @'set' `o` 'nonEmpty' 'set'@. , sets , cycles , linOrds@@ -59,16 +58,16 @@ ) where -import qualified Algebra.Differential as Differential+import qualified Algebra.Differential as Differential #if MIN_VERSION_numeric_prelude(0,2,0)-import NumericPrelude hiding (cycle)+import NumericPrelude hiding (cycle) #else-import NumericPrelude-import PreludeBase hiding (cycle)+import NumericPrelude+import PreludeBase hiding (cycle) #endif -import Math.Combinatorics.Species.AST+import Math.Combinatorics.Species.AST -- | The Species type class. Note that the @Differential@ constraint -- requires s to be a differentiable ring, which means that every@@ -78,9 +77,6 @@ -- i.e. partitional product), and "Algebra.Differential" (species -- differentiation, i.e. adjoining a distinguished element). ----- Minimal complete definition: 'singleton', 'set', 'cycle', 'o',--- '><', '@@', 'ofSize'.--- -- Note that the 'o' operation can be used infix to suggest common -- notation for composition, and also to be read as an abbreviation -- for \"of\", as in \"top o' the mornin'\": @set \`o\` nonEmpty@@ -119,7 +115,7 @@ subset = set * set -- | Subsets of size exactly k, @'ksubset' k = ('set'- -- ``ofSizeExactly`` k) * 'set'@. Included with a default definition+ -- \`ofSizeExactly\` k) * 'set'@. Included with a default definition -- in the 'Species' class for the same reason as 'subset'. ksubset :: Integer -> s ksubset k = (set `ofSizeExactly` k) * set@@ -131,7 +127,7 @@ element :: s element = singleton * set - -- | Partitional composition. To form all @(f ``o`` g)@-structures on+ -- | Partitional composition. To form all @(f \`o\` g)@-structures on -- the underlying label set U, first form all set partitions of U; -- for each partition @p@, put an @f@-structure on the classes of -- @p@, and a separate @g@-structure on the elements in each@@ -143,7 +139,7 @@ -- the same underlying set. (><) :: s -> s -> s - -- | Functor composition of two species. An @(f '@@' g)@-structure+ -- | Functor composition of two species. An @(f \@\@ g)@-structure -- consists of an @f@-structure on the set of all @g@-structures. (@@) :: s -> s -> s @@ -166,8 +162,8 @@ nonEmpty :: s -> s nonEmpty = flip ofSize (>0) - -- | 'rec f' is the least fixpoint of (the interpretation of) the- -- higher-order species constructor 'f'.+ -- | @rec f@ is the least fixpoint of (the interpretation of) the+ -- higher-order species constructor @f@. rec :: ASTFunctor f => f -> s -- | Omega is the pseudo-species which only puts a structure on@@ -176,6 +172,8 @@ -- in for recursive occurrences of a species. omega :: s + {-# MINIMAL singleton, set, cycle, o, (><), (@@), ofSize #-}+ -- | A convenient synonym for differentiation. @'oneHole' -- f@-structures look like @f@-structures on a set formed by adjoining -- a distinguished \"hole\" element to the underlying set.@@ -217,19 +215,19 @@ -- | An octopus is a cyclic arrangement of lists, so called because -- the lists look like \"tentacles\" attached to the cyclic--- \"body\": @'octopus' = 'cycle' ``o`` 'nonEmpty' 'linOrds'@.+-- \"body\": @'octopus' = 'cycle' \`o\` 'nonEmpty' 'linOrds'@. octopi, octopus :: Species s => s octopus = cycle `o` nonEmpty linOrds octopi = octopus -- | The species of set partitions is just the composition @'set'--- ``o`` 'nonEmpty' 'sets'@.+-- \`o\` 'nonEmpty' 'sets'@. partitions, partition :: Species s => s partition = set `o` nonEmpty sets partitions = partition -- | A permutation is a set of disjoint cycles: @'permutation' = 'set'--- ``o`` 'cycles'@.+-- \`o\` 'cycles'@. permutations, permutation :: Species s => s permutation = set `o` cycles permutations = permutation@@ -238,7 +236,7 @@ subsets = subset -- | The species of ballots consists of linear orderings of--- nonempty sets: @'ballot' = 'linOrd' ``o`` 'nonEmpty' 'sets'@.+-- nonempty sets: @'ballot' = 'linOrd' \`o\` 'nonEmpty' 'sets'@. ballots, ballot :: Species s => s ballot = linOrd `o` nonEmpty sets ballots = ballot@@ -248,13 +246,13 @@ -- | Simple graphs (undirected, without loops). A simple graph is a -- subset of the set of all size-two subsets of the vertices:--- @'simpleGraph' = 'subset' '@@' ('ksubset' 2)@.+-- @'simpleGraph' = 'subset' \@\@ ('ksubset' 2)@. simpleGraphs, simpleGraph :: Species s => s simpleGraph = subset @@ (ksubset 2) simpleGraphs = simpleGraph -- | A directed graph (with loops) is a subset of all pairs drawn--- (with replacement) from the set of vertices: @'subset' '@@'+-- (with replacement) from the set of vertices: @'subset' \@\@ -- ('element' '><' 'element')@. It can also be thought of as the -- species of binary relations. directedGraphs, directedGraph :: Species s => s
Math/Combinatorics/Species/Enumerate.hs view
@@ -156,7 +156,7 @@ -- | An existential wrapper for structures, hiding the structure -- functor and ensuring that it is 'Typeable'. data Structure a where- Structure :: Typeable1 f => f a -> Structure a+ Structure :: Typeable f => f a -> Structure a -- | Extract the contents from a 'Structure' wrapper, if we know the -- type, and map it into an isomorphic type. If the type doesn't@@ -202,7 +202,7 @@ -- 'enumerate' can often be inferred. structureType :: ESpeciesAST -> String structureType (Wrap s) = showStructureType . extractType $ (stripI s)- where extractType :: forall s. Typeable1 s => TSpeciesAST s -> TypeRep+ where extractType :: forall s. Typeable s => TSpeciesAST s -> TypeRep extractType _ = typeOf1 (undefined :: s ()) -- | Show a 'TypeRep' while stripping off qualifier portions of 'TyCon'@@ -214,13 +214,13 @@ where showsPrecST :: Int -> TypeRep -> ShowS showsPrecST p t = case splitTyConApp t of- (tycon, []) -> showString (dropQuals $ tyConString tycon)- (tycon, [x]) | tyConString tycon == "[]"- -> showChar '[' . showsPrecST 11 x . showChar ']'+ (tycon, []) -> showString (dropQuals $ tyConName tycon)+ (tycon, [x]) | tyConName tycon == "[]"+ -> showChar '[' . showsPrecST 11 x . showChar ']' (tycon, args) -> showParen (p > 9)- $ showString (dropQuals $ tyConString tycon)- . showChar ' '- . showArgsST args+ $ showString (dropQuals $ tyConName tycon)+ . showChar ' '+ . showArgsST args showArgsST :: [TypeRep] -> ShowS showArgsST [] = id@@ -377,7 +377,7 @@ -- You should only rarely have to explicitly make an instance of -- 'Enumerable' yourself; Template Haskell code to derive instances -- for you is provided in "Math.Combinatorics.Species.TH".-class Typeable1 (StructTy f) => Enumerable (f :: * -> *) where+class Typeable (StructTy f) => Enumerable (f :: * -> *) where -- | The standard structure type (see -- "Math.Combinatorics.Species.Structures") that will map into @f@. type StructTy f :: * -> *
Math/Combinatorics/Species/Structures.hs view
@@ -74,15 +74,15 @@ fmap _ Unit = Unit -- | The constant functor.-newtype Const x a = Const x+newtype Const x a = Const x deriving (Typeable) instance Functor (Const x) where fmap _ (Const x) = Const x instance (Show x) => Show (Const x a) where show (Const x) = show x-instance Typeable2 Const where- typeOf2 _ = mkTyConApp (mkTyCon "Const") []-instance Typeable x => Typeable1 (Const x) where- typeOf1 = typeOf1Default+-- instance Typeable2 Const where+-- typeOf2 _ = mkTyConApp (mkTyCon "Const") []+-- instance Typeable x => Typeable1 (Const x) where+-- typeOf1 = typeOf1Default -- | The identity functor. newtype Id a = Id a@@ -93,22 +93,22 @@ show (Id x) = show x -- | Functor coproduct.-data (f :+: g) a = Inl (f a) | Inr (g a)+data (f :+: g) a = Inl (f a) | Inr (g a) deriving Typeable instance (Functor f, Functor g) => Functor (f :+: g) where fmap f (Inl fa) = Inl (fmap f fa) fmap f (Inr ga) = Inr (fmap f ga) instance (Show (f a), Show (g a)) => Show ((f :+: g) a) where show (Inl fa) = "inl(" ++ show fa ++ ")" show (Inr ga) = "inr(" ++ show ga ++ ")"-instance (Typeable1 f, Typeable1 g) => Typeable1 (f :+: g) where- typeOf1 x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:+:)") [typeOf1 (getF x), typeOf1 (getG x)]- where getF :: (f :+: g) a -> f a- getF = undefined- getG :: (f :+: g) a -> g a- getG = undefined+-- instance (Typeable f, Typeable g) => Typeable (f :+: g) where+-- typeOf x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:+:)") [typeOf (getF x), typeOf (getG x)]+-- where getF :: (f :+: g) a -> f a+-- getF = undefined+-- getG :: (f :+: g) a -> g a+-- getG = undefined -- | Functor product.-data (f :*: g) a = f a :*: g a+data (f :*: g) a = f a :*: g a deriving Typeable pFst :: (f :*: g) a -> f a pFst (x :*: y) = x@@ -123,25 +123,25 @@ fmap f (fa :*: ga) = fmap f fa :*: fmap f ga instance (Show (f a), Show (g a)) => Show ((f :*: g) a) where show (x :*: y) = show (x,y)-instance (Typeable1 f, Typeable1 g) => Typeable1 (f :*: g) where- typeOf1 x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:*:)") [typeOf1 (getF x), typeOf1 (getG x)]- where getF :: (f :*: g) a -> f a- getF = undefined- getG :: (f :*: g) a -> g a- getG = undefined+-- instance (Typeable1 f, Typeable1 g) => Typeable1 (f :*: g) where+-- typeOf1 x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:*:)") [typeOf1 (getF x), typeOf1 (getG x)]+-- where getF :: (f :*: g) a -> f a+-- getF = undefined+-- getG :: (f :*: g) a -> g a+-- getG = undefined -- | Functor composition.-data (f :.: g) a = Comp { unComp :: (f (g a)) }+data (f :.: g) a = Comp { unComp :: (f (g a)) } deriving Typeable instance (Functor f, Functor g) => Functor (f :.: g) where fmap f (Comp fga) = Comp (fmap (fmap f) fga) instance (Show (f (g a))) => Show ((f :.: g) a) where show (Comp x) = show x-instance (Typeable1 f, Typeable1 g) => Typeable1 (f :.: g) where- typeOf1 x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:.:)") [typeOf1 (getF x), typeOf1 (getG x)]- where getF :: (f :.: g) a -> f a- getF = undefined- getG :: (f :.: g) a -> g a- getG = undefined+-- instance (Typeable1 f, Typeable1 g) => Typeable1 (f :.: g) where+-- typeOf1 x = mkTyConApp (mkTyCon "Math.Combinatorics.Species.Types.(:.:)") [typeOf1 (getF x), typeOf1 (getG x)]+-- where getF :: (f :.: g) a -> f a+-- getF = undefined+-- getG :: (f :.: g) a -> g a+-- getG = undefined -- | Cycle structure. A value of type @'Cycle' a@ is implemented as -- @[a]@, but thought of as a directed cycle.@@ -198,4 +198,3 @@ -- | Interpretation type function for codes for higher-order type -- constructors, used as arguments to the higher-order fixpoint 'Mu'. type family Interp f (self :: * -> *) :: * -> *-
Math/Combinatorics/Species/TH.hs view
@@ -1,13 +1,12 @@-{-# LANGUAGE NoImplicitPrelude- , CPP- , TemplateHaskell- , FlexibleInstances- , TypeSynonymInstances- , TypeFamilies- , PatternGuards- , DeriveDataTypeable- , TypeOperators- #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE PatternGuards #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE TypeSynonymInstances #-} {- Refactoring plan: @@ -49,28 +48,29 @@ ) where #if MIN_VERSION_numeric_prelude(0,2,0)-import NumericPrelude hiding (cycle)+import NumericPrelude hiding (cycle) #else-import NumericPrelude-import PreludeBase hiding (cycle)+import NumericPrelude+import PreludeBase hiding (cycle) #endif -import Math.Combinatorics.Species.Class-import Math.Combinatorics.Species.Enumerate-import Math.Combinatorics.Species.Structures-import Math.Combinatorics.Species.AST-import Math.Combinatorics.Species.AST.Instances () -- only import instances+import Math.Combinatorics.Species.AST+import Math.Combinatorics.Species.AST.Instances ()+import Math.Combinatorics.Species.Class+import Math.Combinatorics.Species.Enumerate+import Math.Combinatorics.Species.Structures -import Control.Arrow (first, second, (***))-import Control.Monad (zipWithM, liftM2, mapM, ap)-import Control.Applicative (Applicative(..), (<$>), (<*>))-import Data.Char (toLower)-import Data.Maybe (isJust)+import Control.Applicative (Applicative (..),+ (<$>), (<*>))+import Control.Arrow (first, (***))+import Control.Monad (zipWithM)+import Data.Char (toLower)+import Data.Maybe (isJust) -import Data.Typeable+import Data.Typeable -import Language.Haskell.TH-import Language.Haskell.TH.Syntax (lift)+import Language.Haskell.TH+import Language.Haskell.TH.Syntax (lift) ------------------------------------------------------------ -- Preliminaries -----------------------------------------@@ -78,7 +78,7 @@ -- | Report a fatal error and stop processing in the 'Q' monad. errorQ :: String -> Q a-errorQ msg = report True msg >> error msg+errorQ msg = reportError msg >> error msg ------------------------------------------------------------ -- Parsing type declarations -----------------------------@@ -288,7 +288,8 @@ Nothing -> spToTy undefined sp -- undefined is OK, it isn't recursive -- so won't use that argument instanceD (return []) (appT (conT ''Enumerable) (conT nm))- [ tySynInstD ''StructTy [conT nm] stTy+-- [ tySynInstD ''StructTy [conT nm] stTy+ [ tySynInstD ''StructTy (tySynEqn [conT nm] stTy) , return $ FunD 'iso clauses ] @@ -406,11 +407,11 @@ -- -- This is what you get: ----- * An 'Enumerable' instance for @MyType@ (and various other+-- * An 'Enumerable' instance for @MyType@ (and various other -- supporting things like a code and an 'ASTFunctor' instance if -- your data type is recursive) ----- * A declaration of @myType :: Species s => s@ (the same name as+-- * A declaration of @myType :: Species s => s@ (the same name as -- the type constructor but with the first letter lowercased) -- -- You can then use @myType@ in any species expression, or as input
species.cabal view
@@ -1,32 +1,31 @@ name: species-version: 0.3.2.3+version: 0.3.2.4 license: BSD3 license-file: LICENSE build-type: Simple cabal-version: >= 1.10-tested-with: GHC == 7.4.2, GHC == 7.6.1+tested-with: GHC == 7.8.4, GHC == 7.10.1 author: Brent Yorgey-maintainer: Brent Yorgey <byorgey@cis.upenn.edu>-bug-reports: http://hub.darcs.net/byorgey/species/issues+maintainer: Brent Yorgey <byorgey@gmail.com>+bug-reports: https://github.com/byorgey/species/issues category: Math synopsis: Computational combinatorial species description: A DSL for describing and computing with combinatorial species, e.g. counting labeled or unlabeled structures, or generating a list of all labeled structures for a species.-homepage: http://www.cis.upenn.edu/~byorgey/species extra-source-files: CHANGES source-repository head- type: darcs- location: http://hub.darcs.net/byorgey/species+ type: git+ location: https://github.com/byorgey/species Library- build-depends: base >= 3 && < 4.7,- numeric-prelude >= 0.3 && < 0.4,+ build-depends: base >= 4.7 && < 4.9,+ numeric-prelude >= 0.3 && < 0.5, np-extras >= 0.3 && < 0.4, containers >= 0.2 && < 0.6, multiset-comb >= 0.2.3 && < 0.3,- template-haskell >= 2.7 && < 2.9+ template-haskell >= 2.7 && < 3.0 exposed-modules: Math.Combinatorics.Species Math.Combinatorics.Species.Class