Skip to content

Instantly share code, notes, and snippets.

View mwotton's full-sized avatar

Mark Wotton mwotton

View GitHub Profile
orb ➜ ~/projects/meanpath/spider/lambdaspider git:(pipes) ✗ (grep --line-buffered '' - || echo "grep died") & (echo "once"; inotifywait -m -r . -e CLOSE_WRITE |grep --line-buffered '\.hs$' | grep -v --line-buffered flymake | collapse | while read x; do echo ":reload\n:main --rerun" ; done) | cabal repl tests
[1] 25067
[1] + 25067 suspended (tty input) ( grep --line-buffered '' - || echo "grep died"; )
Setting up watches. Beware: since -r was given, this may take a while!
delete :: Ord k => k -> Map k a -> Map k a
delete = go
where
go :: Ord k => k -> Map k a -> Map k a
go _ Tip = Tip
go k (Bin _ kx x l r) =
case compare k kx of
LT -> balanceR kx x (go k l) r
GT -> balanceL kx x l (go k r)
EQ -> glue l r
Configuring direct-sqlite-2.3.14...
Building direct-sqlite-2.3.14...
Preprocessing library direct-sqlite-2.3.14...
[1 of 4] Compiling Database.SQLite3.Bindings.Types ( dist/dist-sandbox-14c711/build/Database/SQLite3/Bindings/Types.hs, dist/dist-sandbox-14c711/build/Database/SQLite3/Bindings/Types.js_o )
[2 of 4] Compiling Database.SQLite3.Bindings ( Database/SQLite3/Bindings.hs, dist/dist-sandbox-14c711/build/Database/SQLite3/Bindings.js_o )
ghcjs-0.1.0-7.8.3.bin: panic! (the 'impossible' happened)
(GHC version 7.8.3 for x86_64-unknown-linux):
applyTypeToArgs
Expression: {__pkg_ccall h$mkExportDyn GHC.Prim.Addr#
-> forall a.
-- Initial caveman.cabal generated by cabal init. For further
-- documentation, see http://haskell.org/cabal/users-guide/
name: caveman
version: 0.1.0.0
-- synopsis:
-- description:
license: AllRightsReserved
license-file: LICENSE
author: Mark Wotton
orb ➜ ~ cat mb.hs
import Data.Set
loseDupes :: [Int] -> [Int]
loseDupes = toList . fromList
main = getContents >>= print . loseDupes . read
orb ➜ ~ ghcjs mb.hs
Linking mb.jsexe (Main)
orb ➜ ~ echo '[1,2,22,2,2,3]' | node mb.jsexe/all.js
0
[1,2,3,22]
domChar x = a ! x
where
a :: UArray Char Bool
a = array (minBound, maxBound) $ map (\x -> (x,f x)) [minBound..maxBound]
f = (\x -> isAlphaNum x || x `elem` ".-")
componentChar x = a ! x
where
a :: UArray Char Bool
{-# LANGUAGE InstanceSigs, OverloadedStrings #-}
module Text.Parser.Selmer where
import Control.Applicative
import Data.Char (isAlpha)
import Data.Map.Lazy (Map)
import qualified Data.Map.Lazy as M
import Data.Maybe (fromMaybe)
import Data.Monoid
Sun Oct 5 12:40 2014 Time and Allocation Profiling Report (Final)
english +RTS -p -RTS
total time = 6.76 secs (6761 ticks @ 1000 us, 1 processor)
total alloc = 9,011,443,760 bytes (excludes profiling overheads)
COST CENTRE MODULE %time %alloc
aggregate Text.CTK.Lexers 44.0 26.8
import Control.Monad
import System.IO
main :: IO ()
main = do
hSetBuffering stdout LineBuffering
forever $ do
getLine >> emptyStdin
putStrLn "x"
orb ➜ ~ cat test5.hs
main = print $ heead [1..10]
orb ➜ ~ ghci test5.hs
GHCi, version 7.8.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( test5.hs, interpreted )
test5.hs:1:16: