packages feed

stringbuilder 0.4.0 → 0.5.0

raw patch · 3 files changed

+17/−5 lines, 3 files

Files

LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2011, 2012 Simon Hengel <sol@typeful.net>+Copyright (c) 2011-2014 Simon Hengel <sol@typeful.net>  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
src/Data/String/Builder.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE DeriveFunctor, TypeSynonymInstances, FlexibleInstances, TypeFamilies #-} -- | -- The `build` function can be used to construct multi-line string literals in -- a monadic way:@@ -21,17 +21,29 @@ , BuilderM ) where -import Data.String+import           Control.Applicative+import           Control.Monad+import           Data.Monoid+import           Data.String  -- | A writer monad for string literals. data BuilderM a = BuilderM a ShowS+  deriving Functor +instance Applicative BuilderM where+  pure = return+  (<*>) = ap+ instance Monad BuilderM where   return a            = BuilderM a id   BuilderM a xs >>= f = case f a of     BuilderM b ys -> BuilderM b (xs . ys)  type Builder = BuilderM ()++instance Monoid Builder where+  mempty = return ()+  a `mappend` b = a >> b  -- | Add a literal string. literal :: String -> Builder
stringbuilder.cabal view
@@ -1,11 +1,11 @@ name:             stringbuilder-version:          0.4.0+version:          0.5.0 synopsis:         A writer monad for multi-line string literals description:      <https://github.com/sol/stringbuilder#readme> category:         Testing license:          MIT license-file:     LICENSE-copyright:        (c) 2011, 2012 Simon Hengel+copyright:        (c) 2011-2014 Simon Hengel author:           Simon Hengel <sol@typeful.net> maintainer:       Simon Hengel <sol@typeful.net> build-type:       Simple