Git Product home page Git Product logo

Comments (2)

stevana avatar stevana commented on May 26, 2024

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.

stevana avatar stevana commented on May 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.