hatt 1.4.0 → 1.4.0.1
raw patch · 4 files changed
+21/−14 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +10/−8
- hatt.cabal +1/−1
- src/Data/Logic/Propositional/Parser.hs +4/−0
- src/hatt.hs +6/−5
README.md view
@@ -33,9 +33,11 @@ * Conditional: `(ϕ -> ψ)` * Biconditional: `(ϕ <-> ψ)` -For top-level formulae where the primary connective is a binary one, parentheses-are not required. For example, the expression `a | b` is valid and will be-parsed correctly.+Parentheses are not required around top-level formulae, regardless of whether+the primary connective is binary. For example, the expression `a | b` is valid+and will be parsed correctly, as would `p <-> (q & ~r)`, although the+parenthesised versions of both these expressions (`(a | b)` and+`(p <-> (q & ~r))`) are also fine. There is currently no support for operator precedence, so nested expressions must be parenthesised correctly for the parser to make sense of them.@@ -49,14 +51,14 @@ $ hatt Entering interactive mode. Type `help` if you don't know what to do!- > (A | B)+ > A | B A B | (A | B) ------------- T T | T T F | T F T | T F F | F- > (p -> (q & ~r))+ > p -> (q & ~r) p q r | (p -> (q & ~r)) ----------------------- T T T | F@@ -67,7 +69,7 @@ F T F | T F F T | T F F F | T- > (e <-> f)+ > e <-> f e f | (e <-> f) --------------- T T | T@@ -79,7 +81,7 @@ The `--evaluate` flag lets you pass a single expression to be evaluated directly. - $ hatt --evaluate="(P -> (Q | ~R))"+ $ hatt --evaluate="P -> (Q | ~R)" P Q R | (P -> (Q | ~R)) ----------------------- T T T | F@@ -95,7 +97,7 @@ a Unicode-capable terminal, try passing the `--pretty` option to pretty-print expressions using the the more common logical symbols. - $ hatt --evaluate="(P -> (Q | ~R))" --pretty+ $ hatt --evaluate="P -> (Q | ~R)" --pretty P Q R | (P → (Q ∨ ¬R)) ---------------------- T T T | F
hatt.cabal view
@@ -1,5 +1,5 @@ Name: hatt-Version: 1.4.0+Version: 1.4.0.1 Synopsis: A truth table generator for classical propositional logic. Description: Hatt is a command-line program which prints truth tables
src/Data/Logic/Propositional/Parser.hs view
@@ -31,6 +31,10 @@ -- * Conditional: @\"(φ -> ψ)\"@ -- -- * Biconditional: @\"(φ \<-> ψ)\"@+--+-- Top-level expressions where the primary connective is a binary one do not+-- need to be parenthesised. For example, @\"p -> (q & r)\"@ is a valid+-- expression, although @\"(p -> (q & r))\"@ is also fine. parseExpr :: SourceName -> String -> Either ParseError Expr parseExpr = parse statement
src/hatt.hs view
@@ -31,7 +31,7 @@ , interactive = False &= help "Enter interactive mode" , pretty = False &= help "Use Unicode logic symbols" , coloured = False &= help "Use colour-coded symbols"- } &= summary "Hatt 1.4.0, (c) Benedict Eastaugh 2011"+ } &= summary "Hatt 1.4.0.1, (c) Benedict Eastaugh 2011" &= program "hatt" main :: IO ()@@ -128,11 +128,12 @@ , "For example, if you enter \"(A -> B)\" at the prompt, Hatt will print the" , "truth table for that expression. Here's an example console session." , ""- , " > (A | B)"+ , " > A | B" , indentBy 4 $ truthTableP printer (Disjunction (Variable "A") (Variable "B"))- ++ "> (A -> B)\n"- ++ truthTableP printer (Conditional (Variable "A") (Variable "B"))- ++ "> exit"+ ++ "> P -> (Q & R)\n"+ ++ truthTableP printer (Conditional+ (Variable "P")+ (Conjunction (Variable "Q") (Variable "R"))) , "If none of this makes any sense, try reading the README file." ]