((\f.\g.\x.f(gx))(\f.\x.\y.fyx)(\f.\x.\y.fyx))(\x.x)
Renaming things for clarity...
((\f.\g.\x.f(gx))(\f2.\x2.\y2.f2 y2 x2)(\f3.\x3.\y3.f3 y3 x3))(\x4.x4)
| module Main where | |
| import Color (rotateHue) | |
| import Color as Color | |
| import Color.Scheme.MaterialDesign (red) | |
| import Control.Apply (lift3) | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (logShow) | |
| import Data.Maybe (Maybe(..)) | |
| import Data.Monoid (mempty) |
| module Main where | |
| import Control.Alternative ((<|>)) | |
| import Control.Apply (lift2) | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (CONSOLE, logShow) | |
| import Data.Argonaut.Core (Json) | |
| import Data.Argonaut.Decode (class DecodeJson, decodeJson) | |
| import Data.Argonaut.Encode (class EncodeJson, encodeJson) | |
| import Data.Either (hush) |
| call plug#begin('~/.vim/plugged') | |
| Plug 'godlygeek/tabular' | |
| Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
| Plug 'kcsongor/vim-monochrome' | |
| Plug 'tpope/vim-fugitive' | |
| Plug 'tpope/vim-surround' | |
| Plug 'tpope/vim-unimpaired' | |
| call plug#end() | |
| colorscheme monochrome |
| module Main where | |
| -- Often in applications, we want to generate unique IDs. In imperative | |
| -- programming, we might be tempted to define, albeit with obfuscation, | |
| -- a global integer that we increment every time we want a new value. | |
| -- In this gist, we'll look at how to achieve the same thing using the | |
| -- state type to keep things good and pure. | |
| import Control.Apply (lift2) | |
| import Control.Monad.Eff (Eff) |
| module Main where | |
| import Control.Monad ((<=<)) | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (log) | |
| import TryPureScript (withConsole, render) | |
| import Prelude ((#), (+), ($), bind, discard, show, Unit) | |
| -- | Encoding data types with universal quantification! |
| const Future = require('fluture') | |
| // I can't guarantee this will work out of the box - it's quite old... but | |
| // you should hopefully be able to see how this fits together! | |
| const { ReaderT } = require('fantasy-readers') | |
| // First of all, you're going to need to "lift" all your `Future` operations | |
| // to work within ReaderT. Basically, you just need to call `ReaderT.lift` on | |
| // any `Future` values. | |
| const doAjaxThing_ = x => ReaderT.lift(doAjaxThing(x)) |
| -- Folding | |
| project :: Nat -> Maybe Nat | |
| cata :: (Maybe a -> a) -> Nat -> a | |
| gcata :: Comonad w => Distributive w => (Maybe (w a) -> a) -> Nat -> a | |
| para :: (Maybe (Nat, a) -> a) -> Nat -> a | |
| gpara :: Comonad w => Distributive w => (Maybe (Nat, w a) -> a) -> Nat -> a |
| module Main where | |
| import Prelude (Unit, ($), discard) | |
| import Type.Prelude | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (CONSOLE, logShow) | |
| import Data.Record (get) | |
| import Data.Tuple (Tuple) | |
| import Data.Tuple.Nested ((/\)) |
((\f.\g.\x.f(gx))(\f.\x.\y.fyx)(\f.\x.\y.fyx))(\x.x)
Renaming things for clarity...
((\f.\g.\x.f(gx))(\f2.\x2.\y2.f2 y2 x2)(\f3.\x3.\y3.f3 y3 x3))(\x4.x4)
| module Main (main, zip, zipRecord, class ZipRowList) where | |
| import Control.Monad.Eff (Eff) | |
| import Control.Monad.Eff.Console (CONSOLE, log) | |
| import Data.Record (get, insert) | |
| import Data.Symbol (class IsSymbol, SProxy(..)) | |
| import Data.These (These(..)) | |
| import Global.Unsafe (unsafeStringify) | |
| import Prelude (Unit, discard) | |
| import Type.Row |