Giter VIP home page Giter VIP logo

Comments (4)

JaSpa avatar JaSpa commented on May 28, 2024

I think you don't need Template Haskell for this but the same can be accomplished by using type families and data kinds:

type family StackEff (members :: [(* -> *) -> * -> *]) where
  StackEff '[] = Eff VoidC
  StackEff (m ': ms) = Eff (m (StackEff ms))

type family StackEffM (members :: [(* -> *) -> * -> *]) m where
  StackEffM '[] m' = Eff (LiftC m')
  StackEffM (m ': ms) m' = Eff (m (StackEffM ms m'))

-- 'Something' from @patrickt above
type Something = StackEff [StateC [Foo], ErrorC SomeException]

from fused-effects.

robrix avatar robrix commented on May 28, 2024

I’d argue that this isn’t an inappropriate leak of details. Your selection of a handler nails the computation down to a specific carrier, and thence semantics; that’s something consumers need to know about.

Further, this sort of specification is only necessary when you’re actually handling effects. In all other cases you can use Member constraints to abstract a computation over the carrier.

Finally, there isn’t in general a strong match between an effect and one specifically “blessed” carrier. Take Trace, for example.

If we want to be able to change the definitions or names of carriers without affecting consumers, we can always define type synonyms for them. But newtypes are cheap, so we won’t gain much by doing so in my opinion.

from fused-effects.

robrix avatar robrix commented on May 28, 2024

@patrickt: I’m going to close this out given the above, but feel free to reopen if necessary.

from fused-effects.

patrickt avatar patrickt commented on May 28, 2024

@robrix Very fair! And @JaSpa’s example of how to infer it is lovely. Let’s keep this closed.

from fused-effects.

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.