View DynamicBFS.hs
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
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeApplications #-} | |
module BFS where | |
import Control.Applicative | |
import Control.Monad.Logic | |
import Control.Monad.Reader |
View FreeProfunctor.hs
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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE PolyKinds #-} | |
module Data.Profunctor.Free where | |
import Data.Profunctor | |
import Control.Category (Category, (>>>)) | |
data IsCat = | |
HasCategory |
View RequireTypeAp.hs
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
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeApplications #-} | |
{-# LANGUAGE AllowAmbiguousTypes #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
-- Don't export this, it's just to make it so the type family *could* have a different |
View SemiRepresentable.hs
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
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module SemiRepresentable where | |
import qualified Data.Map as M | |
import Numeric.Natural | |
import qualified Data.Set as S | |
import Data.These |
View BindAsync.hs
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
-- Bind an async to be cancelled when the current computation ends. | |
bindAsync :: IO a -> ContT r IO () | |
bindAsync m = do | |
ContT $ \cc -> do | |
withAsync m . const $ cc () | |
-- Use bindAsync to auto-cancel the thread when the containing computation finishes | |
testBoundAsync :: ContT r IO () | |
testBoundAsync = do | |
bindAsync . forever $ print "can you hear me now?" |
View MapF.hs
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
{-# LANGUAGE DerivingStrategies #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE DeriveFoldable #-} | |
{-# LANGUAGE InstanceSigs #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module MyMap where |
View OpticsForTreeTraversals.hs
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
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveTraversable #-} | |
{-# LANGUAGE RankNTypes #-} | |
module Recurser where | |
import Control.Lens | |
import Data.Monoid | |
import Data.Foldable | |
import Data.Functor.Contravariant |
View haddock-up.sh
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
#!/bin/bash | |
# Adapted from script by Dimitri Sabadie <dimitri.sabadie@gmail.com> | |
dist=$(stack path --dist-dir --stack-yaml ./stack.yaml) | |
packagename=$(awk '/^name:\s*(.*)/{ print $2 }' ./*.cabal) | |
packageversion=$(awk '/^version:\s*(.*)/{ print $2 }' ./*.cabal) | |
echo -e "\033[1;36mGenerating documentation for $packagename-$packageversion\033[0m" |
View TextOptics.hs
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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
module Lib where | |
import Control.Lens | |
import Control.Applicative | |
import qualified Data.Text as T |
NewerOlder