This file contains hidden or 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 RankNTypes #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Run ( | |
runner | |
) where | |
import Control.Monad.Reader (ReaderT, runReaderT) | |
import Data.Foldable (traverse_) |
This file contains hidden or 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
:set prompt "> " | |
:set -isrc | |
:load Main |
This file contains hidden or 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
sublime3 and ghcid setup for quick haskell coding feedback | |
tested on sublime 3 | |
(you can omit the SublimeOnSaveBuild steps, as the result is not | |
completely reliable anyways. i still find it useful, though.) | |
steps: | |
- install https://github.com/lspitzner/SublimeOnSaveBuild | |
(original from alexnj; in his/her version the build-window gets closed |
This file contains hidden or 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 ScopedTypeVariables #-} | |
import Reflex.Dom | |
import GHCJS.DOM.CanvasRenderingContext2D (putImageData, setFillStyle, fillRect) | |
import GHCJS.DOM.HTMLCanvasElement (getContext) | |
import GHCJS.DOM.ImageData (newImageData') | |
import Control.Monad.IO.Class (liftIO) | |
import GHCJS.DOM.Types (CanvasStyle(..), CanvasRenderingContext2D(..), toJSString, castToHTMLCanvasElement) | |
import GHCJS.Marshal (toJSVal) | |
import Data.Time (getCurrentTime) |
This file contains hidden or 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
# test | |
- list | |
\begin{code} | |
main = print 1 | |
\end{code} | |
1. num | |
2. bers |
This file contains hidden or 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
-- Good | |
import Database.Persist.Sql | |
toSqlKey 1 :: UserId | |
-- Bad | |
Prelude.read "UserKey {unUserKey = SqlBackendKey {unSqlBackendKey = 1}}" :: UserId |
This file contains hidden or 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
import Text.Printf | |
import ComposeLTR | |
main = do | |
print ls | |
print lsd | |
-- [26,56,114,222,398,628,857,1033,1141,1199,1229,1243] | |
-- [26,30,58,108,176,230,229,176,108,58,30,14] | |
ln |
This file contains hidden or 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
import qualified Data.HashMap as HM | |
hmAt :: (Functor f, Ord t, Hashable t) => t -> (Maybe a -> f b) -> HM.Map t a -> f t1 | |
hmAt k = lens g s | |
where | |
s v = HM.insert k v | |
g = HM.lookup k |
This file contains hidden or 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
import Data.IORef | |
import System.Exit (exitSuccess, ExitCode(ExitSuccess)) | |
import Control.Concurrent | |
import System.Posix.Signals -- (installHandler, Handler(Catch), sigINT, sigTERM) | |
import Control.Concurrent.Lock ( Lock ) | |
import qualified Control.Concurrent.Lock as Lock | |
forkIOInterruptible io = do | |
ctid <- forkIO io | |
tid <- myThreadId |
This file contains hidden or 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
import re | |
import terminatorlib.plugin as plugin | |
import subprocess | |
# Every plugin you want Terminator to load *must* be listed in 'AVAILABLE' | |
AVAILABLE = ['FileURLHandler'] | |
class FileURLHandler(plugin.URLHandler): | |
capabilities = ['url_handler'] | |
handler_name = 'file_path' |