Skip to content

Commit

Permalink
add one more convenience function for pretty printing the rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ym-han committed Aug 13, 2023
1 parent 4124ea3 commit 06c50eb
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions lib/haskell/natural4/src/LS/UtilsREPLDev.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import System.FilePath.Find
(==?),
extension
)
import Text.Pretty.Simple ( pShowNoColor, pPrint )

import LS qualified
import LS.Lib (NoLabel (..), Opts (..))
Expand Down Expand Up @@ -62,8 +63,8 @@ findFileByNameInDir startdir basefnm =
--- TODO: Would be convenient to also have a function that allows you to match just on a part of the base filename

{-|
Util function for getting rules from a L4 CSV filepath
Meant to be for interactive use at the REPL by a dev, and not for production apps
Util function for getting raw rules from a L4 CSV filepath
Not meant for production apps!
Adapted from Joe's code for testing LP Programs
==== __Examples__
>>> l4csv2rules "test/Testcases/LogicalEnglish/" "indentation-databreach.csv"
Expand All @@ -81,6 +82,14 @@ l4csv2rules startdir csvFpath =
dstream = False
}

{-|
Util function for __pretty printing (in color)__ raw rules from a L4 CSV filepath
==== __Examples__
>>> pRules "test/Testcases/LogicalEnglish/" "indentation-databreach.csv"
-}
pRules :: StartDir -> BaseFileName -> IO ()
pRules startdir csvFpath = l4csv2rules startdir csvFpath >>= pPrint


------- TODO: LE-specific things; to be moved into a better place when I have more time
-- | Convenient, tho not the best practice to put this in this module
Expand Down

0 comments on commit 06c50eb

Please sign in to comment.