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
(defun which (file path) | |
(catch 'loop | |
(while path | |
(if (file-exists-p (expand-file-name file (car path))) | |
(throw 'loop (message "%s" (expand-file-name file (car path)))) | |
(setq path (cdr path)))))) |
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 ForeignFunctionInterface #-} | |
import Control.Concurrent | |
import Foreign.C.Types | |
import Foreign.C.Error | |
main :: IO () | |
main = do | |
s <- c_socket 2 1 0 | |
forkIO $ do |
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 DeriveDataTypeable, RankNTypes #-} | |
-- FIXME: should we replace Data with System? | |
module Data.AutoUpdate where | |
import Control.Applicative ((<$>)) | |
import Data.IORef | |
import Control.Concurrent (threadDelay, forkIOWithUnmask) | |
import Control.Monad (forever, void) | |
import Control.Exception (Exception, SomeException(..), handle, catches, throwIO, assert, Handler(..), mask) | |
import Data.Typeable (Typeable) |
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 DeriveDataTypeable #-} | |
-- FIXME: should we replace Data with System? | |
module Data.AutoUpdate where | |
import Control.Applicative ((<$>)) | |
import Data.IORef | |
import Control.Concurrent (threadDelay, forkIO, ThreadId, myThreadId) | |
import Control.Monad (forever) | |
import Control.Exception (throwTo, Exception, handle, fromException, throwIO, assert, SomeException) | |
import Data.Typeable (Typeable) |
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 OverloadedStrings #-} | |
module Main where | |
import qualified Data.Text as T | |
import qualified Data.Text.IO as T | |
import System.IO | |
main :: IO () | |
main = do |
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 DeriveDataTypeable #-} | |
module A where | |
import Data.Typeable (Typeable) | |
import Data.Generics (everywhere, mkT, Data) | |
data T = Tree [U] deriving (Show,Data,Typeable) | |
data U = I Int | T T deriving (Show,Data,Typeable) |
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
-- | This JSON package retains the order of array elements. | |
-- JSON: http://www.ietf.org/rfc/rfc4627.txt | |
module JSON ( | |
JSON(..) | |
, parseJSON | |
) where | |
import Control.Applicative ((<*),(*>),(<$>),(<$)) | |
import Control.Monad (void) |
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
module LCS where | |
import Data.Function.Memoize | |
data Z = A | B | C | D | G | T | X deriving (Eq,Enum,Show) | |
x1 :: [Z] | |
x1 = [A,B,C,B,D,A,B] | |
y1 :: [Z] | |
y1 = [B,D,C,A,B,A] |
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 OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-} | |
import Yesod | |
import Network.HTTP.Types (status200) | |
data App = App | |
mkYesod "App" [parseRoutes| | |
/home HomeR GET | |
|] |
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
(load "haskell-site-file") | |
(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation) | |
(add-hook 'haskell-mode-hook 'turn-on-font-lock) | |
(defun haskell-style () | |
"Sets the current buffer to use Haskell Style. Meant to be | |
added to `haskell-mode-hook'" | |
(setq tab-width 4 | |
haskell-indentation-layout-offset 4 | |
haskell-indentation-left-offset 4 |