-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #365 from JordanMartinez/development
Make next minor release: ps-0.13.x-v0.17.1
- Loading branch information
Showing
17 changed files
with
1,263 additions
and
1,584 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module Node.ReadLine.Aff where | ||
|
||
import Prelude | ||
|
||
import Data.Either (Either(..)) | ||
import Effect (Effect) | ||
import Effect.Aff (Aff, bracket, launchAff_, makeAff, nonCanceler) | ||
import Effect.Class (liftEffect) | ||
import Effect.Console (log) | ||
import Node.ReadLine (Interface, createConsoleInterface, noCompletion, close) | ||
import Node.ReadLine as RL | ||
|
||
question :: String -> Interface -> Aff String | ||
question message interface = makeAff \runAffFunction -> | ||
nonCanceler <$ RL.question message (runAffFunction <<< Right) interface | ||
|
||
main :: Effect Unit | ||
main = do | ||
log "\n\n" -- separate output from program | ||
|
||
launchAff_ $ bracketInterface \interface -> do | ||
answer <- interface # question "Type something here: " | ||
liftEffect $ log $ "You typed: '" <> answer <> "'\n" | ||
|
||
where | ||
bracketInterface :: (Interface -> Aff Unit) -> Aff Unit | ||
bracketInterface useInterface = do | ||
bracket | ||
(liftEffect $ createConsoleInterface noCompletion) | ||
(liftEffect <<< close) | ||
useInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Node ReadLine and Aff | ||
|
||
To use receive input from a user via the terminal, we need to use `Node.ReadLine`'s API. To deal with callback hell / Pyramid of Doom issues, we'll use `Aff` bindings. | ||
|
||
## Compilation Instructions | ||
|
||
```bash | ||
spago run -m Node.ReadLine.Aff | ||
``` |
Oops, something went wrong.