Skip to content

Instantly share code, notes, and snippets.

$ git diff
diff --git a/src/Text/Taggy/Parser.hs b/src/Text/Taggy/Parser.hs
index e7dc2cc..19b49e1 100644
--- a/src/Text/Taggy/Parser.hs
+++ b/src/Text/Taggy/Parser.hs
@@ -117,7 +117,7 @@ tagclose = do
char '/'
skipSpace
i <- ident
- char '>'
module Data.JSON.FromJSON where
import Control.Applicative
import Data.ByteString
import Data.JSON.Stream
newtype Parse a =
Parse { runParse :: [Event] -> Maybe a }
boo :: Parse a
@alpmestan
alpmestan / crud.hs
Created December 31, 2014 17:43
reusable operations, in servant 0.2
--
type CRUD (resourceName :: Symbol) i a =
resourceName :> Get [a] -- optional: list all
:<|> resourceName :> ReqBody a :> Post a -- create
:<|> resourceName :> Capture "id" i :> Get a -- read
:<|> resourceName :> Capture "id" i :> ReqBody a :> Put a -- update
:<|> resourceName :> Capture "id" i :> Delete -- delete
@alpmestan
alpmestan / gist:33b756b790fbf2c8d2ca
Created January 16, 2015 02:47
pure-darwin openssh/openssl error
checking OpenSSL header version... 100010bf (OpenSSL 1.0.1k 8 Jan 2015)
checking OpenSSL library version... 100010af (OpenSSL 1.0.1j 15 Oct 2014)
checking whether OpenSSL's headers match the library... no
configure: error: Your OpenSSL headers do not match your
library. Check config.log for details.
If you are sure your installation is consistent, you can disable the check
by running "./configure --without-openssl-header-check".
Also see contrib/findssl.sh for help identifying header/library mismatches.
builder for ‘/nix/store/qx4hpp9h9zk0cqldkv51avc9hwg6l4n5-openssh-6.7p1.drv’ failed with exit code 1
@alpmestan
alpmestan / gist:5236437
Created March 25, 2013 11:13
it's "no 'data' week"
{-# LANGUAGE CPP #-}
#define information data
information Dir = Up | Down
@alpmestan
alpmestan / mats.hs
Last active December 31, 2015 00:49
accelerate internal error
import qualified Data.Array.Accelerate as A
import qualified Data.Array.Accelerate.CUDA as A
-- (v1 `outer` v2) . (v1 - v2)
h :: A.Vector Double -> A.Vector Double -> A.Vector Double
h v1 v2 = A.run $ accOuter v1' v2' `accApply` A.zipWith (-) v1' v2'
where !v1' = A.use v1
!v2' = A.use v2
-- outer product
@alpmestan
alpmestan / gist:8022817
Created December 18, 2013 14:00
output of accelerate-blas-example.hs
$ .cabal-sandbox/bin/accelerate-blas-test
Bus error: 10
$ .cabal-sandbox/bin/accelerate-blas-test +RTS -xc
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
Data.Array.Accelerate.CUDA.Persistent.new,
called from Data.Array.Accelerate.CUDA.State.theState,
called from Data.Array.Accelerate.CUDA.State.CAF
*** Exception (reporting due to +RTS -xc): (THUNK_1_0), stack trace:
Data.Array.Accelerate.CUDA.Persistent.new,
called from Data.Array.Accelerate.CUDA.State.theState,
@alpmestan
alpmestan / Files.hs
Last active August 17, 2016 23:53
File upload with servant
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeSynonymInstances #-}
module Files where
import Control.Monad.IO.Class
import Control.Monad.Trans.Either
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Proxy
-- could probably use 'reflection' instead of my
-- hacky KnownXXX classes
-- similar to https://ghc.haskell.org/trac/ghc/ticket/12468
-- except that I'm trying with 8.2.1
GHCi, version 8.2.1: http://www.haskell.org/ghc/ :? for help
Prelude> :set -XGADTs
Prelude> data Foo a where Foo :: Int -> Foo Bool
Prelude> f :: Foo a -> a ; f (Foo n) = _k n
<interactive>:3:31: error:
• Found hole: _k :: Int -> a