Comments (2)
One possible solution might involve introducing a universe of responses, e.g.:
data Response = Return Type | Type :+: Type | Type :*: Type
type familiy Response_ v u where
Response_ v (Return a) = v a
Response_ v (a :+: b) = Either a (v b)
Response_ v (a :*: b) = (v a, v b)
And then change transition to be:
type Transition model act = forall v. model v -> act v resp -> Response_ v resp -> model v
This complicates the definition of actions however, by indexing them by Response
rather than just *
... It's also not as general as it could be, i.e. lets say you want to return three references. One could imagine using , data Response = ... | Response :*: Response
instead, but this would make the implementation of, say, generating programs tricker (where we would need to use Typeable
or singletons to reify the response and do the appropriate thing).
I guess another approach is to drop the indexing of actions altogether as discussed in #170. Something like:
data Response' v resp err
= Return (v resp)
| err :+: v resp
| v resp :*: v resp
type Transition' model act resp err = forall v.
model v -> act v -> Response' v resp err -> model v
Thoughts?
from quickcheck-state-machine.
Fixed as part of #209 by not using a GADT for actions, but instead having a response datatype. The transition function's type changed to:
model v -> act v -> resp v -> model v
Notice that there's no v
around resp, more work is required by the user, see the mock
function in the readme.
from quickcheck-state-machine.
Related Issues (20)
- `forAllCommands` generating fewer commands than expected HOT 3
- Exception while generating shrink-list
- simplify: impossible, because of the structure of linearise. HOT 7
- Use dot for visualization of counter examples HOT 13
- simplify: impossible, because of the structure of linearise HOT 2
- shrinking optimizations HOT 5
- Property Result in case of exceptions HOT 8
- Fix CI HOT 15
- Improve garbage-collection/cleaning-up HOT 20
- Add pretty print for CounterExample and improve test output HOT 1
- Use Dot drawing for sequential programs
- Convenient way for manually writing examples HOT 5
- Drop lts-11 and add lts-14 to Travis CI HOT 5
- Fix CI HOT 2
- New Release? HOT 3
- Use a generator to init models HOT 4
- Mock mismatch with semantics HOT 1
- Event as defined in Labelling is misleading HOT 1
- Read instance for Commands HOT 2
- Lower bound on text in latest revision HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickcheck-state-machine.