universe 0.4 → 0.4.0.1
raw patch · 5 files changed
+26/−54 lines, 5 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Universe: class Universe a where universe = [minBound .. maxBound]
+ Data.Universe: class Universe a where universe = universeDef
Files
- Data/Universe.hs +23/−2
- Data/Universe/Helpers.hs +0/−3
- defsigs/Data/Universe/Class.hs +0/−23
- nodefsigs/Data/Universe/Class.hs +0/−17
- universe.cabal +3/−9
Data/Universe.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE FlexibleContexts, TypeFamilies #-}+{-# LANGUAGE CPP, FlexibleContexts, TypeFamilies #-}+#ifdef DEFAULT_SIGNATURES+{-# LANGUAGE DefaultSignatures #-}+#endif module Data.Universe ( -- | Bottoms are ignored for this entire module: only fully-defined inhabitants are considered inhabitants. Universe(..)@@ -11,7 +14,6 @@ import Data.Monoid import Data.Ratio import Data.Universe.Helpers-import Data.Universe.Class import Data.Void import Data.Word @@ -24,6 +26,25 @@ import Data.Functor.Representable import Data.Key (Key) import qualified Data.Functor.Product as Functor++-- | Creating an instance of this class is a declaration that your type is+-- recursively enumerable (and that 'universe' is that enumeration). In+-- particular, you promise that any finite inhabitant has a finite index in+-- 'universe', and that no inhabitant appears at two different finite indices.+class Universe a where+ universe :: [a]+#ifdef DEFAULT_SIGNATURES+ default universe :: (Enum a, Bounded a) => [a]+ universe = universeDef+#endif++-- | Creating an instance of this class is a declaration that your 'universe'+-- eventually ends. Minimal definition: no methods defined. By default,+-- @universeF = universe@, but for some types (like 'Either') the 'universeF'+-- method may have a more intuitive ordering.+class Universe a => Finite a where+ universeF :: [a]+ universeF = universe instance Universe () where universe = universeDef instance Universe Bool where universe = universeDef
Data/Universe/Helpers.hs view
@@ -7,9 +7,6 @@ import Data.List --- WHEN EDITING THIS DEFINITION:--- edit ../../defsigs/Data/Universe/Class.hs:universe in tandem!- -- | For many types, the 'universe' should be @[minBound .. maxBound]@; -- 'universeDef' makes it easy to make such types an instance of 'Universe' via -- the snippet
− defsigs/Data/Universe/Class.hs
@@ -1,23 +0,0 @@--- WHEN EDITING THIS FILE:--- edit ../../nodefsigs/Data/Universe.hs in tandem!-{-# LANGUAGE DefaultSignatures #-}-module Data.Universe.Class where---- | Creating an instance of this class is a declaration that your type is--- recursively enumerable (and that 'universe' is that enumeration). In--- particular, you promise that any finite inhabitant has a finite index in--- 'universe', and that no inhabitant appears at two different finite indices.-class Universe a where- universe :: [a]- default universe :: (Enum a, Bounded a) => [a]- -- WHEN EDITING THIS DEFINITION:- -- edit ../../Data/Universe/Helpers.hs:universeDef in tandem!- universe = [minBound .. maxBound]---- | Creating an instance of this class is a declaration that your 'universe'--- eventually ends. Minimal definition: no methods defined. By default,--- @universeF = universe@, but for some types (like 'Either') the 'universeF'--- method may have a more intuitive ordering.-class Universe a => Finite a where- universeF :: [a]- universeF = universe
− nodefsigs/Data/Universe/Class.hs
@@ -1,17 +0,0 @@--- WHEN EDITING THIS FILE:--- edit ../../nodefsigs/Data/Universe.hs in tandem!-module Data.Universe.Class where---- | Creating an instance of this class is a declaration that your type is--- recursively enumerable (and that 'universe' is that enumeration). In--- particular, you promise that any finite inhabitant has a finite index in--- 'universe', and that no inhabitant appears at two different finite indices.-class Universe a where universe :: [a]---- | Creating an instance of this class is a declaration that your 'universe'--- eventually ends. Minimal definition: no methods defined. By default,--- @universeF = universe@, but for some types (like 'Either') the 'universeF'--- method may have a more intuitive ordering.-class Universe a => Finite a where- universeF :: [a]- universeF = universe
universe.cabal view
@@ -1,5 +1,5 @@ name: universe-version: 0.4+version: 0.4.0.1 synopsis: Classes for types where we know all the values description: A small package, in the spirit of data-default, which allows the munging of finite and recursively enumerable types license: BSD3@@ -9,8 +9,6 @@ copyright: 2013 Daniel Wagner category: Data build-type: Simple-extra-source-files: defsigs/Data/Universe/Class.hs,- nodefsigs/Data/Universe/Class.hs cabal-version: >=1.8 source-repository head type: git@@ -18,7 +16,7 @@ source-repository this type: git location: https://github.com/dmwit/universe- tag: 0.3+ tag: 0.4.0.1 library exposed-modules: Data.Universe,@@ -29,12 +27,8 @@ Data.Universe.Instances.Read, Data.Universe.Instances.Show, Data.Universe.Instances.Traversable- other-modules: Data.Universe.Class- hs-source-dirs: . if impl(ghc >= 7.4)- hs-source-dirs: defsigs- else- hs-source-dirs: nodefsigs+ cpp-options: -DDEFAULT_SIGNATURES build-depends: base >=4 && <5 , comonad-transformers >=0.1 && <3.1, containers >=0.1 && <1 ,