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 | |
LambdaCase, GADTs, TypeOperators, TypeFamilies, DataKinds #-} | |
data Type = TInt | TBool | Type :=> Type | |
-- Needs GHC >= 7.8 | |
type family Interp (t :: Type) where | |
Interp TInt = Int | |
Interp TBool = Bool | |
Interp (a :=> b) = Interp a -> Interp b |
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 | |
DataKinds, PolyKinds, TypeFamilies, TemplateHaskell, | |
ScopedTypeVariables, UndecidableInstances, GADTs, TypeOperators #-} | |
import Data.Singletons.TH | |
$(singletons [d| | |
data Nat = Zero | Succ Nat | |
(+) :: Nat -> Nat -> Nat |
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
{- | |
Copyright (C) 2014 András Kovács | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOF |
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 MagicHash, UnboxedTuples #-} | |
import Criterion.Main | |
import Criterion.Config | |
import GHC.Exts | |
import GHC.ST | |
data Array a = Array (Array# a) | |
snoc :: Array a -> a -> Array 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
-- http://stackoverflow.com/questions/24278006/need-advice-on-optimising-haskell-data-processing/ | |
-- http://stackoverflow.com/questions/24344440/optimising-haskell-data-processing-part-ii | |
-- ****************** "Normal" version ***************************** | |
import Data.Vector (Vector) | |
import qualified Data.Vector as V | |
import qualified Data.ByteString.Char8 as BS | |
import qualified Data.IntSet as IS |
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 Function | |
open import Data.Nat | |
open import Relation.Binary.PropositionalEquality | |
open import Data.Nat.Properties.Simple | |
open import Data.Unit | |
data Bin : Set where | |
zero : Bin | |
2*n 2*n+1 : Bin → Bin |
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 Data.Nat | |
open import Data.Unit | |
open import Data.Vec | |
open import Relation.Binary.PropositionalEquality | |
open import Relation.Nullary | |
open import Data.Empty | |
open import Data.Product | |
import Level | |
module _ {α}{A : Set α} 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
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 |
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 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 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 |