-
Notifications
You must be signed in to change notification settings - Fork 380
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ test ] Added regression tests for #2927
- Loading branch information
1 parent
b07ef9b
commit a41bdf4
Showing
5 changed files
with
60 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import Data.List.Lazy | ||
|
||
import Debug.Trace | ||
|
||
showHead : Show a => LazyList a -> String | ||
showHead [] = "Empty" | ||
showHead (x::xs) = show x | ||
|
||
%inline | ||
(::) : Maybe a -> Lazy (LazyList a) -> LazyList a | ||
Nothing :: xs = xs | ||
Just x :: xs = x :: xs | ||
|
||
bot : a | ||
bot = bot | ||
|
||
fufu : a -> Maybe a | ||
fufu = Just | ||
|
||
g : LazyList Nat | ||
g = [ fufu 6 | ||
, fufu bot | ||
] | ||
|
||
-- Note that this should finish in finite time, as tail containing | ||
-- `bot` is lazy and should never be computed | ||
main : IO Unit | ||
main = printLn $ showHead g |
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,22 @@ | ||
import Data.List.Lazy | ||
|
||
import Debug.Trace | ||
|
||
%default total | ||
|
||
%inline | ||
(::) : Maybe a -> Lazy (LazyList a) -> LazyList a | ||
Nothing :: xs = xs | ||
Just x :: xs = x :: xs | ||
|
||
fufu : a -> Maybe a | ||
fufu = Just | ||
|
||
g : LazyList Nat | ||
g = trace "--- outmost ---" | ||
[ fufu $ trace "pure 6" 6 | ||
, fufu $ trace "pure 5" 5 | ||
] | ||
|
||
main : IO Unit | ||
main = printLn g |
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,5 @@ | ||
pure 6 | ||
--- outmost --- | ||
pure 5 | ||
[6, 5] | ||
"6" |
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,4 @@ | ||
rm -rf build | ||
|
||
$1 --no-color --console-width 0 --no-banner -p contrib --exec main LiftedTrace.idr | ||
$1 --no-color --console-width 0 --no-banner -p contrib --exec main LiftedBot.idr |