hatt 1.5.0.2 → 1.5.0.3
raw patch · 4 files changed
+17/−6 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Data.Logic.Propositional.NormalForms: toCNF :: Expr -> Expr
+ Data.Logic.Propositional.NormalForms: toDNF :: Expr -> Expr
+ Data.Logic.Propositional.NormalForms: toNNF :: Expr -> Expr
+ Data.Logic.Propositional.Tables: colourBool :: Bool -> String
+ Data.Logic.Propositional.Tables: showBool :: Bool -> String
+ Data.Logic.Propositional.Tables: truthTable :: Expr -> String
+ Data.Logic.Propositional.Tables: truthTableP :: Printer -> Expr -> String
+ Data.Logic.Propositional.Tables: type Printer = (Expr -> String, Bool -> String)
Files
- hatt.cabal +1/−1
- src/Data/Logic/Propositional/NormalForms.hs +4/−2
- src/Data/Logic/Propositional/Tables.hs +11/−2
- src/hatt.hs +1/−1
hatt.cabal view
@@ -1,5 +1,5 @@ Name: hatt-Version: 1.5.0.2+Version: 1.5.0.3 Synopsis: A truth table generator for classical propositional logic. Description: Hatt is a command-line program which prints truth tables
src/Data/Logic/Propositional/NormalForms.hs view
@@ -1,5 +1,7 @@-{-# OPTIONS_HADDOCK hide #-}-+-- | The functions exposed by this module convert expressions of type 'Expr'+-- into different normal forms: negation normal form via 'toNNF', conjunctive+-- normal form via 'toCNF' and disjunctive normal form via 'toDNF'. All these+-- functions are total. module Data.Logic.Propositional.NormalForms ( toNNF , toCNF
src/Data/Logic/Propositional/Tables.hs view
@@ -1,5 +1,9 @@-{-# OPTIONS_HADDOCK hide #-}-+-- | This module contains the truth table generating functionality of Hatt. The+-- core function it exports is 'truthTable' which prints the truth table of the+-- given expression. 'truthTableP' is a configurable version which allows one to+-- select how to print expressions and truth values. This gives one the option+-- of, for example, colouring outputs and changing the symbols used to represent+-- the logical connectives. module Data.Logic.Propositional.Tables ( Printer , colourBool@@ -38,10 +42,15 @@ showVarValues = unwords $ fold ((:) . printer) [] a showExprValue = printer $ interpret expr a +-- | Prints @T@ for 'True' and @F@ for 'False'. showBool :: Bool -> String showBool True = "T" showBool False = "F" +-- | Prints a green @T@ for 'True' and a red @F@ for 'False'. This is used when+-- producing a string representation of a truth table with 'truthTable'. It can+-- also be used as (as the second component of a 'Printer' pair) as an argument+-- to the configurable 'truthTableP' function. colourBool :: Bool -> String colourBool True = show . green . text $ "T" colourBool False = show . red . text $ "F"
src/hatt.hs view
@@ -42,7 +42,7 @@ , interactive = False &= help "Enter interactive mode" , pretty = False &= help "Use Unicode logic symbols" , coloured = False &= help "Use colour-coded symbols"- } &= summary "Hatt 1.5.0.2, (c) Benedict Eastaugh 2012"+ } &= summary "Hatt 1.5.0.3, (c) Benedict Eastaugh 2012" &= program "hatt" main :: IO ()