[Haskell-cafe] where to put general-purpose utility functions

Tristan Ravitch travitch at cs.wisc.edu
Sat Jan 21 21:46:54 CET 2012


You might find many of these on hackage in various forms already.. it
might be easier to just depend on some of those libraries.

On Sat, Jan 21, 2012 at 04:20:25PM -0400, Joey Hess wrote:
>
>   Some quite generic monadic control functions, few of them truely unique:
>
>   whenM :: Monad m => m Bool -> m () -> m ()   -- also >>?
>   unlessM :: Monad m => m Bool -> m () -> m () -- also >>!
>   firstM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a)

IfElse (http://hackage.haskell.org/packages/archive/IfElse/0.85/doc/html/Control-Monad-IfElse.html)
has a few of these.

>   Various path manipulation functions such as:
>   absPath :: FilePath -> IO FilePath

Is this different from canonicalizePath in directory?

>   Other stuff:
>
>   separate :: (a -> Bool) -> [a] -> ([a], [a])

Is this partition from Data.List?

>   format :: Format -> Variables -> String

This looks like it might be similar to HStringTemplate

>   withTempFile :: Template -> (FilePath -> Handle -> IO a) -> IO a

temporary (http://hackage.haskell.org/packages/archive/temporary/1.1.2.3/doc/html/System-IO-Temp.html)
has a few variants of this one
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120121/e83dd774/attachment.pgp>


More information about the Haskell-Cafe mailing list