hatt 1.0 → 1.1
raw patch · 4 files changed
+16/−17 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +2/−2
- hatt.cabal +1/−1
- src/Data/Logic/Propositional/Parser.hs +6/−3
- src/hatt.hs +7/−11
README.md view
@@ -28,8 +28,8 @@ these rules quite literally. This shouldn't be a great hardship, but it does mean that, for example, while `(A -> B)` is a valid expression, `A -> B` isn't. -* Variables: `P`, `Q`, `R` etc.---basically anything in the character class- `[A-Z]`+* Variables: `P`, `Q`, `a`, `b` etc.---basically anything in the character+ class `[a-zA-Z]` * Negation: `~ϕ` * Conjunction: `(ϕ & ψ)` * Disjunction: `(ϕ | ψ)`
hatt.cabal view
@@ -1,5 +1,5 @@ Name: hatt-Version: 1.0+Version: 1.1 Stability: experimental Synopsis: A truth table generator for classical propositional logic.
src/Data/Logic/Propositional/Parser.hs view
@@ -19,8 +19,8 @@ -- following forms, where @φ@ and @ψ@ are metalinguistic variables -- standing for any valid expression. ----- * Variables: @\"P\"@, @\"Q\"@, @\"R\"@ etc.; basically anything in the--- character class @[A-Z]@+-- * Variables: @\"P\"@, @\"Q\"@, @\"a\"@, @\"b\"@ etc.; basically anything in+-- the character class @[a-zA-Z]@ -- -- * Negation: @\"~φ\"@ --@@ -45,7 +45,7 @@ expr = choice [binaryP, negation, variable] variable :: GenParser Char st Expr-variable = do c <- oneOf ['A'..'Z']+variable = do c <- oneOf variableChars return $ Variable [c] negation :: GenParser Char st Expr@@ -72,3 +72,6 @@ connective "->" = Conditional connective "<->" = Biconditional connective _ = error "Impossible case"++variableChars :: [Char]+variableChars = ['a'..'z'] ++ ['A'..'Z']
src/hatt.hs view
@@ -1,11 +1,10 @@ {-# LANGUAGE DeriveDataTypeable #-} -module Main- ( main- ) where+module Main (main) where import Data.Logic.Propositional +import Control.Monad (when, unless) import Data.Char (isSpace, toLower) import System.Console.CmdArgs import System.IO@@ -40,16 +39,13 @@ -- If the --evaluate flag is passed with an expression, print the -- truth table for that expression.- if evalMode- then putStr $ eval printer expStr- else return ()+ when evalMode $ putStr (eval printer expStr) - -- If the --evaluate flag is passed with an expression and+ -- Unless the --evaluate flag is passed with an expression and -- interactive mode is NOT explicitly requested, terminate the -- program; otherwise, enter interactive mode.- if evalMode && not interMode- then return ()- else putStrLn replIntroText >> repl opts+ unless (evalMode && not interMode) $+ putStrLn replIntroText >> repl opts repl :: ProgramMode -> IO () repl mode = do putStr "> "@@ -132,5 +128,5 @@ , "If none of this makes any sense, try reading the README file." ] -selectPrinter :: ProgramMode -> (Expr -> String)+selectPrinter :: ProgramMode -> Expr -> String selectPrinter m = if pretty m then show else showAscii