Skip to content

Instantly share code, notes, and snippets.

{-# LANGUAGE
FlexibleContexts
, FlexibleInstances
, MultiParamTypeClasses
, TypeSynonymInstances
#-}
module ToStringy (ToStringy (..), fromStringy) where
import Data.String
import qualified Data.ByteString as SB
{-# LANGUAGE RankNTypes, TypeFamilies, ConstraintKinds #-}
import Data.String
import Data.String.ToString
import Text.XML.HXT.Arrow.Pickle
import GHC.Exts
import qualified Data.Map.Strict as SM
f :: (C map key, C map String, XmlPickler (map String value), IsString key, ToString key)
=> (forall k k'. C map k => (k -> k') -> map k value -> map k' value)
warming up
estimating clock resolution...
mean is 941.9046 ns (640001 iterations)
found 1045200 outliers among 639999 samples (163.3%)
501011 (78.3%) low severe
544189 (85.0%) high severe
estimating cost of a clock call...
mean is 52.69083 ns (7 iterations)
benchmarking positional/decode/presidents/without conversion
-- $ ghc -ddump-simpl -dsuppress-all Fib.hs -fforce-recomp -O2
[1 of 1] Compiling Fib ( Fib.hs, Fib.o )
==================== Tidy Core ====================
Result size of Tidy Core = {terms: 52, types: 59, coercions: 0}
fibs3
fibs3 = __integer 1
fibs4
(add-hook 'haskell-mode-hook
(lambda () (add-hook 'before-save-hook 'kill-warnings-buffer nil 'make-it-local)))
(defun kill-warnings-buffer ()
(when (get-buffer "*Warnings*")
(kill-buffer "*Warnings*")))
;; Projectile
(progn
(require 'projectile)
(projectile-global-mode)
(setq projectile-indexing-method 'alien)
(setq projectile-enable-caching t))
;; Relax the GC
(setq gc-cons-threshold 20000000)
data Static = X | Y
resource :: Resource WithA WithB Ident Void Static
resource = mkResourceReader
{ R.name = "foo"
, R.schema = noListing $ named
[ ("id" , singleRead ById )
, ( "x" , static X )
, ( "y" , static Y )
]
// x :: Either (Either a b) c -> Either a (Either b c)
// x = either (either Left (Right . Left)) (Right . Right)
interface Either<A,B> {
left? : A;
right? : B;
}
class Fns
{
#!/bin/bash
cabal configure && cabal build && cabal haddock --hyperlink-source --html-location='http://localhost:8080/package/$pkg/docs' --contents-location='http://localhost:8080/package/$pkg'
S=$?
if [ "${S}" -eq "0" ]; then
cd "dist/doc/html"
DDIR="${1}-${2}-docs"
cp -r "${1}" "${DDIR}" && tar -c -v -z --format=ustar -f "${DDIR}.tar.gz" "${DDIR}"
CS=$?
if [ "${CS}" -eq "0" ]; then
echo "Uploading to Hackage…"
example/Example.hs:1:1: Splicing declarations
mkId ''Id
======>
example/Example.hs:25:1-9
unsafeId :: UUID -> Id
unsafeId = Id
unsafeId' :: UUID -> Maybe Id
unsafeId' = (.) Just Id
instance FromField Id where
fromField = fromFieldAux unsafeId'