{"action":"created","issue":{"url":"https://api.github.com/repos/fscheck/FsCheck/issues/234","repository_url":"https://api.github.com/repos/fscheck/FsCheck","labels_url":"https://api.github.com/repos/fscheck/FsCheck/issues/234/labels{/name}","comments_url":"https://api.github.com/repos/fscheck/FsCheck/issues/234/comments","events_url":"https://api.github.com/repos/fscheck/FsCheck/issues/234/events","html_url":"https://github.com/fscheck/FsCheck/pull/234","id":151623000,"number":234,"title":"StateMachine Shrinking shrinks Operations","user":{"login":"MarcoMaar","id":4059205,"avatar_url":"https://avatars.githubusercontent.com/u/4059205?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcoMaar","html_url":"https://github.com/MarcoMaar","followers_url":"https://api.github.com/users/MarcoMaar/followers","following_url":"https://api.github.com/users/MarcoMaar/following{/other_user}","gists_url":"https://api.github.com/users/MarcoMaar/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcoMaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcoMaar/subscriptions","organizations_url":"https://api.github.com/users/MarcoMaar/orgs","repos_url":"https://api.github.com/users/MarcoMaar/repos","events_url":"https://api.github.com/users/MarcoMaar/events{/privacy}","received_events_url":"https://api.github.com/users/MarcoMaar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-28T11:55:43Z","updated_at":"2016-04-29T10:02:32Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fscheck/FsCheck/pulls/234","html_url":"https://github.com/fscheck/FsCheck/pull/234","diff_url":"https://github.com/fscheck/FsCheck/pull/234.diff","patch_url":"https://github.com/fscheck/FsCheck/pull/234.patch"},"body":"Addresses #233\r\n\r\nThere are still two open issues:\r\n1.) I am not entirely sure how I could write a testcase that checks if the Shrunk value is correct(3) and not 5. Of course it is possible to catch the exception and check the exception message but there should be a better way. Currently the testcase in the PR is just failing, so that needs to be fixed.\r\n\r\n2.) Since I am using the defaultListShrinker again, I am not sure which implications this has. The testcase ``shrinker should remove loops`` still passes. Now and before it was not possible to have a transition sequence like [a->b;b->c] with an error in the state c shrunk to [a->c] in this testcase."},"comment":{"url":"https://api.github.com/repos/fscheck/FsCheck/issues/comments/215674927","html_url":"https://github.com/fscheck/FsCheck/pull/234#issuecomment-215674927","issue_url":"https://api.github.com/repos/fscheck/FsCheck/issues/234","id":215674927,"user":{"login":"MarcoMaar","id":4059205,"avatar_url":"https://avatars.githubusercontent.com/u/4059205?v=3","gravatar_id":"","url":"https://api.github.com/users/MarcoMaar","html_url":"https://github.com/MarcoMaar","followers_url":"https://api.github.com/users/MarcoMaar/followers","following_url":"https://api.github.com/users/MarcoMaar/following{/other_user}","gists_url":"https://api.github.com/users/MarcoMaar/gists{/gist_id}","starred_url":"https://api.github.com/users/MarcoMaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MarcoMaar/subscriptions","organizations_url":"https://api.github.com/users/MarcoMaar/orgs","repos_url":"https://api.github.com/users/MarcoMaar/repos","events_url":"https://api.github.com/users/MarcoMaar/events{/privacy}","received_events_url":"https://api.github.com/users/MarcoMaar/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T10:02:32Z","updated_at":"2016-04-29T10:02:32Z","body":"That is what I thought first as well. But I tried out some values and saw that it does not behave that way. I took my time to look at it a bit more and I think I found the reason.\r\n\r\nfor the current version this property passes\r\n```fsharp\r\n    let ``length of shrunk list is at minimum n-1 of list``() =\r\n        let prop l = \r\n            let shrunk = Arb.Default.FsList().Shrinker l\r\n            l.Length = 0 || (shrunk |> Seq.forall (fun s -> s.Length = l.Length || s.Length = l.Length - 1))\r\n        Check.QuickThrowOnFailure prop\r\n```\r\nwhich means it does not skip more than one element.\r\nThe reason is the line you pointed out \r\nhttps://github.com/fscheck/FsCheck/blob/master/src/FsCheck/Arbitrary.fs#L471\r\n\r\nyield only returns one element therefore it should use yield bang I think. e.g. change the line to this\r\n`for xs' in shrink xs do yield! __.Shrinker xs'`\r\nand now the property fails because it generates smaller lists as well.\r\n\r\nSo which behavior do we want for the FsList shrinker? The one that skips 1 element or the one that can skip more than one element. I assume for operations we want the one that skips 1 element. Both versions also shrink the elements in the list.\r\n\r\nIt might be a bit tricky to write a test case(property) that can distinguish between the two versions."}}