├── Snippets ├── \.plist ├── t <- f t.tmSnippet ├── Main.tmSnippet ├── Instance.tmSnippet ├── module.plist └── Case.tmSnippet ├── Preferences ├── Symbol List.tmPreferences ├── Indent Patterns.plist ├── Comments.tmPreferences └── Typing Pairs.plist ├── Support └── bin │ ├── haskellmate │ └── haskelltype ├── Commands ├── Show Type.tmCommand ├── Run.plist ├── Show Core.tmCommand ├── Show Core2Core.tmCommand ├── Lookup on Hoogle.tmCommand ├── Infix Function Call from Selection : Word.tmCommand └── Load in GHCi.tmCommand ├── Syntaxes ├── Literate Haskell.plist └── Haskell.plist └── info.plist /Snippets/\.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | \\${1:t} -> ${0:f t} 7 | name 8 | \t -> f t 9 | scope 10 | source.haskell 11 | tabTrigger 12 | \ 13 | uuid 14 | 89248B78-C2C6-48EE-BC47-CF8E9A5EA0E7 15 | 16 | 17 | -------------------------------------------------------------------------------- /Snippets/t <- f t.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | ${1:t} <- ${0:f t} 7 | keyEquivalent 8 | ^, 9 | name 10 | t <- f t 11 | scope 12 | source.haskell 13 | uuid 14 | 4B154C05-D107-4316-9AAD-43A3DCF1860A 15 | 16 | 17 | -------------------------------------------------------------------------------- /Preferences/Symbol List.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Symbol List 7 | scope 8 | source.haskell entity.name.function.infix 9 | settings 10 | 11 | showInSymbolList 12 | 0 13 | 14 | uuid 15 | 0C39B945-E2C0-4E43-8A5B-332F6FA73C67 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/Main.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | module Main where 7 | 8 | main = ${1:putStrLn "Hello World"} 9 | name 10 | Main 11 | scope 12 | source.haskell 13 | tabTrigger 14 | main 15 | uuid 16 | A3A65891-D126-4D2D-9E6B-E20ADE2EAA88 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Instance.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | instance ${1:Class} ${2:Data} where 7 | ${3:func} = $0 8 | name 9 | Instance 10 | scope 11 | source.haskell 12 | tabTrigger 13 | instance 14 | uuid 15 | CE424A97-E486-4DE7-9328-C6ADB99B4ABD 16 | 17 | 18 | -------------------------------------------------------------------------------- /Snippets/module.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | module ${1:Main} where 7 | 8 | ${2:main = ${3:putStrLn "Hello World"}} 9 | name 10 | Module 11 | scope 12 | source.haskell 13 | tabTrigger 14 | mod 15 | uuid 16 | 21646767-DD1B-4BA9-BF3B-15968F8672AB 17 | 18 | 19 | -------------------------------------------------------------------------------- /Snippets/Case.tmSnippet: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | content 6 | case ${1:a} of ${2:True} -> ${3:$1} 7 | ${1/./ /g} ${4:otherwise} -> ${0:$1} 8 | name 9 | Case 10 | scope 11 | source.haskell 12 | tabTrigger 13 | case 14 | uuid 15 | 18F43074-566D-4AD9-8DCE-9C26B8516B64 16 | 17 | 18 | -------------------------------------------------------------------------------- /Support/bin/haskellmate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | 4 | 5 | require 'cgi' 6 | puts "
"
 7 | def proper_escape fname
 8 |   fname.split('/').each{|s| CGI.escape s}.join('/')
 9 | end
