Instantly share code, notes, and snippets.

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 ((-))
View BankersQueue.hs
module BankersQueue where
import Prelude hiding (head, tail)
data Queue a =
Queue [a] !Int [a] !Int
deriving (Show)
empty :: Queue a
empty = Queue [] 0 [] 0
View Main.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -Wall #-}
module Main where
import Data.Function ((&))
data Locked
View Constrained.hs
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Data.Constrained
( Constrained(unconstrained)
, constrain
) where
import Data.Bool ((&&), otherwise)
View Sized.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE ExplicitNamespaces #-}
{-# LANGUAGE TypeOperators #-}
module Data.Text.Sized
( Text
View Main.hs
module Main where
import Data.Bool (bool)
import Control.Monad ((<=<))
import Control.Monad.State (State, evalState, get, put)
import Data.Char (isSpace)
import Data.Foldable (traverse_)
import Data.Functor.Compose (Compose(Compose, getCompose))
import Data.Functor.Const (Const(Const, getConst))
import Data.Functor.Product (Product(Pair))
View Main.hs
module Main where
import Data.Functor (void)
import Control.Applicative ((<|>), empty, many, some, optional)
import Control.Monad (msum, replicateM)
import Control.Monad.State (StateT(runStateT))
import Control.Monad.State.Class (get, put)
import Data.Char (isHexDigit, chr, isDigit, isSpace)
import Data.Map (Map)
import Data.Maybe (listToMaybe, fromMaybe)
View Lens.hs
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Control.Applicative (Applicative(..))
import Data.Bool (Bool(False, True), not)
import Data.Char (toUpper)
import Data.Function (($), (&), (.), const, flip)
View recursive-foldable.hs
{-# LANGUAGE DeriveFoldable #-}
module Main where
import Data.Map (Map)
import qualified Data.Map as Map
import Data.Foldable
data Object a
= Value a