Skip to content

Instantly share code, notes, and snippets.

filter' : (a -> Bool) -> Vect n a -> (p ** Vect p a)
filter' _ Nil = (_ ** [])
filter' p (x :: xs) with (filter' p xs)
| (_ ** xs') = if (p x) then (_ ** x :: xs') else (_ ** xs')
{-
When elaborating right hand side of Main.filter':
Can't convert
Int
{-# LANGUAGE PatternSynonyms #-}
module List where
import Control.Applicative
import Control.Monad.State
import Data.Foldable
import Data.Monoid
import System.Random
import Control.Monad.Free
@maoe
maoe / sublime-project.json
Created May 9, 2014 06:05
Sublime project file
{
"folders":
[
{
"follow_symlinks": true,
"path": ".",
"file_exclude_patterns": [
"cabal.sandbox.config",
"*.hi",
"*.o",
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# OPTIONS_GHC -Wall #-}
@maoe
maoe / influxdb.strace.log
Last active August 29, 2015 14:01
Strace of the influxdb process
Process 28432 attached with 28 threads - interrupt to quit
[pid 25696] futex(0xc2101a70e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25695] futex(0xc2109688e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25694] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 25693] futex(0xc2106b88e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25678] restart_syscall(<... resuming interrupted call ...> <unfinished ...>
[pid 25677] futex(0xc21086f8e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25676] futex(0xc21086d0e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25675] futex(0xc2102948e8, FUTEX_WAIT, 0, NULL <unfinished ...>
[pid 25674] futex(0xc2102920e8, FUTEX_WAIT, 0, NULL <unfinished ...>
@maoe
maoe / test.hs
Last active August 29, 2015 14:02
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Data.Aeson
import qualified Data.ByteString.Lazy as B
{- Generic Language extension -}
import GHC.Generics (Generic)
data Pull = Pull {
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# OPTIONS_GHC -F -pgmF she #-}
import Control.Applicative hiding (empty)
import Control.Monad.Trans
import Control.Monad.Trans.Cont
import Control.Monad.Identity
import Data.Maybe
main :: IO ()
@maoe
maoe / PerformAsync.hs
Created July 10, 2014 09:45
performAsync
perform
:: (a -> IO b)
-> Event a
-> SignalGen (Event b)
perform f event = generatorE $ execute . f <$> event
performSync :: Event (IO a) -> SignalGen (Event a)
performSync = perform id
-- | Perform IO actions asynchronously in separate threads.
@maoe
maoe / DynMap.hs
Last active August 29, 2015 14:04
{-# OPTIONS_GHC -O2 -fobject-code #-}
module DynMap where
import Control.Applicative
import Control.Monad (join)
import Control.Seq
import Data.Map (Map)
import Data.Traversable (Traversable)
import qualified Data.Map as Map
import qualified Data.Traversable as T
[maoe@maoe:~/src/bindings-portaudio/example on master]
% brew install portaudio
Warning: portaudio-19.20140130 already installed
[maoe@maoe:~/src/bindings-portaudio/example on master]
% ./.cabal-sandbox/bin/example-portaudio 44100 1024
Initialization: 0
Available APIs:
Opening the default stream: -9985
example-portaudio: user error (Failed.)