Skip to content

Commit

Permalink
v0.1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Boucey committed Jan 7, 2016
1 parent b700b42 commit 8984130
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright Michel Boucey (c) 2015
Copyright Michel Boucey (c) 2016

All rights reserved.

Expand All @@ -13,7 +13,7 @@ modification, are permitted provided that the following conditions are met:
disclaimer in the documentation and/or other materials provided
with the distribution.

* Neither the name of Author name here nor the names of other
* Neither the name of Michel Boucey nor the names of other
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.

Expand Down
4 changes: 2 additions & 2 deletions Spintax.cabal
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Spintax
version: 0.1.0.0
synopsis: Random text generation based on spintax
description: Random text generation based on spintax, i.e. spinning syntax, with nested alternatives and empty options.
description: Random text generation based on spintax with nested alternatives and empty options.
homepage: https://github.com/MichelBoucey/spintax
license: BSD3
license-file: LICENSE
author: Michel Boucey
maintainer: [email protected]
copyright: Copyright © 2015 - Michel Boucey
copyright: Copyright © 2016 - Michel Boucey
category: Text
build-type: Simple
cabal-version: >=1.10
Expand Down
6 changes: 3 additions & 3 deletions src/Text/Spintax.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import System.Random.MWC

-- | Generate random texts based on a spinning syntax template, with nested alternatives and empty options.
--
-- >λ> spintax "{A||B|C|{a|b|c{1|2|3}|d}|D}"
-- >λ> spintax "{A|B|C|{a|b|c{1|2|3}|d}|D}{|, {..|etc}.}"
-- > Right "c2"
--
spintax :: T.Text -> IO (Either T.Text T.Text)
Expand All @@ -28,7 +28,7 @@ spintax template =
Done rest match ->
case match of
"{" -> getText gen output alters rest (nestlev+1)
"}" -> getText gen output alters rest (nestlev-1)
"}" -> return failure
"|" -> return failure
_ -> getText gen (output `append` match) alters rest nestlev
Partial _ -> return $ Right $ output `append` input
Expand Down Expand Up @@ -58,7 +58,7 @@ spintax template =
Partial _ -> return failure
Fail {} -> return failure
where
failure = Left "Spintax parsing failure"
failure = Left "Spintax template parsing failure"
addToLast l t =
case E.unsnoc l of
Just (xs,x) -> E.snoc xs $ x `append` t
Expand Down

0 comments on commit 8984130

Please sign in to comment.