Skip to content

Commit

Permalink
Add hardcoded
Browse files Browse the repository at this point in the history
  • Loading branch information
arowM committed Jun 9, 2024
1 parent 9abaa79 commit 5439f0b
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/Tepa.elm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module Tepa exposing
, none
, currentState
, bind, bind2, bind3, bindAll
, succeed, sync
, succeed, sync, hardcoded
, lazy
, void
, when
Expand Down Expand Up @@ -218,7 +218,7 @@ The rejection of JavaScript Promise is a sort of Exception, which drops context.
`currentState` is resolved with the current state, but how to retrieve the value? You can use `bind` to pass the result into another sequence of procedures.
@docs bind, bind2, bind3, bindAll
@docs succeed, sync
@docs succeed, sync, hardcoded
#### Recursive procedures
Expand Down Expand Up @@ -902,6 +902,27 @@ sync =
Core.syncPromise


{-| Alias for `sync << succeed`, especially useful when defining `init` functions:
type alias MemoryBody =
{ field1 : Widget1.MemoryBody
, field2 : Bool
, field3 : Int
}
init : Promise MemoryBody
init =
succeed MemoryBody
|> sync Widget1.init
|> hardcoded False
|> hardcoded 0
-}
hardcoded : a -> Promise m (a -> b) -> Promise m b
hardcoded =
sync << succeed



-- Procedures

Expand Down

0 comments on commit 5439f0b

Please sign in to comment.