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 |
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 |
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 |
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 |
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?" |
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 |
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 |
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" |
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