Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ run cmd = do
Left e ->
putStrLn e

Test entrypoint target debug watch coverage optLevel ->
runTests entrypoint target debug watch coverage optLevel
Test entrypoint target debug watch coverage optLevel verbose ->
runTests entrypoint target debug watch coverage optLevel verbose

Install ->
runPackageInstaller
Expand Down
3 changes: 2 additions & 1 deletion compiler/main/Run/CommandLine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ data Command
, testWatch :: Bool
, testCoverage :: Bool
, testOptimizationLevel :: OptimizationLevel
, testVerbose :: Bool
}
| Install
| New { newFolder :: FilePath }
Expand Down Expand Up @@ -232,7 +233,7 @@ parseTestInput =
strOption (long "input" <> short 'i' <> metavar "INPUT" <> help "What to test" <> showDefault <> value ".")

parseTest :: Parser Command
parseTest = Test <$> parseTestInput <*> parseTarget <*> parseDebug <*> parseWatch <*> parseCoverage <*> parseOptimizationLevel
parseTest = Test <$> parseTestInput <*> parseTarget <*> parseDebug <*> parseWatch <*> parseCoverage <*> parseOptimizationLevel <*> parseVerbose


parseRunInput :: Parser FilePath
Expand Down
4 changes: 2 additions & 2 deletions compiler/main/Run/TestRunner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ backToTopCode :: String
backToTopCode = "\x1b[0;0H"


runTests :: String -> Target -> Bool -> Bool -> Bool -> OptimizationLevel -> IO ()
runTests entrypoint target debug watchMode coverage optLevel = do
runTests :: String -> Target -> Bool -> Bool -> Bool -> OptimizationLevel -> Bool -> IO ()
runTests entrypoint target debug watchMode coverage optLevel verbose = do
canonicalEntrypoint <- canonicalizePath entrypoint
rootPath <- canonicalizePath "./"

Expand Down
12 changes: 10 additions & 2 deletions madlib.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.0

-- This file has been generated from package.yaml by hpack version 0.34.4.
-- This file has been generated from package.yaml by hpack version 0.36.0.
--
-- see: https://github.com/sol/hpack

Expand Down Expand Up @@ -123,6 +123,8 @@ library
VersionLock.VersionLock
other-modules:
Paths_madlib
autogen-modules:
Paths_madlib
hs-source-dirs:
compiler/main
ghc-options: -threaded -funbox-strict-fields -O3 -optc-O3 -fsimpl-tick-factor=500 -rtsopts -fexcess-precision -optc-ffast-math -funfolding-use-threshold=16 -Wunused-binds -Wunused-local-binds -Wunused-matches -Wunused-pattern-binds -Wunused-top-binds -Wunused-type-patterns
Expand Down Expand Up @@ -213,6 +215,8 @@ library common
Parse.DocString.DocString
other-modules:
Paths_madlib
autogen-modules:
Paths_madlib
hs-source-dirs:
compiler/common
ghc-options: -threaded -funbox-strict-fields -O3 -optc-O3 -fsimpl-tick-factor=500 -rtsopts -fexcess-precision -optc-ffast-math -funfolding-use-threshold=16 -Wunused-binds -Wunused-local-binds -Wunused-matches -Wunused-pattern-binds -Wunused-top-binds -Wunused-type-patterns
Expand Down Expand Up @@ -281,6 +285,8 @@ executable madlib
main-is: Main.hs
other-modules:
Paths_madlib
autogen-modules:
Paths_madlib
hs-source-dirs:
compiler/app
ghc-options: -threaded -funbox-strict-fields -O3 -optc-O3 -fsimpl-tick-factor=500 -rtsopts -fexcess-precision -optc-ffast-math -funfolding-use-threshold=16 -Wunused-binds -Wunused-local-binds -Wunused-matches -Wunused-pattern-binds -Wunused-top-binds -Wunused-type-patterns
Expand Down Expand Up @@ -343,9 +349,9 @@ executable madlib
, transformers-base ==0.4.6
, unordered-containers ==0.2.16.0
, utf8-string
default-language: Haskell2010
if flag(static)
ld-options: -static
default-language: Haskell2010

