Search is not available for this dataset
repo_name
string
path
string
license
string
full_code
string
full_size
int64
uncommented_code
string
uncommented_size
int64
function_only_code
string
function_only_size
int64
is_commented
bool
is_signatured
bool
n_ast_errors
int64
ast_max_depth
int64
n_whitespaces
int64
n_ast_nodes
int64
n_ast_terminals
int64
n_ast_nonterminals
int64
loc
int64
cycloplexity
int64
ComputationWithBoundedResources/tct-config-mischel
tct-trs-comp15/Certify.hs
bsd-3-clause
certifySD = strategy "certify" (OneTuple $ degArg `optional` 5) certify
71
certifySD = strategy "certify" (OneTuple $ degArg `optional` 5) certify
71
certifySD = strategy "certify" (OneTuple $ degArg `optional` 5) certify
71
false
false
0
8
9
26
14
12
null
null
shayan-najd/HsParser
Language/Haskell/Utility/FastString.hs
gpl-3.0
--Why do we recalculate length every time it's requested? --If it's commonly needed, we should perhaps have --data LitString = LitString {-#UNPACK#-}!Addr# {-#UNPACK#-}!Int# mkLitString# :: Addr# -> LitString mkLitString# a# = Ptr a#
234
mkLitString# :: Addr# -> LitString mkLitString# a# = Ptr a#
59
mkLitString# a# = Ptr a#
24
true
true
0
5
33
24
13
11
null
null
google/codeworld
codeworld-compiler/test/testcases/magicImport_prelude/Prelude.hs
apache-2.0
foo = 42
8
foo = 42
8
foo = 42
8
false
false
1
5
2
10
3
7
null
null
ice1000/OI-codes
codewars/1-100/sum-up-the-random-string.hs
agpl-3.0
digit = ['0'..'9']
18
digit = ['0'..'9']
18
digit = ['0'..'9']
18
false
false
0
5
2
11
6
5
null
null
MoixaEnergy/blaze-react
src/Text/Blaze/Event/Keycode.hs
mit
umpadDivide = Keycode 111
32
numpadDivide = Keycode 111
32
numpadDivide = Keycode 111
32
false
false
1
4
10
12
4
8
null
null
HaskellZhangSong/derive-topdown
src/Data/Derive/TopDown/TH.hs
mit
deriving_ths :: [(Name, Name -> Q [Dec])] -- ^ class names and corresponding instance generation functions -> Name -- ^ type name -> Q [Dec] deriving_ths cds typeName = fmap concat (mapM (\c -> deriving_th c typeName) cds)
246
deriving_ths :: [(Name, Name -> Q [Dec])] -- ^ class names and corresponding instance generation functions -> Name -- ^ type name -> Q [Dec] deriving_ths cds typeName = fmap concat (mapM (\c -> deriving_th c typeName) cds)
246
deriving_ths cds typeName = fmap concat (mapM (\c -> deriving_th c typeName) cds)
81
false
true
0
10
61
77
41
36
null
null
michalkonecny/aern2
aern2-fnreps/main/Demo.hs
bsd-3-clause
--------------------------------------------------------------------- -- THE IDENTITY FUNCTION (USING VARIOUS TYPES) x_PPoly :: Accuracy -> PPoly x_PPoly = PPoly.fromPoly . x_Poly
179
x_PPoly :: Accuracy -> PPoly x_PPoly = PPoly.fromPoly . x_Poly
62
x_PPoly = PPoly.fromPoly . x_Poly
33
true
true
0
6
17
23
13
10
null
null
emilaxelsson/compass
src/Language/Embedded/Testing.hs
bsd-3-clause
genTerm :: (Constructors f, Functor f, Traversable f) => Bool -- ^ Only closed terms? -> Int -- ^ Size -> [Name] -- ^ Variables in scope -> Gen (Term (Binding :+: f)) genTerm _ 0 env = fmap Term $ oneof $ map (return . Inr . fmap (const undefined)) $ filter (null . toList) constructors
330
genTerm :: (Constructors f, Functor f, Traversable f) => Bool -- ^ Only closed terms? -> Int -- ^ Size -> [Name] -- ^ Variables in scope -> Gen (Term (Binding :+: f)) genTerm _ 0 env = fmap Term $ oneof $ map (return . Inr . fmap (const undefined)) $ filter (null . toList) constructors
330
genTerm _ 0 env = fmap Term $ oneof $ map (return . Inr . fmap (const undefined)) $ filter (null . toList) constructors
135
false
true
6
14
100
131
64
67
null
null
vladimir-ipatov/ganeti
src/Ganeti/Constants.hs
gpl-2.0
luxiReqQuery :: String luxiReqQuery = "Query"
45
luxiReqQuery :: String luxiReqQuery = "Query"
45
luxiReqQuery = "Query"
22
false
true
0
6
5
18
7
11
null
null
ComputationWithBoundedResources/tct-trs
src/Tct/Trs/Encoding/Bounds/Violations/Fix.hs
bsd-3-clause
rule3 _ = return fail
38
rule3 _ = return fail
38
rule3 _ = return fail
38
false
false
0
5
21
12
5
7
null
null
OS2World/DEV-UTIL-HUGS
libraries/Graphics/Rendering/OpenGL/GL/PixelRectangles.hs
bsd-3-clause
skipPixels :: PixelStoreDirection -> StateVar GLint skipPixels Pack = pixelStorei GetPackSkipPixels PackSkipPixels
116
skipPixels :: PixelStoreDirection -> StateVar GLint skipPixels Pack = pixelStorei GetPackSkipPixels PackSkipPixels
116
skipPixels Pack = pixelStorei GetPackSkipPixels PackSkipPixels
64
false
true
0
6
13
26
12
14
null
null
NCrashed/sinister
src/client/Core/Context.hs
mit
newEventManager :: EventManager newEventManager = EventManager [] [] []
71
newEventManager :: EventManager newEventManager = EventManager [] [] []
71
newEventManager = EventManager [] [] []
39
false
true
0
6
8
24
12
12
null
null
igrep/plus2tweet
test-api.hs
mit
tryTweet :: [String] -> IO () tryTweet args = do undefined
60
tryTweet :: [String] -> IO () tryTweet args = do undefined
60
tryTweet args = do undefined
30
false
true
0
7
12
29
14
15
null
null
grnet/snf-ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- | The version identifier for builtin data collectors builtinDataCollectorVersion :: String builtinDataCollectorVersion = "B"
127
builtinDataCollectorVersion :: String builtinDataCollectorVersion = "B"
71
builtinDataCollectorVersion = "B"
33
true
true
0
4
14
12
7
5
null
null
andrejborstnik/Samodejno-odvajanje
Lipschitz/dist/build/autogen/Paths_Lipschitz.hs
mit
sysconfdir = "\\\\Spin\\borstnika$\\_System\\ApplicationData\\cabal\\etc"
73
sysconfdir = "\\\\Spin\\borstnika$\\_System\\ApplicationData\\cabal\\etc"
73
sysconfdir = "\\\\Spin\\borstnika$\\_System\\ApplicationData\\cabal\\etc"
73
false
false
0
4
2
6
3
3
null
null
osa1/rho-torrent
src/Rho/Session.hs
bsd-3-clause
initTorrentSession' :: HostAddress -> Info -> [Tracker] -> PeerId -> IO Session initTorrentSession' host info ts pid = do (pieceMgr, _) <- tryReadFiles info "" let miData = LB.toStrict $ BE.encode info miPieceMgr <- Just <$> newPieceMgrFromData miData (2 ^ (14 :: Word32)) sock <- socket AF_INET Stream defaultProtocol bind sock (SockAddrInet aNY_PORT host) port <- socketPort sock listen sock 1 sess <- initSession pid (iHash info) port ts (Just pieceMgr) miPieceMgr void $ async $ listenPeerSocket sess sock return sess
574
initTorrentSession' :: HostAddress -> Info -> [Tracker] -> PeerId -> IO Session initTorrentSession' host info ts pid = do (pieceMgr, _) <- tryReadFiles info "" let miData = LB.toStrict $ BE.encode info miPieceMgr <- Just <$> newPieceMgrFromData miData (2 ^ (14 :: Word32)) sock <- socket AF_INET Stream defaultProtocol bind sock (SockAddrInet aNY_PORT host) port <- socketPort sock listen sock 1 sess <- initSession pid (iHash info) port ts (Just pieceMgr) miPieceMgr void $ async $ listenPeerSocket sess sock return sess
574
initTorrentSession' host info ts pid = do (pieceMgr, _) <- tryReadFiles info "" let miData = LB.toStrict $ BE.encode info miPieceMgr <- Just <$> newPieceMgrFromData miData (2 ^ (14 :: Word32)) sock <- socket AF_INET Stream defaultProtocol bind sock (SockAddrInet aNY_PORT host) port <- socketPort sock listen sock 1 sess <- initSession pid (iHash info) port ts (Just pieceMgr) miPieceMgr void $ async $ listenPeerSocket sess sock return sess
494
false
true
0
12
133
211
98
113
null
null
adamse/haddock
haddock-api/src/Haddock/Backends/LaTeX.hs
bsd-2-clause
ppFds :: [Located ([Located DocName], [Located DocName])] -> Bool -> LaTeX ppFds fds unicode = if null fds then empty else char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) where fundep (vars1,vars2) = hsep (map (ppDocName . unLoc) vars1) <+> arrow unicode <+> hsep (map (ppDocName . unLoc) vars2)
349
ppFds :: [Located ([Located DocName], [Located DocName])] -> Bool -> LaTeX ppFds fds unicode = if null fds then empty else char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) where fundep (vars1,vars2) = hsep (map (ppDocName . unLoc) vars1) <+> arrow unicode <+> hsep (map (ppDocName . unLoc) vars2)
349
ppFds fds unicode = if null fds then empty else char '|' <+> hsep (punctuate comma (map (fundep . unLoc) fds)) where fundep (vars1,vars2) = hsep (map (ppDocName . unLoc) vars1) <+> arrow unicode <+> hsep (map (ppDocName . unLoc) vars2)
274
false
true
2
11
90
163
80
83
null
null
holzensp/ghc
compiler/cmm/PprC.hs
bsd-3-clause
pprForeignCall :: SDoc -> CCallConv -> [Hinted CmmFormal] -> [Hinted CmmActual] -> SDoc pprForeignCall fn cconv results args = fn_call where fn_call = braces ( pprCFunType (char '*' <> text "ghcFunPtr") cconv results args <> semi $$ text "ghcFunPtr" <+> equals <+> cast_fn <> semi $$ pprCall (text "ghcFunPtr") cconv results args <> semi ) cast_fn = parens (parens (pprCFunType (char '*') cconv results args) <> fn)
498
pprForeignCall :: SDoc -> CCallConv -> [Hinted CmmFormal] -> [Hinted CmmActual] -> SDoc pprForeignCall fn cconv results args = fn_call where fn_call = braces ( pprCFunType (char '*' <> text "ghcFunPtr") cconv results args <> semi $$ text "ghcFunPtr" <+> equals <+> cast_fn <> semi $$ pprCall (text "ghcFunPtr") cconv results args <> semi ) cast_fn = parens (parens (pprCFunType (char '*') cconv results args) <> fn)
498
pprForeignCall fn cconv results args = fn_call where fn_call = braces ( pprCFunType (char '*' <> text "ghcFunPtr") cconv results args <> semi $$ text "ghcFunPtr" <+> equals <+> cast_fn <> semi $$ pprCall (text "ghcFunPtr") cconv results args <> semi ) cast_fn = parens (parens (pprCFunType (char '*') cconv results args) <> fn)
395
false
true
0
17
149
166
81
85
null
null
nevrenato/HetsAlloy
CspCASL/Morphism.hs
gpl-2.0
-- | The empty CspAddMorphism. emptyCspAddMorphism :: CspAddMorphism emptyCspAddMorphism = CspAddMorphism {- Note that when applying the CspAddMorphism to process names or channel names, if the name is not in the map in the morphism, then the application is the identity function. Thus empty maps are used to form the empty morphism. -} { channelMap = Map.empty , processMap = Map.empty }
416
emptyCspAddMorphism :: CspAddMorphism emptyCspAddMorphism = CspAddMorphism {- Note that when applying the CspAddMorphism to process names or channel names, if the name is not in the map in the morphism, then the application is the identity function. Thus empty maps are used to form the empty morphism. -} { channelMap = Map.empty , processMap = Map.empty }
385
emptyCspAddMorphism = CspAddMorphism {- Note that when applying the CspAddMorphism to process names or channel names, if the name is not in the map in the morphism, then the application is the identity function. Thus empty maps are used to form the empty morphism. -} { channelMap = Map.empty , processMap = Map.empty }
347
true
true
0
8
89
35
20
15
null
null
michalkonecny/aern
aern-order/src/Numeric/AERN/Misc/List.hs
bsd-3-clause
zipFill :: [a] -> [b] -> [(a,b)] zipFill [] list2 = []
55
zipFill :: [a] -> [b] -> [(a,b)] zipFill [] list2 = []
54
zipFill [] list2 = []
21
false
true
0
10
12
49
25
24
null
null
Soostone/bloodhound
src/Database/Bloodhound/Types.hs
bsd-3-clause
-- $setup -- >>> :set -XOverloadedStrings -- >>> import Data.Aeson -- >>> import Database.Bloodhound -- >>> let testServer = (Server "http://localhost:9200") -- >>> let testIndex = IndexName "twitter" -- >>> let testMapping = MappingName "tweet" -- >>> let defaultIndexSettings = IndexSettings (ShardCount 3) (ReplicaCount 2) -- defaultIndexSettings is exported by Database.Bloodhound as well -- no trailing slashes in servers, library handles building the path. -- | Create a 'BHEnv' with all optional fields defaulted. HTTP hook -- will be a noop. You can use the exported fields to customize it further, e.g.: -- -- >> (mkBHEnv myServer myManager) { bhRequestHook = customHook } mkBHEnv :: Server -> Manager -> BHEnv mkBHEnv s m = BHEnv s m return
752
mkBHEnv :: Server -> Manager -> BHEnv mkBHEnv s m = BHEnv s m return
68
mkBHEnv s m = BHEnv s m return
30
true
true
0
6
119
49
30
19
null
null
spinda/liquidhaskell
src/Language/Haskell/Liquid/Misc.hs
bsd-3-clause
pad msg _ xs ys | nxs == nys = (xs, ys) | otherwise = errorstar $ "pad: " ++ msg where nxs = length xs nys = length ys
151
pad msg _ xs ys | nxs == nys = (xs, ys) | otherwise = errorstar $ "pad: " ++ msg where nxs = length xs nys = length ys
151
pad msg _ xs ys | nxs == nys = (xs, ys) | otherwise = errorstar $ "pad: " ++ msg where nxs = length xs nys = length ys
151
false
false
2
8
62
65
32
33
null
null
jkff/storable-endian
Data/Storable/Endian.hs
bsd-3-clause
-- | Read a Word32 in little endian format getWord32le :: Ptr Word8 -> IO Word32 getWord32le = if byteOrder == LittleEndian then \p -> peek (castPtr p) else \p -> do b0 <- fromIntegral `fmap` (p `peekElemOff` 0) b1 <- fromIntegral `fmap` (p `peekElemOff` 1) b2 <- fromIntegral `fmap` (p `peekElemOff` 2) b3 <- fromIntegral `fmap` (p `peekElemOff` 3) return $! (b3 `shiftl_w32` 24) .|. (b2 `shiftl_w32` 16) .|. (b1 `shiftl_w32` 8) .|. (b0 )
531
getWord32le :: Ptr Word8 -> IO Word32 getWord32le = if byteOrder == LittleEndian then \p -> peek (castPtr p) else \p -> do b0 <- fromIntegral `fmap` (p `peekElemOff` 0) b1 <- fromIntegral `fmap` (p `peekElemOff` 1) b2 <- fromIntegral `fmap` (p `peekElemOff` 2) b3 <- fromIntegral `fmap` (p `peekElemOff` 3) return $! (b3 `shiftl_w32` 24) .|. (b2 `shiftl_w32` 16) .|. (b1 `shiftl_w32` 8) .|. (b0 )
488
getWord32le = if byteOrder == LittleEndian then \p -> peek (castPtr p) else \p -> do b0 <- fromIntegral `fmap` (p `peekElemOff` 0) b1 <- fromIntegral `fmap` (p `peekElemOff` 1) b2 <- fromIntegral `fmap` (p `peekElemOff` 2) b3 <- fromIntegral `fmap` (p `peekElemOff` 3) return $! (b3 `shiftl_w32` 24) .|. (b2 `shiftl_w32` 16) .|. (b1 `shiftl_w32` 8) .|. (b0 )
450
true
true
0
14
167
190
109
81
null
null
hvr/jhc
regress/tests/9_nofib/spectral/Primes.hs
mit
--the_filter :: [Int] -> [Int] --the_filter (n:ns) = filter (isdivs n) ns the_filter :: [Int] -> [Int] the_filter (n:ns) = f ns where f [] = [] f (x:ns) | isdivs n x = (x:f ns) f (_:ns) = f ns
205
the_filter :: [Int] -> [Int] the_filter (n:ns) = f ns where f [] = [] f (x:ns) | isdivs n x = (x:f ns) f (_:ns) = f ns
130
the_filter (n:ns) = f ns where f [] = [] f (x:ns) | isdivs n x = (x:f ns) f (_:ns) = f ns
101
true
true
0
8
53
103
53
50
null
null
mattias-lundell/timber-llvm
src/Core2Kindle.hs
bsd-3-clause
cType' (Tvar n, []) = ([], Kindle.tInt)
59
cType' (Tvar n, []) = ([], Kindle.tInt)
59
cType' (Tvar n, []) = ([], Kindle.tInt)
59
false
false
0
7
26
30
16
14
null
null
portnov/integration-server
THIS/Protocols/Parse.hs
lgpl-3.0
parseReceiveProtocol "ssh-commnands" cfg = AnyFilesConnection <$> (connect cfg :: IO SSHCommands)
101
parseReceiveProtocol "ssh-commnands" cfg = AnyFilesConnection <$> (connect cfg :: IO SSHCommands)
101
parseReceiveProtocol "ssh-commnands" cfg = AnyFilesConnection <$> (connect cfg :: IO SSHCommands)
101
false
false
0
7
14
27
13
14
null
null
qsn/rhcalc
src/Operators.hs
mit
operators :: Map.Map String Operator operators = Map.fromList $ op_stack ++ op_math ++ op_fct ++ op_logic ++ op_test ++ op_list ++ cst {-++ op_abstract-} ++ op_unit
166
operators :: Map.Map String Operator operators = Map.fromList $ op_stack ++ op_math ++ op_fct ++ op_logic ++ op_test ++ op_list ++ cst {-++ op_abstract-} ++ op_unit
166
operators = Map.fromList $ op_stack ++ op_math ++ op_fct ++ op_logic ++ op_test ++ op_list ++ cst {-++ op_abstract-} ++ op_unit
129
false
true
1
13
27
58
27
31
null
null
egison/egison
hs-src/Language/Egison/PrettyMath/Maxima.hs
mit
showMathExpr (Tuple _) = "undefined"
36
showMathExpr (Tuple _) = "undefined"
36
showMathExpr (Tuple _) = "undefined"
36
false
false
0
6
4
16
7
9
null
null
UCSD-PL/RefScript
src/Language/Rsc/Core/Env.hs
bsd-3-clause
envAdds xts γ = L.foldl' (\γ (x,t) -> envAdd x t γ) γ xts
62
envAdds xts γ = L.foldl' (\γ (x,t) -> envAdd x t γ) γ xts
62
envAdds xts γ = L.foldl' (\γ (x,t) -> envAdd x t γ) γ xts
62
false
false
0
8
18
43
22
21
null
null
sgillespie/ghc
compiler/codeGen/StgCmmClosure.hs
bsd-3-clause
lfDynTag _ _other = 0
47
lfDynTag _ _other = 0
47
lfDynTag _ _other = 0
47
false
false
0
5
30
11
5
6
null
null
AlexanderPankiv/ghc
libraries/base/GHC/Natural.hs
bsd-3-clause
timesNatural x (NatS# 1##) = x
38
timesNatural x (NatS# 1##) = x
38
timesNatural x (NatS# 1##) = x
38
false
false
0
7
13
17
8
9
null
null
obgs/utils
src/Obgs/Utils/Text.hs
mit
-- | Returns a /snakified/ version of the given text -- (using [snake_case](https://en.wikipedia.org/wiki/Snake_case)). snakify :: T.Text -> T.Text snakify = Case.snakify
170
snakify :: T.Text -> T.Text snakify = Case.snakify
50
snakify = Case.snakify
22
true
true
0
6
20
23
13
10
null
null
lostbean/DeUni
profile/RenderSVG.hs
gpl-3.0
renderSetS2Circle::IntMap (S2 Point2D) -> Diagram SVG R2 renderSetS2Circle ss = let func acc x = acc <> renderCircle (circleCenter x) (circleRadius x ** 0.5) (green `withOpacity` 0.15) # fcA (green `withOpacity` 0.15) in IM.foldl func mempty ss
268
renderSetS2Circle::IntMap (S2 Point2D) -> Diagram SVG R2 renderSetS2Circle ss = let func acc x = acc <> renderCircle (circleCenter x) (circleRadius x ** 0.5) (green `withOpacity` 0.15) # fcA (green `withOpacity` 0.15) in IM.foldl func mempty ss
268
renderSetS2Circle ss = let func acc x = acc <> renderCircle (circleCenter x) (circleRadius x ** 0.5) (green `withOpacity` 0.15) # fcA (green `withOpacity` 0.15) in IM.foldl func mempty ss
211
false
true
0
14
60
109
54
55
null
null
mcschroeder/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprInstr (FCMP reg1 reg2) = hcat [ char '\t', text "fcmpu\tcr0, ", -- Note: we're using fcmpu, not fcmpo -- The difference is with fcmpo, compare with NaN is an invalid operation. -- We don't handle invalid fp ops, so we don't care pprReg reg1, text ", ", pprReg reg2 ]
349
pprInstr (FCMP reg1 reg2) = hcat [ char '\t', text "fcmpu\tcr0, ", -- Note: we're using fcmpu, not fcmpo -- The difference is with fcmpo, compare with NaN is an invalid operation. -- We don't handle invalid fp ops, so we don't care pprReg reg1, text ", ", pprReg reg2 ]
349
pprInstr (FCMP reg1 reg2) = hcat [ char '\t', text "fcmpu\tcr0, ", -- Note: we're using fcmpu, not fcmpo -- The difference is with fcmpo, compare with NaN is an invalid operation. -- We don't handle invalid fp ops, so we don't care pprReg reg1, text ", ", pprReg reg2 ]
349
false
false
0
7
130
53
27
26
null
null
phaazon/vector
Data/Vector/Unboxed/Mutable.hs
bsd-3-clause
grow = G.grow
13
grow = G.grow
13
grow = G.grow
13
false
false
0
5
2
8
4
4
null
null
sfindeisen/xtiles
src/Config.hs
gpl-3.0
showMatch :: TMatch -> [String] showMatch m = ("Match file: " ++ (mfile m) ++ " xpath: " ++ (showMaybeStr $ mxpath m)) : (indent . concat $ map showMatchChild (mitems m))
174
showMatch :: TMatch -> [String] showMatch m = ("Match file: " ++ (mfile m) ++ " xpath: " ++ (showMaybeStr $ mxpath m)) : (indent . concat $ map showMatchChild (mitems m))
174
showMatch m = ("Match file: " ++ (mfile m) ++ " xpath: " ++ (showMaybeStr $ mxpath m)) : (indent . concat $ map showMatchChild (mitems m))
142
false
true
0
11
35
78
40
38
null
null
vikraman/ghc
compiler/main/DynFlags.hs
bsd-3-clause
-- -stubdir D adds an implicit -I D, so that gcc can find the _stub.h file -- \#included from the .hc file when compiling via C (i.e. unregisterised -- builds). setDumpDir f d = d { dumpDir = Just f}
209
setDumpDir f d = d { dumpDir = Just f}
44
setDumpDir f d = d { dumpDir = Just f}
44
true
false
1
8
49
33
15
18
null
null
peterokagey/haskellOEIS
src/Sandbox/OpenishProblems/Problem79_2.hs
apache-2.0
offSpring n c1 c2 = foldr insertSum Set.empty (necklace c1) where insertSum c1' = insertStandardized n (zipWith (+) c1' c2)
125
offSpring n c1 c2 = foldr insertSum Set.empty (necklace c1) where insertSum c1' = insertStandardized n (zipWith (+) c1' c2)
125
offSpring n c1 c2 = foldr insertSum Set.empty (necklace c1) where insertSum c1' = insertStandardized n (zipWith (+) c1' c2)
125
false
false
0
9
21
55
27
28
null
null
mgmillani/pictikz
src/Main.hs
gpl-3.0
defaultAction = Action { colorFile = "" , colors = defaultColors , help = False , inF = "" , latexColors = False , nodeF = id , outputF = printGraph , preprocessF = renameNodes , startTime = 0 , temporal = False , version = False } :: Action Double Node
279
defaultAction = Action { colorFile = "" , colors = defaultColors , help = False , inF = "" , latexColors = False , nodeF = id , outputF = printGraph , preprocessF = renameNodes , startTime = 0 , temporal = False , version = False } :: Action Double Node
279
defaultAction = Action { colorFile = "" , colors = defaultColors , help = False , inF = "" , latexColors = False , nodeF = id , outputF = printGraph , preprocessF = renameNodes , startTime = 0 , temporal = False , version = False } :: Action Double Node
279
false
false
3
6
77
89
53
36
null
null
noteed/sentry
Sentry/Server/Core.hs
bsd-3-clause
sameEntries :: Entry -> Entry -> Bool sameEntries p1 p2 = eType p1 == eType p2 && eCommand p1 == eCommand p2 && eArguments p1 == eArguments p2
146
sameEntries :: Entry -> Entry -> Bool sameEntries p1 p2 = eType p1 == eType p2 && eCommand p1 == eCommand p2 && eArguments p1 == eArguments p2
146
sameEntries p1 p2 = eType p1 == eType p2 && eCommand p1 == eCommand p2 && eArguments p1 == eArguments p2
108
false
true
4
6
31
64
28
36
null
null
ideas-edu/ideas
src/Ideas/Encoding/RulesInfo.hs
apache-2.0
collectExamples :: Exercise a -> ExampleMap a collectExamples ex = foldr add M.empty (examplesAsList ex) where add a m = let f = foldr g m . maybe [] triples g (x, (r, _), y) = case fromContextWith2 (,) x y of Just p -> M.insertWith (++) (getId r) [p] Nothing -> id in f (defaultDerivation ex a)
404
collectExamples :: Exercise a -> ExampleMap a collectExamples ex = foldr add M.empty (examplesAsList ex) where add a m = let f = foldr g m . maybe [] triples g (x, (r, _), y) = case fromContextWith2 (,) x y of Just p -> M.insertWith (++) (getId r) [p] Nothing -> id in f (defaultDerivation ex a)
403
collectExamples ex = foldr add M.empty (examplesAsList ex) where add a m = let f = foldr g m . maybe [] triples g (x, (r, _), y) = case fromContextWith2 (,) x y of Just p -> M.insertWith (++) (getId r) [p] Nothing -> id in f (defaultDerivation ex a)
357
false
true
0
14
166
162
80
82
null
null
dorchard/camfort
src/Camfort/Specification/Stencils/Model.hs
apache-2.0
sensibleGroupBy :: Eq a => (a -> a -> Ordering) -> (a -> a -> Bool) -> [ a ] -> [ [ a ] ] sensibleGroupBy ord p l = nub . map (\el -> sortBy ord . filter (p el) $ l) $ l
236
sensibleGroupBy :: Eq a => (a -> a -> Ordering) -> (a -> a -> Bool) -> [ a ] -> [ [ a ] ] sensibleGroupBy ord p l = nub . map (\el -> sortBy ord . filter (p el) $ l) $ l
236
sensibleGroupBy ord p l = nub . map (\el -> sortBy ord . filter (p el) $ l) $ l
79
false
true
0
14
112
107
55
52
null
null
tpajenka/shift
src/ShiftGame/Scenario.hs
bsd-3-clause
-- | Other @Features@ can be shifted onto this @Feature@? targetable :: Feature -> Bool targetable Floor = True
113
targetable :: Feature -> Bool targetable Floor = True
55
targetable Floor = True
25
true
true
0
5
20
19
10
9
null
null
pharaun/hGnucash
src/Types.hs
apache-2.0
job n = XT.Name n (Just "http://www.gnucash.org/XML/job") (Just "job")
77
job n = XT.Name n (Just "http://www.gnucash.org/XML/job") (Just "job")
77
job n = XT.Name n (Just "http://www.gnucash.org/XML/job") (Just "job")
77
false
false
0
7
15
30
14
16
null
null
faylang/fay-server
modules/project/Demo/Cookies.hs
bsd-3-clause
main = ready $ do body <- select "body" group <- select "<div class='btn-group'></div>" >>= appendTo body select "<h3>Log:</h3>" >>= appendTo body select "<button class='btn'>Go Again</button>" >>= appendTo group >>= onClick (do readAgain; return False) select "<button class='btn'>Clear Cookie</button>" >>= appendTo group >>= onClick (do deleteCookie "demo"; return False) readAgain
437
main = ready $ do body <- select "body" group <- select "<div class='btn-group'></div>" >>= appendTo body select "<h3>Log:</h3>" >>= appendTo body select "<button class='btn'>Go Again</button>" >>= appendTo group >>= onClick (do readAgain; return False) select "<button class='btn'>Clear Cookie</button>" >>= appendTo group >>= onClick (do deleteCookie "demo"; return False) readAgain
437
main = ready $ do body <- select "body" group <- select "<div class='btn-group'></div>" >>= appendTo body select "<h3>Log:</h3>" >>= appendTo body select "<button class='btn'>Go Again</button>" >>= appendTo group >>= onClick (do readAgain; return False) select "<button class='btn'>Clear Cookie</button>" >>= appendTo group >>= onClick (do deleteCookie "demo"; return False) readAgain
437
false
false
1
13
102
126
51
75
null
null
m00nlight/hackerrank
library/haskell/ufset.hs
gpl-2.0
addToMap :: Ord k => M.Map k a -> [(k, a)] -> M.Map k a addToMap m xs = L.foldl' (\ acc (x, d) -> M.insert x d acc) m xs
120
addToMap :: Ord k => M.Map k a -> [(k, a)] -> M.Map k a addToMap m xs = L.foldl' (\ acc (x, d) -> M.insert x d acc) m xs
120
addToMap m xs = L.foldl' (\ acc (x, d) -> M.insert x d acc) m xs
64
false
true
0
9
30
88
45
43
null
null
Airtnp/Freshman_Simple_Haskell_Lib
Intro/WIW/IxMonad.hs
mit
join :: IState i m (IState m o a) -> IState i o a join v = IState $ \i -> let (w, m) = runIState v i in runIState w m
126
join :: IState i m (IState m o a) -> IState i o a join v = IState $ \i -> let (w, m) = runIState v i in runIState w m
126
join v = IState $ \i -> let (w, m) = runIState v i in runIState w m
76
false
true
2
10
40
86
39
47
null
null
thenaesh/SoCFault
src/Receiver.hs
gpl-3.0
createGetUpdatesRequest :: Maybe Int -> IO GetUpdatesRequest createGetUpdatesRequest nextUpdateId = return $ defaultGetUpdatesRequest { updates_offset = nextUpdateId } where defaultGetUpdatesRequest = GetUpdatesRequest { updates_offset = Nothing , updates_limit = Nothing , updates_timeout = Nothing , updates_allowed_updates = Just ["message"] }
418
createGetUpdatesRequest :: Maybe Int -> IO GetUpdatesRequest createGetUpdatesRequest nextUpdateId = return $ defaultGetUpdatesRequest { updates_offset = nextUpdateId } where defaultGetUpdatesRequest = GetUpdatesRequest { updates_offset = Nothing , updates_limit = Nothing , updates_timeout = Nothing , updates_allowed_updates = Just ["message"] }
418
createGetUpdatesRequest nextUpdateId = return $ defaultGetUpdatesRequest { updates_offset = nextUpdateId } where defaultGetUpdatesRequest = GetUpdatesRequest { updates_offset = Nothing , updates_limit = Nothing , updates_timeout = Nothing , updates_allowed_updates = Just ["message"] }
357
false
true
0
10
111
75
42
33
null
null
raptros/respond
src/Web/Respond/Path.hs
bsd-3-clause
-- | create a 'PathMatcher' by providing a path extractor and an action that -- consumes the extracted elements. -- -- note that 'HListElim' is just a function from the types extracted to -- something else -- -- > path ((value :: PathExtractor1 String) </> seg "whatever" </> (value :: PathExtractor1 Integer)) $ \string integer -> -- some action path :: MonadRespond m => PathExtractor (HList l) -> HListElim l (m a) -> PathMatcher (m a) path extractor f = PathMatcher $ uncurry (useNextPathState f) . pathExtract extractor
524
path :: MonadRespond m => PathExtractor (HList l) -> HListElim l (m a) -> PathMatcher (m a) path extractor f = PathMatcher $ uncurry (useNextPathState f) . pathExtract extractor
177
path extractor f = PathMatcher $ uncurry (useNextPathState f) . pathExtract extractor
85
true
true
0
11
87
91
45
46
null
null
ezyang/ghc
compiler/simplStg/StgCse.hs
bsd-3-clause
stgCseTopLvl in_scope (StgTopLifted (StgRec eqs)) = ( in_scope' , StgTopLifted (StgRec [ (bndr, stgCseTopLvlRhs in_scope' rhs) | (bndr, rhs) <- eqs ])) where in_scope' = in_scope `extendInScopeSetList` [ bndr | (bndr, _) <- eqs ]
241
stgCseTopLvl in_scope (StgTopLifted (StgRec eqs)) = ( in_scope' , StgTopLifted (StgRec [ (bndr, stgCseTopLvlRhs in_scope' rhs) | (bndr, rhs) <- eqs ])) where in_scope' = in_scope `extendInScopeSetList` [ bndr | (bndr, _) <- eqs ]
241
stgCseTopLvl in_scope (StgTopLifted (StgRec eqs)) = ( in_scope' , StgTopLifted (StgRec [ (bndr, stgCseTopLvlRhs in_scope' rhs) | (bndr, rhs) <- eqs ])) where in_scope' = in_scope `extendInScopeSetList` [ bndr | (bndr, _) <- eqs ]
241
false
false
0
12
46
97
53
44
null
null
rueshyna/gogol
gogol-partners/gen/Network/Google/Resource/Partners/Companies/List.hs
mpl-2.0
-- | IP address to use instead of the user\'s geo-located IP address. clRequestMetadataUserOverridesIPAddress :: Lens' CompaniesList (Maybe Text) clRequestMetadataUserOverridesIPAddress = lens _clRequestMetadataUserOverridesIPAddress (\ s a -> s{_clRequestMetadataUserOverridesIPAddress = a})
309
clRequestMetadataUserOverridesIPAddress :: Lens' CompaniesList (Maybe Text) clRequestMetadataUserOverridesIPAddress = lens _clRequestMetadataUserOverridesIPAddress (\ s a -> s{_clRequestMetadataUserOverridesIPAddress = a})
239
clRequestMetadataUserOverridesIPAddress = lens _clRequestMetadataUserOverridesIPAddress (\ s a -> s{_clRequestMetadataUserOverridesIPAddress = a})
163
true
true
0
8
46
49
25
24
null
null
pbogdan/kube-cert
src/Lib/Commands.hs
bsd-3-clause
genRootPrivateKey :: EitherT String IO () genRootPrivateKey = genPrivateKey "private/ca.key" 4096 mempty
104
genRootPrivateKey :: EitherT String IO () genRootPrivateKey = genPrivateKey "private/ca.key" 4096 mempty
104
genRootPrivateKey = genPrivateKey "private/ca.key" 4096 mempty
62
false
true
1
6
11
30
13
17
null
null
cdornan/keystore
src/Data/KeyStore/CLI/Command.hs
bsd-3-clause
p_safeguard :: Parser Safeguard p_safeguard = option (eitherReader $ either (Left . showReason) Right . parseSafeguard) $ long "safeguard" <> metavar "SAFEGUARD" <> help "keys used to encrypt the secret key"
236
p_safeguard :: Parser Safeguard p_safeguard = option (eitherReader $ either (Left . showReason) Right . parseSafeguard) $ long "safeguard" <> metavar "SAFEGUARD" <> help "keys used to encrypt the secret key"
236
p_safeguard = option (eitherReader $ either (Left . showReason) Right . parseSafeguard) $ long "safeguard" <> metavar "SAFEGUARD" <> help "keys used to encrypt the secret key"
204
false
true
7
10
59
68
29
39
null
null
lordi/jazzmate
src/MIDI/JACK.hs
gpl-2.0
run :: TChan Msg.T -> IO () run noteCh = MIDI.main (writeMsg noteCh)
68
run :: TChan Msg.T -> IO () run noteCh = MIDI.main (writeMsg noteCh)
68
run noteCh = MIDI.main (writeMsg noteCh)
40
false
true
0
7
12
39
18
21
null
null
himura/twitter-enumerator
Web/Twitter/Enumerator/Fetch.hs
bsd-2-clause
iterPageC :: (Monad m, FromJSON a) => Iteratee Value m (Maybe [a]) iterPageC = do ret <- EL.head case ret of Just v -> return . fromJSON' $ v Nothing -> return Nothing
179
iterPageC :: (Monad m, FromJSON a) => Iteratee Value m (Maybe [a]) iterPageC = do ret <- EL.head case ret of Just v -> return . fromJSON' $ v Nothing -> return Nothing
179
iterPageC = do ret <- EL.head case ret of Just v -> return . fromJSON' $ v Nothing -> return Nothing
112
false
true
0
11
44
84
41
43
null
null
ulricha/algebra-sql
src/Database/Algebra/SQL/Render/Query.hs
bsd-3-clause
renderAggregateFunction c (AFCountDistinct e) = kw "COUNT" <> parens (kw "DISTINCT" <+> renderColumnExpr c e)
118
renderAggregateFunction c (AFCountDistinct e) = kw "COUNT" <> parens (kw "DISTINCT" <+> renderColumnExpr c e)
118
renderAggregateFunction c (AFCountDistinct e) = kw "COUNT" <> parens (kw "DISTINCT" <+> renderColumnExpr c e)
118
false
false
0
9
23
42
19
23
null
null
ingemaradahl/bilder
src/Compiler/Texture2D.hs
lgpl-3.0
addVar ∷ String → Type → TEX () addVar n t = get >>= \m → put $ Map.insert n t m
80
addVar ∷ String → Type → TEX () addVar n t = get >>= \m → put $ Map.insert n t m
80
addVar n t = get >>= \m → put $ Map.insert n t m
48
false
true
0
9
21
51
25
26
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_WEIGHT_ARRAY_TYPE_ARB :: GLenum gl_WEIGHT_ARRAY_TYPE_ARB = 0x86A9
68
gl_WEIGHT_ARRAY_TYPE_ARB :: GLenum gl_WEIGHT_ARRAY_TYPE_ARB = 0x86A9
68
gl_WEIGHT_ARRAY_TYPE_ARB = 0x86A9
33
false
true
0
4
5
11
6
5
null
null
michaelficarra/purescript
src/Language/PureScript/Sugar/Operators.hs
mit
toAssoc Infix = P.AssocNone
28
toAssoc Infix = P.AssocNone
28
toAssoc Infix = P.AssocNone
28
false
false
1
6
4
15
5
10
null
null
kawu/polysoup
src/Text/XML/PolySoup/Tag.hs
bsd-2-clause
-- | Extract the attribute value. attr :: Eq s => s -> Q (Tag s) s attr = Q . getAttr
85
attr :: Eq s => s -> Q (Tag s) s attr = Q . getAttr
51
attr = Q . getAttr
18
true
true
0
9
21
38
19
19
null
null
urbanslug/ghc
compiler/utils/Encoding.hs
bsd-3-clause
decode_lower 'g' = '>'
22
decode_lower 'g' = '>'
22
decode_lower 'g' = '>'
22
false
false
0
5
3
9
4
5
null
null
TomMD/cryptol
src/Cryptol/TypeCheck/Instantiate.hs
bsd-3-clause
instantiateWith :: Expr -> Schema -> [Located (Maybe QName,Type)] -> InferM (Expr,Type) instantiateWith e s ts | null named = instantiateWithPos e s positional | null positional = instantiateWithNames e s named | otherwise = do recordError CannotMixPositionalAndNamedTypeParams instantiateWithNames e s named where (named,positional) = partitionEithers (map classify ts) classify t = case thing t of (Just n,ty) -> Left t { thing = (n,ty) } (Nothing,ty) -> Right ty
565
instantiateWith :: Expr -> Schema -> [Located (Maybe QName,Type)] -> InferM (Expr,Type) instantiateWith e s ts | null named = instantiateWithPos e s positional | null positional = instantiateWithNames e s named | otherwise = do recordError CannotMixPositionalAndNamedTypeParams instantiateWithNames e s named where (named,positional) = partitionEithers (map classify ts) classify t = case thing t of (Just n,ty) -> Left t { thing = (n,ty) } (Nothing,ty) -> Right ty
565
instantiateWith e s ts | null named = instantiateWithPos e s positional | null positional = instantiateWithNames e s named | otherwise = do recordError CannotMixPositionalAndNamedTypeParams instantiateWithNames e s named where (named,positional) = partitionEithers (map classify ts) classify t = case thing t of (Just n,ty) -> Left t { thing = (n,ty) } (Nothing,ty) -> Right ty
461
false
true
2
11
169
198
98
100
null
null
dysinger/amazonka
amazonka-opsworks/gen/Network/AWS/OpsWorks/CloneStack.hs
mpl-2.0
-- | The ID of the VPC that the cloned stack is to be launched into. It must be in -- the specified region. All instances are launched into this VPC, and you -- cannot change the ID later. -- -- If your account supports EC2 Classic, the default value is no VPC. If your -- account does not support EC2 Classic, the default value is the default VPC -- for the specified region. If the VPC ID corresponds to a default VPC and you -- have specified either the 'DefaultAvailabilityZone' or the 'DefaultSubnetId' -- parameter only, AWS OpsWorks infers the value of the other parameter. If you -- specify neither parameter, AWS OpsWorks sets these parameters to the first -- valid Availability Zone for the specified region and the corresponding -- default VPC subnet ID, respectively. -- -- If you specify a nondefault VPC ID, note the following: -- -- It must belong to a VPC in your account that is in the specified region. You must specify a value for -- 'DefaultSubnetId'. For more information on how to use AWS OpsWorks with a VPC, -- see <http://docs.aws.amazon.com/opsworks/latest/userguide/workingstacks-vpc.html Running a Stack in a VPC>. For more information on default VPC and EC2 -- Classic, see <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-supported-platforms.html Supported Platforms>. cs1VpcId :: Lens' CloneStack (Maybe Text) cs1VpcId = lens _cs1VpcId (\s a -> s { _cs1VpcId = a })
1,405
cs1VpcId :: Lens' CloneStack (Maybe Text) cs1VpcId = lens _cs1VpcId (\s a -> s { _cs1VpcId = a })
97
cs1VpcId = lens _cs1VpcId (\s a -> s { _cs1VpcId = a })
55
true
true
0
9
229
64
43
21
null
null
reactormonk/hoauth2
example/Fitbit/test.hs
bsd-3-clause
application :: Application application request respond = do response <- handleRequest requestPath request respond $ responseLBS status200 [("Content-Type", "text/plain")] response where requestPath = T.intercalate "/" $ pathInfo request
250
application :: Application application request respond = do response <- handleRequest requestPath request respond $ responseLBS status200 [("Content-Type", "text/plain")] response where requestPath = T.intercalate "/" $ pathInfo request
250
application request respond = do response <- handleRequest requestPath request respond $ responseLBS status200 [("Content-Type", "text/plain")] response where requestPath = T.intercalate "/" $ pathInfo request
223
false
true
3
10
41
80
35
45
null
null
eklavya/Idris-dev
src/Idris/Core/Evaluate.hs
bsd-3-clause
canonical (VType _) = True
26
canonical (VType _) = True
26
canonical (VType _) = True
26
false
false
0
7
4
15
7
8
null
null
FranklinChen/hugs98-plus-Sep2006
packages/OpenAL/Sound/OpenAL/Constants.hs
bsd-3-clause
al_LOOPING = CONST_AL_LOOPING
54
al_LOOPING = CONST_AL_LOOPING
54
al_LOOPING = CONST_AL_LOOPING
54
false
false
0
4
27
6
3
3
null
null
pbiggar/rash
src/Rash/IR/Bash2Rough.hs
bsd-3-clause
uop2FunctionName C.UserOwned = "file.isUserOwned"
49
uop2FunctionName C.UserOwned = "file.isUserOwned"
49
uop2FunctionName C.UserOwned = "file.isUserOwned"
49
false
false
0
6
3
11
5
6
null
null
mpickering/hackage-server
Distribution/Server/Features/HoogleData.hs
bsd-3-clause
writeCacheFile :: SafeCopy a => FilePath -> a -> IO () writeCacheFile file x = BS.writeFile file (runPutLazy (safePut x))
125
writeCacheFile :: SafeCopy a => FilePath -> a -> IO () writeCacheFile file x = BS.writeFile file (runPutLazy (safePut x))
125
writeCacheFile file x = BS.writeFile file (runPutLazy (safePut x))
70
false
true
0
9
23
55
26
29
null
null
yihuang/cabal-install
Distribution/Client/Init.hs
bsd-3-clause
writeCabalFile :: InitFlags -> IO Bool writeCabalFile flags@(InitFlags{packageName = NoFlag}) = do message flags "Error: no package name provided." return False
164
writeCabalFile :: InitFlags -> IO Bool writeCabalFile flags@(InitFlags{packageName = NoFlag}) = do message flags "Error: no package name provided." return False
164
writeCabalFile flags@(InitFlags{packageName = NoFlag}) = do message flags "Error: no package name provided." return False
125
false
true
0
9
24
55
25
30
null
null
TransformingMusicology/tabcode-haskell
src/TabCode/Serialiser/MEIXML/Serialiser.hs
gpl-3.0
mei :: Namespace mei = namespace "" "http://www.music-encoding.org/ns/mei"
74
mei :: Namespace mei = namespace "" "http://www.music-encoding.org/ns/mei"
74
mei = namespace "" "http://www.music-encoding.org/ns/mei"
57
false
true
0
6
7
22
9
13
null
null
AshyIsMe/lambdatwit
Main.hs
mit
addReply :: TweetId -> Update LambdaTwitDb () addReply tweetId = modify go where go (LambdaTwitDb db) = LambdaTwitDb $ tweetId : db {-The Acid State magic-}
159
addReply :: TweetId -> Update LambdaTwitDb () addReply tweetId = modify go where go (LambdaTwitDb db) = LambdaTwitDb $ tweetId : db {-The Acid State magic-}
159
addReply tweetId = modify go where go (LambdaTwitDb db) = LambdaTwitDb $ tweetId : db {-The Acid State magic-}
113
false
true
0
7
28
53
26
27
null
null
AaronFriel/hs-tls
core/Network/TLS/Cipher.hs
bsd-3-clause
cipherKeyBlockSize :: Cipher -> Int cipherKeyBlockSize cipher = 2 * (hashDigestSize (cipherHash cipher) + bulkIVSize bulk + bulkKeySize bulk) where bulk = cipherBulk cipher -- | Check if a specific 'Cipher' is allowed to be used -- with the version specified
261
cipherKeyBlockSize :: Cipher -> Int cipherKeyBlockSize cipher = 2 * (hashDigestSize (cipherHash cipher) + bulkIVSize bulk + bulkKeySize bulk) where bulk = cipherBulk cipher -- | Check if a specific 'Cipher' is allowed to be used -- with the version specified
261
cipherKeyBlockSize cipher = 2 * (hashDigestSize (cipherHash cipher) + bulkIVSize bulk + bulkKeySize bulk) where bulk = cipherBulk cipher -- | Check if a specific 'Cipher' is allowed to be used -- with the version specified
225
false
true
0
11
43
61
30
31
null
null
brendanhay/gogol
gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs
mpl-2.0
-- | The thumbnail of a person\'s face. g1Thumbnail :: Lens' GoogleCloudVideointelligenceV1p1beta1_FaceDetectionAnnotation (Maybe ByteString) g1Thumbnail = lens _g1Thumbnail (\ s a -> s{_g1Thumbnail = a}) . mapping _Bytes
229
g1Thumbnail :: Lens' GoogleCloudVideointelligenceV1p1beta1_FaceDetectionAnnotation (Maybe ByteString) g1Thumbnail = lens _g1Thumbnail (\ s a -> s{_g1Thumbnail = a}) . mapping _Bytes
189
g1Thumbnail = lens _g1Thumbnail (\ s a -> s{_g1Thumbnail = a}) . mapping _Bytes
87
true
true
0
10
35
55
28
27
null
null
s9gf4ult/yesod
yesod-form/Yesod/Form/Functions.hs
mit
postHelper :: (MonadHandler m, RenderMessage (HandlerSite m) FormMessage) => (Html -> MForm m (FormResult a, xml)) -> Maybe (Env, FileEnv) -> m ((FormResult a, xml), Enctype) postHelper form env = do req <- getRequest let tokenKey = defaultCsrfParamName let token = case reqToken req of Nothing -> Data.Monoid.mempty Just n -> [shamlet|<input type=hidden name=#{tokenKey} value=#{n}>|] m <- getYesod langs <- languages ((res, xml), enctype) <- runFormGeneric (form token) m langs env let res' = case (res, env) of (_, Nothing) -> FormMissing (FormSuccess{}, Just (params, _)) | not (Map.lookup tokenKey params === reqToken req) -> FormFailure [renderMessage m langs MsgCsrfWarning] _ -> res -- It's important to use constant-time comparison (constEqBytes) in order to avoid timing attacks. where (Just [t1]) === (Just t2) = TE.encodeUtf8 t1 `constEqBytes` TE.encodeUtf8 t2 Nothing === Nothing = True _ === _ = False return ((res', xml), enctype) -- | Similar to 'runFormPost', except it always ignores the currently available -- environment. This is necessary in cases like a wizard UI, where a single -- page will both receive and incoming form and produce a new, blank form. For -- general usage, you can stick with @runFormPost@.
1,534
postHelper :: (MonadHandler m, RenderMessage (HandlerSite m) FormMessage) => (Html -> MForm m (FormResult a, xml)) -> Maybe (Env, FileEnv) -> m ((FormResult a, xml), Enctype) postHelper form env = do req <- getRequest let tokenKey = defaultCsrfParamName let token = case reqToken req of Nothing -> Data.Monoid.mempty Just n -> [shamlet|<input type=hidden name=#{tokenKey} value=#{n}>|] m <- getYesod langs <- languages ((res, xml), enctype) <- runFormGeneric (form token) m langs env let res' = case (res, env) of (_, Nothing) -> FormMissing (FormSuccess{}, Just (params, _)) | not (Map.lookup tokenKey params === reqToken req) -> FormFailure [renderMessage m langs MsgCsrfWarning] _ -> res -- It's important to use constant-time comparison (constEqBytes) in order to avoid timing attacks. where (Just [t1]) === (Just t2) = TE.encodeUtf8 t1 `constEqBytes` TE.encodeUtf8 t2 Nothing === Nothing = True _ === _ = False return ((res', xml), enctype) -- | Similar to 'runFormPost', except it always ignores the currently available -- environment. This is necessary in cases like a wizard UI, where a single -- page will both receive and incoming form and produce a new, blank form. For -- general usage, you can stick with @runFormPost@.
1,534
postHelper form env = do req <- getRequest let tokenKey = defaultCsrfParamName let token = case reqToken req of Nothing -> Data.Monoid.mempty Just n -> [shamlet|<input type=hidden name=#{tokenKey} value=#{n}>|] m <- getYesod langs <- languages ((res, xml), enctype) <- runFormGeneric (form token) m langs env let res' = case (res, env) of (_, Nothing) -> FormMissing (FormSuccess{}, Just (params, _)) | not (Map.lookup tokenKey params === reqToken req) -> FormFailure [renderMessage m langs MsgCsrfWarning] _ -> res -- It's important to use constant-time comparison (constEqBytes) in order to avoid timing attacks. where (Just [t1]) === (Just t2) = TE.encodeUtf8 t1 `constEqBytes` TE.encodeUtf8 t2 Nothing === Nothing = True _ === _ = False return ((res', xml), enctype) -- | Similar to 'runFormPost', except it always ignores the currently available -- environment. This is necessary in cases like a wizard UI, where a single -- page will both receive and incoming form and produce a new, blank form. For -- general usage, you can stick with @runFormPost@.
1,322
false
true
0
20
493
387
199
188
null
null
rzeigler/advent-of-code-2016
Lib/AoC/Day11.hs
mit
successorsTo :: Floors -> [Floors] successorsTo current = filter isValid (apply current <$> (posUpdates ++ negUpdates)) where (Floors len _ fs e) = current upper = delta (len * 2) Up downer = delta (len * 2) Down moveable = filter onTargetFloor [0..(len * 2) - 1] moveablePairs = [(x, y) | x <- moveable, y <- moveable, x < y] posUpdates = if e < 3 then (upper . Single <$> moveable) ++ (upper . uncurry Pair <$> moveablePairs) else [] negUpdates = if e > 0 then (downer . Single <$> moveable) ++ (downer . uncurry Pair <$> moveablePairs) else [] onTargetFloor i = fs ! i == e
628
successorsTo :: Floors -> [Floors] successorsTo current = filter isValid (apply current <$> (posUpdates ++ negUpdates)) where (Floors len _ fs e) = current upper = delta (len * 2) Up downer = delta (len * 2) Down moveable = filter onTargetFloor [0..(len * 2) - 1] moveablePairs = [(x, y) | x <- moveable, y <- moveable, x < y] posUpdates = if e < 3 then (upper . Single <$> moveable) ++ (upper . uncurry Pair <$> moveablePairs) else [] negUpdates = if e > 0 then (downer . Single <$> moveable) ++ (downer . uncurry Pair <$> moveablePairs) else [] onTargetFloor i = fs ! i == e
628
successorsTo current = filter isValid (apply current <$> (posUpdates ++ negUpdates)) where (Floors len _ fs e) = current upper = delta (len * 2) Up downer = delta (len * 2) Down moveable = filter onTargetFloor [0..(len * 2) - 1] moveablePairs = [(x, y) | x <- moveable, y <- moveable, x < y] posUpdates = if e < 3 then (upper . Single <$> moveable) ++ (upper . uncurry Pair <$> moveablePairs) else [] negUpdates = if e > 0 then (downer . Single <$> moveable) ++ (downer . uncurry Pair <$> moveablePairs) else [] onTargetFloor i = fs ! i == e
593
false
true
7
13
162
279
145
134
null
null
phaul/chess
Test/Puzzle/EvaluationConfigGA.hs
bsd-3-clause
minimums :: String -> Int minimums "STS1.epd" = 342 - 10
57
minimums :: String -> Int minimums "STS1.epd" = 342 - 10
57
minimums "STS1.epd" = 342 - 10
31
false
true
0
5
11
22
11
11
null
null
prl-tokyo/bigul-configuration-adaptation
Transformations/src/Generics/BiGUL/Interpreter.hs
mit
createAndCheck :: MonadError' ErrorInfo m => v -> (v -> m s) -> (s -> m Bool) -> (s -> v -> m s) -> (s -> v -> m Bool)-> m s createAndCheck v create p elemPut matchCond = create v >>= \s -> putAndCheck s v p elemPut matchCond
226
createAndCheck :: MonadError' ErrorInfo m => v -> (v -> m s) -> (s -> m Bool) -> (s -> v -> m s) -> (s -> v -> m Bool)-> m s createAndCheck v create p elemPut matchCond = create v >>= \s -> putAndCheck s v p elemPut matchCond
226
createAndCheck v create p elemPut matchCond = create v >>= \s -> putAndCheck s v p elemPut matchCond
101
false
true
0
14
51
125
61
64
null
null
josefs/deep-shallow-paper
DeepShallow.hs
mit
none :: (Syntactic a, Inhabited (Internal a)) => Option a none = Option false (fromFunC example)
96
none :: (Syntactic a, Inhabited (Internal a)) => Option a none = Option false (fromFunC example)
96
none = Option false (fromFunC example)
38
false
true
0
8
15
46
23
23
null
null
shockkolate/containers
Data/IntMap/Strict.hs
bsd-3-clause
-- | /O(n+m)/. The intersection with a combining function. -- -- > let f k al ar = (show k) ++ ":" ++ al ++ "|" ++ ar -- > intersectionWithKey f (fromList [(5, "a"), (3, "b")]) (fromList [(5, "A"), (7, "C")]) == singleton 5 "5:a|A" intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c intersectionWithKey f m1 m2 = mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 $! f k1 x1 x2) (const Nil) (const Nil) m1 m2
444
intersectionWithKey :: (Key -> a -> b -> c) -> IntMap a -> IntMap b -> IntMap c intersectionWithKey f m1 m2 = mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 $! f k1 x1 x2) (const Nil) (const Nil) m1 m2
211
intersectionWithKey f m1 m2 = mergeWithKey' bin (\(Tip k1 x1) (Tip _k2 x2) -> Tip k1 $! f k1 x1 x2) (const Nil) (const Nil) m1 m2
131
true
true
0
9
93
124
62
62
null
null
stschiff/rarecoal-tools
src-vcf2FreqSum/vcf2FreqSum.hs
gpl-3.0
desc :: Description desc = Description $ PT.text ("vcf2FreqSum version " ++ showVersion version ++ ": a program to convert a multi-sample VCF, read from stdin, into a freqSum file")
185
desc :: Description desc = Description $ PT.text ("vcf2FreqSum version " ++ showVersion version ++ ": a program to convert a multi-sample VCF, read from stdin, into a freqSum file")
185
desc = Description $ PT.text ("vcf2FreqSum version " ++ showVersion version ++ ": a program to convert a multi-sample VCF, read from stdin, into a freqSum file")
165
false
true
0
10
33
40
18
22
null
null
reflex-frp/reflex-dom
reflex-dom-core/src/Reflex/Dom/Xhr/Foreign.hs
bsd-3-clause
xmlHttpRequestOpen :: (ToJSString method, ToJSString url, ToJSString user, ToJSString password, MonadJSM m) => XMLHttpRequest -> method -> url -> Bool -> user -> password -> m () xmlHttpRequestOpen request method url async user password = open request method url async (Just user) (Just password)
336
xmlHttpRequestOpen :: (ToJSString method, ToJSString url, ToJSString user, ToJSString password, MonadJSM m) => XMLHttpRequest -> method -> url -> Bool -> user -> password -> m () xmlHttpRequestOpen request method url async user password = open request method url async (Just user) (Just password)
336
xmlHttpRequestOpen request method url async user password = open request method url async (Just user) (Just password)
117
false
true
0
13
83
111
55
56
null
null
dan-t/hsbot
Grid.hs
bsd-3-clause
index :: GridCoord -> Grid -> Int index (x:.y:.()) grid = (x * grid ^. height) + y
82
index :: GridCoord -> Grid -> Int index (x:.y:.()) grid = (x * grid ^. height) + y
82
index (x:.y:.()) grid = (x * grid ^. height) + y
48
false
true
0
12
17
58
28
30
null
null
nejla/auth-service
service/src/Twilio.hs
bsd-3-clause
apiVersion :: BS.ByteString apiVersion = "2010-04-01"
53
apiVersion :: BS.ByteString apiVersion = "2010-04-01"
53
apiVersion = "2010-04-01"
25
false
true
0
7
5
20
8
12
null
null
mydaum/cabal
cabal-install/Distribution/Solver/Types/ConstraintSource.hs
bsd-3-clause
showConstraintSource ConstraintSourceConfigFlagOrTarget = "config file, command line flag, or user target"
110
showConstraintSource ConstraintSourceConfigFlagOrTarget = "config file, command line flag, or user target"
110
showConstraintSource ConstraintSourceConfigFlagOrTarget = "config file, command line flag, or user target"
110
false
false
0
5
14
9
4
5
null
null
tdox/elevators
Elevators/Logic.hs
gpl-3.0
continue1 :: Elevator -> (Maybe Goal, Elevator) continue1 e = elTick Nothing e
78
continue1 :: Elevator -> (Maybe Goal, Elevator) continue1 e = elTick Nothing e
78
continue1 e = elTick Nothing e
30
false
true
0
7
12
32
16
16
null
null
AlexanderPankiv/ghc
compiler/vectorise/Vectorise/Monad/Base.hs
bsd-3-clause
maybeV :: SDoc -> VM (Maybe a) -> VM a maybeV reason p = maybe (noV reason) return =<< p
88
maybeV :: SDoc -> VM (Maybe a) -> VM a maybeV reason p = maybe (noV reason) return =<< p
88
maybeV reason p = maybe (noV reason) return =<< p
49
false
true
0
10
19
57
25
32
null
null
bumptech/riak-haskell-client
src/Network/Riak/Content.hs
apache-2.0
-- | Content encoded as @application/json@. json :: ToJSON a => a -> Content json j = empty { value = encode j , content_type = Just "application/json" }
183
json :: ToJSON a => a -> Content json j = empty { value = encode j , content_type = Just "application/json" }
139
json j = empty { value = encode j , content_type = Just "application/json" }
106
true
true
0
8
58
55
26
29
null
null
CGenie/platform
shared/src/Unison/ABT.hs
mit
freshNamed' :: Var v => Set v -> Text -> v freshNamed' used n = fresh' used (v' n)
82
freshNamed' :: Var v => Set v -> Text -> v freshNamed' used n = fresh' used (v' n)
82
freshNamed' used n = fresh' used (v' n)
39
false
true
0
7
18
45
21
24
null
null
jstolarek/sandbox
haskell/PropEq.hs
unlicense
boolToProp :: (BoolEq a b ~ True) => SNat a -> SNat b -> PropEq a b boolToProp SZero SZero = Refl
97
boolToProp :: (BoolEq a b ~ True) => SNat a -> SNat b -> PropEq a b boolToProp SZero SZero = Refl
97
boolToProp SZero SZero = Refl
29
false
true
0
9
21
56
25
31
null
null
Bolt64/wyas
src/PrimitiveFunctions.hs
mit
isNumber _ ([_]) = return $ LispBool False
42
isNumber _ ([_]) = return $ LispBool False
42
isNumber _ ([_]) = return $ LispBool False
42
false
false
0
7
7
24
12
12
null
null
romildo/hprettybox
src/Text/PrettyPrint/Box.hs
bsd-3-clause
widen b@(Box xs) w | w <= wid = b | otherwise = left <> b <> right where wid = width b hei = height b left = uniform ' ' ((w - wid) `div` 2) hei right = uniform ' ' (w - wid - width left) hei
244
widen b@(Box xs) w | w <= wid = b | otherwise = left <> b <> right where wid = width b hei = height b left = uniform ' ' ((w - wid) `div` 2) hei right = uniform ' ' (w - wid - width left) hei
244
widen b@(Box xs) w | w <= wid = b | otherwise = left <> b <> right where wid = width b hei = height b left = uniform ' ' ((w - wid) `div` 2) hei right = uniform ' ' (w - wid - width left) hei
244
false
false
3
9
102
120
60
60
null
null
rvion/ride
jetpack/src/System/Process/AsEnv.hs
bsd-3-clause
set_env_cmdspec x o = o { I.cmdspec = x}
40
set_env_cmdspec x o = o { I.cmdspec = x}
40
set_env_cmdspec x o = o { I.cmdspec = x}
40
false
false
0
6
8
21
11
10
null
null
spire/spire
src/Spire/Canonical/Embedder.hs
bsd-3-clause
embedV (VPi _A _B) = Infer <$> (IPi <$> embedV _A <*> embedVB _B)
78
embedV (VPi _A _B) = Infer <$> (IPi <$> embedV _A <*> embedVB _B)
78
embedV (VPi _A _B) = Infer <$> (IPi <$> embedV _A <*> embedVB _B)
78
false
false
0
9
26
38
18
20
null
null
mightymoose/liquidhaskell
benchmarks/icfp15/pos/FindRec.hs
bsd-3-clause
forM_ (x:xs) m = m x >> forM_ xs m
34
forM_ (x:xs) m = m x >> forM_ xs m
34
forM_ (x:xs) m = m x >> forM_ xs m
34
false
false
3
6
9
37
14
23
null
null
brownplt/strobe-old
src/BrownPLT/TypedJS/RuntimeAnnotations.hs
bsd-2-clause
isFunction :: Stx.Expression SourcePos -> Bool isFunction (Stx.FuncExpr {}) = True
82
isFunction :: Stx.Expression SourcePos -> Bool isFunction (Stx.FuncExpr {}) = True
82
isFunction (Stx.FuncExpr {}) = True
35
false
true
0
7
10
37
17
20
null
null
sdiehl/ghc
libraries/base/GHC/Event/Thread.hs
bsd-3-clause
threadWaitReadSTM :: Fd -> IO (STM (), IO ()) threadWaitReadSTM = threadWaitSTM evtRead
87
threadWaitReadSTM :: Fd -> IO (STM (), IO ()) threadWaitReadSTM = threadWaitSTM evtRead
87
threadWaitReadSTM = threadWaitSTM evtRead
41
false
true
0
9
12
37
18
19
null
null
UoYCS-plasma/LazySmallCheck2012
suite/performance/Benchmarks/Countdown.hs
bsd-3-clause
ne :: ([a],[b]) -> Bool ne (xs,ys) = not (null xs || null ys)
90
ne :: ([a],[b]) -> Bool ne (xs,ys) = not (null xs || null ys)
90
ne (xs,ys) = not (null xs || null ys)
48
false
true
0
8
42
52
28
24
null
null
h3nnn4n/rubiks-cube-haskell
Rubik.hs
gpl-3.0
ldb = (Corner Green Yellow Orange)
34
ldb = (Corner Green Yellow Orange)
34
ldb = (Corner Green Yellow Orange)
34
false
false
1
6
5
19
8
11
null
null
GaloisInc/sk-dev-platform
user/sklite/src/Sklite/Config.hs
bsd-3-clause
aOverwrite = name "overwrite"
29
aOverwrite = name "overwrite"
29
aOverwrite = name "overwrite"
29
false
false
0
5
3
9
4
5
null
null
wavewave/EventAnalysis
exe/test.hs
bsd-2-clause
interwine2 :: LHEvent -> LHEvent -> LHEvent interwine2 (LHEvent einfo1 pinfos1) (LHEvent einfo2 pinfos2) = let ptlids1 = map ptlid pinfos1 icols1 = filter (/= 0) (concatMap ((\x -> [fst x, snd x]) . icolup ) pinfos1) maxid1 = maximum ptlids1 maxicol1 = maximum icols1 minicol1 = minimum icols1 npinfos2' = map (adjustIds (idChange (maxid1-1)) (colChange (maxicol1-minicol1+1))) pinfos2 (first1,(n1:rest1)) = getN1 pinfos1 pinfos1' = first1 ++ (n1 { istup = 2} : rest1) rn1 = head $ npinfos2' (_:npinfos2) = adjustIdMomSpin (n1,rn1) . adjustFirst (ptlid n1) $ npinfos2' npinfos = pinfos1' ++ npinfos2 numptls = length npinfos neinfo = einfo1 { nup = numptls } in LHEvent neinfo npinfos
826
interwine2 :: LHEvent -> LHEvent -> LHEvent interwine2 (LHEvent einfo1 pinfos1) (LHEvent einfo2 pinfos2) = let ptlids1 = map ptlid pinfos1 icols1 = filter (/= 0) (concatMap ((\x -> [fst x, snd x]) . icolup ) pinfos1) maxid1 = maximum ptlids1 maxicol1 = maximum icols1 minicol1 = minimum icols1 npinfos2' = map (adjustIds (idChange (maxid1-1)) (colChange (maxicol1-minicol1+1))) pinfos2 (first1,(n1:rest1)) = getN1 pinfos1 pinfos1' = first1 ++ (n1 { istup = 2} : rest1) rn1 = head $ npinfos2' (_:npinfos2) = adjustIdMomSpin (n1,rn1) . adjustFirst (ptlid n1) $ npinfos2' npinfos = pinfos1' ++ npinfos2 numptls = length npinfos neinfo = einfo1 { nup = numptls } in LHEvent neinfo npinfos
825
interwine2 (LHEvent einfo1 pinfos1) (LHEvent einfo2 pinfos2) = let ptlids1 = map ptlid pinfos1 icols1 = filter (/= 0) (concatMap ((\x -> [fst x, snd x]) . icolup ) pinfos1) maxid1 = maximum ptlids1 maxicol1 = maximum icols1 minicol1 = minimum icols1 npinfos2' = map (adjustIds (idChange (maxid1-1)) (colChange (maxicol1-minicol1+1))) pinfos2 (first1,(n1:rest1)) = getN1 pinfos1 pinfos1' = first1 ++ (n1 { istup = 2} : rest1) rn1 = head $ npinfos2' (_:npinfos2) = adjustIdMomSpin (n1,rn1) . adjustFirst (ptlid n1) $ npinfos2' npinfos = pinfos1' ++ npinfos2 numptls = length npinfos neinfo = einfo1 { nup = numptls } in LHEvent neinfo npinfos
781
false
true
0
17
250
306
161
145
null
null