Closed
Description
Given
safeHead :: [x] -> Maybe x
safeHead = _
We expect a program equivalent to the following to be synthesized (i.e. respects naturality condition)
safeHead :: [x] -> Maybe x
safeHead = \ l_x
-> case l_x of
[] -> Nothing
((:) x l_x2) -> Just x
And indeed, this is one of the candidate programs as shown in the stderr output below. However the tactics engine produces
safeHead :: [x] -> Maybe x
safeHead = (\ l_x -> Nothing)
stderr output
!!!goal: Judgement {_jHypothesis = fromList [], _jDestructed = fromList [], _jPatternVals = fromList [], _jBlacklistDestruct = False, _jWhitelistSplit = True, _jPositionMaps = fromList [(safeHead,[[]])], _jAncestry = fromList [], _jIsTopHole = True, _jGoal = [x] -> Maybe x}
!!!ctx: [(safeHead,[x] -> Maybe x)]
!!!solns: (auto
`- intros {l_x}
`- destruct(auto)
`- destruct l_x
+- match [] {}
| `- split(auto)
| `- splitDataCon:Nothing
| `- Nothing
`- match : {x, l_x2}
`- split(auto)
`- splitDataCon:Nothing
`- Nothing
,\ l_x
-> case l_x of
[] -> Nothing
((:) x l_x2) -> Nothing)
(auto
`- intros {l_x}
`- destruct(auto)
`- destruct l_x
+- match [] {}
| `- split(auto)
| `- splitDataCon:Nothing
| `- Nothing
`- match : {x, l_x2}
`- split(auto)
`- splitDataCon:Just
`- Just
`- assume x
,\ l_x
-> case l_x of
[] -> Nothing
((:) x l_x2) -> Just x)
(auto
`- intros {l_x}
`- destruct(auto)
`- destruct l_x
+- match [] {}
| `- split(auto)
| `- splitDataCon:Nothing
| `- Nothing
`- match : {x, l_x2}
`- recursion
`- apply' safeHead
`- assume l_x2
,\ l_x
-> case l_x of
[] -> Nothing
((:) x l_x2) -> safeHead l_x2)
(auto
`- intros {l_x}
`- split(auto)
`- splitDataCon:Nothing
`- Nothing
,\ l_x -> Nothing)
Subject of the issue
Describe your issue here.
Your environment
- Output of
haskell-language-server --probe-tools
orhaskell-language-server-wrapper --probe-tools
- This command is available since version
>= 0.4.0.0
- This command is available since version
haskell-language-server --probe-tools
haskell-language-server version: 0.5.1.0 (GHC: 8.8.4) (PATH: /nix/store/ffh2c9zmq8f4nh6ya5v505lb2viyvqsy-haskell-language-server-ghc884/bin/haskell-language-server)
Tool versions found on the $PATH
cabal: 3.2.0.0
stack: Not found
ghc: 8.8.4
- Which lsp-client do you use
- emacs
- Describe your project
- Just a single file Haskell program with the code above.
Steps to reproduce
As above.