You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rings characterized by a fused multiply-add operator and negative one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Recently, Rust 1.26 was released, and with it came stable access to a heavily desired feature: impl Trait.
For those unfamiliar, impl Trait lets you write something like this:
It’s often the case, when programming in Rust, that one needs to convert a value of one type to a corresponding value of another type. Some typical examples include:
borrowing a vector as a slice;
converting a Rust-style string to a C-style string;
embedding an existing value in an Option;
getting an iterator from a collection;
rendering a value of a structured type as a string;
Residual representations of `Lens` and `PLens` in Agda, and the canonical embedding of the former into the latter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An introduction to the indexed privilege monad in Haskell, Scala and C#.
The Indexed Privilege Monad in Haskell, Scala, and C#
We've already looked at twodifferent indexed monads in our tour so far, so let's go for a third whose regular counterpart isn't as well known: the privilege monad.
Motivation
The regular privilege monad allows you to express constraints on which operations a given component is allowed to perform. This lets the developers of seperate interacting components be statically assured that other components can't access their private state, and it gives you a compile-time guarantee that any code that doesn't have appropriate permissions cannot do things that would require those permissions. Unfortunately, you cannot easily, and sometimes cannot at all, build code in the privilege monad that gains or loses permissions as the code runs; in other words, you cannot (in general) raise or lower your own privilege level, not even when it really should be a
An introduction to the indexed continuation monad in Haskell, Scala, and C#.
The Indexed Continuation Monad in Haskell, Scala, and C#
The indexed state monad is not the only indexed monad out there; it's not even the only useful one. In this tutorial, we will explore another indexed monad, this time one that encapsulates the full power of delimited continuations: the indexed continuation monad.
Motivation
The relationship between the indexed and regular state monads holds true as well for the indexed and regular continuation monads, but while the indexed state monad allows us to keep a state while changing its type in a type-safe way, the indexed continuation monad allows us to manipulate delimited continuations while the return type of the continuation block changes arbitrarily. This, unlike the regular continuation monad, allows us the full power of delimited continuations in a dynamic language like Scheme while still remaining completely statically typed.
An introduction to the indexed state monad in Haskell, Scala, and C#.
The Indexed State Monad in Haskell, Scala, and C#
Have you ever had to write code that made a complex series of succesive modifications to a single piece of mutable state? (Almost certainly yes.)
Did you ever wish you could make the compiler tell you if a particular operation on the state was illegal at a given point in the modifications? (If you're a fan of static typing, probably yes.)
If that's the case, the indexed state monad can help!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters