This file contains hidden or 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
| import Data.Maybe | |
| import Data.Char | |
| import Data.List | |
| dictionary :: [String] | |
| dictionary = [[chr x] | x <- [0..127]] | |
| encode :: String -> [Int] | |
| encode [] = [] | |
| encode (x:xs) = go dictionary [x] xs where |
This file contains hidden or 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, NoMonomorphismRestriction, | |
| RankNTypes, ScopedTypeVariables, | |
| TupleSections, GADTs, FlexibleContexts, | |
| ViewPatterns, GeneralizedNewtypeDeriving #-} | |
| import Data.List | |
| import Data.List.Split | |
| import Data.Ord | |
| import Control.Lens |
This file contains hidden or 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 Function | |
| open import Data.Nat | |
| open import Data.Fin | |
| open import Data.Empty | |
| open import Data.Unit | |
| open import Relation.Binary.PropositionalEquality | |
| open import Relation.Nullary | |
| open import Data.Product | |
| open import Data.Vec hiding (_∈_; module _∈_) |
This file contains hidden or 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 TypeOperators, PolyKinds, DataKinds, GADTs, TypeFamilies #-} | |
| import Data.Type.Equality | |
| type family (++) (xs :: [*]) (ys :: [*]) where | |
| '[] ++ ys = ys | |
| (x ': xs) ++ ys = x ': (xs ++ ys) | |
| data SList (xs :: [*]) where | |
| Nil :: SList '[] |
This file contains hidden or 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 Data.String | |
| open import Relation.Binary.PropositionalEquality | |
| open import Relation.Nullary.Decidable | |
| open import Function | |
| open import Data.List | |
| open import Data.Product | |
| open import Relation.Nullary | |
| open import Data.Unit hiding (_≟_) | |
| open import Data.Empty | |
| open import Data.Bool hiding (_≟_) |
This file contains hidden or 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 Data.List | |
| open import Data.Nat | |
| open import Relation.Binary.PropositionalEquality | |
| open import Function | |
| open import Data.Product | |
| open import Data.Sum | |
| data _▶_≡_ {A : Set}(x : A) : List A → List A → Set where | |
| here : ∀ {xs} → x ▶ xs ≡ (x ∷ xs) |
This file contains hidden or 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
| -- Lens style ---------------------- | |
| -- Kudos for circed for holes and contexts in lens-style: http://stackoverflow.com/questions/25393870/how-can-holes-and-contexts-be-implemented-for-higher-kinded-types-in-a-lens-styl | |
| {-# LANGUAGE GADTs, RankNTypes, PolyKinds, StandaloneDeriving, ScopedTypeVariables #-} | |
| import Control.Applicative | |
| import Control.Monad.Identity |
This file contains hidden or 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, | |
| MultiParamTypeClasses, | |
| UndecidableInstances, | |
| IncoherentInstances, -- GHC 7.10 can do with only Overlapping | |
| TypeFamilies #-} | |
| class ZipWithN f t where | |
| zipWithN' :: [f] -> t |
This file contains hidden or 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 Data.List | |
| open import Function | |
| open import Relation.Binary.PropositionalEquality | |
| open import Data.Product | |
| open import Algebra | |
| module LM {a}{A : Set a} = Monoid (monoid A) | |
| infixr 5 _>>=_ | |
| _>>=_ : ∀ {a b}{A : Set a}{B : Set b} → List A → (A → List B) → List B |
This file contains hidden or 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 Function | |
| open import Data.Nat hiding (_⊔_) | |
| open import Data.Fin renaming (_+_ to _f+_) | |
| open import Data.Unit | |
| open import Relation.Binary.PropositionalEquality | |
| open import Data.Product | |
| open import Data.Sum | |
| open import Data.Vec | |
| open import Data.Vec.Properties |