This file contains hidden or 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
| {-# LANGUAGE InstanceSigs #-} | |
| {-# LANGUAGE NoImplicitPrelude #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE TupleSections #-} | |
| {-# LANGUAGE FlexibleInstances #-} | |
| module Traversals where | |
| import Control.Applicative (Applicative(..)) | |
| import Data.Bool (Bool(True)) |
This file contains hidden or 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
| {-# LANGUAGE InstanceSigs #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE TupleSections #-} | |
| module LensesAndFunctionalReferences where | |
| import Data.Char (chr, ord, toUpper) | |
| import Data.Functor.Const (Const(Const, getConst)) | |
| import Data.Functor.Contravariant (Contravariant(contramap)) | |
| import Data.Functor.Identity (Identity(Identity, runIdentity)) |
This file contains hidden or 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
| {-# LANGUAGE TupleSections #-} | |
| newtype NonEmpty a = NonEmpty { getNonEmpty :: (a, List a) } | |
| newtype List a = List { getList :: Maybe (NonEmpty a) } | |
| nil :: List a | |
| nil = List Nothing | |
| cons :: a -> List a -> List a | |
| cons a = |
This file contains hidden or 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
| let | |
| overlay = self: super: | |
| { | |
| haskell = super.haskell // { | |
| packages = super.haskell.packages // { | |
| ghcjs = super.haskell.packages.ghcjs.extend (hself: hsuper: { | |
| # Doctest fails to build with a strange error. | |
| doctest = null; | |
| # These require doctest to run their tests. |
This file contains hidden or 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
| #!/usr/bin/env bash | |
| main () { | |
| local filename="the-little-typer.rkt" | |
| tmux \ | |
| new-window "nix-shell --run 'vim $filename'"\; \ | |
| split-window "nix-shell --run 'entr -c racket $filename <<< $filename'"\; \ | |
| select-layout even-horizontal\; \ | |
| split-window -v "nix-shell --run 'racket -i'" |
This file contains hidden or 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
| {-# LANGUAGE RankNTypes #-} | |
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE DeriveFunctor #-} | |
| {-# OPTIONS_GHC -Wall #-} | |
| -- $ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.random ])" | |
| -- $ runhaskell Comonad.hs | |
| module Main where |
This file contains hidden or 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
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main | |
| ( main | |
| ) where | |
| import CMarkGFM | |
| ( ListAttributes | |
| , Node | |
| , NodeType |
This file contains hidden or 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
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# LANGUAGE RankNTypes #-} | |
| module Main where | |
| import Control.Monad | |
| import Control.Monad.Trans.State (runState, runStateT) | |
| import Control.Monad.Trans.Except (runExceptT, runExcept) | |
| import Control.Monad.Error.Class | |
| import Control.Monad.State.Class |
This file contains hidden or 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
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE QuasiQuotes #-} | |
| module Main where | |
| import Control.Monad (replicateM) | |
| import qualified Data.ByteString.Char8 as BS | |
| import Data.ByteString.Char8 (ByteString) | |
| import Data.Foldable (foldl') | |
| import Data.Functor.Contravariant (contramap) |
This file contains hidden or 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
| {-# LANGUAGE Arrows #-} | |
| {-# LANGUAGE OverloadedStrings #-} | |
| {-# LANGUAGE FlexibleContexts #-} | |
| {-# OPTIONS_GHC -Wall #-} | |
| module Main where | |
| import Data.Bool (bool) | |
| import Data.Text (Text) | |
| import Control.Arrow (returnA) |