test-suite madlib-test
type: exitcode-stdio-1.0
Expand All @@ -358,6 +364,8 @@ test-suite madlib-test
TestUtils
Utils.PathSpec
Paths_madlib
autogen-modules:
Paths_madlib
hs-source-dirs:
compiler/test
build-depends:
Expand Down
4 changes: 2 additions & 2 deletions pkg/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions prelude/__internal__/IO.mad
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export colortrace = (fn, v, a) => trace(prettyCase(fn, v), a)

export red = Terminal.text.red
export green = Terminal.text.green
export blue = Terminal.text.blue
export yellow = Terminal.text.yellow
export grey = Terminal.text.white

Expand Down
31 changes: 15 additions & 16 deletions prelude/__internal__/Terminal.mad
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import String from "String"



type HandlerId = HandlerId
export type HandlerId

Expand All @@ -24,7 +26,6 @@ export ansi = {
FGMagenta: "35",
FGCyan: "36",
FGWhite: "37",

FGBrightBlack: "90",
FGBrightRed: "91",
FGBrightGreen: "92",
Expand All @@ -33,7 +34,6 @@ export ansi = {
FGBrightMagenta: "95",
FGBrightCyan: "96",
FGBrightWhite: "97",

BGBlack: "40",
BGRed: "41",
BGGreen: "42",
Expand All @@ -42,7 +42,6 @@ export ansi = {
BGMagenta: "45",
BGCyan: "46",
BGWhite: "47",

BGBrightBlack: "100",
BGBrightRed: "101",
BGBrightGreen: "102",
Expand All @@ -51,15 +50,14 @@ export ansi = {
BGBrightMagenta: "105",
BGBrightCyan: "106",
BGBrightWhite: "107",

FormatUnderline: "4",
FormatNoUnderline: "24",
FormatBold: "1",
FormatNoBold: "21",

FormatInvert: "7",
}

ansify = (parts) => `\x1b[${String.join(";", parts)}m`

/**
* Adds ansi escape codes to a string given a list of styles.
Expand All @@ -69,10 +67,16 @@ export ansi = {
* ansiColor([ansi.FormatBold, ansi.FGBrightRed], "will be red and bold")
*/
ansiColor :: List String -> String -> String
export ansiColor = (parts, str) => colorize(
`\x1b[${String.join(";", parts)}m`,
str
)
export ansiColor = (parts, str) => colorize(ansify(parts), str)

/**
* Set an ansi color conditionally
* @since 0.24.1
* @example
* ansiCond(successPattern, failurePattern, condition, string)
*/
ansiCond :: List String -> List String -> Boolean -> String -> String
export ansiCond = (ok, no, check, str) => ansiColor(check ? ok : no, str)

export text = {
black: ansiColor([ansi.FGBlack]),
Expand Down Expand Up @@ -161,9 +165,7 @@ onWindowResizedFFI :: ({} -> {}) -> HandlerId
onWindowResizedFFI = extern "madlib__stdio__onWindowResized"

onWindowResized :: (#[Integer, Integer] -> {}) -> HandlerId
export onWindowResized = (cb) => onWindowResizedFFI(() => {
cb(getWindowSize())
})
export onWindowResized = (cb) => onWindowResizedFFI(() => { cb(getWindowSize()) })


clearWindowResizeHandler :: HandlerId -> {}
Expand Down Expand Up @@ -221,10 +223,7 @@ export clearKeyPressedHandler = (id) => #- {


getWindowSize :: {} -> #[Integer, Integer]
export getWindowSize = () => #[
#- process.stdout.columns -#,
#- process.stdout.rows -#,
]
export getWindowSize = () => #[#- process.stdout.columns -#, #- process.stdout.rows -#]


getTTYMode :: {} -> TTYMode
Expand Down
Loading