singletons 1.1.1 → 1.1.2
raw patch · 10 files changed
+47/−26 lines, 10 files
Files
- CHANGES.md +5/−0
- singletons.cabal +2/−2
- src/Data/Singletons/CustomStar.hs +4/−2
- src/Data/Singletons/Prelude/Either.hs +8/−6
- src/Data/Singletons/Prelude/Maybe.hs +9/−9
- src/Data/Singletons/Prelude/Tuple.hs +5/−5
- src/Data/Singletons/Promote.hs +4/−1
- src/Data/Singletons/Single.hs +3/−0
- src/Data/Singletons/TH.hs +3/−0
- src/Data/Singletons/Util.hs +4/−1
CHANGES.md view
@@ -1,6 +1,11 @@ Changelog for singletons project ================================ +1.1.2+-----++Fix warnings and Haddock failure with GHC 7.10.1.+ 1.1.1 -----
singletons.cabal view
@@ -1,5 +1,5 @@ name: singletons-version: 1.1.1+version: 1.1.2 -- Remember to bump version in the Makefile as well cabal-version: >= 1.10 synopsis: A framework for generating singleton types@@ -38,7 +38,7 @@ source-repository this type: git location: https://github.com/goldfirere/singletons.git- tag: v1.1.1+ tag: v1.1.2 library hs-source-dirs: src
src/Data/Singletons/CustomStar.hs view
@@ -33,11 +33,14 @@ import Data.Singletons.Names import Control.Monad import Data.Maybe-import Control.Applicative import Language.Haskell.TH.Desugar import Data.Singletons.Prelude.Eq import Data.Singletons.Prelude.Bool +#if __GLASGOW_HASKELL__ < 709+import Control.Applicative+#endif+ -- | Produce a representation and singleton for the collection of types given. -- -- A datatype @Rep@ is created, with one constructor per type in the declared@@ -116,4 +119,3 @@ t2 <- kindToType k2 return $ DAppT (DAppT DArrowT t1) t2 kindToType DStarK = return $ DConT repName-
src/Data/Singletons/Prelude/Either.hs view
@@ -59,9 +59,11 @@ import Data.Singletons.TH import Data.Singletons.Prelude.Base +-- NB: The haddock comments are disabled because TH can't deal with them.+ $(singletons [d| -- Renamed to avoid name clash- -- | Case analysis for the 'Either' type.+ -- -| Case analysis for the 'Either' type. -- If the value is @'Left' a@, apply the first function to @a@; -- if it is @'Right' b@, apply the second function to @b@. either_ :: (a -> c) -> (b -> c) -> Either a b -> c@@ -70,7 +72,7 @@ |]) $(singletonsOnly [d|- -- | Extracts from a list of 'Either' all the 'Left' elements+ -- -| Extracts from a list of 'Either' all the 'Left' elements -- All the 'Left' elements are extracted in order. -- Modified to avoid list comprehensions@@ -79,7 +81,7 @@ lefts (Left x : xs) = x : lefts xs lefts (Right _ : xs) = lefts xs - -- | Extracts from a list of 'Either' all the 'Right' elements+ -- -| Extracts from a list of 'Either' all the 'Right' elements -- All the 'Right' elements are extracted in order. -- Modified to avoid list comprehensions@@ -88,7 +90,7 @@ rights (Left _ : xs) = rights xs rights (Right x : xs) = x : rights xs - -- | Partitions a list of 'Either' into two lists+ -- -| Partitions a list of 'Either' into two lists -- All the 'Left' elements are extracted, in order, to the first -- component of the output. Similarly the 'Right' elements are extracted -- to the second component of the output.@@ -98,14 +100,14 @@ left a (l, r) = (a:l, r) right a (l, r) = (l, a:r) - -- | Return `True` if the given value is a `Left`-value, `False` otherwise.+ -- -| Return `True` if the given value is a `Left`-value, `False` otherwise. -- -- /Since: 4.7.0.0/ isLeft :: Either a b -> Bool isLeft (Left _) = True isLeft (Right _) = False - -- | Return `True` if the given value is a `Right`-value, `False` otherwise.+ -- -| Return `True` if the given value is a `Right`-value, `False` otherwise. -- -- /Since: 4.7.0.0/ isRight :: Either a b -> Bool
src/Data/Singletons/Prelude/Maybe.hs view
@@ -67,7 +67,7 @@ $(singletons [d| -- Renamed to avoid name clash- -- | The 'maybe' function takes a default value, a function, and a 'Maybe'+ -- -| The 'maybe' function takes a default value, a function, and a 'Maybe' -- value. If the 'Maybe' value is 'Nothing', the function returns the -- default value. Otherwise, it applies the function to the value inside -- the 'Just' and returns the result.@@ -77,50 +77,50 @@ |]) $(singletonsOnly [d|- -- | The 'isJust' function returns 'True' iff its argument is of the+ -- -| The 'isJust' function returns 'True' iff its argument is of the -- form @Just _@. isJust :: Maybe a -> Bool isJust Nothing = False isJust (Just _) = True - -- | The 'isNothing' function returns 'True' iff its argument is 'Nothing'.+ -- -| The 'isNothing' function returns 'True' iff its argument is 'Nothing'. isNothing :: Maybe a -> Bool isNothing Nothing = True isNothing (Just _) = False - -- | The 'fromJust' function extracts the element out of a 'Just' and+ -- -| The 'fromJust' function extracts the element out of a 'Just' and -- throws an error if its argument is 'Nothing'. fromJust :: Maybe a -> a fromJust Nothing = error "Maybe.fromJust: Nothing" -- yuck fromJust (Just x) = x - -- | The 'fromMaybe' function takes a default value and and 'Maybe'+ -- -| The 'fromMaybe' function takes a default value and and 'Maybe' -- value. If the 'Maybe' is 'Nothing', it returns the default values; -- otherwise, it returns the value contained in the 'Maybe'. fromMaybe :: a -> Maybe a -> a fromMaybe d x = case x of {Nothing -> d;Just v -> v} - -- | The 'maybeToList' function returns an empty list when given+ -- -| The 'maybeToList' function returns an empty list when given -- 'Nothing' or a singleton list when not given 'Nothing'. maybeToList :: Maybe a -> [a] maybeToList Nothing = [] maybeToList (Just x) = [x] - -- | The 'listToMaybe' function returns 'Nothing' on an empty list+ -- -| The 'listToMaybe' function returns 'Nothing' on an empty list -- or @'Just' a@ where @a@ is the first element of the list. listToMaybe :: [a] -> Maybe a listToMaybe [] = Nothing listToMaybe (a:_) = Just a -- Modified to avoid list comprehensions- -- | The 'catMaybes' function takes a list of 'Maybe's and returns+ -- -| The 'catMaybes' function takes a list of 'Maybe's and returns -- a list of all the 'Just' values. catMaybes :: [Maybe a] -> [a] catMaybes [] = [] catMaybes (Just x : xs) = x : catMaybes xs catMaybes (Nothing : xs) = catMaybes xs - -- | The 'mapMaybe' function is a version of 'map' which can throw+ -- -| The 'mapMaybe' function is a version of 'map' which can throw -- out elements. In particular, the functional argument returns -- something of type @'Maybe' b@. If this is 'Nothing', no element -- is added on to the result list. If it just @'Just' b@, then @b@ is
src/Data/Singletons/Prelude/Tuple.hs view
@@ -54,23 +54,23 @@ import Data.Singletons.TH $(singletonsOnly [d|- -- | Extract the first component of a pair.+ -- -| Extract the first component of a pair. fst :: (a,b) -> a fst (x,_) = x - -- | Extract the second component of a pair.+ -- -| Extract the second component of a pair. snd :: (a,b) -> b snd (_,y) = y - -- | 'curry' converts an uncurried function to a curried function.+ -- -| 'curry' converts an uncurried function to a curried function. curry :: ((a, b) -> c) -> a -> b -> c curry f x y = f (x, y) - -- | 'uncurry' converts a curried function to a function on pairs.+ -- -| 'uncurry' converts a curried function to a function on pairs. uncurry :: (a -> b -> c) -> ((a, b) -> c) uncurry f p = f (fst p) (snd p) - -- | Swap the components of a pair.+ -- -| Swap the components of a pair. swap :: (a,b) -> (b,a) swap (a,b) = (b,a) |])
src/Data/Singletons/Promote.hs view
@@ -26,10 +26,13 @@ import Data.Singletons.Syntax import Prelude hiding (exp) import Control.Monad-import Control.Applicative import Data.Maybe import qualified Data.Map.Strict as Map import Data.Map.Strict ( Map )++#if __GLASGOW_HASKELL__ < 709+import Control.Applicative+#endif -- | Generate promoted definitions from a type that is already defined. -- This is generally only useful with classes.
src/Data/Singletons/Single.hs view
@@ -26,7 +26,10 @@ import qualified Data.Map.Strict as Map import Data.Map.Strict ( Map ) import Control.Monad++#if __GLASGOW_HASKELL__ < 709 import Control.Applicative+#endif {- How singletons works
src/Data/Singletons/TH.hs view
@@ -82,7 +82,10 @@ import GHC.Exts import Language.Haskell.TH import Data.Singletons.Util++#if __GLASGOW_HASKELL__ < 709 import Control.Applicative+#endif -- | The function 'cases' generates a case expression where each right-hand side -- is identical. This may be useful if the type-checker requires knowledge of which
src/Data/Singletons/Util.hs view
@@ -20,12 +20,15 @@ import Language.Haskell.TH.Desugar import Data.Char import Control.Monad hiding ( mapM )-import Control.Applicative import Control.Monad.Writer hiding ( mapM ) import Control.Monad.Reader hiding ( mapM ) import qualified Data.Map as Map import Data.Foldable import Data.Traversable++#if __GLASGOW_HASKELL__ < 709+import Control.Applicative+#endif -- The list of types that singletons processes by default basicTypes :: [Name]