Closed jwaldmann closed 1 year ago
slightly related: this is ambiguous
ghci> print =<< ( solveWith minisat $ return $ Bits [false,true])
<interactive>:5:1: error:
• Ambiguous type variable ‘n0’ arising from a use of ‘print’
but this works:
ghci> print =<< ( solveWith @IO @Maybe minisat $ return $ Bits [false,true])
(Satisfied,Just 2)
This declaration
vaguely suggests a generality that isn't really there.
If the variable in a literal is unconstrained, we can get a list of possible values
but this already breaks when the unconstrained literal is wrapped in a
Bit
:The reason is that the code at https://github.com/ekmett/ersatz/blob/master/src/Ersatz/Bit.hs#L126 will evaluate the literal not in
[Bool]
, but inMaybe Bool
, where the Alternative instance will pick the first value. This is then lifted to a singleton list, viapure
in the second argument ofmaybe
hereThis would be much easier to understand if the result type of
decode
was fixed toMaybe _
. Same critique forn
inWhat is the use case for
MonadPlus
here? All examples I know, do useMaybe
.