packages feed

madlang 4.0.1.1 → 4.0.2.0

raw patch · 7 files changed

+11/−19 lines, 7 filesdep ~base

Dependency ranges changed: base

Files

app/Main.hs view
@@ -3,7 +3,6 @@     main ) where  import           Data.Maybe-import           Data.Monoid import qualified Data.Text           as T import qualified Data.Text.Lazy      as TL import qualified Data.Text.Lazy.IO   as TLIO
madlang.cabal view
@@ -1,10 +1,10 @@ cabal-version: >=1.10 name: madlang-version: 4.0.1.1+version: 4.0.2.0 license: BSD3 license-file: LICENSE-copyright: Copyright: (c) 2016-2017 Vanessa McHale-maintainer: vanessa.mchale@reconfigure.io+copyright: Copyright: (c) 2016-2018 Vanessa McHale+maintainer: vamchale@gmail.com author: Vanessa McHale stability: experimental homepage: https://hub.darcs.net/vmchale/madlang@@ -62,7 +62,7 @@     default-language: Haskell2010     ghc-options: -Wall     build-depends:-        base >=4.9 && <5,+        base >=4.11 && <5,         megaparsec >=6.0,         text -any,         template-haskell -any,@@ -99,7 +99,7 @@     default-language: Haskell2010     ghc-options: -Wall     build-depends:-        base -any,+        base >=4.11,         madlang -any,         optparse-applicative -any,         text -any,
src/Text/Madlibs/Ana/Parse.hs view
@@ -17,7 +17,6 @@ import           Control.Monad.State import qualified Data.Map                    as M import           Data.Maybe-import           Data.Monoid import qualified Data.Text                   as T import           Data.Void import           Text.Madlibs.Ana.ParseUtils
src/Text/Madlibs/Ana/ParseUtils.hs view
@@ -19,7 +19,6 @@ import           Data.List import qualified Data.Map                    as M import           Data.Maybe                  (catMaybes)-import           Data.Monoid import qualified Data.Set                    as S import qualified Data.Text                   as T import           Data.Text.Titlecase
src/Text/Madlibs/Ana/Resolve.hs view
@@ -18,7 +18,6 @@ import           Control.Monad               (replicateM, void) import           Control.Monad.IO.Class      (MonadIO, liftIO) import           Control.Monad.Random.Class-import           Data.Monoid import qualified Data.Text                   as T import           Data.Void import           System.Directory
src/Text/Madlibs/Generate/TH.hs view
@@ -11,9 +11,7 @@     ) where  import           Control.Arrow               (first)-import           Control.Monad.IO.Class      (MonadIO, liftIO) import           Data.FileEmbed              (embedStringFile)-import           Data.Monoid import qualified Data.Text                   as T import qualified Data.Text.IO                as TIO import           Data.Void@@ -27,9 +25,6 @@ import           Text.Madlibs.Internal.Types (Key, RandTok) import           Text.Madlibs.Internal.Utils import           Text.Megaparsec--instance MonadIO Q where-    liftIO = runIO  -- | `QuasiQuoter` for an EDSL, e.g. --
src/Text/Madlibs/Internal/Types.hs view
@@ -18,7 +18,6 @@ import           Data.Binary                (Binary) import           Data.Function import           Data.Functor.Foldable.TH   (makeBaseFunctor)-import           Data.Monoid import qualified Data.Text                  as T import           GHC.Generics               (Generic) import           Instances.TH.Lift          ()@@ -50,16 +49,18 @@ apply f (Value str) = Value (f str) apply f (List l)    = List $ fmap (second (apply f)) l +instance Semigroup RandTok where+    (<>) (Value v1) (Value v2) = Value (T.append v1 v2)+    (<>) (List l1) v@Value{}   = List $ fmap (second (`mappend` v)) l1+    (<>) v@Value{} (List l2)   = List $ fmap (second (mappend v)) l2+    (<>) l@List{} (List l2)    = List [ (p, l `mappend` tok) | (p,tok) <- l2 ]+ -- | Make `RandTok` a monoid so we can append them together nicely (since they do generate text). -- -- > (Value "Hello") <> (List [(0.5," you"), (0.5, " me")]) -- > (List [(0.5,"Hello you"), (0.5, "Hello me")]) instance Monoid RandTok where     mempty = Value ""-    mappend (Value v1) (Value v2) = Value (T.append v1 v2)-    mappend (List l1) v@Value{} = List $ fmap (second (`mappend` v)) l1-    mappend v@Value{} (List l2) = List $ fmap (second (mappend v)) l2-    mappend l@List{} (List l2) = List [ (p, l `mappend` tok) | (p,tok) <- l2 ]  -- TODO make this a map instead of keys for faster parse. -- | State monad providing context, i.e. function we've already called before