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 FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
module ReadExcept ( | |
module ReadExcept | |
, module Control.Monad.Reader | |
, module Control.Monad.Except | |
, module Control.Monad.Identity | |
) 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 FlexibleContexts #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE LambdaCase #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
module JSON_RPC where | |
import ReadExcept |
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 UnicodeSyntax #-} | |
{-# LANGUAGE TupleSections #-} | |
module Caesar where | |
import Data.Map (Map, fromList, fromListWith, unionWith) | |
import Data.Char | |
import Data.List | |
import Data.Function | |
encode ∷ Int → String → String |
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, DataKinds, KindSignatures, GADTs #-} | |
{- TypeFamilies is required to define type-level functions -} | |
data Nat = Zero | Succ Nat | |
data Fin :: Nat -> * where | |
FZero :: Fin ('Succ n) | |
FSucc :: Fin n -> Fin ('Succ n) | |
data Vector (a :: *) :: Nat -> * 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 DeriveGeneric #-} | |
{- Building a tree based on its bfs result. -} | |
module BFS where | |
import Test.QuickCheck hiding ((><)) | |
import GHC.Generics | |
import Generic.Random | |
import Data.Sequence (Seq (..), singleton, (><)) |
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 TypeApplications #-} | |
import Test.QuickCheck | |
import Data.List (sort) | |
selectOrigin k = (!! k) . sort | |
select :: (Ord a) => Int -> [a] -> a | |
select k (x:xs) = case compare k n of | |
LT -> select k ys | |
EQ -> x |
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 ViewPatterns, PatternSynonyms #-} | |
module Deque where | |
import Text.Read | |
import Data.Bifunctor | |
import Prelude hiding (length, init, tail, last, head) | |
import qualified Prelude as P | |
data Deque a = |
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 BangPatterns #-} | |
module Union where | |
import Data.Ix | |
import Data.Array | |
import Data.Array.ST | |
import Control.Monad | |
import Control.Monad.ST |
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
open import Relation.Binary | |
open import Relation.Binary.PropositionalEquality hiding ([_]) | |
module Term.Base (Atom : Set)(_≟A_ : Decidable {A = Atom} (_≡_)) where | |
open import Relation.Nullary public | |
open import Data.Nat renaming (_≟_ to _≟ℕ_) | |
open import Data.Fin renaming (_≟_ to _≟F_) hiding (_+_; compare) | |
open import Data.Product hiding (map) | |
open import Data.List |
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
{-# OPTIONS --safe --prop --overlapping-instances #-} | |
module Playground where | |
open import Data.Nat | |
open import Data.List | |
open import Data.Bool | |
open import Data.Empty | |
open import Data.Unit |
OlderNewer