[Haskell-cafe] Hedgehog: returning a list from `commandExecute` and getting to the items in an update function

Magnus Therning magnus at therning.org
Thu Oct 10 14:00:42 UTC 2019


Magnus Therning <magnus at therning.org> writes:

> I found an open issue for what I've run into (I think):
> https://github.com/hedgehogqa/haskell-hedgehog/issues/113

My copy-pasting skills need work! The issue is this:

https://github.com/hedgehogqa/haskell-hedgehog/issues/126

/M

> Magnus Therning <magnus at therning.org> writes:
>
>> Hello,
>>
>> I'm trying to use Hedgehog to test a web app at work. Yesterday I ran
>> into an issue with getting to the value returned from my
>> `commandExecute` in an `Update` `Callback`.
>>
>> Basically my model looks like this
>>
>> ~~~
>> newtype State (v :: * -> *) = State (M.Map (Var UUID v) DataPerItem)
>>     deriving (Eq, Show)
>> ~~~
>>
>> and I have an action, `Command gen exec [Update update]` where
>>
>> ~~~
>> exec :: action -> m [UUID]
>> ~~~
>>
>> which results in
>>
>> ~~~
>> update :: State v -> action -> Var [UUID] v -> State v
>> ~~~
>>
>> AFAICS I need to, in order to actually update my model, turn that `Var
>> [UUID] v` into `[Var UUID v]`. I've been staring at the functions in
>> Hedgehog for a while now but nothing jumps out... or am I, once again,
>> thinking about it all wrong? :)
>>
>> /M
>>
>> I also asked at stackoverflow:
>> https://stackoverflow.com/questions/58157292/returning-a-list-and-getting-to-the-items-in-hedgehog-state-machine
>> This is just to widen the net a bit...


--
Magnus Therning              OpenPGP: 0x927912051716CE39
email: magnus at therning.org
twitter: magthe              http://magnus.therning.org/

Every act of creation is first an act of destruction.
     — Pablo Picasso


More information about the Haskell-Cafe mailing list