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
DanielRS/marquee
src/Text/Marquee/Writers/HTML.hs
mit
writeElement (Paragraph x) = p $ writeInline x
50
writeElement (Paragraph x) = p $ writeInline x
50
writeElement (Paragraph x) = p $ writeInline x
50
false
false
0
7
11
22
10
12
null
null
8l/barrelfish
hake/XScale.hs
mit
linker = ArchDefaults.linker arch compiler
42
linker = ArchDefaults.linker arch compiler
42
linker = ArchDefaults.linker arch compiler
42
false
false
1
6
4
16
6
10
null
null
ecordell/hackaroons
src/Macaroon/Macaroon.hs
mit
padBase64 :: String -> String padBase64 s | len `mod` 4 == 0 = s | otherwise = s ++ padding where len = length s padding = replicate ((-len) `mod` 4) '='
167
padBase64 :: String -> String padBase64 s | len `mod` 4 == 0 = s | otherwise = s ++ padding where len = length s padding = replicate ((-len) `mod` 4) '='
167
padBase64 s | len `mod` 4 == 0 = s | otherwise = s ++ padding where len = length s padding = replicate ((-len) `mod` 4) '='
137
false
true
2
9
46
80
42
38
null
null
haskellGardener/yusic
src/Yusic.hs
mit
toKeyGuide (Ds_Eb:Gs_Ab:As_Bb :[]) = Just KG_Ds_EbSus4
62
toKeyGuide (Ds_Eb:Gs_Ab:As_Bb :[]) = Just KG_Ds_EbSus4
62
toKeyGuide (Ds_Eb:Gs_Ab:As_Bb :[]) = Just KG_Ds_EbSus4
62
false
false
0
10
13
29
14
15
null
null
owst/Penrose
src/ParseNFA.hs
bsd-3-clause
-- Parse a Net definition: -- NET ::= PLACES, "\n", TRANS, { TRANS }, "\n", MBPLACES "\n"; -- -- PLACE ::= {- Natural Number -}; -- -- MBPLACES ::= [] -- | PLACES; -- -- PLACES ::= PLACE -- | PLACE, ",", PLACES; -- -- TRANS ::= PLACES, "--", LABELS, "->", PLACES; -- -- LABELS ::= LABEL -- | LABEL, ",", LABELS; -- -- LABEL ::= {- Anything but ',' or '-' -} -- -- -- E.g.: -- 0 -- 0--a,b,c->1 -- 0--a->0 -- 1 -- -- is the NFA that has two states and accepts any string a*(a|b|c). parseNetDef :: Parser (NFADef String) parseNetDef = NFADef <$> (parsePlaces <* newline) <*> (NEL.fromList <$> many1 (try (parseNFATrans <* newline))) <*> option [] (NEL.toList <$> parsePlaces <* option '\n' newline) where commaSep1 x = sepBy1 x (char ',') parseInt = read <$> many1 digit parsePlaces = NEL.fromList <$> commaSep1 parseInt parseNFATrans = NFATransDef <$> parsePlaces <*> between (string "--") (string "->") parseLabels <*> parsePlaces parseLabels = NEL.fromList <$> (commaSep1 . many1 $ noneOf "-,")
1,148
parseNetDef :: Parser (NFADef String) parseNetDef = NFADef <$> (parsePlaces <* newline) <*> (NEL.fromList <$> many1 (try (parseNFATrans <* newline))) <*> option [] (NEL.toList <$> parsePlaces <* option '\n' newline) where commaSep1 x = sepBy1 x (char ',') parseInt = read <$> many1 digit parsePlaces = NEL.fromList <$> commaSep1 parseInt parseNFATrans = NFATransDef <$> parsePlaces <*> between (string "--") (string "->") parseLabels <*> parsePlaces parseLabels = NEL.fromList <$> (commaSep1 . many1 $ noneOf "-,")
614
parseNetDef = NFADef <$> (parsePlaces <* newline) <*> (NEL.fromList <$> many1 (try (parseNFATrans <* newline))) <*> option [] (NEL.toList <$> parsePlaces <* option '\n' newline) where commaSep1 x = sepBy1 x (char ',') parseInt = read <$> many1 digit parsePlaces = NEL.fromList <$> commaSep1 parseInt parseNFATrans = NFATransDef <$> parsePlaces <*> between (string "--") (string "->") parseLabels <*> parsePlaces parseLabels = NEL.fromList <$> (commaSep1 . many1 $ noneOf "-,")
576
true
true
0
13
326
224
125
99
null
null
exbb2/BlastItWithPiss
src/GtkBlast/Mainloop.hs
gpl-3.0
killWipe :: E () killWipe = do E{ wipeStarted , boardUnits , threadGroup , connection , wbuttonwipe , wprogresswipe } <- ask io $ atomically $ writeTVar wipeStarted False -- HACK? destroy captcha server setCaptchaServer Primitive writeLog "Stopping wipe..." -- close all connections io $ closeManager connection mapM_ killBoardUnit boardUnits -- io is uninterruptible on dos, so workers might not even be able to die #ifndef mingw32_HOST_OS io $ ThreadGroup.wait threadGroup #endif -- once all generators are dead, remove captcha killAllCaptcha io $ buttonSetLabel wbuttonwipe "Начать _Вайп" io $ progressBarSetFraction wprogresswipe 0 --uncMessage "Вайп ещё не начат"
757
killWipe :: E () killWipe = do E{ wipeStarted , boardUnits , threadGroup , connection , wbuttonwipe , wprogresswipe } <- ask io $ atomically $ writeTVar wipeStarted False -- HACK? destroy captcha server setCaptchaServer Primitive writeLog "Stopping wipe..." -- close all connections io $ closeManager connection mapM_ killBoardUnit boardUnits -- io is uninterruptible on dos, so workers might not even be able to die #ifndef mingw32_HOST_OS io $ ThreadGroup.wait threadGroup #endif -- once all generators are dead, remove captcha killAllCaptcha io $ buttonSetLabel wbuttonwipe "Начать _Вайп" io $ progressBarSetFraction wprogresswipe 0 --uncMessage "Вайп ещё не начат"
757
killWipe = do E{ wipeStarted , boardUnits , threadGroup , connection , wbuttonwipe , wprogresswipe } <- ask io $ atomically $ writeTVar wipeStarted False -- HACK? destroy captcha server setCaptchaServer Primitive writeLog "Stopping wipe..." -- close all connections io $ closeManager connection mapM_ killBoardUnit boardUnits -- io is uninterruptible on dos, so workers might not even be able to die #ifndef mingw32_HOST_OS io $ ThreadGroup.wait threadGroup #endif -- once all generators are dead, remove captcha killAllCaptcha io $ buttonSetLabel wbuttonwipe "Начать _Вайп" io $ progressBarSetFraction wprogresswipe 0 --uncMessage "Вайп ещё не начат"
740
false
true
0
9
185
136
65
71
null
null
mhwombat/prediction-wains
src/ALife/Creatur/Wain/UIVector/Prediction/Universe.hs
bsd-3-clause
cWorkingDir :: Setting FilePath cWorkingDir = requiredSetting "workingDir"
74
cWorkingDir :: Setting FilePath cWorkingDir = requiredSetting "workingDir"
74
cWorkingDir = requiredSetting "workingDir"
42
false
true
0
5
7
17
8
9
null
null
exbb2/BlastItWithPiss
src/BlastItWithPiss/Board.hs
gpl-3.0
ssach :: (Monoid a, IsString a) => a ssach = "http://" <> fromString (unsafePerformIO (readIORef domainVar))
108
ssach :: (Monoid a, IsString a) => a ssach = "http://" <> fromString (unsafePerformIO (readIORef domainVar))
108
ssach = "http://" <> fromString (unsafePerformIO (readIORef domainVar))
71
false
true
0
10
15
45
23
22
null
null
keera-studios/hsQt
Qtc/Enums/Gui/QMessageBox.hs
bsd-2-clause
eButtonMask :: QMessageBoxStandardButton eButtonMask = ieQMessageBoxStandardButton $ -769
91
eButtonMask :: QMessageBoxStandardButton eButtonMask = ieQMessageBoxStandardButton $ -769
91
eButtonMask = ieQMessageBoxStandardButton $ -769
50
false
true
0
6
9
23
10
13
null
null
ksaveljev/hake-2
src/Render/Fast/Model.hs
bsd-3-clause
pointInLeaf :: V3 Float -> ModelT -> Quake MLeafT pointInLeaf p model = do let rootNode = MNodeChildReference ((model^.mNodes) V.! 0) findLeaf rootNode where findLeaf :: MNodeChild -> Quake MLeafT findLeaf (MNodeChildReference nodeRef) = do node <- io $ readIORef nodeRef plane <- io $ readIORef (node^.mnPlane) let d = p `dot` (plane^.cpNormal) - (plane^.cpDist) childRef = if d > 0 then node^.mnChildren._1 else node^.mnChildren._2 case childRef of MLeafChildReference leafRef -> io $ readIORef leafRef nodeChild -> findLeaf nodeChild
689
pointInLeaf :: V3 Float -> ModelT -> Quake MLeafT pointInLeaf p model = do let rootNode = MNodeChildReference ((model^.mNodes) V.! 0) findLeaf rootNode where findLeaf :: MNodeChild -> Quake MLeafT findLeaf (MNodeChildReference nodeRef) = do node <- io $ readIORef nodeRef plane <- io $ readIORef (node^.mnPlane) let d = p `dot` (plane^.cpNormal) - (plane^.cpDist) childRef = if d > 0 then node^.mnChildren._1 else node^.mnChildren._2 case childRef of MLeafChildReference leafRef -> io $ readIORef leafRef nodeChild -> findLeaf nodeChild
689
pointInLeaf p model = do let rootNode = MNodeChildReference ((model^.mNodes) V.! 0) findLeaf rootNode where findLeaf :: MNodeChild -> Quake MLeafT findLeaf (MNodeChildReference nodeRef) = do node <- io $ readIORef nodeRef plane <- io $ readIORef (node^.mnPlane) let d = p `dot` (plane^.cpNormal) - (plane^.cpDist) childRef = if d > 0 then node^.mnChildren._1 else node^.mnChildren._2 case childRef of MLeafChildReference leafRef -> io $ readIORef leafRef nodeChild -> findLeaf nodeChild
639
false
true
0
14
231
231
110
121
null
null
ekarayel/HTF
Test/Framework/Preprocessor.hs
lgpl-2.1
fixPositionsTest :: IO () fixPositionsTest = let toks = concatMap (\(f, i) -> f i) (zip [tok, linePragma "bar" 10, tok, tok, linePragma "foo" 99, tok] [1..]) fixedToks = fixPositions origFileName toks expectedToks = concat $ [tok' origFileName 1 ,linePragma' "bar" 10 2 ,tok' "bar" 10 ,tok' "bar" 11 ,linePragma' "foo" 99 5 ,tok' "foo" 99] in assertEqual (show expectedToks ++ "\n\n /= \n\n" ++ show toks) expectedToks fixedToks where origFileName = "spam" tok line = [(Varid, (Pos 0 line 1, "_"))] linePragma fname line lineHere = let pos = Pos 0 lineHere 1 in [(Varsym, (pos, "#")) ,(Varid, (pos, "line")) ,(IntLit, (pos, show line)) ,(StringLit, (pos, fname))] tok' fname line = let loc = Loc fname line 1 in [(Varid, (loc, "_"))] linePragma' fname line lineHere = let loc = Loc origFileName lineHere 1 in [(Varsym, (loc, "#")) ,(Varid, (loc, "line")) ,(IntLit, (loc, show line)) ,(StringLit,(loc, fname))]
1,264
fixPositionsTest :: IO () fixPositionsTest = let toks = concatMap (\(f, i) -> f i) (zip [tok, linePragma "bar" 10, tok, tok, linePragma "foo" 99, tok] [1..]) fixedToks = fixPositions origFileName toks expectedToks = concat $ [tok' origFileName 1 ,linePragma' "bar" 10 2 ,tok' "bar" 10 ,tok' "bar" 11 ,linePragma' "foo" 99 5 ,tok' "foo" 99] in assertEqual (show expectedToks ++ "\n\n /= \n\n" ++ show toks) expectedToks fixedToks where origFileName = "spam" tok line = [(Varid, (Pos 0 line 1, "_"))] linePragma fname line lineHere = let pos = Pos 0 lineHere 1 in [(Varsym, (pos, "#")) ,(Varid, (pos, "line")) ,(IntLit, (pos, show line)) ,(StringLit, (pos, fname))] tok' fname line = let loc = Loc fname line 1 in [(Varid, (loc, "_"))] linePragma' fname line lineHere = let loc = Loc origFileName lineHere 1 in [(Varsym, (loc, "#")) ,(Varid, (loc, "line")) ,(IntLit, (loc, show line)) ,(StringLit,(loc, fname))]
1,264
fixPositionsTest = let toks = concatMap (\(f, i) -> f i) (zip [tok, linePragma "bar" 10, tok, tok, linePragma "foo" 99, tok] [1..]) fixedToks = fixPositions origFileName toks expectedToks = concat $ [tok' origFileName 1 ,linePragma' "bar" 10 2 ,tok' "bar" 10 ,tok' "bar" 11 ,linePragma' "foo" 99 5 ,tok' "foo" 99] in assertEqual (show expectedToks ++ "\n\n /= \n\n" ++ show toks) expectedToks fixedToks where origFileName = "spam" tok line = [(Varid, (Pos 0 line 1, "_"))] linePragma fname line lineHere = let pos = Pos 0 lineHere 1 in [(Varsym, (pos, "#")) ,(Varid, (pos, "line")) ,(IntLit, (pos, show line)) ,(StringLit, (pos, fname))] tok' fname line = let loc = Loc fname line 1 in [(Varid, (loc, "_"))] linePragma' fname line lineHere = let loc = Loc origFileName lineHere 1 in [(Varsym, (loc, "#")) ,(Varid, (loc, "line")) ,(IntLit, (loc, show line)) ,(StringLit,(loc, fname))]
1,238
false
true
0
13
502
450
248
202
null
null
jcsmnt0/MarkovMusic
Music.hs
mit
(.+) = flip progression
23
(.+) = flip progression
23
(.+) = flip progression
23
false
false
0
5
3
11
6
5
null
null
thomie/cabal
cabal-install/Distribution/Client/Setup.hs
bsd-3-clause
showRepo :: RemoteRepo -> String showRepo repo = remoteRepoName repo ++ ":" ++ uriToString id (remoteRepoURI repo) []
130
showRepo :: RemoteRepo -> String showRepo repo = remoteRepoName repo ++ ":" ++ uriToString id (remoteRepoURI repo) []
130
showRepo repo = remoteRepoName repo ++ ":" ++ uriToString id (remoteRepoURI repo) []
97
false
true
0
8
30
44
21
23
null
null
snoyberg/yesodcms
Handler/Feed.hs
bsd-2-clause
getContentFeedItemR :: FeedItemId -> Handler () getContentFeedItemR fid = do f <- runDB $ get404 fid redirectText RedirectPermanent $ feedItemUrl f
155
getContentFeedItemR :: FeedItemId -> Handler () getContentFeedItemR fid = do f <- runDB $ get404 fid redirectText RedirectPermanent $ feedItemUrl f
155
getContentFeedItemR fid = do f <- runDB $ get404 fid redirectText RedirectPermanent $ feedItemUrl f
107
false
true
0
10
28
55
23
32
null
null
michaelschade/hs-stripe
src/Web/Stripe/Card.hs
bsd-3-clause
deleteCard :: MonadIO m => CustomerId -> CardId -> StripeT m Bool deleteCard (CustomerId cid) (CardId cardid) = snd `liftM` query (delCardReq cid cardid) { sMethod = DELETE, sData = [] }
190
deleteCard :: MonadIO m => CustomerId -> CardId -> StripeT m Bool deleteCard (CustomerId cid) (CardId cardid) = snd `liftM` query (delCardReq cid cardid) { sMethod = DELETE, sData = [] }
190
deleteCard (CustomerId cid) (CardId cardid) = snd `liftM` query (delCardReq cid cardid) { sMethod = DELETE, sData = [] }
124
false
true
0
11
35
88
44
44
null
null
ssaavedra/liquidhaskell
benchmarks/vector-0.10.0.1/Data/Vector/Generic/New.hs
bsd-3-clause
transform f (New p) = New (MVector.transform f =<< p)
53
transform f (New p) = New (MVector.transform f =<< p)
53
transform f (New p) = New (MVector.transform f =<< p)
53
false
false
0
9
9
32
15
17
null
null
tjakway/ghcjvm
compiler/simplStg/StgStats.hs
bsd-3-clause
emptySE :: StatEnv emptySE = Map.empty
38
emptySE :: StatEnv emptySE = Map.empty
38
emptySE = Map.empty
19
false
true
0
6
5
20
8
12
null
null
glennrfisher/cis194-haskell
02 Algebraic Data Types/LogAnalysis.hs
mit
-- Parse a line from a log file. -- -- > parseMessage "E 2 562 help help" == LogMessage (Error 2) 562 "help help" -- > parseMessage "I 29 la la la" == LogMessage Info 29 "la la la" -- > parseMessage "Incorrect format" == Unknown "Incorrect format" parseMessage :: String -> LogMessage parseMessage line = let wordList = words line in case wordList of ("I":ts:msg) -> LogMessage Info timestamp message where timestamp = read ts message = unwords msg ("W":ts:msg) -> LogMessage Warning timestamp message where timestamp = read ts message = unwords msg ("E":s:ts:msg) -> LogMessage (Error severity) timestamp message where severity = read s timestamp = read ts message = unwords msg _ -> Unknown message where message = unwords wordList -- Parse all lines from a log file. -- -- > parse "" == [] -- > parse "E 2 562 help help\nI 29 la la la" -- == [LogMessage (Error 2) 562 "help help", LogMessage Info 29 "la la la"]
1,134
parseMessage :: String -> LogMessage parseMessage line = let wordList = words line in case wordList of ("I":ts:msg) -> LogMessage Info timestamp message where timestamp = read ts message = unwords msg ("W":ts:msg) -> LogMessage Warning timestamp message where timestamp = read ts message = unwords msg ("E":s:ts:msg) -> LogMessage (Error severity) timestamp message where severity = read s timestamp = read ts message = unwords msg _ -> Unknown message where message = unwords wordList -- Parse all lines from a log file. -- -- > parse "" == [] -- > parse "E 2 562 help help\nI 29 la la la" -- == [LogMessage (Error 2) 562 "help help", LogMessage Info 29 "la la la"]
885
parseMessage line = let wordList = words line in case wordList of ("I":ts:msg) -> LogMessage Info timestamp message where timestamp = read ts message = unwords msg ("W":ts:msg) -> LogMessage Warning timestamp message where timestamp = read ts message = unwords msg ("E":s:ts:msg) -> LogMessage (Error severity) timestamp message where severity = read s timestamp = read ts message = unwords msg _ -> Unknown message where message = unwords wordList -- Parse all lines from a log file. -- -- > parse "" == [] -- > parse "E 2 562 help help\nI 29 la la la" -- == [LogMessage (Error 2) 562 "help help", LogMessage Info 29 "la la la"]
848
true
true
0
13
384
209
108
101
null
null
paolino/dependencies-sm
Test.hs
bsd-3-clause
touch :: b -> Graph a b -> ChangeGraph a b touch x (Accept t) = G.touch t x
76
touch :: b -> Graph a b -> ChangeGraph a b touch x (Accept t) = G.touch t x
76
touch x (Accept t) = G.touch t x
32
false
true
0
7
19
47
22
25
null
null
sopvop/snaplet-postgresql-simple
src/Snap/Snaplet/PostgresqlSimple.hs
bsd-3-clause
getConnectionString :: C.Config -> IO ByteString getConnectionString config = do let params = [ ["host"] , ["hostaddr"] , ["port"] , ["dbname","db"] , ["user"] , ["password","pass"] , ["connection_timeout"] , ["client_encoding"] , ["options"] , ["application_name"] , ["fallback_application_name"] , ["keepalives"] , ["keepalives_idle"] , ["keepalives_interval"] , ["keepalives_count"] , ["sslmode"] , ["sslcompression"] , ["sslcert"] , ["sslkey"] , ["sslrootcert"] , ["sslcrl"] , ["requirepeer"] , ["krbsrvname"] , ["gsslib"] , ["service"] ] connstr <- fmap mconcat $ mapM showParam params extra <- fmap TB.fromText $ C.lookupDefault "" config "connectionString" return $! T.encodeUtf8 (TL.toStrict (TB.toLazyText (connstr <> extra))) where qt = TB.singleton '\'' bs = TB.singleton '\\' sp = TB.singleton ' ' eq = TB.singleton '=' lookupConfig = foldr (\name names -> do mval <- C.lookup config name case mval of Nothing -> names Just _ -> return mval) (return Nothing) showParam [] = undefined showParam names@(name:_) = do mval :: Maybe C.Value <- lookupConfig names let key = TB.fromText name <> eq case mval of Nothing -> return mempty Just (C.Bool x) -> return (key <> showBool x <> sp) Just (C.String x) -> return (key <> showText x <> sp) Just (C.Number x) -> return (key <> showNum x <> sp) Just (C.List _) -> return mempty showBool x = TB.decimal (fromEnum x) nd ratio = (numerator ratio, denominator ratio) showNum (nd -> (n,1)) = TB.decimal n showNum x = TB.formatRealFloat TB.Fixed Nothing ( fromIntegral (numerator x) / fromIntegral (denominator x) :: Double ) showText x = qt <> loop x where loop (T.break escapeNeeded -> (a,b)) = TB.fromText a <> case T.uncons b of Nothing -> qt Just (c,b') -> escapeChar c <> loop b' escapeNeeded c = c == '\'' || c == '\\' escapeChar c = case c of '\'' -> bs <> qt '\\' -> bs <> bs _ -> TB.singleton c
2,680
getConnectionString :: C.Config -> IO ByteString getConnectionString config = do let params = [ ["host"] , ["hostaddr"] , ["port"] , ["dbname","db"] , ["user"] , ["password","pass"] , ["connection_timeout"] , ["client_encoding"] , ["options"] , ["application_name"] , ["fallback_application_name"] , ["keepalives"] , ["keepalives_idle"] , ["keepalives_interval"] , ["keepalives_count"] , ["sslmode"] , ["sslcompression"] , ["sslcert"] , ["sslkey"] , ["sslrootcert"] , ["sslcrl"] , ["requirepeer"] , ["krbsrvname"] , ["gsslib"] , ["service"] ] connstr <- fmap mconcat $ mapM showParam params extra <- fmap TB.fromText $ C.lookupDefault "" config "connectionString" return $! T.encodeUtf8 (TL.toStrict (TB.toLazyText (connstr <> extra))) where qt = TB.singleton '\'' bs = TB.singleton '\\' sp = TB.singleton ' ' eq = TB.singleton '=' lookupConfig = foldr (\name names -> do mval <- C.lookup config name case mval of Nothing -> names Just _ -> return mval) (return Nothing) showParam [] = undefined showParam names@(name:_) = do mval :: Maybe C.Value <- lookupConfig names let key = TB.fromText name <> eq case mval of Nothing -> return mempty Just (C.Bool x) -> return (key <> showBool x <> sp) Just (C.String x) -> return (key <> showText x <> sp) Just (C.Number x) -> return (key <> showNum x <> sp) Just (C.List _) -> return mempty showBool x = TB.decimal (fromEnum x) nd ratio = (numerator ratio, denominator ratio) showNum (nd -> (n,1)) = TB.decimal n showNum x = TB.formatRealFloat TB.Fixed Nothing ( fromIntegral (numerator x) / fromIntegral (denominator x) :: Double ) showText x = qt <> loop x where loop (T.break escapeNeeded -> (a,b)) = TB.fromText a <> case T.uncons b of Nothing -> qt Just (c,b') -> escapeChar c <> loop b' escapeNeeded c = c == '\'' || c == '\\' escapeChar c = case c of '\'' -> bs <> qt '\\' -> bs <> bs _ -> TB.singleton c
2,680
getConnectionString config = do let params = [ ["host"] , ["hostaddr"] , ["port"] , ["dbname","db"] , ["user"] , ["password","pass"] , ["connection_timeout"] , ["client_encoding"] , ["options"] , ["application_name"] , ["fallback_application_name"] , ["keepalives"] , ["keepalives_idle"] , ["keepalives_interval"] , ["keepalives_count"] , ["sslmode"] , ["sslcompression"] , ["sslcert"] , ["sslkey"] , ["sslrootcert"] , ["sslcrl"] , ["requirepeer"] , ["krbsrvname"] , ["gsslib"] , ["service"] ] connstr <- fmap mconcat $ mapM showParam params extra <- fmap TB.fromText $ C.lookupDefault "" config "connectionString" return $! T.encodeUtf8 (TL.toStrict (TB.toLazyText (connstr <> extra))) where qt = TB.singleton '\'' bs = TB.singleton '\\' sp = TB.singleton ' ' eq = TB.singleton '=' lookupConfig = foldr (\name names -> do mval <- C.lookup config name case mval of Nothing -> names Just _ -> return mval) (return Nothing) showParam [] = undefined showParam names@(name:_) = do mval :: Maybe C.Value <- lookupConfig names let key = TB.fromText name <> eq case mval of Nothing -> return mempty Just (C.Bool x) -> return (key <> showBool x <> sp) Just (C.String x) -> return (key <> showText x <> sp) Just (C.Number x) -> return (key <> showNum x <> sp) Just (C.List _) -> return mempty showBool x = TB.decimal (fromEnum x) nd ratio = (numerator ratio, denominator ratio) showNum (nd -> (n,1)) = TB.decimal n showNum x = TB.formatRealFloat TB.Fixed Nothing ( fromIntegral (numerator x) / fromIntegral (denominator x) :: Double ) showText x = qt <> loop x where loop (T.break escapeNeeded -> (a,b)) = TB.fromText a <> case T.uncons b of Nothing -> qt Just (c,b') -> escapeChar c <> loop b' escapeNeeded c = c == '\'' || c == '\\' escapeChar c = case c of '\'' -> bs <> qt '\\' -> bs <> bs _ -> TB.singleton c
2,631
false
true
8
14
1,125
850
434
416
null
null
julienschmaltz/madl
app/Dlockdetect/main.hs
mit
fatal :: Int -> String -> a fatal i s = error ("Fatal "++show i++" in " ++utxt fileName ++":\n "++ s)
102
fatal :: Int -> String -> a fatal i s = error ("Fatal "++show i++" in " ++utxt fileName ++":\n "++ s)
102
fatal i s = error ("Fatal "++show i++" in " ++utxt fileName ++":\n "++ s)
74
false
true
0
12
22
56
27
29
null
null
kmate/HaRe
old/testing/unfoldAsPatterns/A8.hs
bsd-3-clause
insert :: Ord a => a -> BTree a -> (Int, BTree a) insert val (t@(T val1 Empty Empty)) = (42, t)
95
insert :: Ord a => a -> BTree a -> (Int, BTree a) insert val (t@(T val1 Empty Empty)) = (42, t)
95
insert val (t@(T val1 Empty Empty)) = (42, t)
45
false
true
1
13
21
73
35
38
null
null
jbracker/supermonad-plugin
examples/monad/hmtc/supermonad/CodeGenerator.hs
bsd-3-clause
sizeOf (Ref _) = 1
20
sizeOf (Ref _) = 1
20
sizeOf (Ref _) = 1
20
false
false
0
7
6
15
7
8
null
null
nothiphop/project-euler
013/solution.hs
apache-2.0
largeSumDigits :: Int -> [String] -> String largeSumDigits n xs = join "" (toArrayOfChars (take n (digits (sum (toArrayOfIntegers xs)))))
137
largeSumDigits :: Int -> [String] -> String largeSumDigits n xs = join "" (toArrayOfChars (take n (digits (sum (toArrayOfIntegers xs)))))
137
largeSumDigits n xs = join "" (toArrayOfChars (take n (digits (sum (toArrayOfIntegers xs)))))
93
false
true
0
15
19
71
33
38
null
null
brendanhay/gogol
gogol-doubleclick-search/gen/Network/Google/DoubleClickSearch/Types/Product.hs
mpl-2.0
-- | Asynchronous report only. Id of the report. rId :: Lens' Report (Maybe Text) rId = lens _rId (\ s a -> s{_rId = a})
120
rId :: Lens' Report (Maybe Text) rId = lens _rId (\ s a -> s{_rId = a})
71
rId = lens _rId (\ s a -> s{_rId = a})
38
true
true
0
9
25
46
25
21
null
null
kemskems/cis194-spring13
src/HW07/Sized.hs
bsd-3-clause
getSize :: Size -> Int getSize (Size i) = i
43
getSize :: Size -> Int getSize (Size i) = i
43
getSize (Size i) = i
20
false
true
0
9
9
30
13
17
null
null
rodrigogribeiro/mptc
src/Language/Haskell/Exts/Syntax.hs
bsd-3-clause
unboxed_singleton_tycon_name = Special UnboxedSingleCon
55
unboxed_singleton_tycon_name = Special UnboxedSingleCon
55
unboxed_singleton_tycon_name = Special UnboxedSingleCon
55
false
false
0
5
3
9
4
5
null
null
MoixaEnergy/blaze-react
src/Blaze/React/Examples/TimeMachine.hs
mit
renderBody :: (Show a, Show s) => H.Html (WithWindowActions a) -> TMState s a -> H.Html (TMAction a) renderBody internalBody state = do H.div H.! A.class_ "tm-time-machine" $ do H.h1 "Time machine" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction TogglePauseAppA) $ if (_tmsPaused state) then "Resume app" else "Pause app" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction ClearAppHistoryA) $ "Clear history" renderHistoryBrowser renderAppStateBrowser H.div H.! A.class_ "tm-internal-app" $ E.mapActions (AppAction . InternalA) $ internalBody where actionsWithIndices :: [(Int, String)] actionsWithIndices = reverse $ (0, "Initial state") : (zip [1..] $ map show $ _tmsActionHistory state) renderHistoryBrowser = do H.h2 "Events" H.div H.! A.class_ "tm-history-browser" $ do H.ol $ forM_ actionsWithIndices $ \(idx, action) -> H.li H.! A.value (H.toValue $ idx + 1) H.! E.onMouseEnter (\_ -> AppAction $ RevertAppHistoryA idx) H.!? (idx == view tmsActiveAction state, A.class_ "tm-active-item") $ H.toHtml action renderAppStateBrowser = do H.h2 "Application state" H.div H.! A.class_ "tm-app-state-browser" $ H.pre $ H.toHtml $ ppShow $ view tmsInternalState state -- the application transformer ------------------------------
1,442
renderBody :: (Show a, Show s) => H.Html (WithWindowActions a) -> TMState s a -> H.Html (TMAction a) renderBody internalBody state = do H.div H.! A.class_ "tm-time-machine" $ do H.h1 "Time machine" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction TogglePauseAppA) $ if (_tmsPaused state) then "Resume app" else "Pause app" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction ClearAppHistoryA) $ "Clear history" renderHistoryBrowser renderAppStateBrowser H.div H.! A.class_ "tm-internal-app" $ E.mapActions (AppAction . InternalA) $ internalBody where actionsWithIndices :: [(Int, String)] actionsWithIndices = reverse $ (0, "Initial state") : (zip [1..] $ map show $ _tmsActionHistory state) renderHistoryBrowser = do H.h2 "Events" H.div H.! A.class_ "tm-history-browser" $ do H.ol $ forM_ actionsWithIndices $ \(idx, action) -> H.li H.! A.value (H.toValue $ idx + 1) H.! E.onMouseEnter (\_ -> AppAction $ RevertAppHistoryA idx) H.!? (idx == view tmsActiveAction state, A.class_ "tm-active-item") $ H.toHtml action renderAppStateBrowser = do H.h2 "Application state" H.div H.! A.class_ "tm-app-state-browser" $ H.pre $ H.toHtml $ ppShow $ view tmsInternalState state -- the application transformer ------------------------------
1,442
renderBody internalBody state = do H.div H.! A.class_ "tm-time-machine" $ do H.h1 "Time machine" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction TogglePauseAppA) $ if (_tmsPaused state) then "Resume app" else "Pause app" H.span H.! A.class_ "tm-button" H.! E.onClick' (AppAction ClearAppHistoryA) $ "Clear history" renderHistoryBrowser renderAppStateBrowser H.div H.! A.class_ "tm-internal-app" $ E.mapActions (AppAction . InternalA) $ internalBody where actionsWithIndices :: [(Int, String)] actionsWithIndices = reverse $ (0, "Initial state") : (zip [1..] $ map show $ _tmsActionHistory state) renderHistoryBrowser = do H.h2 "Events" H.div H.! A.class_ "tm-history-browser" $ do H.ol $ forM_ actionsWithIndices $ \(idx, action) -> H.li H.! A.value (H.toValue $ idx + 1) H.! E.onMouseEnter (\_ -> AppAction $ RevertAppHistoryA idx) H.!? (idx == view tmsActiveAction state, A.class_ "tm-active-item") $ H.toHtml action renderAppStateBrowser = do H.h2 "Application state" H.div H.! A.class_ "tm-app-state-browser" $ H.pre $ H.toHtml $ ppShow $ view tmsInternalState state -- the application transformer ------------------------------
1,325
false
true
0
20
364
491
237
254
null
null
rueshyna/gogol
gogol-discovery/gen/Network/Google/Discovery/Types/Product.hs
mpl-2.0
-- | The default value of this property (if one exists). jsDefault :: Lens' JSONSchema (Maybe Text) jsDefault = lens _jsDefault (\ s a -> s{_jsDefault = a})
158
jsDefault :: Lens' JSONSchema (Maybe Text) jsDefault = lens _jsDefault (\ s a -> s{_jsDefault = a})
101
jsDefault = lens _jsDefault (\ s a -> s{_jsDefault = a})
58
true
true
0
9
29
48
25
23
null
null
urbanslug/ghc
compiler/codeGen/StgCmmMonad.hs
bsd-3-clause
emitUnwind :: GlobalReg -> CmmExpr -> FCode () emitUnwind g e = do dflags <- getDynFlags when (gopt Opt_Debug dflags) $ emitCgStmt $ CgStmt $ CmmUnwind g e
164
emitUnwind :: GlobalReg -> CmmExpr -> FCode () emitUnwind g e = do dflags <- getDynFlags when (gopt Opt_Debug dflags) $ emitCgStmt $ CgStmt $ CmmUnwind g e
164
emitUnwind g e = do dflags <- getDynFlags when (gopt Opt_Debug dflags) $ emitCgStmt $ CgStmt $ CmmUnwind g e
117
false
true
0
12
36
67
31
36
null
null
cmahon/interactive-brokers
executable/Requests-Service.hs
bsd-3-clause
newIBEventHandler :: EventHandler SomeEvent SomeEvent s newIBEventHandler = mkEventHandler $ SomeEventHandler 0 IBEventHandlerAPI Just id IBEventHandler { _ibDone = False , _ibClientId = 0 , _ibServerVersion = Nothing , _ibServerTimeZone = Nothing , _ibServiceStatus = ServicePending , _ibManagedAccounts = [] , _ibNextRequestId = Nothing , _ibNextOrderId = Nothing }
386
newIBEventHandler :: EventHandler SomeEvent SomeEvent s newIBEventHandler = mkEventHandler $ SomeEventHandler 0 IBEventHandlerAPI Just id IBEventHandler { _ibDone = False , _ibClientId = 0 , _ibServerVersion = Nothing , _ibServerTimeZone = Nothing , _ibServiceStatus = ServicePending , _ibManagedAccounts = [] , _ibNextRequestId = Nothing , _ibNextOrderId = Nothing }
386
newIBEventHandler = mkEventHandler $ SomeEventHandler 0 IBEventHandlerAPI Just id IBEventHandler { _ibDone = False , _ibClientId = 0 , _ibServerVersion = Nothing , _ibServerTimeZone = Nothing , _ibServiceStatus = ServicePending , _ibManagedAccounts = [] , _ibNextRequestId = Nothing , _ibNextOrderId = Nothing }
330
false
true
1
8
67
92
51
41
null
null
IxpertaSolutions/freer-effects
src/Control/Monad/Freer/Internal.hs
bsd-3-clause
qComp :: Arrs effs a b -> (Eff effs b -> Eff effs' c) -> Arr effs' a c qComp g h a = h $ qApp g a
97
qComp :: Arrs effs a b -> (Eff effs b -> Eff effs' c) -> Arr effs' a c qComp g h a = h $ qApp g a
97
qComp g h a = h $ qApp g a
26
false
true
0
9
28
66
31
35
null
null
jxv/cis-194-winter-2016
test/Homework/Week12Spec.hs
mit
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
0
6
7
19
9
10
null
null
jaapweel/piffle
src/IrIr.hs
gpl-2.0
-- Memory does not multiply!! nil :: Bounds nil = Bounds 0 0
65
nil :: Bounds nil = Bounds 0 0
34
nil = Bounds 0 0
20
true
true
0
6
17
23
10
13
null
null
JacquesCarette/literate-scientific-software
code/drasil-example/Drasil/NoPCM/Main.hs
bsd-2-clause
-- Sub interpolation mod into list when possible choices :: Choices choices = defaultChoices { lang = [Python, Cpp, CSharp, Java], modularity = Modular Combined, impType = Program, logFile = "log.txt", logging = LogNone, comments = [CommentFunc, CommentClass, CommentMod], doxVerbosity = Quiet, dates = Hide, onSfwrConstraint = Warning, onPhysConstraint = Warning, inputStructure = Unbundled, constStructure = Store Bundled, constRepr = Const, conceptMatch = matchConcepts ([] :: [QDefinition]) [], auxFiles = [SampleInput] }
556
choices :: Choices choices = defaultChoices { lang = [Python, Cpp, CSharp, Java], modularity = Modular Combined, impType = Program, logFile = "log.txt", logging = LogNone, comments = [CommentFunc, CommentClass, CommentMod], doxVerbosity = Quiet, dates = Hide, onSfwrConstraint = Warning, onPhysConstraint = Warning, inputStructure = Unbundled, constStructure = Store Bundled, constRepr = Const, conceptMatch = matchConcepts ([] :: [QDefinition]) [], auxFiles = [SampleInput] }
506
choices = defaultChoices { lang = [Python, Cpp, CSharp, Java], modularity = Modular Combined, impType = Program, logFile = "log.txt", logging = LogNone, comments = [CommentFunc, CommentClass, CommentMod], doxVerbosity = Quiet, dates = Hide, onSfwrConstraint = Warning, onPhysConstraint = Warning, inputStructure = Unbundled, constStructure = Store Bundled, constRepr = Const, conceptMatch = matchConcepts ([] :: [QDefinition]) [], auxFiles = [SampleInput] }
487
true
true
0
9
102
152
96
56
null
null
codemac/yi-editor
src/Yi/Syntax/Tree.hs
gpl-2.0
toksAfter _begin = allToks
26
toksAfter _begin = allToks
26
toksAfter _begin = allToks
26
false
false
0
5
3
9
4
5
null
null
jonaprieto/athena
src/Athena/Utils/PrettyPrint.hs
mit
spaced ∷ Int → Doc spaced l = Spaces l' where l' = fromIntegral l -- An alias for readability purposes
109
spaced ∷ Int → Doc spaced l = Spaces l' where l' = fromIntegral l -- An alias for readability purposes
109
spaced l = Spaces l' where l' = fromIntegral l -- An alias for readability purposes
90
false
true
1
7
27
41
17
24
null
null
alpicola/mel
src/Backend/PrettyPrint.hs
mit
ppTransfur (LIf cmp n1 n2 l1 l2) = do newline write $ "if " ++ show n1 ++ " " ++ show cmp ++ " " ++ show n2 ++ ", " write $ show l1 ++ ", " ++ show l2
156
ppTransfur (LIf cmp n1 n2 l1 l2) = do newline write $ "if " ++ show n1 ++ " " ++ show cmp ++ " " ++ show n2 ++ ", " write $ show l1 ++ ", " ++ show l2
156
ppTransfur (LIf cmp n1 n2 l1 l2) = do newline write $ "if " ++ show n1 ++ " " ++ show cmp ++ " " ++ show n2 ++ ", " write $ show l1 ++ ", " ++ show l2
156
false
false
0
13
47
87
39
48
null
null
bgamari/linear
src/Linear/Matrix.hs
bsd-3-clause
-- |4x4 matrix inverse. inv44 :: Fractional a => M44 a -> M44 a inv44 (V4 (V4 i00 i01 i02 i03) (V4 i10 i11 i12 i13) (V4 i20 i21 i22 i23) (V4 i30 i31 i32 i33)) = let s0 = i00 * i11 - i10 * i01 s1 = i00 * i12 - i10 * i02 s2 = i00 * i13 - i10 * i03 s3 = i01 * i12 - i11 * i02 s4 = i01 * i13 - i11 * i03 s5 = i02 * i13 - i12 * i03 c5 = i22 * i33 - i32 * i23 c4 = i21 * i33 - i31 * i23 c3 = i21 * i32 - i31 * i22 c2 = i20 * i33 - i30 * i23 c1 = i20 * i32 - i30 * i22 c0 = i20 * i31 - i30 * i21 det = s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0 invDet = recip det in invDet *!! V4 (V4 (i11 * c5 - i12 * c4 + i13 * c3) (-i01 * c5 + i02 * c4 - i03 * c3) (i31 * s5 - i32 * s4 + i33 * s3) (-i21 * s5 + i22 * s4 - i23 * s3)) (V4 (-i10 * c5 + i12 * c2 - i13 * c1) (i00 * c5 - i02 * c2 + i03 * c1) (-i30 * s5 + i32 * s2 - i33 * s1) (i20 * s5 - i22 * s2 + i23 * s1)) (V4 (i10 * c4 - i11 * c2 + i13 * c0) (-i00 * c4 + i01 * c2 - i03 * c0) (i30 * s4 - i31 * s2 + i33 * s0) (-i20 * s4 + i21 * s2 - i23 * s0)) (V4 (-i10 * c3 + i11 * c1 - i12 * c0) (i00 * c3 - i01 * c1 + i02 * c0) (-i30 * s3 + i31 * s1 - i32 * s0) (i20 * s3 - i21 * s1 + i22 * s0))
1,589
inv44 :: Fractional a => M44 a -> M44 a inv44 (V4 (V4 i00 i01 i02 i03) (V4 i10 i11 i12 i13) (V4 i20 i21 i22 i23) (V4 i30 i31 i32 i33)) = let s0 = i00 * i11 - i10 * i01 s1 = i00 * i12 - i10 * i02 s2 = i00 * i13 - i10 * i03 s3 = i01 * i12 - i11 * i02 s4 = i01 * i13 - i11 * i03 s5 = i02 * i13 - i12 * i03 c5 = i22 * i33 - i32 * i23 c4 = i21 * i33 - i31 * i23 c3 = i21 * i32 - i31 * i22 c2 = i20 * i33 - i30 * i23 c1 = i20 * i32 - i30 * i22 c0 = i20 * i31 - i30 * i21 det = s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0 invDet = recip det in invDet *!! V4 (V4 (i11 * c5 - i12 * c4 + i13 * c3) (-i01 * c5 + i02 * c4 - i03 * c3) (i31 * s5 - i32 * s4 + i33 * s3) (-i21 * s5 + i22 * s4 - i23 * s3)) (V4 (-i10 * c5 + i12 * c2 - i13 * c1) (i00 * c5 - i02 * c2 + i03 * c1) (-i30 * s5 + i32 * s2 - i33 * s1) (i20 * s5 - i22 * s2 + i23 * s1)) (V4 (i10 * c4 - i11 * c2 + i13 * c0) (-i00 * c4 + i01 * c2 - i03 * c0) (i30 * s4 - i31 * s2 + i33 * s0) (-i20 * s4 + i21 * s2 - i23 * s0)) (V4 (-i10 * c3 + i11 * c1 - i12 * c0) (i00 * c3 - i01 * c1 + i02 * c0) (-i30 * s3 + i31 * s1 - i32 * s0) (i20 * s3 - i21 * s1 + i22 * s0))
1,565
inv44 (V4 (V4 i00 i01 i02 i03) (V4 i10 i11 i12 i13) (V4 i20 i21 i22 i23) (V4 i30 i31 i32 i33)) = let s0 = i00 * i11 - i10 * i01 s1 = i00 * i12 - i10 * i02 s2 = i00 * i13 - i10 * i03 s3 = i01 * i12 - i11 * i02 s4 = i01 * i13 - i11 * i03 s5 = i02 * i13 - i12 * i03 c5 = i22 * i33 - i32 * i23 c4 = i21 * i33 - i31 * i23 c3 = i21 * i32 - i31 * i22 c2 = i20 * i33 - i30 * i23 c1 = i20 * i32 - i30 * i22 c0 = i20 * i31 - i30 * i21 det = s0 * c5 - s1 * c4 + s2 * c3 + s3 * c2 - s4 * c1 + s5 * c0 invDet = recip det in invDet *!! V4 (V4 (i11 * c5 - i12 * c4 + i13 * c3) (-i01 * c5 + i02 * c4 - i03 * c3) (i31 * s5 - i32 * s4 + i33 * s3) (-i21 * s5 + i22 * s4 - i23 * s3)) (V4 (-i10 * c5 + i12 * c2 - i13 * c1) (i00 * c5 - i02 * c2 + i03 * c1) (-i30 * s5 + i32 * s2 - i33 * s1) (i20 * s5 - i22 * s2 + i23 * s1)) (V4 (i10 * c4 - i11 * c2 + i13 * c0) (-i00 * c4 + i01 * c2 - i03 * c0) (i30 * s4 - i31 * s2 + i33 * s0) (-i20 * s4 + i21 * s2 - i23 * s0)) (V4 (-i10 * c3 + i11 * c1 - i12 * c0) (i00 * c3 - i01 * c1 + i02 * c0) (-i30 * s3 + i31 * s1 - i32 * s0) (i20 * s3 - i21 * s1 + i22 * s0))
1,525
true
true
0
19
803
804
414
390
null
null
justinethier/husk-scheme
hs-src/Language/Scheme/Core.hs
mit
r7rsTimeEnv :: IO Env r7rsTimeEnv = do nullEnv >>= (flip extendEnv [ ((varNamespace, "current-second"), IOFunc currentTimestamp)]) -- Functions that extend the core evaluator, but that can be defined separately. -- {- These functions have access to the current environment via the current continuation, which is passed as the first LispVal argument. -} --
378
r7rsTimeEnv :: IO Env r7rsTimeEnv = do nullEnv >>= (flip extendEnv [ ((varNamespace, "current-second"), IOFunc currentTimestamp)]) -- Functions that extend the core evaluator, but that can be defined separately. -- {- These functions have access to the current environment via the current continuation, which is passed as the first LispVal argument. -} --
378
r7rsTimeEnv = do nullEnv >>= (flip extendEnv [ ((varNamespace, "current-second"), IOFunc currentTimestamp)]) -- Functions that extend the core evaluator, but that can be defined separately. -- {- These functions have access to the current environment via the current continuation, which is passed as the first LispVal argument. -} --
356
false
true
0
12
75
51
29
22
null
null
sebastiaanvisser/jail
src/System/IO/Jail.hs
bsd-3-clause
hIsSeekable :: Handle -> IO Bool hIsSeekable = embedHandle "hIsSeekable" U.hIsSeekable
86
hIsSeekable :: Handle -> IO Bool hIsSeekable = embedHandle "hIsSeekable" U.hIsSeekable
86
hIsSeekable = embedHandle "hIsSeekable" U.hIsSeekable
53
false
true
0
6
10
25
12
13
null
null
bmabsout/neural-swarm
src/Minimizer.hs
bsd-3-clause
episodicM :: forall s enabled. (Simulator s) => Minimizer enabled -> Settings -> (forall a . (Floating a) => Weights enabled a -> s a -> s a) -> Weights enabled Double -> Rand StdGen ((Double,Double), Weights enabled Double) episodicM optimizer settins weightSetter initialWeights = do iters <- getRandomR (settins^.iterRange) randSystems <- getRandoms &> take (settins^.systems) let episodeSize = settins^.groupedBy let simsEpisode :: Floating a => [s a] -> [s a] simsEpisode = apply episodeSize simsStep let episodes = iters `div` episodeSize let episodedSystems :: Floating a => [[s a]] episodedSystems = randSystems &> realToFracSim & iterate simsEpisode & take episodes let costOfWeights :: (Floating a) => Weights enabled a -> a costOfWeights ws = episodedSystems &>>weightSetter ws &> simsEpisode &> simsCost & sum let resultWeights = optimizer costOfWeights initialWeights return ((costOfWeights initialWeights,costOfWeights resultWeights), resultWeights) -- inputRecreator :: _ => Brain n n numWeights -> Minimizer numWeights -> g (Weights numWeights) -- inputRecreator (Brain feed) optimizer = -- getRandoms &>> randWeights -- &> (\inputs -> optimizer (\w -> let outputs = inputs &> feed w -- in zipWith hamming inputs outputs & sum) -- (randWeights 23423)) -- where -- hamming :: Weights n -> Weights n -> Double -- hamming w1 w2 = sZipWith (\x y -> (x-y)**2) w1 w2 & sum
1,760
episodicM :: forall s enabled. (Simulator s) => Minimizer enabled -> Settings -> (forall a . (Floating a) => Weights enabled a -> s a -> s a) -> Weights enabled Double -> Rand StdGen ((Double,Double), Weights enabled Double) episodicM optimizer settins weightSetter initialWeights = do iters <- getRandomR (settins^.iterRange) randSystems <- getRandoms &> take (settins^.systems) let episodeSize = settins^.groupedBy let simsEpisode :: Floating a => [s a] -> [s a] simsEpisode = apply episodeSize simsStep let episodes = iters `div` episodeSize let episodedSystems :: Floating a => [[s a]] episodedSystems = randSystems &> realToFracSim & iterate simsEpisode & take episodes let costOfWeights :: (Floating a) => Weights enabled a -> a costOfWeights ws = episodedSystems &>>weightSetter ws &> simsEpisode &> simsCost & sum let resultWeights = optimizer costOfWeights initialWeights return ((costOfWeights initialWeights,costOfWeights resultWeights), resultWeights) -- inputRecreator :: _ => Brain n n numWeights -> Minimizer numWeights -> g (Weights numWeights) -- inputRecreator (Brain feed) optimizer = -- getRandoms &>> randWeights -- &> (\inputs -> optimizer (\w -> let outputs = inputs &> feed w -- in zipWith hamming inputs outputs & sum) -- (randWeights 23423)) -- where -- hamming :: Weights n -> Weights n -> Double -- hamming w1 w2 = sZipWith (\x y -> (x-y)**2) w1 w2 & sum
1,760
episodicM optimizer settins weightSetter initialWeights = do iters <- getRandomR (settins^.iterRange) randSystems <- getRandoms &> take (settins^.systems) let episodeSize = settins^.groupedBy let simsEpisode :: Floating a => [s a] -> [s a] simsEpisode = apply episodeSize simsStep let episodes = iters `div` episodeSize let episodedSystems :: Floating a => [[s a]] episodedSystems = randSystems &> realToFracSim & iterate simsEpisode & take episodes let costOfWeights :: (Floating a) => Weights enabled a -> a costOfWeights ws = episodedSystems &>>weightSetter ws &> simsEpisode &> simsCost & sum let resultWeights = optimizer costOfWeights initialWeights return ((costOfWeights initialWeights,costOfWeights resultWeights), resultWeights) -- inputRecreator :: _ => Brain n n numWeights -> Minimizer numWeights -> g (Weights numWeights) -- inputRecreator (Brain feed) optimizer = -- getRandoms &>> randWeights -- &> (\inputs -> optimizer (\w -> let outputs = inputs &> feed w -- in zipWith hamming inputs outputs & sum) -- (randWeights 23423)) -- where -- hamming :: Weights n -> Weights n -> Double -- hamming w1 w2 = sZipWith (\x y -> (x-y)**2) w1 w2 & sum
1,484
false
true
0
16
589
379
189
190
null
null
ekohl/ganeti
htools/Ganeti/HTools/PeerMap.hs
gpl-2.0
-- | Find the maximum element. -- -- Since this is a sorted list, we just get the value at the head of -- the list, or zero for a null list maxElem :: PeerMap -> Elem maxElem (x:_) = snd x
188
maxElem :: PeerMap -> Elem maxElem (x:_) = snd x
48
maxElem (x:_) = snd x
21
true
true
0
7
41
32
18
14
null
null
sternenseemann/large-hashable
test/Main.hs
bsd-3-clause
allTests :: [TestSuite] allTests = htf_importedTests
52
allTests :: [TestSuite] allTests = htf_importedTests
52
allTests = htf_importedTests
28
false
true
0
7
5
21
9
12
null
null
haskell/haddock
haddock-library/src/Documentation/Haddock/Parser.hs
bsd-2-clause
-- | Markdown image parser. As per the commonmark reference recommendation, the -- description text for an image converted to its a plain string representation. -- -- >>> parseString "![some /emphasis/ in a description](www.site.com)" -- DocPic (Picture "www.site.com" (Just "some emphasis in a description")) markdownImage :: Parser (DocH mod Identifier) markdownImage = do text <- markup stringMarkup <$> ("!" *> markdownLinkText) url <- markdownLinkTarget pure $ DocPic (Picture url (Just text)) where stringMarkup = plainMarkup (const "") renderIdent renderIdent (Identifier ns l c r) = renderNs ns <> [l] <> c <> [r] -- | Paragraph parser, called by 'parseParas'.
685
markdownImage :: Parser (DocH mod Identifier) markdownImage = do text <- markup stringMarkup <$> ("!" *> markdownLinkText) url <- markdownLinkTarget pure $ DocPic (Picture url (Just text)) where stringMarkup = plainMarkup (const "") renderIdent renderIdent (Identifier ns l c r) = renderNs ns <> [l] <> c <> [r] -- | Paragraph parser, called by 'parseParas'.
375
markdownImage = do text <- markup stringMarkup <$> ("!" *> markdownLinkText) url <- markdownLinkTarget pure $ DocPic (Picture url (Just text)) where stringMarkup = plainMarkup (const "") renderIdent renderIdent (Identifier ns l c r) = renderNs ns <> [l] <> c <> [r] -- | Paragraph parser, called by 'parseParas'.
329
true
true
1
12
116
139
71
68
null
null
fizruk/demarcate
examples/writer.hs
bsd-3-clause
runWP :: WP a -> IO (a, String) runWP = runP runWriterT
55
runWP :: WP a -> IO (a, String) runWP = runP runWriterT
55
runWP = runP runWriterT
23
false
true
0
7
11
30
15
15
null
null
deech/LibClang
src/Clang/Type.hs
bsd-3-clause
getEnumConstantDeclValue :: ClangBase m => FFI.Cursor s' -> ClangT s m Int64 getEnumConstantDeclValue c = liftIO $ FFI.getEnumConstantDeclValue c
145
getEnumConstantDeclValue :: ClangBase m => FFI.Cursor s' -> ClangT s m Int64 getEnumConstantDeclValue c = liftIO $ FFI.getEnumConstantDeclValue c
145
getEnumConstantDeclValue c = liftIO $ FFI.getEnumConstantDeclValue c
68
false
true
0
8
18
46
21
25
null
null
tjakway/ghcjvm
compiler/nativeGen/RegAlloc/Graph/SpillClean.hs
bsd-3-clause
ntersects assocs = foldl1' intersectAssoc assocs
55
intersects assocs = foldl1' intersectAssoc assocs
55
intersects assocs = foldl1' intersectAssoc assocs
55
false
false
0
5
12
14
6
8
null
null
mattias-lundell/timber-llvm
src/Common.hs
bsd-3-clause
rng = map snd
41
rng = map snd
41
rng = map snd
41
false
false
0
5
31
9
4
5
null
null
bergmark/hlint
src/Hint/Extensions.hs
bsd-3-clause
minimalExtensions :: Module_ -> [Extension] -> [Extension] minimalExtensions x es = nub $ concatMap f es where f e = [e | usedExt e x] -- RecordWildCards implies DisambiguateRecordFields, but most people probably don't want it
232
minimalExtensions :: Module_ -> [Extension] -> [Extension] minimalExtensions x es = nub $ concatMap f es where f e = [e | usedExt e x] -- RecordWildCards implies DisambiguateRecordFields, but most people probably don't want it
232
minimalExtensions x es = nub $ concatMap f es where f e = [e | usedExt e x] -- RecordWildCards implies DisambiguateRecordFields, but most people probably don't want it
173
false
true
0
7
41
62
32
30
null
null
YoEight/hk-coolc
src/Compiler/Semantic.hs
bsd-3-clause
typecheckExpr (Gt l r) = do (l', l_typ) <- typecheckExpr l (r', r_typ) <- typecheckExpr r when (l_typ /= "Int" || r_typ /= "Int") (throwError $ TypeError $ "Cannot do comparaison operation on " ++ l_typ ++ " and " ++ r_typ) return (Gt l' r', "Bool")
257
typecheckExpr (Gt l r) = do (l', l_typ) <- typecheckExpr l (r', r_typ) <- typecheckExpr r when (l_typ /= "Int" || r_typ /= "Int") (throwError $ TypeError $ "Cannot do comparaison operation on " ++ l_typ ++ " and " ++ r_typ) return (Gt l' r', "Bool")
257
typecheckExpr (Gt l r) = do (l', l_typ) <- typecheckExpr l (r', r_typ) <- typecheckExpr r when (l_typ /= "Int" || r_typ /= "Int") (throwError $ TypeError $ "Cannot do comparaison operation on " ++ l_typ ++ " and " ++ r_typ) return (Gt l' r', "Bool")
257
false
false
0
13
54
112
55
57
null
null
kumasento/accelerate
Data/Array/Accelerate/Debug.hs
bsd-3-clause
tickToStr KnownBranch{} = "KnownBranch"
47
tickToStr KnownBranch{} = "KnownBranch"
47
tickToStr KnownBranch{} = "KnownBranch"
47
false
false
0
6
11
13
6
7
null
null
valderman/haste-deck
Haste/Deck/Internal.hs
mit
-- | Create a deck of slides. createDeck :: MonadIO m => Config -> [Slide] -> m Deck createDeck cfg s = liftIO $ do inner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute"] e <- newElem "div" `with` [children [inner], style "overflow" =: "hidden", style "padding" =: "0px", style "margin" =: "0px", style "top" =: "0px", style "bottom" =: "0px", style "left" =: "0px", style "right" =: "0px", style "width" =: "auto", style "height" =: "auto", style "position" =: "absolute", style "display" =: "block"] v <- newEmptyMVar s' <- mapM toElem s let len = length s' slides = listArray (1, len) s' ix = max 1 (min len (startAtSlide cfg)) unless (null s') $ concurrent . fork $ do let (slide, enableHook, _) = slides ! ix setChildren inner [slide] liftIO enableHook start e (takeMVar v) len slides inner ix Deck e slides v `fmap` newIORef Nothing where t = transition cfg start parent wait len slides = go where clamp = max 1 . min len go inner ix = do proceed <- wait let ix' = clamp $ case proceed of Next -> ix+1 Prev -> ix-1 Goto n -> n Skip n -> ix + n if ix /= ix' then do let (e, enableHook, _) = slides ! ix' (_, _, disableHook) = slides ! ix liftIO $ do enableHook disableHook changeSlide inner e ix ix' else go inner ix -- Animate the transition from an old one to a new changeSlide :: Elem -> Elem -> Int -> Int -> IO () changeSlide inner new ix ix' = do t0 <- now let duration = transitionDuration t newinner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute", children [new]] let animate t1 = do let progress = min ((t1-t0)/duration) 1 transitionStep t progress ix ix' parent inner newinner if progress < 1 then void $ requestAnimationFrame animate else do transitionFinished t ix ix' parent inner newinner setChildren newinner [new] setChildren parent [newinner] onSlideChange cfg ix ix' concurrent $ go newinner ix' void . requestAnimationFrame $ \t1 -> do transitionSetup t ix ix' parent inner newinner animate t1
3,258
createDeck :: MonadIO m => Config -> [Slide] -> m Deck createDeck cfg s = liftIO $ do inner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute"] e <- newElem "div" `with` [children [inner], style "overflow" =: "hidden", style "padding" =: "0px", style "margin" =: "0px", style "top" =: "0px", style "bottom" =: "0px", style "left" =: "0px", style "right" =: "0px", style "width" =: "auto", style "height" =: "auto", style "position" =: "absolute", style "display" =: "block"] v <- newEmptyMVar s' <- mapM toElem s let len = length s' slides = listArray (1, len) s' ix = max 1 (min len (startAtSlide cfg)) unless (null s') $ concurrent . fork $ do let (slide, enableHook, _) = slides ! ix setChildren inner [slide] liftIO enableHook start e (takeMVar v) len slides inner ix Deck e slides v `fmap` newIORef Nothing where t = transition cfg start parent wait len slides = go where clamp = max 1 . min len go inner ix = do proceed <- wait let ix' = clamp $ case proceed of Next -> ix+1 Prev -> ix-1 Goto n -> n Skip n -> ix + n if ix /= ix' then do let (e, enableHook, _) = slides ! ix' (_, _, disableHook) = slides ! ix liftIO $ do enableHook disableHook changeSlide inner e ix ix' else go inner ix -- Animate the transition from an old one to a new changeSlide :: Elem -> Elem -> Int -> Int -> IO () changeSlide inner new ix ix' = do t0 <- now let duration = transitionDuration t newinner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute", children [new]] let animate t1 = do let progress = min ((t1-t0)/duration) 1 transitionStep t progress ix ix' parent inner newinner if progress < 1 then void $ requestAnimationFrame animate else do transitionFinished t ix ix' parent inner newinner setChildren newinner [new] setChildren parent [newinner] onSlideChange cfg ix ix' concurrent $ go newinner ix' void . requestAnimationFrame $ \t1 -> do transitionSetup t ix ix' parent inner newinner animate t1
3,228
createDeck cfg s = liftIO $ do inner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute"] e <- newElem "div" `with` [children [inner], style "overflow" =: "hidden", style "padding" =: "0px", style "margin" =: "0px", style "top" =: "0px", style "bottom" =: "0px", style "left" =: "0px", style "right" =: "0px", style "width" =: "auto", style "height" =: "auto", style "position" =: "absolute", style "display" =: "block"] v <- newEmptyMVar s' <- mapM toElem s let len = length s' slides = listArray (1, len) s' ix = max 1 (min len (startAtSlide cfg)) unless (null s') $ concurrent . fork $ do let (slide, enableHook, _) = slides ! ix setChildren inner [slide] liftIO enableHook start e (takeMVar v) len slides inner ix Deck e slides v `fmap` newIORef Nothing where t = transition cfg start parent wait len slides = go where clamp = max 1 . min len go inner ix = do proceed <- wait let ix' = clamp $ case proceed of Next -> ix+1 Prev -> ix-1 Goto n -> n Skip n -> ix + n if ix /= ix' then do let (e, enableHook, _) = slides ! ix' (_, _, disableHook) = slides ! ix liftIO $ do enableHook disableHook changeSlide inner e ix ix' else go inner ix -- Animate the transition from an old one to a new changeSlide :: Elem -> Elem -> Int -> Int -> IO () changeSlide inner new ix ix' = do t0 <- now let duration = transitionDuration t newinner <- newElem "div" `with` [style "width" =: "100%", style "height" =: "100%", style "position" =: "absolute", children [new]] let animate t1 = do let progress = min ((t1-t0)/duration) 1 transitionStep t progress ix ix' parent inner newinner if progress < 1 then void $ requestAnimationFrame animate else do transitionFinished t ix ix' parent inner newinner setChildren newinner [new] setChildren parent [newinner] onSlideChange cfg ix ix' concurrent $ go newinner ix' void . requestAnimationFrame $ \t1 -> do transitionSetup t ix ix' parent inner newinner animate t1
3,173
true
true
24
14
1,590
876
433
443
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/showsPrec_2.hs
mit
primCmpInt (Pos Zero) (Neg Zero) = EQ
37
primCmpInt (Pos Zero) (Neg Zero) = EQ
37
primCmpInt (Pos Zero) (Neg Zero) = EQ
37
false
false
0
7
6
23
11
12
null
null
psg-titech/cfrp
src/Language/CFrp/CodeGen.hs
mit
codeGenExpr :: TypedCExpr -> D.DList String codeGenExpr (PrimC p) = D.singleton $ "retval = " <> codeGenPrim p <> ";"
117
codeGenExpr :: TypedCExpr -> D.DList String codeGenExpr (PrimC p) = D.singleton $ "retval = " <> codeGenPrim p <> ";"
117
codeGenExpr (PrimC p) = D.singleton $ "retval = " <> codeGenPrim p <> ";"
73
false
true
0
8
19
46
22
24
null
null
input-output-hk/daedalus
installers/common/Config.hs
apache-2.0
dfp :: Format r (FilePath -> r) dfp = makeFormat (\fpath -> either id id (FP.toText FP.posix fpath))
100
dfp :: Format r (FilePath -> r) dfp = makeFormat (\fpath -> either id id (FP.toText FP.posix fpath))
100
dfp = makeFormat (\fpath -> either id id (FP.toText FP.posix fpath))
68
false
true
0
11
17
53
27
26
null
null
elieux/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
nlInfixConPat :: id -> LPat id -> LPat id -> LPat id nlInfixConPat con l r = noLoc (ConPatIn (noLoc con) (InfixCon l r))
120
nlInfixConPat :: id -> LPat id -> LPat id -> LPat id nlInfixConPat con l r = noLoc (ConPatIn (noLoc con) (InfixCon l r))
120
nlInfixConPat con l r = noLoc (ConPatIn (noLoc con) (InfixCon l r))
67
false
true
0
9
23
69
31
38
null
null
HIPERFIT/futhark
src/Futhark/IR/Parse.hs
isc
pAttr :: Parser Attr pAttr = choice [ AttrInt . toInteger <$> pInt, do v <- pName choice [ AttrComp v <$> parens (pAttr `sepBy` pComma), pure $ AttrName v ] ]
222
pAttr :: Parser Attr pAttr = choice [ AttrInt . toInteger <$> pInt, do v <- pName choice [ AttrComp v <$> parens (pAttr `sepBy` pComma), pure $ AttrName v ] ]
222
pAttr = choice [ AttrInt . toInteger <$> pInt, do v <- pName choice [ AttrComp v <$> parens (pAttr `sepBy` pComma), pure $ AttrName v ] ]
201
false
true
1
14
95
80
38
42
null
null
damianfral/clay
src/Clay/Elements.hs
bsd-3-clause
ins = "ins"
11
ins = "ins"
11
ins = "ins"
11
false
false
1
5
2
10
3
7
null
null
IreneKnapp/direct-opengl
Graphics/Rendering/OpenGL/GL/VertexArrays.hs
bsd-3-clause
marshalGetPointervPName :: GetPointervPName -> GLenum marshalGetPointervPName x = case x of VertexArrayPointer -> gl_VERTEX_ARRAY_POINTER NormalArrayPointer -> gl_NORMAL_ARRAY_POINTER ColorArrayPointer -> gl_COLOR_ARRAY_POINTER IndexArrayPointer -> gl_INDEX_ARRAY_POINTER TextureCoordArrayPointer -> gl_TEXTURE_COORD_ARRAY_POINTER EdgeFlagArrayPointer -> gl_EDGE_FLAG_ARRAY_POINTER FogCoordArrayPointer -> gl_FOG_COORD_ARRAY_POINTER SecondaryColorArrayPointer -> gl_SECONDARY_COLOR_ARRAY_POINTER FeedbackBufferPointer -> gl_FEEDBACK_BUFFER_POINTER SelectionBufferPointer -> gl_SELECTION_BUFFER_POINTER WeightArrayPointer -> gl_WEIGHT_ARRAY_POINTER MatrixIndexArrayPointer -> gl_MATRIX_INDEX_ARRAY_POINTER --------------------------------------------------------------------------------
822
marshalGetPointervPName :: GetPointervPName -> GLenum marshalGetPointervPName x = case x of VertexArrayPointer -> gl_VERTEX_ARRAY_POINTER NormalArrayPointer -> gl_NORMAL_ARRAY_POINTER ColorArrayPointer -> gl_COLOR_ARRAY_POINTER IndexArrayPointer -> gl_INDEX_ARRAY_POINTER TextureCoordArrayPointer -> gl_TEXTURE_COORD_ARRAY_POINTER EdgeFlagArrayPointer -> gl_EDGE_FLAG_ARRAY_POINTER FogCoordArrayPointer -> gl_FOG_COORD_ARRAY_POINTER SecondaryColorArrayPointer -> gl_SECONDARY_COLOR_ARRAY_POINTER FeedbackBufferPointer -> gl_FEEDBACK_BUFFER_POINTER SelectionBufferPointer -> gl_SELECTION_BUFFER_POINTER WeightArrayPointer -> gl_WEIGHT_ARRAY_POINTER MatrixIndexArrayPointer -> gl_MATRIX_INDEX_ARRAY_POINTER --------------------------------------------------------------------------------
822
marshalGetPointervPName x = case x of VertexArrayPointer -> gl_VERTEX_ARRAY_POINTER NormalArrayPointer -> gl_NORMAL_ARRAY_POINTER ColorArrayPointer -> gl_COLOR_ARRAY_POINTER IndexArrayPointer -> gl_INDEX_ARRAY_POINTER TextureCoordArrayPointer -> gl_TEXTURE_COORD_ARRAY_POINTER EdgeFlagArrayPointer -> gl_EDGE_FLAG_ARRAY_POINTER FogCoordArrayPointer -> gl_FOG_COORD_ARRAY_POINTER SecondaryColorArrayPointer -> gl_SECONDARY_COLOR_ARRAY_POINTER FeedbackBufferPointer -> gl_FEEDBACK_BUFFER_POINTER SelectionBufferPointer -> gl_SELECTION_BUFFER_POINTER WeightArrayPointer -> gl_WEIGHT_ARRAY_POINTER MatrixIndexArrayPointer -> gl_MATRIX_INDEX_ARRAY_POINTER --------------------------------------------------------------------------------
768
false
true
12
5
84
118
48
70
null
null
bacher09/darkplaces-demo
src/DarkPlaces/Binary.hs
gpl-2.0
getCoord :: ProtocolVersion -> Get Float getCoord p | p `elem` quakes ++ neharaFamily = getCoord13i | p `elem` [(ProtocolDarkplaces2)..(ProtocolDarkplaces4)] = getCoord16i | otherwise = getCoord32f -- for ProtocolDarkplaces1 and bigger then 4 where quakes = [ProtocolQuake, ProtocolQuakeDP, ProtocolQuakeWorld] neharaFamily = [(ProtocolNehahraMovie)..(ProtocolNehahraBJP3)]
395
getCoord :: ProtocolVersion -> Get Float getCoord p | p `elem` quakes ++ neharaFamily = getCoord13i | p `elem` [(ProtocolDarkplaces2)..(ProtocolDarkplaces4)] = getCoord16i | otherwise = getCoord32f -- for ProtocolDarkplaces1 and bigger then 4 where quakes = [ProtocolQuake, ProtocolQuakeDP, ProtocolQuakeWorld] neharaFamily = [(ProtocolNehahraMovie)..(ProtocolNehahraBJP3)]
395
getCoord p | p `elem` quakes ++ neharaFamily = getCoord13i | p `elem` [(ProtocolDarkplaces2)..(ProtocolDarkplaces4)] = getCoord16i | otherwise = getCoord32f -- for ProtocolDarkplaces1 and bigger then 4 where quakes = [ProtocolQuake, ProtocolQuakeDP, ProtocolQuakeWorld] neharaFamily = [(ProtocolNehahraMovie)..(ProtocolNehahraBJP3)]
354
false
true
2
10
63
121
61
60
null
null
rsachtl/asm_experiment
src/AbstractStateMachine.hs
mit
pdatesForSameFunctions [] m = m
32
updatesForSameFunctions [] m = m
32
updatesForSameFunctions [] m = m
32
false
false
0
6
5
13
6
7
null
null
alexbaluta/courseography
dependencies/HaXml-1.25.3/src/Text/XML/HaXml/ByteStringPP.hs
gpl-3.0
externalid (PUBLIC i sl) = text "PUBLIC" <+> pubidliteral i <+> systemliteral sl
119
externalid (PUBLIC i sl) = text "PUBLIC" <+> pubidliteral i <+> systemliteral sl
119
externalid (PUBLIC i sl) = text "PUBLIC" <+> pubidliteral i <+> systemliteral sl
119
false
false
0
7
51
35
15
20
null
null
DavidAlphaFox/darcs
src/Darcs/Patch/Rebase/Viewing.hs
gpl-2.0
-- signature to be compatible with extractRebaseSelect -- | Like 'extractRebaseSelect', but any fixups are "reified" into a separate patch. reifyRebaseSelect :: forall p wX wY . (PrimPatchBase p, Commute p, Merge p, Invert p, Effect p, FromPrim p) => FL (RebaseSelect p) wX wY -> IO ((FL (WDDNamed p) :> FL (RebaseFixup p)) wX wY) reifyRebaseSelect rs = do res <- concatFL <$> mapFL_FL_M reifyOne rs return (res :> NilFL) where reifyOne :: RebaseSelect p wA wB -> IO (FL (WDDNamed p) wA wB) reifyOne (RSFwd fixups toedit) = case flToNamesPrims fixups of names :> NilFL -> return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps toedit :>: NilFL) names :> prims -> do n <- mkReified prims return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps n :>: noDroppedDeps toedit :>: NilFL) reifyOne (RSRev{}) = impossible
1,038
reifyRebaseSelect :: forall p wX wY . (PrimPatchBase p, Commute p, Merge p, Invert p, Effect p, FromPrim p) => FL (RebaseSelect p) wX wY -> IO ((FL (WDDNamed p) :> FL (RebaseFixup p)) wX wY) reifyRebaseSelect rs = do res <- concatFL <$> mapFL_FL_M reifyOne rs return (res :> NilFL) where reifyOne :: RebaseSelect p wA wB -> IO (FL (WDDNamed p) wA wB) reifyOne (RSFwd fixups toedit) = case flToNamesPrims fixups of names :> NilFL -> return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps toedit :>: NilFL) names :> prims -> do n <- mkReified prims return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps n :>: noDroppedDeps toedit :>: NilFL) reifyOne (RSRev{}) = impossible
898
reifyRebaseSelect rs = do res <- concatFL <$> mapFL_FL_M reifyOne rs return (res :> NilFL) where reifyOne :: RebaseSelect p wA wB -> IO (FL (WDDNamed p) wA wB) reifyOne (RSFwd fixups toedit) = case flToNamesPrims fixups of names :> NilFL -> return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps toedit :>: NilFL) names :> prims -> do n <- mkReified prims return (mapFL_FL (noDroppedDeps . mkDummy) names +>+ noDroppedDeps n :>: noDroppedDeps toedit :>: NilFL) reifyOne (RSRev{}) = impossible
652
true
true
3
18
338
320
157
163
null
null
danr/hipspec
examples/old-examples/Iterate.hs
gpl-3.0
ind :: List -> List ind Nil = Nil
38
ind :: List -> List ind Nil = Nil
38
ind Nil = Nil
18
false
true
0
5
13
18
9
9
null
null
mightymoose/liquidhaskell
benchmarks/containers-0.5.0.0/tests/map-properties.hs
bsd-3-clause
prop_descList :: [Int] -> Bool prop_descList xs = (reverse (sort (nub xs)) == [x | (x,()) <- toDescList (fromList [(x,()) | x <- xs])])
135
prop_descList :: [Int] -> Bool prop_descList xs = (reverse (sort (nub xs)) == [x | (x,()) <- toDescList (fromList [(x,()) | x <- xs])])
135
prop_descList xs = (reverse (sort (nub xs)) == [x | (x,()) <- toDescList (fromList [(x,()) | x <- xs])])
104
false
true
0
16
23
96
49
47
null
null
ChrisKuklewicz/XWords
src/Template.hs
bsd-3-clause
allTemplates :: Template -> [Template] allTemplates template = sortBy (flip compare `on` length) $ let leading = length (takeWhile isBlank template) backwards = reverse template trailing = length (takeWhile isBlank backwards) in if all isBlank template || trailing==0 then take (succ leading) (tails template) else concatMap (take (succ leading) . tails . reverse) . take (succ trailing) . tails $ backwards
450
allTemplates :: Template -> [Template] allTemplates template = sortBy (flip compare `on` length) $ let leading = length (takeWhile isBlank template) backwards = reverse template trailing = length (takeWhile isBlank backwards) in if all isBlank template || trailing==0 then take (succ leading) (tails template) else concatMap (take (succ leading) . tails . reverse) . take (succ trailing) . tails $ backwards
450
allTemplates template = sortBy (flip compare `on` length) $ let leading = length (takeWhile isBlank template) backwards = reverse template trailing = length (takeWhile isBlank backwards) in if all isBlank template || trailing==0 then take (succ leading) (tails template) else concatMap (take (succ leading) . tails . reverse) . take (succ trailing) . tails $ backwards
411
false
true
0
18
103
168
83
85
null
null
substack/hsopenid
src/Text/XRDS.hs
bsd-3-clause
arseService :: Element -> Maybe Service parseService el = do let vals t x = first (map getText) $ partition (tag t) x (tys,tr) = vals "Type" (elChildren el) (mts,mr) = vals "MediaType" tr (uris,ur) = vals "URI" mr (lids,rest) = vals "LocalID" ur priority = readMaybe =<< findAttr' (("priority" ==) . qName) el guard $ not $ null tys return $ Service { serviceTypes = tys , serviceMediaTypes = mts , serviceURIs = uris , serviceLocalIDs = lids , servicePriority = priority , serviceExtra = rest }
687
parseService :: Element -> Maybe Service parseService el = do let vals t x = first (map getText) $ partition (tag t) x (tys,tr) = vals "Type" (elChildren el) (mts,mr) = vals "MediaType" tr (uris,ur) = vals "URI" mr (lids,rest) = vals "LocalID" ur priority = readMaybe =<< findAttr' (("priority" ==) . qName) el guard $ not $ null tys return $ Service { serviceTypes = tys , serviceMediaTypes = mts , serviceURIs = uris , serviceLocalIDs = lids , servicePriority = priority , serviceExtra = rest }
687
parseService el = do let vals t x = first (map getText) $ partition (tag t) x (tys,tr) = vals "Type" (elChildren el) (mts,mr) = vals "MediaType" tr (uris,ur) = vals "URI" mr (lids,rest) = vals "LocalID" ur priority = readMaybe =<< findAttr' (("priority" ==) . qName) el guard $ not $ null tys return $ Service { serviceTypes = tys , serviceMediaTypes = mts , serviceURIs = uris , serviceLocalIDs = lids , servicePriority = priority , serviceExtra = rest }
646
false
true
0
14
279
217
114
103
null
null
Kinokkory/thorn
Data/Thorn/Zipper.hs
bsd-3-clause
derivedata _ _ _ _ = error "derivedata : Thorn doesn't work well, sorry."
73
derivedata _ _ _ _ = error "derivedata : Thorn doesn't work well, sorry."
73
derivedata _ _ _ _ = error "derivedata : Thorn doesn't work well, sorry."
73
false
false
1
5
13
17
7
10
null
null
Peaker/lamdu
src/Lamdu/Sugar/Convert/Option.hs
gpl-3.0
suggestFromNom :: Monad m => NominalInst NominalId T.Types # Pure -> Transaction m [(Deps, Pure # V.Term)] suggestFromNom n = Load.nominal tid <&> (^.. Lens._Right) <&> Lens.mapped %~ \s -> (mempty & depsNominals . Lens.at tid ?~ s, _Pure . V._BLeaf . V._LFromNom # tid) where tid = n ^. nId
311
suggestFromNom :: Monad m => NominalInst NominalId T.Types # Pure -> Transaction m [(Deps, Pure # V.Term)] suggestFromNom n = Load.nominal tid <&> (^.. Lens._Right) <&> Lens.mapped %~ \s -> (mempty & depsNominals . Lens.at tid ?~ s, _Pure . V._BLeaf . V._LFromNom # tid) where tid = n ^. nId
311
suggestFromNom n = Load.nominal tid <&> (^.. Lens._Right) <&> Lens.mapped %~ \s -> (mempty & depsNominals . Lens.at tid ?~ s, _Pure . V._BLeaf . V._LFromNom # tid) where tid = n ^. nId
204
false
true
5
12
70
147
71
76
null
null
cliffano/swaggy-jenkins
clients/haskell-yesod/generated/src/Handler/BlueOcean.hs
mit
-- | -- -- Replay an organization pipeline run -- operationId: postPipelineRun postBlueRestOrganizationsByTextPipelinesByTextRunsByTextReplayR :: Text -- ^ Name of the organization -> Text -- ^ Name of the pipeline -> Text -- ^ Name of the run -> Handler Value postBlueRestOrganizationsByTextPipelinesByTextRunsByTextReplayR organization pipeline run = notImplemented
560
postBlueRestOrganizationsByTextPipelinesByTextRunsByTextReplayR :: Text -- ^ Name of the organization -> Text -- ^ Name of the pipeline -> Text -- ^ Name of the run -> Handler Value postBlueRestOrganizationsByTextPipelinesByTextRunsByTextReplayR organization pipeline run = notImplemented
480
postBlueRestOrganizationsByTextPipelinesByTextRunsByTextReplayR organization pipeline run = notImplemented
106
true
true
0
8
238
40
23
17
null
null
aaronc/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
declared (PClauses _ _ n _) = []
32
declared (PClauses _ _ n _) = []
32
declared (PClauses _ _ n _) = []
32
false
false
0
7
7
23
11
12
null
null
nbloomf/feivel
src/Feivel/Eval/EvalM.hs
gpl-3.0
defineKey :: Key -> Expr -> Locus -> EvalM () defineKey key a loc = do old <- getState case addKey key a loc old of Left err -> reportErr loc err Right new -> putState new
184
defineKey :: Key -> Expr -> Locus -> EvalM () defineKey key a loc = do old <- getState case addKey key a loc old of Left err -> reportErr loc err Right new -> putState new
184
defineKey key a loc = do old <- getState case addKey key a loc old of Left err -> reportErr loc err Right new -> putState new
138
false
true
0
11
49
89
39
50
null
null
JoeyEremondi/haskelm-old
src/Language/Elm/TH/Util.hs
bsd-3-clause
splitListN 2 l = let (l1, l2) = splitList l in [l1, l2]
72
splitListN 2 l = let (l1, l2) = splitList l in [l1, l2]
72
splitListN 2 l = let (l1, l2) = splitList l in [l1, l2]
72
false
false
0
9
29
38
19
19
null
null
mgrebenets/hackerrank
alg/arr-n-srt/tutorial-intro.hs
mit
main :: IO () main = do e <- readLn :: IO Int n <- readLn :: IO Int line <- getLine let list = readNumbers line print (Data.Maybe.fromJust (elemIndex e list))
178
main :: IO () main = do e <- readLn :: IO Int n <- readLn :: IO Int line <- getLine let list = readNumbers line print (Data.Maybe.fromJust (elemIndex e list))
178
main = do e <- readLn :: IO Int n <- readLn :: IO Int line <- getLine let list = readNumbers line print (Data.Maybe.fromJust (elemIndex e list))
164
false
true
0
12
51
90
40
50
null
null
facebookincubator/duckling
Duckling/Time/KA/Rules.hs
bsd-3-clause
ruleYYYYMMDD :: Rule ruleYYYYMMDD = Rule { name = "yyyy-mm-dd" , pattern = [ regex "(\\d{2,4})-(0?[1-9]|1[0-2])-(3[01]|[12]\\d|0?[1-9])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:mm:dd:_)):_) -> do y <- parseInt yy m <- parseInt mm d <- parseInt dd tt $ yearMonthDay y m d _ -> Nothing }
356
ruleYYYYMMDD :: Rule ruleYYYYMMDD = Rule { name = "yyyy-mm-dd" , pattern = [ regex "(\\d{2,4})-(0?[1-9]|1[0-2])-(3[01]|[12]\\d|0?[1-9])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:mm:dd:_)):_) -> do y <- parseInt yy m <- parseInt mm d <- parseInt dd tt $ yearMonthDay y m d _ -> Nothing }
356
ruleYYYYMMDD = Rule { name = "yyyy-mm-dd" , pattern = [ regex "(\\d{2,4})-(0?[1-9]|1[0-2])-(3[01]|[12]\\d|0?[1-9])" ] , prod = \case (Token RegexMatch (GroupMatch (yy:mm:dd:_)):_) -> do y <- parseInt yy m <- parseInt mm d <- parseInt dd tt $ yearMonthDay y m d _ -> Nothing }
335
false
true
0
19
108
132
65
67
null
null
gbwey/persistent
persistent-sqlite/Database/Sqlite.hs
mit
prepareError :: Connection -> Text -> IO (Either Statement Error) prepareError (Connection _ (Connection' database)) text' = do BS.useAsCString (encodeUtf8 text') (\text -> do alloca (\statement -> do error' <- prepareC database text (-1) statement nullPtr error <- return $ decodeError error' case error of ErrorOK -> do statement' <- peek statement return $ Left $ Statement statement' _ -> return $ Right error))
703
prepareError :: Connection -> Text -> IO (Either Statement Error) prepareError (Connection _ (Connection' database)) text' = do BS.useAsCString (encodeUtf8 text') (\text -> do alloca (\statement -> do error' <- prepareC database text (-1) statement nullPtr error <- return $ decodeError error' case error of ErrorOK -> do statement' <- peek statement return $ Left $ Statement statement' _ -> return $ Right error))
703
prepareError (Connection _ (Connection' database)) text' = do BS.useAsCString (encodeUtf8 text') (\text -> do alloca (\statement -> do error' <- prepareC database text (-1) statement nullPtr error <- return $ decodeError error' case error of ErrorOK -> do statement' <- peek statement return $ Left $ Statement statement' _ -> return $ Right error))
637
false
true
0
24
351
179
83
96
null
null
unisonweb/platform
codebase2/codebase-sqlite/U/Codebase/Sqlite/Serialization.hs
mit
getNat :: MonadGet m => m Word64 getNat = deserializeBE
55
getNat :: MonadGet m => m Word64 getNat = deserializeBE
55
getNat = deserializeBE
22
false
true
0
6
9
21
10
11
null
null
ssaavedra/liquidhaskell
tests/neg/vector00.hs
bsd-3-clause
xs = [1,2,3,4] :: [Int]
26
xs = [1,2,3,4] :: [Int]
26
xs = [1,2,3,4] :: [Int]
26
false
false
0
5
7
24
15
9
null
null
Ongy/monky
Monky/CPU.hs
lgpl-3.0
getNumaHandle :: [String] -- ^CPU "names" to include ([cpu0, cpu1, cpu2, ..]) -> IO NumaHandle getNumaHandle cpus = do workref <- newIORef ([0] :: [Int]) allref <- newIORef ([0] :: [Int]) stat <- fopen pathStat return $ NumaHandle cpus (CPUH stat allref workref) -- |Create an 'CPUHandle'
301
getNumaHandle :: [String] -- ^CPU "names" to include ([cpu0, cpu1, cpu2, ..]) -> IO NumaHandle getNumaHandle cpus = do workref <- newIORef ([0] :: [Int]) allref <- newIORef ([0] :: [Int]) stat <- fopen pathStat return $ NumaHandle cpus (CPUH stat allref workref) -- |Create an 'CPUHandle'
301
getNumaHandle cpus = do workref <- newIORef ([0] :: [Int]) allref <- newIORef ([0] :: [Int]) stat <- fopen pathStat return $ NumaHandle cpus (CPUH stat allref workref) -- |Create an 'CPUHandle'
202
false
true
0
11
59
107
53
54
null
null
soupi/chip-8
src/Runtime/Run.hs
bsd-3-clause
update :: [SDL.EventPayload] -> (SDL.Scancode -> Bool) -> World -> IO (Either (Maybe String) World) update _ keysState (settings, audioChan, cpu) = pure . fmap ((,,) settings audioChan) . mapLeft (pure . CPU.showErr) . (pure . updateTimers <=< replicateMChain emulationSpeed emulateCycle . cleanSoundTimer) . setKeys keysState . CPU.clearKeys $ cpu where emulationSpeed = speedMultiplier (setSpeed settings)
423
update :: [SDL.EventPayload] -> (SDL.Scancode -> Bool) -> World -> IO (Either (Maybe String) World) update _ keysState (settings, audioChan, cpu) = pure . fmap ((,,) settings audioChan) . mapLeft (pure . CPU.showErr) . (pure . updateTimers <=< replicateMChain emulationSpeed emulateCycle . cleanSoundTimer) . setKeys keysState . CPU.clearKeys $ cpu where emulationSpeed = speedMultiplier (setSpeed settings)
423
update _ keysState (settings, audioChan, cpu) = pure . fmap ((,,) settings audioChan) . mapLeft (pure . CPU.showErr) . (pure . updateTimers <=< replicateMChain emulationSpeed emulateCycle . cleanSoundTimer) . setKeys keysState . CPU.clearKeys $ cpu where emulationSpeed = speedMultiplier (setSpeed settings)
323
false
true
7
12
71
169
83
86
null
null
phunehehe/deepseq-bounded
tests/FooG.hs
bsd-3-clause
xpTB_10 -- 5 . = B2 (A3 (B3 False (A2 3) 5) True) (B1 True (A4 (2.3, B1 False (A1 True 4), __)))
164
expTB_10 -- 5 . = B2 (A3 (B3 False (A2 3) 5) True) (B1 True (A4 (2.3, B1 False (A1 True 4), __)))
164
expTB_10 -- 5 . = B2 (A3 (B3 False (A2 3) 5) True) (B1 True (A4 (2.3, B1 False (A1 True 4), __)))
164
false
false
1
12
90
76
37
39
null
null
ezyang/ghc
compiler/types/TyCoRep.hs
bsd-3-clause
coVarsOfCo (ForAllCo tv kind_co co) = coVarsOfCo co `delVarSet` tv `unionVarSet` coVarsOfCo kind_co
101
coVarsOfCo (ForAllCo tv kind_co co) = coVarsOfCo co `delVarSet` tv `unionVarSet` coVarsOfCo kind_co
101
coVarsOfCo (ForAllCo tv kind_co co) = coVarsOfCo co `delVarSet` tv `unionVarSet` coVarsOfCo kind_co
101
false
false
1
6
14
34
17
17
null
null
AdityaKumarRavikanti/Boxes
src/SheetDB.hs
mit
insert :: Row -> Sheet -> API () insert rawRow sheet = do let cols = columns sheet when (not $ isEqualLength rawRow cols) $ do die ["Length is different"] when (not $ isvalid rawRow cols) $ do die ["Columns mismatch, required", show cols, "got", show rawRow] let xml = rowToXml rawRow url <- formURL (key sheet) (worksheetId sheet) [] token <- io $ tokenOf sheet status <- post token (exportURL url) xml when (status /= status201) $ do die ["Status returned: ", show status]
551
insert :: Row -> Sheet -> API () insert rawRow sheet = do let cols = columns sheet when (not $ isEqualLength rawRow cols) $ do die ["Length is different"] when (not $ isvalid rawRow cols) $ do die ["Columns mismatch, required", show cols, "got", show rawRow] let xml = rowToXml rawRow url <- formURL (key sheet) (worksheetId sheet) [] token <- io $ tokenOf sheet status <- post token (exportURL url) xml when (status /= status201) $ do die ["Status returned: ", show status]
551
insert rawRow sheet = do let cols = columns sheet when (not $ isEqualLength rawRow cols) $ do die ["Length is different"] when (not $ isvalid rawRow cols) $ do die ["Columns mismatch, required", show cols, "got", show rawRow] let xml = rowToXml rawRow url <- formURL (key sheet) (worksheetId sheet) [] token <- io $ tokenOf sheet status <- post token (exportURL url) xml when (status /= status201) $ do die ["Status returned: ", show status]
518
false
true
0
12
161
224
103
121
null
null
markus-git/co-feldspar
src/Feldspar/Software/Verify/Primitive.hs
bsd-3-clause
verifyPrim Tan (x :* Nil) | Dict <- witnessFractional (undefined :: Prim (DenResult a)) = fmap tan (V.eval (Prim x))
122
verifyPrim Tan (x :* Nil) | Dict <- witnessFractional (undefined :: Prim (DenResult a)) = fmap tan (V.eval (Prim x))
122
verifyPrim Tan (x :* Nil) | Dict <- witnessFractional (undefined :: Prim (DenResult a)) = fmap tan (V.eval (Prim x))
122
false
false
0
13
25
65
31
34
null
null
mgsloan/instance-templates
Rewriter.hs
bsd-3-clause
addExts = addExtensions [ "TemplateHaskell" , "QuasiQuotes" , "ConstraintKinds" , "ScopedTypeVariables" , "EmptyDataDecls" , "FlexibleInstances" ]
160
addExts = addExtensions [ "TemplateHaskell" , "QuasiQuotes" , "ConstraintKinds" , "ScopedTypeVariables" , "EmptyDataDecls" , "FlexibleInstances" ]
160
addExts = addExtensions [ "TemplateHaskell" , "QuasiQuotes" , "ConstraintKinds" , "ScopedTypeVariables" , "EmptyDataDecls" , "FlexibleInstances" ]
160
false
false
0
5
29
27
16
11
null
null
sgfxq/Haskell
Geometry.hs
apache-2.0
area :: Shape -> Float area (Rect p1 p2) = ((getX p2)-(getX p1))*((getY p2)-(getY p1))
87
area :: Shape -> Float area (Rect p1 p2) = ((getX p2)-(getX p1))*((getY p2)-(getY p1))
87
area (Rect p1 p2) = ((getX p2)-(getX p1))*((getY p2)-(getY p1))
64
false
true
0
9
15
68
35
33
null
null
fpco/cabal
Cabal/Distribution/Simple/Compiler.hs
bsd-3-clause
flagToOptimisationLevel (Just s) = case reads s of [(i, "")] | i >= fromEnum (minBound :: OptimisationLevel) && i <= fromEnum (maxBound :: OptimisationLevel) -> toEnum i | otherwise -> error $ "Bad optimisation level: " ++ show i ++ ". Valid values are 0..2" _ -> error $ "Can't parse optimisation level " ++ s -- ------------------------------------------------------------ -- * Languages and Extensions -- ------------------------------------------------------------
536
flagToOptimisationLevel (Just s) = case reads s of [(i, "")] | i >= fromEnum (minBound :: OptimisationLevel) && i <= fromEnum (maxBound :: OptimisationLevel) -> toEnum i | otherwise -> error $ "Bad optimisation level: " ++ show i ++ ". Valid values are 0..2" _ -> error $ "Can't parse optimisation level " ++ s -- ------------------------------------------------------------ -- * Languages and Extensions -- ------------------------------------------------------------
536
flagToOptimisationLevel (Just s) = case reads s of [(i, "")] | i >= fromEnum (minBound :: OptimisationLevel) && i <= fromEnum (maxBound :: OptimisationLevel) -> toEnum i | otherwise -> error $ "Bad optimisation level: " ++ show i ++ ". Valid values are 0..2" _ -> error $ "Can't parse optimisation level " ++ s -- ------------------------------------------------------------ -- * Languages and Extensions -- ------------------------------------------------------------
536
false
false
2
11
132
108
56
52
null
null
verement/etamoo
src/MOO/Network.hs
bsd-3-clause
point2text :: Point -> Text point2text point = case point of TCP _ port -> "port " <> T.pack (show port)
106
point2text :: Point -> Text point2text point = case point of TCP _ port -> "port " <> T.pack (show port)
106
point2text point = case point of TCP _ port -> "port " <> T.pack (show port)
78
false
true
3
5
22
44
22
22
null
null
ForestPhoenix/FPSurvey
Forms/TakeSurvey.hs
mit
groupForm :: (QgroupData, [QuestionData], [RatingData]) -> MForm Handler (FormResult [(QuestionData, SurveyInput)], Widget) groupForm (qgroup, questions, ratings) = do let freeField = (freeInputForm . unEnumField . qgroupFreeField) qgroup (results, widget) <- case (unEnumField . qgroupQuestionDisplay) qgroup of RadioInline -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioInline"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} <table class="RadioInline"> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioTable -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (const "") freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioTable"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <table class="RadioTable"> <thead> <tr> <th> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall descr <- (toHtml . ratingValue) <$> ratings <th> #{descr} $if isJust freeField <th> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioLines -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioLines ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioLines"> <tbody> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall (question, view) <- moreThanOne <table class="RadioLines"> <tbody> <td> #{questionText question} ^{fvInput view} |] return (results, widget) return (mconcat $ fmap (:[]) <$> results, widget)
4,099
groupForm :: (QgroupData, [QuestionData], [RatingData]) -> MForm Handler (FormResult [(QuestionData, SurveyInput)], Widget) groupForm (qgroup, questions, ratings) = do let freeField = (freeInputForm . unEnumField . qgroupFreeField) qgroup (results, widget) <- case (unEnumField . qgroupQuestionDisplay) qgroup of RadioInline -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioInline"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} <table class="RadioInline"> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioTable -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (const "") freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioTable"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <table class="RadioTable"> <thead> <tr> <th> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall descr <- (toHtml . ratingValue) <$> ratings <th> #{descr} $if isJust freeField <th> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioLines -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioLines ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioLines"> <tbody> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall (question, view) <- moreThanOne <table class="RadioLines"> <tbody> <td> #{questionText question} ^{fvInput view} |] return (results, widget) return (mconcat $ fmap (:[]) <$> results, widget)
4,099
groupForm (qgroup, questions, ratings) = do let freeField = (freeInputForm . unEnumField . qgroupFreeField) qgroup (results, widget) <- case (unEnumField . qgroupQuestionDisplay) qgroup of RadioInline -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioInline"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} <table class="RadioInline"> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioTable -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioInput ratings (const "") freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioTable"> <tbody> <tr> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <table class="RadioTable"> <thead> <tr> <th> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall descr <- (toHtml . ratingValue) <$> ratings <th> #{descr} $if isJust freeField <th> <tbody> $forall (question, view) <- moreThanOne <tr> <td> #{questionText question} ^{fvInput view} |] return (results, widget) RadioLines -> do (results, views) <- unzip <$> forM questions (\q -> first (fmap (q,)) <$> radioLines ratings (toHtml . ratingValue) freeField) let widget = case zip questions views of ((question, view):[]) -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{questionText question} <table class="RadioLines"> <tbody> ^{fvInput view} |] moreThanOne -> [whamlet| <div class="qgroupFrame"> <span class="qgroupHeader"> #{qgroupHeader qgroup} $forall (question, view) <- moreThanOne <table class="RadioLines"> <tbody> <td> #{questionText question} ^{fvInput view} |] return (results, widget) return (mconcat $ fmap (:[]) <$> results, widget)
3,967
false
true
0
22
2,083
539
293
246
null
null
banacorn/formal-language
haskell-legacy/test.hs
mit
propConcatenateDFA :: Property propConcatenateDFA = do alphabets <- alphabetTestLimit genAlphabets -- DFA 0 states0 <- take 4 <$> genStates dfa0 <- genDFA states0 alphabets lang0 <- genLanguage alphabets -- DFA 1 states1 <- take 4 <$> genStates dfa1 <- genDFA states1 alphabets lang1 <- genLanguage alphabets dfa <- return $ dfa0 `concatenateDFA` dfa1 printTestCase (show dfa0 ++ "\n" ++ show dfa1 ++ "\n" ++ show dfa) (automaton dfa0 lang0 && automaton dfa1 lang1 ==> automaton dfa (lang0 ++ lang1))
591
propConcatenateDFA :: Property propConcatenateDFA = do alphabets <- alphabetTestLimit genAlphabets -- DFA 0 states0 <- take 4 <$> genStates dfa0 <- genDFA states0 alphabets lang0 <- genLanguage alphabets -- DFA 1 states1 <- take 4 <$> genStates dfa1 <- genDFA states1 alphabets lang1 <- genLanguage alphabets dfa <- return $ dfa0 `concatenateDFA` dfa1 printTestCase (show dfa0 ++ "\n" ++ show dfa1 ++ "\n" ++ show dfa) (automaton dfa0 lang0 && automaton dfa1 lang1 ==> automaton dfa (lang0 ++ lang1))
591
propConcatenateDFA = do alphabets <- alphabetTestLimit genAlphabets -- DFA 0 states0 <- take 4 <$> genStates dfa0 <- genDFA states0 alphabets lang0 <- genLanguage alphabets -- DFA 1 states1 <- take 4 <$> genStates dfa1 <- genDFA states1 alphabets lang1 <- genLanguage alphabets dfa <- return $ dfa0 `concatenateDFA` dfa1 printTestCase (show dfa0 ++ "\n" ++ show dfa1 ++ "\n" ++ show dfa) (automaton dfa0 lang0 && automaton dfa1 lang1 ==> automaton dfa (lang0 ++ lang1))
560
false
true
0
13
169
181
83
98
null
null
vasily-kartashov/playground
euler/problem-004.hs
apache-2.0
main = print $ maximum [p | x <- [100..999], y <- [100..999], let p = x * y, let s = show p, s == reverse s]
113
main = print $ maximum [p | x <- [100..999], y <- [100..999], let p = x * y, let s = show p, s == reverse s]
113
main = print $ maximum [p | x <- [100..999], y <- [100..999], let p = x * y, let s = show p, s == reverse s]
113
false
false
3
11
32
85
40
45
null
null
brendanhay/gogol
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
mpl-2.0
-- | Creates a value of 'JobCancelResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'jcrKind' -- -- * 'jcrJob' jobCancelResponse :: JobCancelResponse jobCancelResponse = JobCancelResponse' {_jcrKind = "bigquery#jobCancelResponse", _jcrJob = Nothing}
352
jobCancelResponse :: JobCancelResponse jobCancelResponse = JobCancelResponse' {_jcrKind = "bigquery#jobCancelResponse", _jcrJob = Nothing}
148
jobCancelResponse = JobCancelResponse' {_jcrKind = "bigquery#jobCancelResponse", _jcrJob = Nothing}
105
true
true
1
7
59
39
23
16
null
null
josefs/sbv
Data/SBV/SMT/SMTLib2.hs
bsd-3-clause
smtType :: Kind -> String smtType KBool = "Bool"
58
smtType :: Kind -> String smtType KBool = "Bool"
58
smtType KBool = "Bool"
32
false
true
0
7
18
24
10
14
null
null
JacquesCarette/literate-scientific-software
code/drasil-database/Database/Drasil/SystemInformation.hs
bsd-2-clause
compareAuthYearTitle :: (HasFields c) => c -> c -> Ordering compareAuthYearTitle c1 c2 | cp /= EQ = cp | y1 /= y2 = y1 `compare` y2 | t1 /= t2 = t1 `compare` t2 | otherwise = error "Couldn't sort authors" where cp = comparePeople (getAuthor c1) (getAuthor c2) y1 = getYear c1 y2 = getYear c2 t1 = getTitle c1 t2 = getTitle c2
355
compareAuthYearTitle :: (HasFields c) => c -> c -> Ordering compareAuthYearTitle c1 c2 | cp /= EQ = cp | y1 /= y2 = y1 `compare` y2 | t1 /= t2 = t1 `compare` t2 | otherwise = error "Couldn't sort authors" where cp = comparePeople (getAuthor c1) (getAuthor c2) y1 = getYear c1 y2 = getYear c2 t1 = getTitle c1 t2 = getTitle c2
355
compareAuthYearTitle c1 c2 | cp /= EQ = cp | y1 /= y2 = y1 `compare` y2 | t1 /= t2 = t1 `compare` t2 | otherwise = error "Couldn't sort authors" where cp = comparePeople (getAuthor c1) (getAuthor c2) y1 = getYear c1 y2 = getYear c2 t1 = getTitle c1 t2 = getTitle c2
295
false
true
3
8
95
148
74
74
null
null
juodaspaulius/clafer
src/Language/Clafer/Intermediate/TypeSystem.hs
mit
unionType (TMap _ ta') = unionType ta'
38
unionType (TMap _ ta') = unionType ta'
38
unionType (TMap _ ta') = unionType ta'
38
false
false
0
6
6
21
9
12
null
null
reiddraper/async
Control/Concurrent/Async.hs
bsd-3-clause
-- | Like 'waitEitherCatch', but also 'cancel's both @Async@s before -- returning. -- waitEitherCatchCancel :: Async a -> Async b -> IO (Either (Either SomeException a) (Either SomeException b)) waitEitherCatchCancel left right = waitEitherCatch left right `finally` (cancel left >> cancel right)
356
waitEitherCatchCancel :: Async a -> Async b -> IO (Either (Either SomeException a) (Either SomeException b)) waitEitherCatchCancel left right = waitEitherCatch left right `finally` (cancel left >> cancel right)
270
waitEitherCatchCancel left right = waitEitherCatch left right `finally` (cancel left >> cancel right)
103
true
true
0
11
101
85
42
43
null
null
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DescribeReservedInstancesOfferings.hs
mpl-2.0
-- | The token to retrieve the next page of results. drioNextToken :: Lens' DescribeReservedInstancesOfferings (Maybe Text) drioNextToken = lens _drioNextToken (\s a -> s { _drioNextToken = a })
194
drioNextToken :: Lens' DescribeReservedInstancesOfferings (Maybe Text) drioNextToken = lens _drioNextToken (\s a -> s { _drioNextToken = a })
141
drioNextToken = lens _drioNextToken (\s a -> s { _drioNextToken = a })
70
true
true
1
9
29
51
25
26
null
null
tphyahoo/happs-tutorial
src/AppStateGraphBased.hs
bsd-3-clause
numSessions :: Query AppState Int numSessions = liftM (M.size . unsession) askSessions
88
numSessions :: Query AppState Int numSessions = liftM (M.size . unsession) askSessions
88
numSessions = liftM (M.size . unsession) askSessions
54
false
true
0
8
13
30
15
15
null
null
mocnik-science/chorale
src/Chorale/Common.hs
mit
-- | lookup by using a function -- -- @lookupBy f b xs@ finds the element @x@ which satisfies @f x = b@ lookupBy :: Eq b => (a -> b) -> b -> [a] -> Maybe a lookupBy f b = lookup b . map (map21 (f, id))
201
lookupBy :: Eq b => (a -> b) -> b -> [a] -> Maybe a lookupBy f b = lookup b . map (map21 (f, id))
97
lookupBy f b = lookup b . map (map21 (f, id))
45
true
true
0
9
48
73
38
35
null
null