SwensenSoftware / unquote

Write F# unit test assertions as quoted expressions, get step-by-step failure messages for free
http://www.swensensoftware.com/unquote
Apache License 2.0
287 stars 25 forks source link

Reduction Feature Request: do not reduce expressions which return Lambda Values #24

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Related to issue 23, Let(_,x,Lambda(_)) when x |> isReduced should be 
considered reduced, since we don't want to see generated lambda names sprinted

So instead of

> unquote <@ 23 + 3 + 4 + 1, let x = 2 + 3 in (fun j -> j + x) @>;;
> 
(23 + 3 + 4 + 1, (let x = 2 + 3 in fun j -> j + x))
(26 + 4 + 1, (let x = 5 in fun j -> j + x))
(30 + 1, <fun:ToFSharpFunc@3051-1>)
(31, <fun:ToFSharpFunc@3051-1>)

should be

> unquote <@ 23 + 3 + 4 + 1, let x = 2 + 3 in (fun j -> j + x) @>;;
> 
(23 + 3 + 4 + 1, (let x = 2 + 3 in fun j -> j + x))
(26 + 4 + 1, (let x = 5 in fun j -> j + x))
(30 + 1, (let x = 5 in fun j -> j + x))
(31, (let x = 5 in fun j -> j + x))

Original issue reported on code.google.com by stephen....@gmail.com on 22 Mar 2011 at 2:13

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 22 Mar 2011 at 2:31

GoogleCodeExporter commented 9 years ago
I had a change of heart, I am on the brink of completing work to "re-sugar" 
various partially applied lambda call expressions and this issue no longer 
seems relevant: there are too many expression cases which may reduce as Lambda 
values and there are too few cases where you'd even encounter this situation in 
test expressions. 

Original comment by stephen....@gmail.com on 26 Mar 2011 at 1:51

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 26 Mar 2011 at 1:51

GoogleCodeExporter commented 9 years ago
FALSE!  this turns out to indeed be a critical part of issue 23.  But i'm not 
quite ready to mark as "Fixed" quite yet... needs to be more definite in 
results.

Original comment by stephen....@gmail.com on 26 Mar 2011 at 2:33

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 26 Mar 2011 at 11:54

GoogleCodeExporter commented 9 years ago
Marking as fixed: we do reduce in most appropriate scenarios, but sometimes 
it's not appropriate, e.g.

> <@ [1;2;3] |> List.map (+) @> |> unquote;;

[1; 2; 3] |> List.map (+)
[<fun:ToFSharpFunc@3051-1>; <fun:ToFSharpFunc@3051-1>; 
<fun:ToFSharpFunc@3051-1>] 

Original comment by stephen....@gmail.com on 2 Apr 2011 at 8:27

GoogleCodeExporter commented 9 years ago

Original comment by stephen....@gmail.com on 2 Apr 2011 at 7:59