Skip to content

Instantly share code, notes, and snippets.

Max A.K. max630

View GitHub Profile
@max630
max630 / MainCLI.hs
Last active Feb 8, 2018
testing prime speed
View MainCLI.hs
module Main where
import System.Environment(getArgs)
import qualified Prime
main :: IO ()
main = do
a <- getArgs
Prime.main (a !! 0) (read (a !! 1))
@max630
max630 / LibTest.hs
Created Nov 28, 2011
stage restriction for instances in quotations
View LibTest.hs
{-# LANGUAGE TemplateHaskell #-}
module LibTest where
import Language.Haskell.TH.Ppr (pprint)
import Language.Haskell.TH.Syntax (runQ, Lit(StringL), reify)
import Language.Haskell.TH.Lib (litE)
import Monad (liftM)
import Data.Typeable (typeOf)
import Language.Haskell.TH.Syntax (Q, Exp)
@max630
max630 / H.hs
Created Dec 21, 2011
Уточнение типа по мере продвижения по файлу
View H.hs
{-# LANGUAGE TemplateHaskell #-}
module H where
import Language.Haskell.TH
f = [42]
$(do
i <- reify (mkName "f")
runIO (print i)
@max630
max630 / main.rb
Created Feb 1, 2012
ruby "instance" WTF
View main.rb
def showA0()
puts self.class
puts @a
end
class B
def showA(t)
@a = t
showA0()
end
View AccessorTemplateExpr.hs
{-# LANGUAGE TemplateHaskell, ViewPatterns #-}
module AccessorTemplateExpr where
import Language.Haskell.TH (reify, runIO, Info(TyConI), Dec(DataD), ppr, Con(NormalC, RecC), newName,
tupE, appE, lamE, varE, conE,
conP, varP, wildP)
import Data.Accessor.Basic (fromSetGet)
makeAccessors typeName = do
info <- reify typeName
@max630
max630 / a.hs
Created Feb 28, 2012
parser for a toy programming language
View a.hs
parseExprControl =
do {
label <- try (do { l <- p_name; p_eq [Spec ":"]; return l})
; e <- parseExprControl
; return (Label label e)
}
<|> do {
try (p_eq [Spec "def"])
; name <- p_name
; p_eq [Spec "="]
@max630
max630 / IOFrontend.hs
Created May 26, 2012
Enumerator-based IO Frontend for JSON-RPC
View IOFrontend.hs
module IOFrontend where
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Aeson as A
import qualified Data.Attoparsec as AP
import qualified Data.ByteString.Lazy as BSL
import qualified Data.Enumerator as E
import qualified Data.Enumerator.Binary as EB
import qualified Data.Enumerator.List as EL
import qualified GHC.IO.Handle as GIO
@max630
max630 / gist:2872656
Created Jun 5, 2012
Russian phonetic layout for MS Keyboard Layout Creator
View gist:2872656
KBD RU2 "Russian Phonetic"
COPYRIGHT "(c) 2011 "
COMPANY "Max"
LOCALEID "00000419"
VERSION 1.0
You can’t perform that action at this time.