This repository has been archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Updates for 0.12 compiler * Remove event example
- Loading branch information
Showing
19 changed files
with
222 additions
and
658 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 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
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 |
---|---|---|
@@ -1,17 +1,19 @@ | ||
module FRP.Behavior.Time | ||
( millisSinceEpoch | ||
( instant | ||
, seconds | ||
) where | ||
|
||
import Prelude | ||
|
||
import Data.DateTime.Instant (Instant, unInstant) | ||
import Data.Time.Duration (Seconds, toDuration) | ||
import FRP.Behavior (Behavior, behavior) | ||
import FRP.Event.Time (withTime) | ||
|
||
-- | Get the current time in milliseconds since the epoch. | ||
millisSinceEpoch :: Behavior Number | ||
millisSinceEpoch = behavior \e -> map (\{ value, time: t } -> value t) (withTime e) | ||
instant :: Behavior Instant | ||
instant = behavior \e -> map (\{ value, time: t } -> value t) (withTime e) | ||
|
||
-- | Get the current time in seconds since the epoch. | ||
seconds :: Behavior Number | ||
seconds = map (_ / 1000.0) millisSinceEpoch | ||
seconds :: Behavior Seconds | ||
seconds = map (toDuration <<< unInstant) instant |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.