- Put
ci.yaml
into.github/workflows/
- Follow https://github.com/cachix/cachix-action#usage to setup Cachix and benefit from quick CI build times.
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
;; I wrote a bit of Emacs configuration (which can be added to your | |
;; init.el) so that an lhs2tex file can be syntax-highlighted as a | |
;; Latex file but the Haskell code is highlighted as Haskell code. In | |
;; fact it's a little more than this, as the code blocks are | |
;; interpreted with the haskell-mode, so you can use your haskell | |
;; commands there. | |
;; | |
;; I don't recommend opening all `.lhs' file in this mode, as they | |
;; don't need to be Latex files. Literate Haskell is really agnostic | |
;; about its surrounding language. |
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 DeriveFunctor, DeriveFoldable, DeriveTraversable, TypeFamilies, TemplateHaskell #-} | |
import Data.Functor.Foldable | |
import Data.Functor.Foldable.TH | |
import Data.Functor.Compose | |
-- Example type | |
data Exp | |
= IntValue Int | |
| Sum Exp Exp |
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
# add your package set to your existing environment (together with the things you installed imperatively) | |
$ nix-env -i -f ./packages.nix | |
# More declarative: _replace_ your environment with _exactly_ what is in ./packages.nix | |
$ nix-env --set -f ./packages.nix | |
# Show previous versions | |
$ nix-env --list-generations | |
# Rollback | |
$ nix-env --rollback |
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
-- | Our main engine for naming a value, then we can prove properties about a named value. | |
{-# LANGUAGE ExistentialQuantification #-} -- Used for SomeNamed. | |
{-# LANGUAGE PatternSynonyms #-} -- Used for the Name pattern. | |
{-# LANGUAGE ViewPatterns #-} -- Used for the Name pattern. | |
{-# LANGUAGE RankNTypes #-} -- Used for withName. | |
module Named ( Named, pattern Name, forgetName, withName, someNamed, SomeNamed(..) ) where | |
-- | Give a generated type-level name to any value. |
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, RankNTypes #-} | |
import Control.Lens -- from `lens` | |
import Control.Monad.State.Lazy | |
moore :: MonadState s m => Lens s s b a -> Traversal as bs a b -> as -> m bs | |
moore l trav = trav (\a -> l <<.= a) | |
runMoore :: Lens s s b a -> s -> [a] -> [b] | |
runMoore l s fa = evalState (moore l traverse fa) s |
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
-- Let's say you have a table full of work: | |
CREATE TABLE tasks ( | |
id UUID PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(), | |
status TEXT NOT NULL DEFAULT 'pending', | |
payload JSON NOT NULL, -- or just have meaningful columns! | |
created_at TIMESTAMP NOT NULL DEFAULT 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 BlockArguments #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE DeriveGeneric #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE MonoLocalBinds #-} | |
{-# LANGUAGE RecordWildCards #-} | |
{-# LANGUAGE TypeApplications #-} | |
module Main where | |
import Control.Applicative (Alternative (..)) |
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 FlexibleInstances #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeInType #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE UndecidableInstances #-} | |
{-# OPTIONS_GHC -Wall #-} |
NewerOlder