-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
v0.5.0: Nested Actions Now Executed and Major Refactoring (#123)
* Add missing GHC options * Remove record from core * Remove * Reexport Show * Add scaffolding for HTTP * wip * wip * Update * Refactor * update * Update * Change to fmt strings * Add toml * wip * wip * OMG IT WORKZ!!1!!one! * Put back HTTP * Bump versions --------- Co-authored-by: Nikita Tchayka <[email protected]>
- Loading branch information
Nick Seagull
and
Nikita Tchayka
authored
Sep 16, 2024
1 parent
714a27c
commit deb9780
Showing
37 changed files
with
639 additions
and
487 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
module Neo.Build ( | ||
Event, | ||
BuildEvent (..), | ||
State (..), | ||
commandParser, | ||
initialState, | ||
update, | ||
view, | ||
) where | ||
|
||
import Action qualified | ||
import Command qualified | ||
import Core | ||
import File qualified | ||
|
||
|
||
type Event = BuildEvent | ||
|
||
|
||
data BuildEvent | ||
= BuildStarted | ||
| ProjectFileNotFound | ||
| ReadProjectFile Text | ||
deriving (Show, Eq, Ord) | ||
|
||
|
||
commandParser :: Command.OptionsParser BuildEvent | ||
commandParser = do | ||
pure BuildStarted | ||
|
||
|
||
data State = State | ||
{ message :: Text | ||
} | ||
deriving (Show, Eq, Ord) | ||
|
||
|
||
initialState :: State | ||
initialState = | ||
State | ||
{ message = "Build Started" | ||
} | ||
|
||
|
||
update :: BuildEvent -> State -> (State, Action BuildEvent) | ||
update event state = | ||
case event of | ||
BuildStarted -> do | ||
let handleRes res = case res of | ||
Ok text -> ReadProjectFile text | ||
Err _ -> ProjectFileNotFound | ||
let opts = | ||
File.ReadOptions | ||
{ path = "foo.txt" | ||
} | ||
(state, File.readText opts |> Action.map handleRes) | ||
ReadProjectFile text -> do | ||
let newState = state {message = text} | ||
(newState, Action.none) | ||
ProjectFileNotFound -> do | ||
let newState = state {message = "Project file not found"} | ||
(newState, Action.none) | ||
|
||
|
||
view :: State -> View | ||
view = dieWith "Not implemented yet" |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.