raft 0.3.11.0 → 0.4.0.0
raw patch · 7 files changed
+30/−21 lines, 7 files
Files
- raft.cabal +5/−5
- src/Control/Monad/Except/Util.hs +11/−1
- src/Data/Function/MapReduce/Internal.hs +4/−5
- src/Data/List/Util/Listable.hs +1/−0
- src/Data/Table/Identifier.hs +5/−8
- src/Data/Tabular.hs +3/−2
- src/Data/Tuple/Util.hs +1/−0
raft.cabal view
@@ -1,20 +1,20 @@ name : raft-version : 0.3.11.0+version : 0.4.0.0 synopsis : Miscellaneous Haskell utilities for data structures and data manipulation. description : This Haskell library contains miscellaneous data structures and data manipulation functions for general uses. license : MIT license-file : LICENSE-author : Brian W Bush <consult@brianwbush.info>-maintainer : Brian W Bush <consult@brianwbush.info>-copyright : (c) 2005-17 Brian W Bush+author : Brian W Bush <code@functionally.io>+maintainer : Brian W Bush <code@functionally.io>+copyright : (c) 2005-19 Brian W Bush category : Data stability : Experimental build-type : Simple cabal-version : >= 1.10 homepage : https://bitbucket.org/functionally/raft bug-reports : https://bwbush.atlassian.net/projects/HRAFT/issues/-package-url : https://bitbucket.org/functionally/raft/downloads/raft-0.3.7.2.tar.gz+package-url : https://bitbucket.org/functionally/raft/downloads/raft-0.4.0.0.tar.gz source-repository head type : mercurial
src/Control/Monad/Except/Util.hs view
@@ -26,10 +26,12 @@ , guardIO , eitherError , runToIO+-- * Exceptions+, guardSomeException ) where -import Control.Exception (IOException, throw, try)+import Control.Exception (IOException, SomeException, throw, try) import Control.Monad (unless, when) import Control.Monad.Except (ExceptT, MonadError, MonadIO, liftIO, runExceptT, throwError) import Data.String (IsString(..))@@ -47,6 +49,14 @@ (either (throwError . show) return =<<) . liftIO . tryIOError+++-- | Catch any exception and throw it into 'MonadError String'.+guardSomeException :: (MonadIO m, MonadError String m) => IO a -> m a+guardSomeException =+ (either (throwError . (show :: SomeException -> String)) return =<<)+ . liftIO+ . try -- | Throw 'Data.Either.Left' into 'Control.Exception.IOException'.
src/Data/Function/MapReduce/Internal.hs view
@@ -42,11 +42,10 @@ -- | Functiom for mapping and then reducing.-type MapReduce a k v b = Ord k- => (a -> (k, v)) -- ^ Function for mapping to keys and values.- -> (k -> [v] -> b) -- ^ Function for reducing values.- -> [a] -- ^ The values.- -> [b] -- ^ The reduced values.+type MapReduce a k v b = (a -> (k, v)) -- ^ Function for mapping to keys and values.+ -> (k -> [v] -> b) -- ^ Function for reducing values.+ -> [a] -- ^ The values.+ -> [b] -- ^ The reduced values. -- | Reduce values by group.
src/Data/List/Util/Listable.hs view
@@ -15,6 +15,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FunctionalDependencies #-}+{-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE Safe #-}
src/Data/Table/Identifier.hs view
@@ -14,6 +14,7 @@ {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MonoLocalBinds #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} @@ -24,6 +25,7 @@ ) where +import Data.String.Util (Stringy(..)) import Data.Table (Tabulatable(..)) @@ -31,12 +33,7 @@ newtype Id a = Id {unId :: a} deriving (Read, Show) -instance Tabulatable (Id String) where- labels = const ["ID"]- tabulation = (: []) . unId- untabulation = Id . head--instance (Read a, Show a) => Tabulatable (Id a) where+instance Stringy a => Tabulatable (Id a) where labels = const ["ID"]- tabulation = (: []) . show . unId- untabulation = Id . read . head+ tabulation = (: []) . toString . unId+ untabulation = Id . fromString . head
src/Data/Tabular.hs view
@@ -15,6 +15,7 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE Safe #-}+{-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE UndecidableInstances #-} @@ -31,7 +32,7 @@ ) where -import Control.Monad (ap, liftM)+import Control.Monad (ap) import Data.List (intercalate) import Data.List.Split (splitOn) @@ -117,7 +118,7 @@ readTabular :: Tabular a => FilePath -- ^ The filename. -> IO [a] -- ^ Action to read the data.-readTabular = liftM (checkHeader . read) . readFile+readTabular = fmap (checkHeader . read) . readFile -- | Write tabular data.
src/Data/Tuple/Util.hs view
@@ -14,6 +14,7 @@ {-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE Safe #-}