869 private links
pairs = [ (x,y) | x <- [0..], y <- [0..] ]
This program doesn't really enumerate all "valid" pairs in finite time. For example (0, 1) is never reached because the list will not halt traversing the first component. How can we enumerate the space of all indexable pairs of integers? Moreover, given a recursive context-free grammar, how to write a program that enumerates all valid expressions?
This type of enumeration problems is where the Omega Monad can be useful. It acts like a "breadth-first" search for list comprehension. I recall finding the conde
primitive (sometimes known as condi
) from miniKanren fascinating. Now I learned the Omega Monad is exactly the same thing.
Hask is the category of Haskell types. This article lists some interesting exceptions where the programming language do not quite hold the consistent properties to the corresponding mathematically description of category theory objects.
A short summary on the method:
- construct an infinite sequence of numbers [f(0), f'(0), f''(0), ...] to represent a function f (note the the boundary conditions are specified directly)
- the sequence can constructd by self-reference (e.g. y = y'), compsition (+, -, negate, *, diff), analytic function composition (g f = g fa :> g' f * f', for log, exp, trig)
- By Taylor expansion, f(a+x) = sum(f[k] * x^k / k!), this allows us to evaluate f at any x.
I just learned that people actually made a software for the idea! Fascinating!
A nice personal website with interactive demo of of type theories, lambda calculus, etc.
it is not possible to type the y combinator with a higher ranked type--system F is strongly normalizing
Concise and to the point
I never know there is a van Laarhoven's representation of Free Monad! What's more, van Laarhoven free monad can be used to implement extensible algebraic effects (see https://hackage.haskell.org/package/free-vl). Isn't that awesome?
newtype VLMonad ops a = VLMonad { runVLMonad :: forall m. Monad m => ops m -> m a }
instance Monad (VLMonad ops) where
return a = VLMonad (\_ -> return a)
m >>= f = VLMonad (\ops -> runVLMonad m ops >>= f' ops)
where
f' ops a = runVLMonad (f a) ops
Convert functions to point free form.
Profunctor optics zoo. Features these box and arrow graphs that explains the optics visually.
<blockquote>Lenses, Folds, and Traversals - Join us on freenode #haskell-lens - ekmett/lens</blockquote>
A list of references to the papers/post that paves the road for lenses.
<blockquote>Learn libraries and techniques to use Haskell for a variety of real world
tasks, like connecting to databases, building web servers, and testing.</blockquote>
<blockquote>Command line tools on the web. Try our research tools directly in your browser.</blockquote>