-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-yampa-test-style' into develop. Close #256.
- Loading branch information
Showing
6 changed files
with
255 additions
and
245 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
-- | Debug FRP networks by inspecting their behaviour inside. | ||
-- | | ||
-- Copyright : (c) Ivan Perez, 2017-2022 | ||
-- License : BSD-style (see the LICENSE file in the distribution) | ||
-- Maintainer : ivan.perez@keera.co.uk | ||
-- | ||
-- Debug FRP networks by inspecting their behaviour inside. | ||
module FRP.Yampa.Debug where | ||
|
||
import Debug.Trace | ||
import FRP.Yampa | ||
import System.IO.Unsafe | ||
-- External imports | ||
import Debug.Trace (trace) | ||
import FRP.Yampa (SF, arr) | ||
import System.IO.Unsafe (unsafePerformIO) | ||
|
||
-- | Signal Function that prints the value passing through using 'trace'. | ||
traceSF :: Show a => SF a a | ||
traceSF = traceSFWith show | ||
|
||
-- | Signal Function that prints the value passing through using 'trace', | ||
-- and a customizable 'show' function. | ||
-- | Signal Function that prints the value passing through using 'trace', and a | ||
-- customizable 'show' function. | ||
traceSFWith :: (a -> String) -> SF a a | ||
traceSFWith f = arr (\x -> trace (f x) x) | ||
|
||
-- | Execute an IO action using 'unsafePerformIO' at every step, and ignore the | ||
-- result. | ||
traceSFWithIO :: (a -> IO b) -> SF a a | ||
traceSFWithIO f = arr (\x -> (unsafePerformIO (f x >> return x))) | ||
traceSFWithIO f = arr (\x -> unsafePerformIO (f x >> return x)) |
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
Oops, something went wrong.