10 | 
11 | 
12 | until (STDIN.eof?)
13 |   s = CGI.escapeHTML(STDIN.readline)
14 |   m = s.match(/(.*?):(\d+):(\d+):/)
15 |   fname, line, column = m[1..3] if m
16 |   if m && File.exist?(fname)
17 | #     puts line
18 |     s.gsub!(/#{fname}:#{line}:#{column}/,"#{fname}:#{line}:#{column}")
19 |   end
20 |   puts s
21 |   STDOUT.flush
22 | end
23 | 
24 | puts "
" -------------------------------------------------------------------------------- /Preferences/Indent Patterns.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Indent Patterns 7 | scope 8 | source.haskell 9 | settings 10 | 11 | increaseIndentPattern 12 | ((^.*(=|\bdo|\bwhere|\bthen|\belse|\bof)\s*$)|(^.*\bif(?!.*\bthen\b.*\belse\b.*).*$)) 13 | 14 | uuid 15 | 39417FB9-B85C-4213-BB1D-C19BCDD4E487 16 | 17 | 18 | -------------------------------------------------------------------------------- /Commands/Show Type.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | haskelltype "${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" 9 | input 10 | none 11 | keyEquivalent 12 | ^h 13 | name 14 | Show Type 15 | output 16 | showAsTooltip 17 | scope 18 | source.haskell 19 | uuid 20 | 6B723007-D4EE-476B-8282-76230C559D5A 21 | 22 | 23 | -------------------------------------------------------------------------------- /Commands/Run.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveActiveFile 7 | command 8 | : ${TM_HASKELL:=runhaskell} 9 | require_cmd "$TM_HASKELL" 10 | 11 | "$TM_HASKELL" "$TM_FILEPATH" 2>&1 | haskellmate 12 | 13 | 14 | input 15 | none 16 | keyEquivalent 17 | @r 18 | name 19 | Run 20 | output 21 | showAsHTML 22 | scope 23 | source.haskell 24 | uuid 25 | 3B083BE7-9812-4F06-A758-CCAD9514E797 26 | 27 | 28 | -------------------------------------------------------------------------------- /Commands/Show Core.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveActiveFile 7 | command 8 | : ${TM_GHC:=ghc} 9 | require_cmd "$TM_GHC" 10 | 11 | "$TM_GHC" -O2 -c -ddump-simpl "$TM_FILEPATH" 2>&1 | tail -n +2 12 | 13 | input 14 | none 15 | keyEquivalent 16 | @C 17 | name 18 | Show Core 19 | output 20 | openAsNewDocument 21 | scope 22 | source.haskell 23 | uuid 24 | F3E0D494-2845-4917-BF3A-A08507974688 25 | 26 | 27 | -------------------------------------------------------------------------------- /Commands/Show Core2Core.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | saveActiveFile 7 | command 8 | : ${TM_GHC:=ghc} 9 | require_cmd "$TM_GHC" 10 | 11 | "$TM_GHC" -O2 -c -dverbose-core2core "$TM_FILEPATH" 2>&1 | tail -n +2 12 | 13 | input 14 | none 15 | keyEquivalent 16 | @@ 17 | name 18 | Show Core2Core 19 | output 20 | openAsNewDocument 21 | scope 22 | source.haskell 23 | uuid 24 | 07B760AF-EFD5-4E29-BDFD-60D242891DF5 25 | 26 | 27 | -------------------------------------------------------------------------------- /Commands/Lookup on Hoogle.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | echo "<meta http-equiv=\"refresh\" content=\"0; http://haskell.org/hoogle/?q=${TM_SELECTED_TEXT:=$TM_CURRENT_WORD}\">" 9 | fallbackInput 10 | word 11 | input 12 | none 13 | keyEquivalent 14 | ^H 15 | name 16 | Lookup on Hoogle 17 | output 18 | showAsHTML 19 | scope 20 | source.haskell 21 | uuid 22 | 50D814AE-D850-4C97-AF3E-1FDE4366C6A3 23 | 24 | 25 | -------------------------------------------------------------------------------- /Preferences/Comments.tmPreferences: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Comments 7 | scope 8 | source.haskell 9 | settings 10 | 11 | shellVariables 12 | 13 | 14 | name 15 | TM_COMMENT_START_2 16 | value 17 | {- 18 | 19 | 20 | name 21 | TM_COMMENT_END_2 22 | value 23 | -} 24 | 25 | 26 | name 27 | TM_COMMENT_START 28 | value 29 | -- 30 | 31 | 32 | 33 | uuid 34 | E3994307-4D9E-44D6-832E-52C244F1CDF3 35 | 36 | 37 | -------------------------------------------------------------------------------- /Commands/Infix Function Call from Selection : Word.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/usr/bin/env python 9 | 10 | import sys 11 | x = sys.stdin.read().strip() 12 | if x: 13 | sys.stdout.write("\`%s\`$0" % x) 14 | else: 15 | sys.stdout.write("\`$1\`$0") 16 | 17 | fallbackInput 18 | word 19 | input 20 | selection 21 | keyEquivalent 22 | ^' 23 | name 24 | Infix Function Call From Word / Selection 25 | output 26 | insertAsSnippet 27 | scope 28 | source.haskell 29 | uuid 30 | FA4AA254-EB7D-4B43-AC67-066AA9E8E8D9 31 | 32 | 33 | -------------------------------------------------------------------------------- /Preferences/Typing Pairs.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | name 6 | Typing Pairs 7 | scope 8 | source.haskell 9 | settings 10 | 11 | smartTypingPairs 12 | 13 | 14 | " 15 | " 16 | 17 | 18 | { 19 | } 20 | 21 | 22 | [ 23 | ] 24 | 25 | 26 | 27 | 28 | 29 | 30 | ( 31 | ) 32 | 33 | 34 | ` 35 | ` 36 | 37 | 38 | 39 | uuid 40 | FBF9D932-D5CE-4EC4-9162-122E511C8627 41 | 42 | 43 | -------------------------------------------------------------------------------- /Commands/Load in GHCi.tmCommand: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | beforeRunningCommand 6 | nop 7 | command 8 | #!/bin/bash 9 | 10 | THASKELL=${TM_HASKELL:-ghci} 11 | 12 | esc () { 13 | STR="$1" ruby <<"RUBY" 14 | str = ENV['STR'] 15 | str = str.gsub(/'/, "'\\\\''") 16 | str = str.gsub(/[\\"]/, '\\\\\\0') 17 | print "'#{str}'" 18 | RUBY 19 | } 20 | 21 | osascript <<- APPLESCRIPT 22 | tell app "Terminal" 23 | launch 24 | activate 25 | do script "clear; cd $(esc "${TM_DIRECTORY}"); ${THASKELL} $(esc "${TM_FILEPATH}")" 26 | set position of first window to {100, 100} 27 | end tell 28 | APPLESCRIPT 29 | 30 | input 31 | none 32 | keyEquivalent 33 | @R 34 | name 35 | Load in GHCi 36 | output 37 | showAsTooltip 38 | scope 39 | source.haskell 40 | uuid 41 | 2242C46C-153E-4EEB-B80B-A5398559D759 42 | 43 | 44 | -------------------------------------------------------------------------------- /Syntaxes/Literate Haskell.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | lhs 8 | 9 | keyEquivalent 10 | ^~H 11 | name 12 | Literate Haskell 13 | patterns 14 | 15 | 16 | begin 17 | ^((\\)begin)({)code(})(\s*\n)? 18 | captures 19 | 20 | 1 21 | 22 | name 23 | support.function.be.latex 24 | 25 | 2 26 | 27 | name 28 | punctuation.definition.function.latex 29 | 30 | 3 31 | 32 | name 33 | punctuation.definition.arguments.begin.latex 34 | 35 | 4 36 | 37 | name 38 | punctuation.definition.arguments.end.latex 39 | 40 | 41 | contentName 42 | source.haskell.embedded.latex 43 | end 44 | ^((\\)end)({)code(}) 45 | name 46 | meta.function.embedded.haskell.latex 47 | patterns 48 | 49 | 50 | include 51 | source.haskell 52 | 53 | 54 | 55 | 56 | begin 57 | ^(> ) 58 | beginCaptures 59 | 60 | 1 61 | 62 | name 63 | punctuation.definition.bird-track.haskell 64 | 65 | 66 | comment 67 | This breaks type signature detection for now, but it's better than having no highlighting whatsoever. 68 | end 69 | $ 70 | name 71 | meta.embedded.haskell 72 | patterns 73 | 74 | 75 | include 76 | source.haskell 77 | 78 | 79 | 80 | 81 | include 82 | text.tex.latex 83 | 84 | 85 | scopeName 86 | text.tex.latex.haskell 87 | uuid 88 | 439807F5-7129-487D-B5DC-95D5272B43DD 89 | 90 | 91 | -------------------------------------------------------------------------------- /info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | contactEmailRot13 6 | wnzvf@37fvtanyf.pbz 7 | contactName 8 | Jamis Buck 9 | description 10 | Support for <a href="http://www.haskell.org/">Haskell</a>, a general purpose, purely functional programming language featuring static typing, higher order functions, polymorphism, type classes, and monadic effects. 11 | mainMenu 12 | 13 | items 14 | 15 | 3B083BE7-9812-4F06-A758-CCAD9514E797 16 | 2242C46C-153E-4EEB-B80B-A5398559D759 17 | ------------------------------------ 18 | 6B723007-D4EE-476B-8282-76230C559D5A 19 | 50D814AE-D850-4C97-AF3E-1FDE4366C6A3 20 | ------------------------------------ 21 | FA4AA254-EB7D-4B43-AC67-066AA9E8E8D9 22 | ------------------------------------ 23 | A3A65891-D126-4D2D-9E6B-E20ADE2EAA88 24 | 21646767-DD1B-4BA9-BF3B-15968F8672AB 25 | 18F43074-566D-4AD9-8DCE-9C26B8516B64 26 | CE424A97-E486-4DE7-9328-C6ADB99B4ABD 27 | ------------------------------------ 28 | 89248B78-C2C6-48EE-BC47-CF8E9A5EA0E7 29 | 30 | submenus 31 | 32 | 33 | name 34 | Haskell 35 | ordering 36 | 37 | 3B083BE7-9812-4F06-A758-CCAD9514E797 38 | 2242C46C-153E-4EEB-B80B-A5398559D759 39 | 6B723007-D4EE-476B-8282-76230C559D5A 40 | 50D814AE-D850-4C97-AF3E-1FDE4366C6A3 41 | FA4AA254-EB7D-4B43-AC67-066AA9E8E8D9 42 | A3A65891-D126-4D2D-9E6B-E20ADE2EAA88 43 | 21646767-DD1B-4BA9-BF3B-15968F8672AB 44 | 18F43074-566D-4AD9-8DCE-9C26B8516B64 45 | CE424A97-E486-4DE7-9328-C6ADB99B4ABD 46 | 89248B78-C2C6-48EE-BC47-CF8E9A5EA0E7 47 | 4B154C05-D107-4316-9AAD-43A3DCF1860A 48 | 5C034675-1F6D-497E-8073-369D37E2FD7D 49 | 439807F5-7129-487D-B5DC-95D5272B43DD 50 | E3994307-4D9E-44D6-832E-52C244F1CDF3 51 | 39417FB9-B85C-4213-BB1D-C19BCDD4E487 52 | 0C39B945-E2C0-4E43-8A5B-332F6FA73C67 53 | FBF9D932-D5CE-4EC4-9162-122E511C8627 54 | 55 | uuid 56 | 118557A4-4FEF-406D-A68E-BD191D9CBC83 57 | 58 | 59 | -------------------------------------------------------------------------------- /Support/bin/haskelltype: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby -w 2 | 3 | word = ARGV.first 4 | 5 | prelude = ' 6 | (!!) :: [a] -> Int -> a ||||| [0,1,2] !! 1 = 1 7 | ($) :: (a -> b) -> a -> b ||||| f x $ g y = f x (g y) 8 | ($!) :: (a -> b) -> (a -> b) ||||| 9 | (&&) :: Bool -> Bool -> Bool ||||| Boolean \'and\' 10 | (||) :: Bool -> Bool -> Bool ||||| Boolean \'or\' 11 | (*) :: Num a => a -> a -> a ||||| Multiplication 12 | (**) :: Floating a => a -> a -> a ||||| Exponentiation 13 | (+) :: Num a => a -> a -> a ||||| Addition 14 | (++) :: [a] -> [a] -> [a] ||||| Concatonation: "abc" ++ "def" = "abcdef" 15 | (-) :: Num a => a -> a -> a ||||| Subtraction 16 | (.) :: (b -> c) -> (a -> b) -> a -> c ||||| Function composition 17 | (/) :: Fractional a => a -> a -> a ||||| Division 18 | (/=) :: Eq a => a -> a -> Bool ||||| not equal 19 | (<) :: Ord a => a -> a -> Bool ||||| Less Than 20 | (<=) :: Ord a => a -> a -> Bool ||||| Less Than or Equal To 21 | (==) :: Eq a => a -> a -> Bool ||||| Equality 22 | (=<<) :: Monad a => (a -> m b) -> m a -> m b ||||| Monadic binding 23 | (>) :: Ord a => a -> a -> Bool ||||| Greater Than 24 | (>=) :: Ord a => a -> a -> Bool ||||| Greater Than or Equal To 25 | (>>) :: Monad m => m a -> m b -> m b ||||| Monadic binding 26 | (>>=) :: Monad m => m a -> (a -> m b) -> m b ||||| Monadic binding 27 | (^) :: (Num a, Integral b) => a -> b -> a ||||| Exponentiation 28 | (^^) :: (Fractional a, Integral b) => a -> b -> a ||||| negative exponent allowed 29 | abs :: Num a => a -> a ||||| Absolute Value 30 | acos :: Floating a => a -> a ||||| Arccosine 31 | acosh :: Floating a => a -> a ||||| Hyperbolic Arccosine 32 | all :: (a -> Bool) -> [a] -> Bool ||||| all (/= \'a\') "cba" = False 33 | and :: [Bool] -> Bool ||||| and [True, True, True] = True 34 | any :: (a -> Bool) -> [a] -> Bool ||||| any (== \'c\') "abc" = True 35 | appendFile :: FilePath -> String -> IO () ||||| Appends String to FilePath 36 | applyM :: Monad m => (a -> m b) -> m a -> m b ||||| 37 | asTypeOf :: a -> a -> a ||||| Sort of a type cast 38 | asin :: Floating a => a -> a ||||| Arcsine 39 | asinh :: Floating a => a -> a ||||| Hyperbolic Arcsine 40 | atan :: Floating a => a -> a ||||| Arctangent 41 | atan2 :: RealFrac a => a -> a ||||| ArcTangent 42 | atanh :: Floating a => a -> a ||||| Hyperbolic Arctangent 43 | break :: (a -> Bool) -> [a] -> ([a], [a]) ||||| break (<2) [1,2,3] = ([1],[2,3]) 44 | catch :: IO a -> (IOError -> IO a) -> IO a ||||| 45 | ceiling :: (RealFrac a, Integral b) => a -> b ||||| 46 | compare :: Ord a => a -> a -> Ordering ||||| 47 | concat :: MonadPlus m => [m a] -> m a ||||| concat ["a","bc","d"] = "abcd" 48 | concatMap :: (a -> [b]) -> [a] -> [b] ||||| 49 | const :: a -> b -> a ||||| 50 | cos :: Floating a => a -> a ||||| 51 | cosh :: Floating a => a -> a ||||| 52 | curry :: ((a, b) -> c) -> a -> b -> c ||||| 53 | cycle :: [a] -> [a] ||||| cycle "abc" = "abcabcabc... 54 | decodeFloat :: RealFloat a => a -> (Integer, Int) ||||| 55 | div :: Integral a => a -> a -> a ||||| 56 | divMod :: Integral a => a -> a -> (a, a) ||||| 57 | drop :: Int -> [a] -> [a] ||||| drop 2 "abcd" = "cd" 58 | dropWhile :: (a -> Bool) -> [a] -> [a] ||||| dropWhile (>3) [5,3,5] = [3,5] 59 | elem :: Eq a => a -> [a] -> Bool ||||| \'a\' \'elem\' "abc" = True 60 | encodeFloat :: RealFloat a => Integer -> Int -> a ||||| 61 | enumFrom :: Enum a => a -> [a] ||||| [n..] 62 | enumFromThen :: Enum a => a -> a -> [a] ||||| [m,n..] 63 | enumFromThenTo :: Enum a => a -> a -> a -> [a] ||||| [m,n..o] 64 | enumFromTo :: Enum a => a -> a -> [a] ||||| [m..n] 65 | error :: String -> a ||||| 66 | even :: Integral a => a -> Bool ||||| 67 | exp :: Floating a => a -> a ||||| 68 | exponent :: RealFloat a => a -> Int ||||| 69 | fail :: Monad m => String -> m a ||||| 70 | filter :: (a -> Bool) -> [a] -> [a] ||||| 71 | flip :: (a -> b -> c) -> (b -> a -> c) ||||| 72 | floatDigits :: RealFloat a => a -> Int ||||| 73 | floatRadix :: RealFloat a => a -> Integer ||||| 74 | floatRange :: RealFloat a => a -> (Int, Int) ||||| 75 | floor :: (RealFrac a, Integral b) => a -> b ||||| 76 | fmap :: Functor f => (a -> b) -> f a -> f b ||||| 77 | foldl :: (a -> b -> a) -> a -> [b] -> a ||||| foldl (+) 0 [a,b,c] = ((0+a)+b)+c 78 | foldl1 :: (a -> a -> a) -> [a] -> a ||||| foldl1 (+) [a,b,c] = (a+b)+c 79 | foldr :: (a -> b -> b) -> b -> [a] -> b ||||| foldr (+) 0 [a,b,c] = a+(b+(c+0)) 80 | foldr1 :: (a -> a -> a) -> [a] -> a ||||| foldr1 (+) [a,b,c] = a+(b+c) 81 | fromEnum :: Enum a => a -> Int ||||| 82 | fromInteger :: Num a => Integer -> a ||||| 83 | fromIntegral :: (Integral a, Num b) => a -> b ||||| 84 | fromRational :: Fractional a => Rational -> a ||||| 85 | fst :: (a, b) -> a ||||| 86 | gcd :: (Integral a) => a -> a -> a ||||| 87 | getChar :: IO Char ||||| eof generates an IOError 88 | getContents :: IO String ||||| 89 | getLine :: IO String ||||| eof generates an IOError 90 | head :: [a] -> a ||||| 91 | id :: a -> a ||||| 92 | init :: [a] -> [a] ||||| init "abcd" = "abc" 93 | interact :: (String -> String) -> IO () ||||| 94 | ioError :: IOError -> IO a ||||| 95 | isDenormalized :: RealFloat a => a -> Bool ||||| 96 | isIEEE :: RealFloat a => a -> Bool ||||| 97 | isInfinite :: RealFloat a => a -> Bool ||||| 98 | isNaN :: RealFloat a => a -> Bool ||||| 99 | isNegativeZero :: RealFloat a => a -> Bool ||||| 100 | iterate :: (a -> a) -> a -> [a] ||||| iterate (++ " ") "" = ["", " ", " ",...] 101 | last :: [a] -> a ||||| last "abcde" = "e" 102 | lcm :: Integral a => a -> a -> a ||||| 103 | length :: [a] -> Int ||||| length "Abc" = 3 104 | lex :: ReadS String ||||| lex "abc def" = [("abc"," def")] 105 | lines :: String -> [String] ||||| 106 | log :: Floating a => a -> a ||||| 107 | logBase :: Floating a => a -> a -> a ||||| 108 | lookup :: Eq a => a -> [(a, b)] -> Maybe b ||||| 109 | map :: (a -> b) -> [a] -> [b] ||||| 110 | mapM :: Monad m => (a -> m b) -> [a] -> m [b] ||||| 111 | mapM_ :: Monad m => (a -> m b) -> [a] -> m () ||||| 112 | max :: Ord a => a -> a -> a ||||| 113 | maxBound :: Bounded a => a ||||| 114 | maximum :: Ord a => [a] -> a ||||| 115 | maybe :: b -> (a -> b) -> Maybe a -> b ||||| maybe 0 (+1) (Just 1) = 2 116 | min :: Ord a => a -> a -> a ||||| 117 | minBound :: Bounded a => a ||||| 118 | minimum :: Ord a => [a] -> a ||||| 119 | mod :: Integral a => a -> a -> a ||||| 120 | negate :: Num a => a -> a ||||| 121 | not :: Bool -> Bool ||||| 122 | notElem :: Eq a => a -> [a] -> Bool ||||| 123 | null :: [a] -> Bool ||||| 124 | odd :: Integral a => a -> Bool ||||| 125 | or :: [Bool] -> Bool ||||| 126 | otherwise :: Bool ||||| 127 | pi :: Floating a => a ||||| 128 | pred :: Enum a => a -> a ||||| pred True = False 129 | print :: Show a => IO () ||||| adds a newline 130 | product :: Num a => [a] -> a ||||| 131 | properFraction :: (RealFrac a, Integral b) => a -> (b, a) ||||| 132 | putChar :: Char -> IO () ||||| 133 | putStr :: String -> IO () ||||| 134 | putStrLn :: String -> IO () ||||| adds a newline 135 | quot :: Integral a => a -> a -> a ||||| 136 | quotRem :: Integral a => a -> a -> (a, a) ||||| 137 | read :: Read a => String -> a ||||| 138 | readFile :: FilePath -> IO String ||||| 139 | readIO :: Read a => String -> IO a ||||| fails with IOError 140 | readList :: Read a => ReadS [a] ||||| 141 | readLn :: Read a => IO a ||||| 142 | readParen :: Bool -> ReadS a -> ReadS a ||||| 143 | reads :: Read a => ReadS a ||||| reads "1 2" :: [(Int,String)] = [(1," 2")] 144 | readsPrec :: Read a => Int -> ReadS a ||||| 145 | realToFrac :: (Real a, Fractional b) => a -> b ||||| 146 | recip :: Fractional a => a -> a ||||| 147 | rem :: Integral a => a -> a -> a ||||| 148 | repeat :: a -> [a] ||||| repeat \'a\' = "aaaaaaaaa..." 149 | replicate :: Int -> a -> [a] ||||| replicate 4 \'a\' = "aaaa" 150 | return :: Monad m => a -> m a ||||| 151 | reverse :: [a] -> [a] ||||| reverse "abc" = "cba" 152 | round :: (RealFrac a, Integral b) => a -> b ||||| 153 | scaleFloat :: RealFloat a => Int -> a -> a ||||| 154 | scanl :: (a -> b -> a) -> a -> [b] -> [a] ||||| scanl (+) 0 [1,2,3] = [0,1,3,6] 155 | scanl1 :: (a -> a -> a) -> [a] -> [a] ||||| scanl1 (+) [1,2,3] = [1,3,6] 156 | scanr :: (a -> b -> b) -> b -> [a] -> [b] ||||| scanr (+) 0 [1,2,3] = [6,5,3,0] 157 | scanr1 :: (a -> a -> a) -> [a] -> [a] ||||| scanr1 (+) [1,2,3] = [6,5,3] 158 | seq :: a -> b -> b ||||| 159 | sequence :: Monad m => [m a] -> m [a] ||||| 160 | sequence_ :: Monad m => [m a] -> m () ||||| do operations in sequence 161 | show :: Show a => a -> String ||||| 162 | showChar :: Char -> ShowS ||||| 163 | showList :: Show a => [a] -> ShowS ||||| 164 | showParen :: Bool -> ShowS -> ShowS ||||| 165 | showString :: String -> ShowS ||||| 166 | shows :: Show a => a -> ShowS ||||| 167 | showsPrec :: Show a => Int -> a -> ShowS ||||| 168 | significand :: RealFloat a => a -> a ||||| 169 | signum :: Num a => a -> a ||||| 170 | sin :: Floating a => a -> a ||||| 171 | sinh :: Floating a => a -> a ||||| 172 | snd :: (a, b) -> b ||||| 173 | span :: (a -> Bool) -> [a] -> ([a], [a]) ||||| span isAlpha "ab cd" = ("ab"," cd") 174 | splitAt :: Int -> [a] -> ([a], [a]) ||||| splitAt 2 "abcdef" = ("ab","cdef") 175 | sqrt :: Floating a => a -> a ||||| 176 | subtract :: Num a => a -> a -> a ||||| 177 | succ :: Enum a => a -> a ||||| succ False = True 178 | sum :: Num a => [a] -> a ||||| sum [1,2,3] = 6 179 | tail :: [a] -> [a] ||||| tail "abc" = "bc" 180 | take :: Int -> [a] -> [a] ||||| take 3 "abcde" = "abc" 181 | takeWhile :: (a -> Bool) -> [a] -> [a] ||||| takeWhile (> 2) [3,2,1] = [3] 182 | tan :: Floating a => a -> a ||||| 183 | tanh :: Floating a => a -> a ||||| 184 | toEnum :: Enum a => Int -> a ||||| toEnum 0 :: Bool = False 185 | toInteger :: Integral a => a -> Integer ||||| 186 | toRational :: Real a => a -> Rational ||||| 187 | truncate :: (RealFrac a, Integral b) => a -> b ||||| 188 | uncurry :: (a -> b -> c) -> ((a, b) -> c) ||||| 189 | undefined :: a ||||| 190 | unlines :: [String] -> String ||||| 191 | until :: (a -> Bool) -> (a -> a) -> a -> a ||||| until (> 3) (+ 2) 0 = 4 192 | unwords :: [String] -> String ||||| 193 | unzip :: [(a, b)] -> ([a], [b]) ||||| unzip [(\'a\',\'b\'),(\'c\',\'d\')] = ("ac",bd") 194 | unzip3 :: [(a, b, c)] -> ([a], [b], [c]) ||||| 195 | userError :: String -> IOError ||||| 196 | words :: String -> [String] ||||| words "ab d as+3" = ["ab","d","as+3"] 197 | writeFile :: FilePath -> String -> IO () ||||| 198 | zip :: [a] -> [b] -> [(a, b)] ||||| zip "abc" "de" = [(\'a\',\'d\'), (\'b\',e\')] 199 | zip3 :: [a] -> [b] -> [c] -> [(a, b, c)] ||||| 200 | zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] ||||| zipWith (+) [1,2] [3,4] = [4,6] 201 | zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] |||||' 202 | 203 | lookup = prelude.strip.split("\n").inject(Hash.new) { |h,l| 204 | name, desc = l.split("::") 205 | h[name.strip] = desc.split("|||||").map {|a| a.strip} 206 | h 207 | } 208 | 209 | if lookup[word] 210 | puts lookup[word] 211 | else 212 | STDIN.each do |line| 213 | name, desc = line.strip.split("::") 214 | if name and desc 215 | if name.split(",").map{|s| s.strip}.include?(word) 216 | puts desc.strip 217 | exit 218 | end 219 | end 220 | end 221 | puts "☿ It is a mystery ☿" 222 | end 223 | -------------------------------------------------------------------------------- /Syntaxes/Haskell.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | fileTypes 6 | 7 | hs 8 | 9 | firstLineMatch 10 | ^(Using\sbinary\spackage\sdatabase|====================\sTidy\sCore|#!/.*\b(runhaskell|runghc)|module\s) 11 | keyEquivalent 12 | ^~H 13 | name 14 | Haskell 15 | patterns 16 | 17 | 18 | captures 19 | 20 | 1 21 | 22 | name 23 | punctuation.definition.entity.haskell 24 | 25 | 2 26 | 27 | name 28 | punctuation.definition.entity.haskell 29 | 30 | 31 | comment 32 | In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]). 33 | match 34 | (`)[a-zA-Z_']*?(`) 35 | name 36 | keyword.operator.function.infix.haskell 37 | 38 | 39 | match 40 | \(\) 41 | name 42 | constant.language.unit.haskell 43 | 44 | 45 | match 46 | \[\] 47 | name 48 | constant.language.empty-list.haskell 49 | 50 | 51 | begin 52 | (module) 53 | beginCaptures 54 | 55 | 1 56 | 57 | name 58 | keyword.other.haskell 59 | 60 | 61 | end 62 | (where) 63 | endCaptures 64 | 65 | 1 66 | 67 | name 68 | keyword.other.haskell 69 | 70 | 71 | name 72 | meta.declaration.module.haskell 73 | patterns 74 | 75 | 76 | include 77 | #module_name 78 | 79 | 80 | include 81 | #module_exports 82 | 83 | 84 | match 85 | [a-z]+ 86 | name 87 | invalid 88 | 89 | 90 | 91 | 92 | begin 93 | \b(class)\b 94 | beginCaptures 95 | 96 | 1 97 | 98 | name 99 | keyword.other.haskell 100 | 101 | 102 | end 103 | \b(where)\b 104 | endCaptures 105 | 106 | 1 107 | 108 | name 109 | keyword.other.haskell 110 | 111 | 112 | name 113 | meta.declaration.class.haskell 114 | patterns 115 | 116 | 117 | match 118 | \b(Monad|Functor|Eq|Ord|Read|Show|Num|(Frac|Ra)tional|Enum|Bounded|Real(Frac|Float)?|Integral|Floating)\b 119 | name 120 | support.class.prelude.haskell 121 | 122 | 123 | match 124 | [A-Z][A-Za-z_']* 125 | name 126 | entity.other.inherited-class.haskell 127 | 128 | 129 | match 130 | \b[a-z][a-zA-Z0-9_']*\b 131 | name 132 | variable.other.generic-type.haskell 133 | 134 | 135 | 136 | 137 | begin 138 | \b(instance)\b 139 | beginCaptures 140 | 141 | 1 142 | 143 | name 144 | keyword.other.haskell 145 | 146 | 147 | end 148 | \b(where)\b|$ 149 | endCaptures 150 | 151 | 1 152 | 153 | name 154 | keyword.other.haskell 155 | 156 | 157 | name 158 | meta.declaration.instance.haskell 159 | patterns 160 | 161 | 162 | include 163 | #type_signature 164 | 165 | 166 | 167 | 168 | begin 169 | (import) 170 | beginCaptures 171 | 172 | 1 173 | 174 | name 175 | keyword.other.haskell 176 | 177 | 178 | end 179 | ($|;) 180 | name 181 | meta.import.haskell 182 | patterns 183 | 184 | 185 | match 186 | (qualified|as|hiding) 187 | name 188 | keyword.other.haskell 189 | 190 | 191 | include 192 | #module_name 193 | 194 | 195 | include 196 | #module_exports 197 | 198 | 199 | 200 | 201 | begin 202 | (deriving)\s*\( 203 | beginCaptures 204 | 205 | 1 206 | 207 | name 208 | keyword.other.haskell 209 | 210 | 211 | end 212 | \) 213 | name 214 | meta.deriving.haskell 215 | patterns 216 | 217 | 218 | match 219 | \b[A-Z][a-zA-Z_']* 220 | name 221 | entity.other.inherited-class.haskell 222 | 223 | 224 | 225 | 226 | match 227 | \b(deriving|where|data|type|case|of|let|in|newtype|default)\b 228 | name 229 | keyword.other.haskell 230 | 231 | 232 | match 233 | \binfix[lr]?\b 234 | name 235 | keyword.operator.haskell 236 | 237 | 238 | match 239 | \b(do|if|then|else)\b 240 | name 241 | keyword.control.haskell 242 | 243 | 244 | comment 245 | Floats are always decimal 246 | match 247 | \b([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\b 248 | name 249 | constant.numeric.float.haskell 250 | 251 | 252 | match 253 | \b([0-9]+|0([xX][0-9a-fA-F]+|[oO][0-7]+))\b 254 | name 255 | constant.numeric.haskell 256 | 257 | 258 | captures 259 | 260 | 1 261 | 262 | name 263 | punctuation.definition.preprocessor.c 264 | 265 | 266 | comment 267 | In addition to Haskell's "native" syntax, GHC permits the C preprocessor to be run on a source file. 268 | match 269 | ^\s*(#)\s*\w+ 270 | name 271 | meta.preprocessor.c 272 | 273 | 274 | include 275 | #pragma 276 | 277 | 278 | begin 279 | " 280 | beginCaptures 281 | 282 | 0 283 | 284 | name 285 | punctuation.definition.string.begin.haskell 286 | 287 | 288 | end 289 | " 290 | endCaptures 291 | 292 | 0 293 | 294 | name 295 | punctuation.definition.string.end.haskell 296 | 297 | 298 | name 299 | string.quoted.double.haskell 300 | patterns 301 | 302 | 303 | match 304 | \\(NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\"'\&]) 305 | name 306 | constant.character.escape.haskell 307 | 308 | 309 | match 310 | \\o[0-7]+|\\x[0-9A-Fa-f]+|\\[0-9]+ 311 | name 312 | constant.character.escape.octal.haskell 313 | 314 | 315 | match 316 | \^[A-Z@\[\]\\\^_] 317 | name 318 | constant.character.escape.control.haskell 319 | 320 | 321 | 322 | 323 | captures 324 | 325 | 1 326 | 327 | name 328 | punctuation.definition.string.begin.haskell 329 | 330 | 2 331 | 332 | name 333 | constant.character.escape.haskell 334 | 335 | 3 336 | 337 | name 338 | constant.character.escape.octal.haskell 339 | 340 | 4 341 | 342 | name 343 | constant.character.escape.hexadecimal.haskell 344 | 345 | 5 346 | 347 | name 348 | constant.character.escape.control.haskell 349 | 350 | 6 351 | 352 | name 353 | punctuation.definition.string.end.haskell 354 | 355 | 356 | match 357 | (?x) 358 | (') 359 | (?: 360 | [\ -\[\]-~] # Basic Char 361 | | (\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE 362 | |DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS 363 | |US|SP|DEL|[abfnrtv\\\"'\&])) # Escapes 364 | | (\\o[0-7]+) # Octal Escapes 365 | | (\\x[0-9A-Fa-f]+) # Hexadecimal Escapes 366 | | (\^[A-Z@\[\]\\\^_]) # Control Chars 367 | ) 368 | (') 369 | 370 | name 371 | string.quoted.single.haskell 372 | 373 | 374 | begin 375 | ^\s*([a-z_][a-zA-Z0-9_']*|\([|!%$+\-.,=</>]+\))\s*(::) 376 | beginCaptures 377 | 378 | 1 379 | 380 | name 381 | entity.name.function.haskell 382 | 383 | 2 384 | 385 | name 386 | keyword.other.double-colon.haskell 387 | 388 | 389 | end 390 | $\n? 391 | name 392 | meta.function.type-declaration.haskell 393 | patterns 394 | 395 | 396 | include 397 | #type_signature 398 | 399 | 400 | 401 | 402 | match 403 | \b(Just|Nothing|Left|Right|True|False|LT|EQ|GT|\(\)|\[\])\b 404 | name 405 | support.constant.haskell 406 | 407 | 408 | match 409 | \b[A-Z]\w*\b 410 | name 411 | constant.other.haskell 412 | 413 | 414 | include 415 | #comments 416 | 417 | 418 | match 419 | \b(abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b 420 | name 421 | support.function.prelude.haskell 422 | 423 | 424 | include 425 | #infix_op 426 | 427 | 428 | comment 429 | In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*. 430 | match 431 | [|!%$?~+:\-.=</>\\]+ 432 | name 433 | keyword.operator.haskell 434 | 435 | 436 | match 437 | , 438 | name 439 | punctuation.separator.comma.haskell 440 | 441 | 442 | repository 443 | 444 | block_comment 445 | 446 | applyEndPatternLast 447 | 1 448 | begin 449 | \{-(?!#) 450 | captures 451 | 452 | 0 453 | 454 | name 455 | punctuation.definition.comment.haskell 456 | 457 | 458 | end 459 | -\} 460 | name 461 | comment.block.haskell 462 | patterns 463 | 464 | 465 | include 466 | #block_comment 467 | 468 | 469 | 470 | comments 471 | 472 | patterns 473 | 474 | 475 | captures 476 | 477 | 1 478 | 479 | name 480 | punctuation.definition.comment.haskell 481 | 482 | 483 | match 484 | (--).*$\n? 485 | name 486 | comment.line.double-dash.haskell 487 | 488 | 489 | include 490 | #block_comment 491 | 492 | 493 | 494 | infix_op 495 | 496 | match 497 | (\([|!%$+:\-.=</>]+\)|\(,+\)) 498 | name 499 | entity.name.function.infix.haskell 500 | 501 | module_exports 502 | 503 | begin 504 | \( 505 | end 506 | \) 507 | name 508 | meta.declaration.exports.haskell 509 | patterns 510 | 511 | 512 | match 513 | \b[a-z][a-zA-Z_']* 514 | name 515 | entity.name.function.haskell 516 | 517 | 518 | match 519 | \b[A-Z][A-Za-z_']* 520 | name 521 | storage.type.haskell 522 | 523 | 524 | match 525 | , 526 | name 527 | punctuation.separator.comma.haskell 528 | 529 | 530 | include 531 | #infix_op 532 | 533 | 534 | comment 535 | So named because I don't know what to call this. 536 | match 537 | \(.*?\) 538 | name 539 | meta.other.unknown.haskell 540 | 541 | 542 | 543 | module_name 544 | 545 | match 546 | [A-Z][A-Za-z._']* 547 | name 548 | support.other.module.haskell 549 | 550 | pragma 551 | 552 | begin 553 | \{-# 554 | end 555 | #-\} 556 | name 557 | meta.preprocessor.haskell 558 | patterns 559 | 560 | 561 | match 562 | \b(LANGUAGE|UNPACK|INLINE)\b 563 | name 564 | keyword.other.preprocessor.haskell 565 | 566 | 567 | 568 | type_signature 569 | 570 | patterns 571 | 572 | 573 | captures 574 | 575 | 1 576 | 577 | name 578 | entity.other.inherited-class.haskell 579 | 580 | 2 581 | 582 | name 583 | variable.other.generic-type.haskell 584 | 585 | 3 586 | 587 | name 588 | keyword.other.big-arrow.haskell 589 | 590 | 591 | match 592 | \(\s*([A-Z][A-Za-z]*)\s+([a-z][A-Za-z_']*)\)\s*(=>) 593 | name 594 | meta.class-constraint.haskell 595 | 596 | 597 | include 598 | #pragma 599 | 600 | 601 | match 602 | -> 603 | name 604 | keyword.other.arrow.haskell 605 | 606 | 607 | match 608 | => 609 | name 610 | keyword.other.big-arrow.haskell 611 | 612 | 613 | match 614 | \b(Int(eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(Error)?)\b 615 | name 616 | support.type.prelude.haskell 617 | 618 | 619 | match 620 | \b[a-z][a-zA-Z0-9_']*\b 621 | name 622 | variable.other.generic-type.haskell 623 | 624 | 625 | match 626 | \b[A-Z][a-zA-Z0-9_']*\b 627 | name 628 | storage.type.haskell 629 | 630 | 631 | match 632 | \(\) 633 | name 634 | support.constant.unit.haskell 635 | 636 | 637 | include 638 | #comments 639 | 640 | 641 | 642 | 643 | scopeName 644 | source.haskell 645 | uuid 646 | 5C034675-1F6D-497E-8073-369D37E2FD7D 647 | 648 | 649 | --------------------------------------------------------------------------------