Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

hackage.haskell.org : Cascade

[Index] Package maintainers For package maintainers and hackage trustees Candidates Cascades are collections of composable functions (e.g. a -> b, b -> c, ... , y -> z) where the intermediate types are stored in a type level list (e.g. Cascade [a,b,c,...,y,z]). For example, consider these Cascades: We can convert a cascade into a function easily enough: But that's not very inspiring. The real question, as Christian Conkle put it, is "what does such a collection give you over function composition?" Because none of the type information has been lost, we can still extract each of the functions that went into the Cascade using simple pattern matching. This opens the door to replacing parts of a cascade, or indexing into the cascade with type-level naturals. It also lets us do something silly like mix and match two different cascades: More seriously, we can record the intermediate results of each Cascade using a Product type as output: Or I can resume the computation at some later point rather that the first function in the Cascade using a Sum type as input: Or we could do both: But what's nice is that this generalizes nicely to categorical composition, so we can do the same with any category, including the Kleisli and Cokleisli categories for Monads and Comonads, respectively: Flipping back to ghci: resume works on both comonads and monads: record works on comonads, but I've been having some issues getting it to work the way I want on monads (see Cascade.Product.hs for more). So, instead of continue to wrestle the type system, for now, I just implemented a debugger that uses Cascades, so in addition running a monadic Cascade you can debug it. Dropping into ghci: We can see the current state of the debugger: the full stack trace back up, step forward: (Note that when we step forward, the monadic computation reruns) We can also use a different input than the default at the current stage: And since the debuggers are normal immutable haskell values, we can use both d and d' without errors. Cascades are still very limited. They're linear, and of a set length. They don't let you hook into functions that call themselves recursively, or functions that have computation paths better represented by trees or lattices. But that doesn't mean those are necessarily impossible to model, either. For example, simple recursion is fairly easily captured with only a slight modification to Cascade

Registry - Source - Homepage - JSON
purl: pkg:hackage/Cascade
Keywords: control, library, public-domain
License: Other
Latest release: over 9 years ago
First release: over 9 years ago
Downloads: 1,277 total
Stars: 15 on GitHub
Forks: 3 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 9 days ago

    Loading...
    Readme
    Loading...