View the-little-typer.pie
#lang pie | |
(claim one | |
Nat) | |
(define one | |
(add1 zero)) | |
(claim vegetables | |
(Pair Atom Atom)) | |
(define vegetables |
View Comonad.hs
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# OPTIONS_GHC -Wall #-} | |
-- $ nix-shell -p "haskellPackages.ghcWithPackages (pkgs: [ pkgs.random ])" | |
-- $ runhaskell Comonad.hs | |
module Main where |
View CommonmarkJSON.hs
{-# LANGUAGE OverloadedStrings #-} | |
module Main | |
( main | |
) where | |
import CMarkGFM | |
( ListAttributes | |
, Node | |
, NodeType |
View Mtl.hs
{-# 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 |
View Hasql.hs
{-# 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) |
View Opaleye.hs
{-# LANGUAGE Arrows #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
import Data.Bool (bool) | |
import Data.Text (Text) | |
import Control.Arrow (returnA) |
View Balance.hs
data Balance = | |
Balance !Int | |
!Int | |
deriving (Eq, Show) | |
instance Semigroup Balance where | |
Balance a b <> Balance c d | |
| b <= c = Balance (a + c - b) d | |
| otherwise = Balance a (d + b - c) |
View ExpandMap.hs
module ExpandMap | |
( expandIntMap | |
) where | |
import Control.Monad.State (evalState, get, put) | |
import Data.IntMap (IntMap) | |
import qualified Data.IntMap as IntMap | |
import Data.Traversable (for) | |
-- >>> expandIntMap '0' 50 (IntMap.fromList (zip [0,5..50] ['a' .. 'z'])) |
View Main.hs
-- To run: | |
-- $ nix-shell -p "haskellPackages.ghcWithPackages (ghc: [ghc.reactive-banana])" --run "runhaskell ./Main.hs" | |
module Main where | |
import Control.Concurrent (threadDelay) | |
import Control.Event.Handler (newAddHandler) | |
import Control.Monad (replicateM_) | |
import Reactive.Banana.Combinators | |
( Event |
View List.hs
{-# LANGUAGE NoImplicitPrelude #-} | |
{-# OPTIONS_GHC -Wall #-} | |
module List where | |
import Data.Bool (Bool) | |
import Data.Function (const) | |
import Data.Ord ((<=)) | |
import GHC.Int (Int) | |
import GHC.Num ((-)) |
NewerOlder