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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
alanz/machines-play | Main.hs | bsd-3-clause | m1m :: Monad m => MachineT m k M1State
m1m = (source "abcde") ~> m1a | 68 | m1m :: Monad m => MachineT m k M1State
m1m = (source "abcde") ~> m1a | 68 | m1m = (source "abcde") ~> m1a | 29 | false | true | 0 | 7 | 14 | 41 | 18 | 23 | null | null |
spacekitteh/smcghc | compiler/cmm/PprC.hs | bsd-3-clause | pprLit :: CmmLit -> SDoc
pprLit lit = case lit of
CmmInt i rep -> pprHexVal i rep
CmmFloat f w -> parens (machRep_F_CType w) <> str
where d = fromRational f :: Double
str | isInfinite d && d < 0 = ptext (sLit "-INFINITY")
| isInfinite d = ptext (sLit "INFINITY")
| isNaN d = ptext (sLit "NAN")
| otherwise = text (show d)
-- these constants come from <math.h>
-- see #1861
CmmVec {} -> panic "PprC printing vector literal"
CmmBlock bid -> mkW_ <> pprCLabelAddr (infoTblLbl bid)
CmmHighStackMark -> panic "PprC printing high stack mark"
CmmLabel clbl -> mkW_ <> pprCLabelAddr clbl
CmmLabelOff clbl i -> mkW_ <> pprCLabelAddr clbl <> char '+' <> int i
CmmLabelDiffOff clbl1 _ i
-- WARNING:
-- * the lit must occur in the info table clbl2
-- * clbl1 must be an SRT, a slow entry point or a large bitmap
-> mkW_ <> pprCLabelAddr clbl1 <> char '+' <> int i
where
pprCLabelAddr lbl = char '&' <> ppr lbl | 1,146 | pprLit :: CmmLit -> SDoc
pprLit lit = case lit of
CmmInt i rep -> pprHexVal i rep
CmmFloat f w -> parens (machRep_F_CType w) <> str
where d = fromRational f :: Double
str | isInfinite d && d < 0 = ptext (sLit "-INFINITY")
| isInfinite d = ptext (sLit "INFINITY")
| isNaN d = ptext (sLit "NAN")
| otherwise = text (show d)
-- these constants come from <math.h>
-- see #1861
CmmVec {} -> panic "PprC printing vector literal"
CmmBlock bid -> mkW_ <> pprCLabelAddr (infoTblLbl bid)
CmmHighStackMark -> panic "PprC printing high stack mark"
CmmLabel clbl -> mkW_ <> pprCLabelAddr clbl
CmmLabelOff clbl i -> mkW_ <> pprCLabelAddr clbl <> char '+' <> int i
CmmLabelDiffOff clbl1 _ i
-- WARNING:
-- * the lit must occur in the info table clbl2
-- * clbl1 must be an SRT, a slow entry point or a large bitmap
-> mkW_ <> pprCLabelAddr clbl1 <> char '+' <> int i
where
pprCLabelAddr lbl = char '&' <> ppr lbl | 1,146 | pprLit lit = case lit of
CmmInt i rep -> pprHexVal i rep
CmmFloat f w -> parens (machRep_F_CType w) <> str
where d = fromRational f :: Double
str | isInfinite d && d < 0 = ptext (sLit "-INFINITY")
| isInfinite d = ptext (sLit "INFINITY")
| isNaN d = ptext (sLit "NAN")
| otherwise = text (show d)
-- these constants come from <math.h>
-- see #1861
CmmVec {} -> panic "PprC printing vector literal"
CmmBlock bid -> mkW_ <> pprCLabelAddr (infoTblLbl bid)
CmmHighStackMark -> panic "PprC printing high stack mark"
CmmLabel clbl -> mkW_ <> pprCLabelAddr clbl
CmmLabelOff clbl i -> mkW_ <> pprCLabelAddr clbl <> char '+' <> int i
CmmLabelDiffOff clbl1 _ i
-- WARNING:
-- * the lit must occur in the info table clbl2
-- * clbl1 must be an SRT, a slow entry point or a large bitmap
-> mkW_ <> pprCLabelAddr clbl1 <> char '+' <> int i
where
pprCLabelAddr lbl = char '&' <> ppr lbl | 1,121 | false | true | 13 | 11 | 420 | 269 | 128 | 141 | null | null |
DominikDitoIvosevic/Uni | IRG/src/Irg/Lab4/Shading2/Lab4.hs | mit | myMain :: IO ()
myMain = do
print "enter path"
path <- getLine
doesExist <- doesFileExist (folderLocation ++ path)
parsedFile <- if doesExist then parseFile (folderLocation ++ path) else parseFile fileLocation
-- print parsedFile
let gameState = GameState parsedFile $ V4 3 3 3 0
initialize gameState reshapeCallback displayCallback keyboardCallback mouseCallback mousePassiveMoveCallback | 403 | myMain :: IO ()
myMain = do
print "enter path"
path <- getLine
doesExist <- doesFileExist (folderLocation ++ path)
parsedFile <- if doesExist then parseFile (folderLocation ++ path) else parseFile fileLocation
-- print parsedFile
let gameState = GameState parsedFile $ V4 3 3 3 0
initialize gameState reshapeCallback displayCallback keyboardCallback mouseCallback mousePassiveMoveCallback | 403 | myMain = do
print "enter path"
path <- getLine
doesExist <- doesFileExist (folderLocation ++ path)
parsedFile <- if doesExist then parseFile (folderLocation ++ path) else parseFile fileLocation
-- print parsedFile
let gameState = GameState parsedFile $ V4 3 3 3 0
initialize gameState reshapeCallback displayCallback keyboardCallback mouseCallback mousePassiveMoveCallback | 387 | false | true | 0 | 12 | 66 | 122 | 55 | 67 | null | null |
AlbinTheander/oden | test/Oden/Infer/Fixtures.hs | mit | tLiteral = Literal missing | 41 | tLiteral = Literal missing | 41 | tLiteral = Literal missing | 41 | false | false | 1 | 5 | 18 | 13 | 4 | 9 | null | null |
da-x/buildsome | src/Lib/FilePath.hs | gpl-2.0 | joinPath :: [FilePath] -> FilePath
joinPath (path:paths) | path == "/" = "/" <> BS8.intercalate "/" paths | 105 | joinPath :: [FilePath] -> FilePath
joinPath (path:paths) | path == "/" = "/" <> BS8.intercalate "/" paths | 105 | joinPath (path:paths) | path == "/" = "/" <> BS8.intercalate "/" paths | 70 | false | true | 0 | 9 | 16 | 54 | 25 | 29 | null | null |
michaelficarra/purescript | src/Language/PureScript/Errors.hs | mit | prettyPrintParseError :: P.ParseError -> Box.Box
prettyPrintParseError = prettyPrintParseErrorMessages "or" "unknown parse error" "expecting" "unexpected" "end of input" . PE.errorMessages | 188 | prettyPrintParseError :: P.ParseError -> Box.Box
prettyPrintParseError = prettyPrintParseErrorMessages "or" "unknown parse error" "expecting" "unexpected" "end of input" . PE.errorMessages | 188 | prettyPrintParseError = prettyPrintParseErrorMessages "or" "unknown parse error" "expecting" "unexpected" "end of input" . PE.errorMessages | 139 | false | true | 0 | 6 | 18 | 36 | 18 | 18 | null | null |
Rsgm/Haskell-problems | 6.hs | mit | fn :: [Integer] -> Bool
fn [_] = True | 37 | fn :: [Integer] -> Bool
fn [_] = True | 37 | fn [_] = True | 13 | false | true | 0 | 6 | 8 | 28 | 14 | 14 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MParasite.hs | bsd-3-clause | frameStand21 :: Int
frameStand21 = 103 | 38 | frameStand21 :: Int
frameStand21 = 103 | 38 | frameStand21 = 103 | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
notae/haskell-exercise | monad/STMonad.hs | bsd-3-clause | newManager :: ST s (STRef s (Manager s))
newManager = newSTRef $ Manager (return ()) (return ()) | 96 | newManager :: ST s (STRef s (Manager s))
newManager = newSTRef $ Manager (return ()) (return ()) | 96 | newManager = newSTRef $ Manager (return ()) (return ()) | 55 | false | true | 2 | 9 | 16 | 62 | 27 | 35 | null | null |
vikraman/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | annotateBotStr id (Just (arity, sig)) = id `setIdArity` arity
`setIdStrictness` sig | 126 | false | false | 0 | 7 | 53 | 37 | 20 | 17 | null | null |
bananu7/Hate | src/Hate/Graphics/Backend/Common/Util.hs | mit | vertexLayoutToGLLayout :: VertexLayout -> GL.PrimitiveMode
vertexLayoutToGLLayout FanVertexLayout = GL.TriangleFan | 115 | vertexLayoutToGLLayout :: VertexLayout -> GL.PrimitiveMode
vertexLayoutToGLLayout FanVertexLayout = GL.TriangleFan | 114 | vertexLayoutToGLLayout FanVertexLayout = GL.TriangleFan | 55 | false | true | 0 | 6 | 9 | 22 | 11 | 11 | null | null |
karamellpelle/grid | source/Game/GUI/Widget/Helpers.hs | gpl-3.0 | wiRefPos :: WidgetInput -> GUIPos -> WidgetInput
wiRefPos wi ref =
wi
{
wiPos = posRef ref (wiPos wi),
wiPos' = posRef ref (wiPos' wi)
} | 165 | wiRefPos :: WidgetInput -> GUIPos -> WidgetInput
wiRefPos wi ref =
wi
{
wiPos = posRef ref (wiPos wi),
wiPos' = posRef ref (wiPos' wi)
} | 165 | wiRefPos wi ref =
wi
{
wiPos = posRef ref (wiPos wi),
wiPos' = posRef ref (wiPos' wi)
} | 116 | false | true | 0 | 10 | 54 | 64 | 32 | 32 | null | null |
gcampax/ghc | compiler/typecheck/TcClassDcl.hs | bsd-3-clause | badGenericMethod :: Outputable a => a -> Name -> SDoc
badGenericMethod clas op
= hsep [ptext (sLit "Class"), quotes (ppr clas),
ptext (sLit "has a generic-default signature without a binding"), quotes (ppr op)] | 222 | badGenericMethod :: Outputable a => a -> Name -> SDoc
badGenericMethod clas op
= hsep [ptext (sLit "Class"), quotes (ppr clas),
ptext (sLit "has a generic-default signature without a binding"), quotes (ppr op)] | 222 | badGenericMethod clas op
= hsep [ptext (sLit "Class"), quotes (ppr clas),
ptext (sLit "has a generic-default signature without a binding"), quotes (ppr op)] | 168 | false | true | 0 | 9 | 44 | 82 | 40 | 42 | null | null |
spechub/Hets | CASL/Formula.hs | gpl-2.0 | genPrimFormula :: TermParser f => AParser st f -> [String]
-> AParser st (FORMULA f)
genPrimFormula p k = do
f <- p
return $ ExtFORMULA f
<|> primCASLFormula k | 171 | genPrimFormula :: TermParser f => AParser st f -> [String]
-> AParser st (FORMULA f)
genPrimFormula p k = do
f <- p
return $ ExtFORMULA f
<|> primCASLFormula k | 171 | genPrimFormula p k = do
f <- p
return $ ExtFORMULA f
<|> primCASLFormula k | 84 | false | true | 3 | 11 | 41 | 78 | 36 | 42 | null | null |
izgzhen/static-hs | src/Language/DFA/Packages/DSA.hs | mit | sLE :: Sign -> Sign -> Bool
sLE Bottom _ = True | 56 | sLE :: Sign -> Sign -> Bool
sLE Bottom _ = True | 56 | sLE Bottom _ = True | 28 | false | true | 0 | 6 | 20 | 29 | 13 | 16 | null | null |
mapanett/DeepZoom | Graphics/Transform/DeepZoom/Slice.hs | bsd-3-clause | tileOffset :: Integral a => a -> a -> a -> a
tileOffset tileSize overlap position
| position == 0 = 0
| otherwise = (position * tileSize) - overlap | 155 | tileOffset :: Integral a => a -> a -> a -> a
tileOffset tileSize overlap position
| position == 0 = 0
| otherwise = (position * tileSize) - overlap | 155 | tileOffset tileSize overlap position
| position == 0 = 0
| otherwise = (position * tileSize) - overlap | 110 | false | true | 1 | 8 | 37 | 66 | 32 | 34 | null | null |
Vlix/telegram-bot-http | Network/Telegram/Bot/Requests/Yesod.hs | mit | ----------------------------
-- SEND AND GET FUNCTIONS --
----------------------------
getMeRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> m (Either TelegramBadResponse (TG.Response TG.User))
getMeRequest = telegramGetRequest "getMe" [] | 278 | getMeRequest :: (MonadThrow m, MonadIO m, HasHttpManager env, MonadReader env m) => Token -> m (Either TelegramBadResponse (TG.Response TG.User))
getMeRequest = telegramGetRequest "getMe" [] | 190 | getMeRequest = telegramGetRequest "getMe" [] | 44 | true | true | 0 | 13 | 32 | 80 | 40 | 40 | null | null |
ndmitchell/shake | src/General/Intern.hs | bsd-3-clause | insert :: (Eq a, Hashable a) => a -> Id -> Intern a -> Intern a
insert k v@(Id i) (Intern n mp) = Intern (max n i) $ Map.insert k v mp | 134 | insert :: (Eq a, Hashable a) => a -> Id -> Intern a -> Intern a
insert k v@(Id i) (Intern n mp) = Intern (max n i) $ Map.insert k v mp | 134 | insert k v@(Id i) (Intern n mp) = Intern (max n i) $ Map.insert k v mp | 70 | false | true | 0 | 9 | 32 | 100 | 46 | 54 | null | null |
iteloo/tsuru-sample | iteratee-0.8.9.6/src/Data/Iteratee/PTerm.hs | bsd-3-clause | -- |Convert one stream into another, not necessarily in lockstep.
--
-- A version of 'convStream' that sends 'EOF's to the inner iteratee.
convStreamPT
:: (Monad m, Nullable s, NullPoint s')
=> Iteratee s m s'
-> Enumeratee s s' m a
convStreamPT fi = go
where
go = eneeCheckIfDonePass check
check k (Just e) = throwRecoverableErr e (const identity)
>> go (k $ Chunk empty)
check k _ = isStreamFinished >>= maybe (step k)
(\e -> case fromException e of
Just EofException -> go . k $ EOF Nothing
Nothing -> go . k . EOF $ Just e)
step k = fi >>= go . k . Chunk
| 666 | convStreamPT
:: (Monad m, Nullable s, NullPoint s')
=> Iteratee s m s'
-> Enumeratee s s' m a
convStreamPT fi = go
where
go = eneeCheckIfDonePass check
check k (Just e) = throwRecoverableErr e (const identity)
>> go (k $ Chunk empty)
check k _ = isStreamFinished >>= maybe (step k)
(\e -> case fromException e of
Just EofException -> go . k $ EOF Nothing
Nothing -> go . k . EOF $ Just e)
step k = fi >>= go . k . Chunk
| 526 | convStreamPT fi = go
where
go = eneeCheckIfDonePass check
check k (Just e) = throwRecoverableErr e (const identity)
>> go (k $ Chunk empty)
check k _ = isStreamFinished >>= maybe (step k)
(\e -> case fromException e of
Just EofException -> go . k $ EOF Nothing
Nothing -> go . k . EOF $ Just e)
step k = fi >>= go . k . Chunk
| 425 | true | true | 3 | 17 | 217 | 217 | 106 | 111 | null | null |
jmitchell/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d | 72 | showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d | 72 | showDeclImp o (PData _ _ _ _ _ d) = showDImp o { ppopt_impl = True } d | 72 | false | false | 0 | 7 | 19 | 40 | 20 | 20 | null | null |
acple/renzu | src/Renzu/Getter.hs | bsd-3-clause | preuses :: MonadState s m => Fold (Alt Maybe r) s t a b -> (a -> r) -> m (Maybe r)
preuses l = gets . previews l | 112 | preuses :: MonadState s m => Fold (Alt Maybe r) s t a b -> (a -> r) -> m (Maybe r)
preuses l = gets . previews l | 112 | preuses l = gets . previews l | 29 | false | true | 1 | 11 | 28 | 79 | 36 | 43 | null | null |
DimaSamoz/mezzo | test/CompTestsFail.hs | mit | sfHGGs = test "major seventh G-Gs" $ gf' qn :-: g qn | 52 | sfHGGs = test "major seventh G-Gs" $ gf' qn :-: g qn | 52 | sfHGGs = test "major seventh G-Gs" $ gf' qn :-: g qn | 52 | false | false | 1 | 7 | 11 | 26 | 10 | 16 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | primOpOutOfLine NumSparks = True | 32 | primOpOutOfLine NumSparks = True | 32 | primOpOutOfLine NumSparks = True | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_244 (96#) = happyGoto action_220 | 39 | action_244 (96#) = happyGoto action_220 | 39 | action_244 (96#) = happyGoto action_220 | 39 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
mightybyte/reflex-dom-stubs | src/GHCJS/DOM/NamedNodeMap.hs | bsd-3-clause | ghcjs_dom_named_node_map_get_named_item_ns = undefined | 54 | ghcjs_dom_named_node_map_get_named_item_ns = undefined | 54 | ghcjs_dom_named_node_map_get_named_item_ns = undefined | 54 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
Seblink/HackerRank | functional-programming/recursion/string-o-permute.hs | mit | swap :: String -> String
swap [] = [] | 50 | swap :: String -> String
swap [] = [] | 50 | swap [] = [] | 25 | false | true | 0 | 6 | 21 | 22 | 11 | 11 | null | null |
ducis/haAni | hs/common/Graphics/Rendering/OpenGL/GL/Texturing/TexParameter.hs | gpl-2.0 | texParamf ::
(GLfloat -> a) -> (a -> GLfloat) -> TexParameter -> TextureTarget -> StateVar a
texParamf unmarshal marshal p t =
makeStateVar
(getTexParameter glGetTexParameterfv unmarshal t p)
(texParameter glTexParameterf (m2a marshal) t p) | 269 | texParamf ::
(GLfloat -> a) -> (a -> GLfloat) -> TexParameter -> TextureTarget -> StateVar a
texParamf unmarshal marshal p t =
makeStateVar
(getTexParameter glGetTexParameterfv unmarshal t p)
(texParameter glTexParameterf (m2a marshal) t p) | 269 | texParamf unmarshal marshal p t =
makeStateVar
(getTexParameter glGetTexParameterfv unmarshal t p)
(texParameter glTexParameterf (m2a marshal) t p) | 173 | false | true | 0 | 9 | 62 | 88 | 44 | 44 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/DFAReporting/Types/Product.hs | mpl-2.0 | -- | ID of this inventory item.
iiId :: Lens' InventoryItem (Maybe Int64)
iiId
= lens _iiId (\ s a -> s{_iiId = a}) .
mapping _Coerce | 141 | iiId :: Lens' InventoryItem (Maybe Int64)
iiId
= lens _iiId (\ s a -> s{_iiId = a}) .
mapping _Coerce | 109 | iiId
= lens _iiId (\ s a -> s{_iiId = a}) .
mapping _Coerce | 67 | true | true | 1 | 9 | 34 | 59 | 28 | 31 | null | null |
hibou107/algocpp | arithmetic.hs | mit | construct [] = Empty | 20 | construct [] = Empty | 20 | construct [] = Empty | 20 | false | false | 0 | 6 | 3 | 11 | 5 | 6 | null | null |
yamamotoj/alfred-git-workflow | src/Action.hs | mit | xs = do
r <- runGitProcess xs
case r of
Right out -> putStr ((unwords xs) ++ "\ncompleted" ++ "\n" ++ out)
Left err -> putStr err | 141 | xs = do
r <- runGitProcess xs
case r of
Right out -> putStr ((unwords xs) ++ "\ncompleted" ++ "\n" ++ out)
Left err -> putStr err | 141 | xs = do
r <- runGitProcess xs
case r of
Right out -> putStr ((unwords xs) ++ "\ncompleted" ++ "\n" ++ out)
Left err -> putStr err | 141 | false | false | 1 | 17 | 38 | 72 | 31 | 41 | null | null |
fmapfmapfmap/amazonka | amazonka-ml/gen/Network/AWS/MachineLearning/Types/Product.hs | mpl-2.0 | -- | A user-supplied name or description of the 'BatchPrediction'.
bpName :: Lens' BatchPrediction (Maybe Text)
bpName = lens _bpName (\ s a -> s{_bpName = a}) | 159 | bpName :: Lens' BatchPrediction (Maybe Text)
bpName = lens _bpName (\ s a -> s{_bpName = a}) | 92 | bpName = lens _bpName (\ s a -> s{_bpName = a}) | 47 | true | true | 1 | 9 | 26 | 51 | 25 | 26 | null | null |
JoeyEremondi/elm-type-effect | src/Type/Effect/Env.hs | bsd-3-clause | constructor = Env.constructor . importedInfo | 44 | constructor = Env.constructor . importedInfo | 44 | constructor = Env.constructor . importedInfo | 44 | false | false | 1 | 6 | 4 | 16 | 6 | 10 | null | null |
Saeron/haskell | data.structures/haskell/DataStructures/Util/Random.hs | apache-2.0 | randomsIn :: [a] -> Seed -> [a]
randomsIn xs s = map (a!) $ aleatInt l s
where
l = length xs
a = listArray (0,l-1) xs
{-
-- Devuelve una lista infinita de randoms en el intervalo [l,h], s es la Seed
uniforme :: (Random a) => (a, a) -> Int -> [a]
uniforme (l,h) s = randomRs (l,h) (mkStdGen $ v s)
-- Devuelve una lista de n booleanos. La probabilidad de True es p. s es la Seed
bernoulli :: (Ord a, Fractional a, Random a) => Int -> a -> Int -> [Bool]
bernoulli n p s = map (<p) . take n . randoms . mkStdGen $ s
normal :: (Ord a, Floating a, Random a) => Int -> a -> a -> Int -> [a]
normal n media desv s = take n . map gauss . pairs . randoms . mkStdGen $ s
where
pairs (x:y:zs) = (x,y) : pairs zs
gauss (r1,r2) = media + desv * sqrt (-2 * log r1) * cos (2 * pi * r2)
-} | 813 | randomsIn :: [a] -> Seed -> [a]
randomsIn xs s = map (a!) $ aleatInt l s
where
l = length xs
a = listArray (0,l-1) xs
{-
-- Devuelve una lista infinita de randoms en el intervalo [l,h], s es la Seed
uniforme :: (Random a) => (a, a) -> Int -> [a]
uniforme (l,h) s = randomRs (l,h) (mkStdGen $ v s)
-- Devuelve una lista de n booleanos. La probabilidad de True es p. s es la Seed
bernoulli :: (Ord a, Fractional a, Random a) => Int -> a -> Int -> [Bool]
bernoulli n p s = map (<p) . take n . randoms . mkStdGen $ s
normal :: (Ord a, Floating a, Random a) => Int -> a -> a -> Int -> [a]
normal n media desv s = take n . map gauss . pairs . randoms . mkStdGen $ s
where
pairs (x:y:zs) = (x,y) : pairs zs
gauss (r1,r2) = media + desv * sqrt (-2 * log r1) * cos (2 * pi * r2)
-} | 812 | randomsIn xs s = map (a!) $ aleatInt l s
where
l = length xs
a = listArray (0,l-1) xs
{-
-- Devuelve una lista infinita de randoms en el intervalo [l,h], s es la Seed
uniforme :: (Random a) => (a, a) -> Int -> [a]
uniforme (l,h) s = randomRs (l,h) (mkStdGen $ v s)
-- Devuelve una lista de n booleanos. La probabilidad de True es p. s es la Seed
bernoulli :: (Ord a, Fractional a, Random a) => Int -> a -> Int -> [Bool]
bernoulli n p s = map (<p) . take n . randoms . mkStdGen $ s
normal :: (Ord a, Floating a, Random a) => Int -> a -> a -> Int -> [a]
normal n media desv s = take n . map gauss . pairs . randoms . mkStdGen $ s
where
pairs (x:y:zs) = (x,y) : pairs zs
gauss (r1,r2) = media + desv * sqrt (-2 * log r1) * cos (2 * pi * r2)
-} | 780 | false | true | 1 | 7 | 218 | 80 | 41 | 39 | null | null |
aloiscochard/sarsi | src/Codec/Sarsi.hs | apache-2.0 | getLocation :: Get Location
getLocation = Location <$> Get.getStr <*> Get.getInt <*> Get.getInt | 95 | getLocation :: Get Location
getLocation = Location <$> Get.getStr <*> Get.getInt <*> Get.getInt | 95 | getLocation = Location <$> Get.getStr <*> Get.getInt <*> Get.getInt | 67 | false | true | 0 | 8 | 12 | 38 | 17 | 21 | null | null |
facebookincubator/duckling | Duckling/Time/PT/Rules.hs | bsd-3-clause | rulePassadoCycle :: Rule
rulePassadoCycle = Rule
{ name = "passado <cycle>"
, pattern =
[ regex "(passad|[úu]ltim)[ao]s?|anterior(es)?"
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_) -> tt . cycleNth grain $ - 1
_ -> Nothing
} | 298 | rulePassadoCycle :: Rule
rulePassadoCycle = Rule
{ name = "passado <cycle>"
, pattern =
[ regex "(passad|[úu]ltim)[ao]s?|anterior(es)?"
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_) -> tt . cycleNth grain $ - 1
_ -> Nothing
} | 298 | rulePassadoCycle = Rule
{ name = "passado <cycle>"
, pattern =
[ regex "(passad|[úu]ltim)[ao]s?|anterior(es)?"
, dimension TimeGrain
]
, prod = \tokens -> case tokens of
(_:Token TimeGrain grain:_) -> tt . cycleNth grain $ - 1
_ -> Nothing
} | 273 | false | true | 0 | 15 | 75 | 103 | 52 | 51 | null | null |
genos/online_problems | advent_of_code_2020/day05/Main.hs | mit | parseFB :: Char -> Maybe FrontBack
parseFB = \case
'F' -> Just F
'B' -> Just B
_ -> Nothing | 99 | parseFB :: Char -> Maybe FrontBack
parseFB = \case
'F' -> Just F
'B' -> Just B
_ -> Nothing | 99 | parseFB = \case
'F' -> Just F
'B' -> Just B
_ -> Nothing | 64 | false | true | 0 | 8 | 27 | 44 | 21 | 23 | null | null |
caasi/spj-book-student-1992 | src/TiState.hs | bsd-3-clause | tiStatIncSReductions :: TiStats -> TiStats
tiStatIncSReductions (s, sr, pr, h, d) = (s, sr + 1, pr, h, d) | 105 | tiStatIncSReductions :: TiStats -> TiStats
tiStatIncSReductions (s, sr, pr, h, d) = (s, sr + 1, pr, h, d) | 105 | tiStatIncSReductions (s, sr, pr, h, d) = (s, sr + 1, pr, h, d) | 62 | false | true | 0 | 6 | 18 | 52 | 31 | 21 | null | null |
maximilianhuber/innovation | lib/Game/Innovation/Types.hs | bsd-3-clause | colors :: [Color]
colors = [minBound ..] | 40 | colors :: [Color]
colors = [minBound ..] | 40 | colors = [minBound ..] | 22 | false | true | 0 | 5 | 6 | 18 | 11 | 7 | null | null |
ribag/ganeti-experiments | src/Ganeti/HTools/Cluster.hs | gpl-2.0 | tryAlloc nl _ inst (Right ok_pairs) =
let cstat = compClusterStatistics $ Container.elems nl
psols = parMap rwhnf (\(p, ss) ->
foldl' (\cstate ->
concatAllocs cstate .
allocateOnPair cstat nl inst p)
emptyAllocSolution ss) ok_pairs
sols = foldl' sumAllocs emptyAllocSolution psols
in return $ annotateSolution sols | 470 | tryAlloc nl _ inst (Right ok_pairs) =
let cstat = compClusterStatistics $ Container.elems nl
psols = parMap rwhnf (\(p, ss) ->
foldl' (\cstate ->
concatAllocs cstate .
allocateOnPair cstat nl inst p)
emptyAllocSolution ss) ok_pairs
sols = foldl' sumAllocs emptyAllocSolution psols
in return $ annotateSolution sols | 470 | tryAlloc nl _ inst (Right ok_pairs) =
let cstat = compClusterStatistics $ Container.elems nl
psols = parMap rwhnf (\(p, ss) ->
foldl' (\cstate ->
concatAllocs cstate .
allocateOnPair cstat nl inst p)
emptyAllocSolution ss) ok_pairs
sols = foldl' sumAllocs emptyAllocSolution psols
in return $ annotateSolution sols | 470 | false | false | 0 | 16 | 201 | 117 | 58 | 59 | null | null |
yliu120/K3 | src/Language/K3/Parser/DataTypes.hs | apache-2.0 | set :: [String] -> HashSet String
set = HashSet.fromList | 56 | set :: [String] -> HashSet String
set = HashSet.fromList | 56 | set = HashSet.fromList | 22 | false | true | 0 | 7 | 8 | 29 | 13 | 16 | null | null |
MedeaMelana/Piso | ExampleTH.hs | bsd-3-clause | coords :: Piso (Float :- Float :- t) (Coords :- t)
coords = $(derivePisos ''Coords) | 83 | coords :: Piso (Float :- Float :- t) (Coords :- t)
coords = $(derivePisos ''Coords) | 83 | coords = $(derivePisos ''Coords) | 32 | false | true | 0 | 8 | 14 | 43 | 22 | 21 | null | null |
josefs/sbv | Data/SBV.hs | bsd-3-clause | -- | Return the known available solver configs, installed on your machine.
sbvAvailableSolvers :: IO [SMTConfig]
sbvAvailableSolvers = filterM sbvCheckSolverInstallation (map defaultSolverConfig [minBound .. maxBound]) | 218 | sbvAvailableSolvers :: IO [SMTConfig]
sbvAvailableSolvers = filterM sbvCheckSolverInstallation (map defaultSolverConfig [minBound .. maxBound]) | 143 | sbvAvailableSolvers = filterM sbvCheckSolverInstallation (map defaultSolverConfig [minBound .. maxBound]) | 105 | true | true | 0 | 8 | 24 | 37 | 20 | 17 | null | null |
agocorona/Workflow | Demos/docAprobal.hs | bsd-3-clause | main = do
-- restart the interrupted document approbal workflows (if necessary)
syncWrite SyncManual
restartWorkflows [("docApprobal",docApprobal)]
putStrLn "\nThis program is an example of simple workflow management; once a document is created a workflow thread controls the flow o mail messages to three different users that approbe or disapprobe and modify the document"
putStrLn "A document is created by the user, then is validated by the boss and the super boss. If any of the two dissapprobe, the document is sent to the user to modify it."
putStrLn "\n please login as:\n 1- user\n 2- boss1\n 3- boos2\n 4- super boss1\n 5- super boss2\n\n Enter the number"
n <- getLine
case n of
"1" -> userMenu
"2" -> aprobal "boss1"
"3" -> aprobal "boss2"
"4" -> aprobal "superboss1"
"5" -> aprobal "superboss2"
_ -> exitWith ExitSuccess | 892 | main = do
-- restart the interrupted document approbal workflows (if necessary)
syncWrite SyncManual
restartWorkflows [("docApprobal",docApprobal)]
putStrLn "\nThis program is an example of simple workflow management; once a document is created a workflow thread controls the flow o mail messages to three different users that approbe or disapprobe and modify the document"
putStrLn "A document is created by the user, then is validated by the boss and the super boss. If any of the two dissapprobe, the document is sent to the user to modify it."
putStrLn "\n please login as:\n 1- user\n 2- boss1\n 3- boos2\n 4- super boss1\n 5- super boss2\n\n Enter the number"
n <- getLine
case n of
"1" -> userMenu
"2" -> aprobal "boss1"
"3" -> aprobal "boss2"
"4" -> aprobal "superboss1"
"5" -> aprobal "superboss2"
_ -> exitWith ExitSuccess | 892 | main = do
-- restart the interrupted document approbal workflows (if necessary)
syncWrite SyncManual
restartWorkflows [("docApprobal",docApprobal)]
putStrLn "\nThis program is an example of simple workflow management; once a document is created a workflow thread controls the flow o mail messages to three different users that approbe or disapprobe and modify the document"
putStrLn "A document is created by the user, then is validated by the boss and the super boss. If any of the two dissapprobe, the document is sent to the user to modify it."
putStrLn "\n please login as:\n 1- user\n 2- boss1\n 3- boos2\n 4- super boss1\n 5- super boss2\n\n Enter the number"
n <- getLine
case n of
"1" -> userMenu
"2" -> aprobal "boss1"
"3" -> aprobal "boss2"
"4" -> aprobal "superboss1"
"5" -> aprobal "superboss2"
_ -> exitWith ExitSuccess | 892 | false | false | 1 | 11 | 194 | 115 | 49 | 66 | null | null |
vinnymac/glot-www | Model/Language.hs | mit | languageLogo Nim = img_nim_svg | 30 | languageLogo Nim = img_nim_svg | 30 | languageLogo Nim = img_nim_svg | 30 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Bodigrim/exp-pairs | tests/Ivic.hs | gpl-3.0 | fromMinus3To3 :: Rational -> Rational
fromMinus3To3 n = (n - 1 % 2) * 6 | 71 | fromMinus3To3 :: Rational -> Rational
fromMinus3To3 n = (n - 1 % 2) * 6 | 71 | fromMinus3To3 n = (n - 1 % 2) * 6 | 33 | false | true | 0 | 8 | 14 | 33 | 17 | 16 | null | null |
mcschroeder/ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | unpackTrivial (Cast e _) = unpackTrivial e | 55 | unpackTrivial (Cast e _) = unpackTrivial e | 55 | unpackTrivial (Cast e _) = unpackTrivial e | 55 | false | false | 0 | 7 | 19 | 20 | 9 | 11 | null | null |
peti/funcmp | FMP/Core.hs | gpl-3.0 | mpPath' (PathJoin p1 ped p2) end
= mpPath' p1 (Just (ped, (mpPath' p2 end))) | 107 | mpPath' (PathJoin p1 ped p2) end
= mpPath' p1 (Just (ped, (mpPath' p2 end))) | 107 | mpPath' (PathJoin p1 ped p2) end
= mpPath' p1 (Just (ped, (mpPath' p2 end))) | 107 | false | false | 1 | 10 | 44 | 50 | 23 | 27 | null | null |
samstokes/icalendar-parser | Text/Icalendar/Parser.hs | bsd-3-clause | begin :: String -> Parser String
begin s = tokenP (T.Begin s) >> return s | 73 | begin :: String -> Parser String
begin s = tokenP (T.Begin s) >> return s | 73 | begin s = tokenP (T.Begin s) >> return s | 40 | false | true | 0 | 9 | 14 | 39 | 18 | 21 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Healthcare/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'MessageLabels' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'mlAddtional'
messageLabels
:: HashMap Text Text -- ^ 'mlAddtional'
-> MessageLabels
messageLabels pMlAddtional_ =
MessageLabels' {_mlAddtional = _Coerce # pMlAddtional_} | 353 | messageLabels
:: HashMap Text Text -- ^ 'mlAddtional'
-> MessageLabels
messageLabels pMlAddtional_ =
MessageLabels' {_mlAddtional = _Coerce # pMlAddtional_} | 166 | messageLabels pMlAddtional_ =
MessageLabels' {_mlAddtional = _Coerce # pMlAddtional_} | 87 | true | true | 0 | 8 | 62 | 50 | 26 | 24 | null | null |
meiersi/psqueues-old | src/Data/OrdPSQ/Internal.hs | bsd-3-clause | ldoubleLeft _ _ _ _ _ _ = moduleError "ldoubleLeft" "malformed tree" | 68 | ldoubleLeft _ _ _ _ _ _ = moduleError "ldoubleLeft" "malformed tree" | 68 | ldoubleLeft _ _ _ _ _ _ = moduleError "ldoubleLeft" "malformed tree" | 68 | false | false | 0 | 5 | 11 | 24 | 11 | 13 | null | null |
stevezhee/shootout | src/Untyped.hs | bsd-3-clause | booltype = wtype 1 | 18 | booltype = wtype 1 | 18 | booltype = wtype 1 | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
WraithM/haskell-opaleye | src/Opaleye/SqlTypes.hs | bsd-3-clause | sqlLazyJSON :: LByteString.ByteString -> F.Field SqlJson
sqlLazyJSON = P.pgLazyJSON | 83 | sqlLazyJSON :: LByteString.ByteString -> F.Field SqlJson
sqlLazyJSON = P.pgLazyJSON | 83 | sqlLazyJSON = P.pgLazyJSON | 26 | false | true | 0 | 8 | 8 | 30 | 13 | 17 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/IoTPolicy.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-iot-policy.html#cfn-iot-policy-policydocument
itpPolicyDocument :: Lens' IoTPolicy Object
itpPolicyDocument = lens _ioTPolicyPolicyDocument (\s a -> s { _ioTPolicyPolicyDocument = a }) | 264 | itpPolicyDocument :: Lens' IoTPolicy Object
itpPolicyDocument = lens _ioTPolicyPolicyDocument (\s a -> s { _ioTPolicyPolicyDocument = a }) | 138 | itpPolicyDocument = lens _ioTPolicyPolicyDocument (\s a -> s { _ioTPolicyPolicyDocument = a }) | 94 | true | true | 0 | 9 | 20 | 40 | 22 | 18 | null | null |
edwardwas/loveletter | src/LoveLetter/Types.hs | mit | showInfo :: Lens' PlayInformation (String -> IO ())
showInfo = lens _showInfo $ \a b -> a {_showInfo = b} | 105 | showInfo :: Lens' PlayInformation (String -> IO ())
showInfo = lens _showInfo $ \a b -> a {_showInfo = b} | 105 | showInfo = lens _showInfo $ \a b -> a {_showInfo = b} | 53 | false | true | 0 | 9 | 19 | 50 | 26 | 24 | null | null |
kejace/ethereum-client-haskell | src/Blockchain/SampleTransactions.hs | bsd-3-clause | simpleStorageTX::Transaction
simpleStorageTX =
createContract 3 1000
$ compile
[
PUSH [1],
PUSH [0],
SSTORE
] | 140 | simpleStorageTX::Transaction
simpleStorageTX =
createContract 3 1000
$ compile
[
PUSH [1],
PUSH [0],
SSTORE
] | 140 | simpleStorageTX =
createContract 3 1000
$ compile
[
PUSH [1],
PUSH [0],
SSTORE
] | 111 | false | true | 2 | 7 | 45 | 45 | 23 | 22 | null | null |
spacekitteh/smcghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageKey (fsLit "stg_EMPTY_MVAR") CmmInfo | 96 | mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageKey (fsLit "stg_EMPTY_MVAR") CmmInfo | 96 | mkEMPTY_MVAR_infoLabel = CmmLabel rtsPackageKey (fsLit "stg_EMPTY_MVAR") CmmInfo | 96 | false | false | 0 | 7 | 22 | 19 | 9 | 10 | null | null |
chadbrewbaker/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | groupWith f = groupBy ((==) `on` f) | 35 | groupWith f = groupBy ((==) `on` f) | 35 | groupWith f = groupBy ((==) `on` f) | 35 | false | false | 0 | 7 | 6 | 23 | 13 | 10 | null | null |
mstksg/auto | src/Control/Auto/Switch.hs | mit | switchFromF_ :: Monad m
=> (c -> Auto m a (b, Blip c)) -- ^ function to generate the
-- next 'Auto' to behave like
-> Auto m a (b, Blip c) -- ^ initial 'Auto'. the @b@
-- is the output, and the
-- blip stream triggers new
-- 'Auto's to replace this
-- one.
-> Auto m a b
switchFromF_ f a0 = mkAutoM_ $ \x -> do
((y, ez), a0') <- stepAuto a0 x
return $ case ez of
Blip z -> (y, switchFromF_ f (f z))
NoBlip -> (y, switchFromF_ f a0' )
-- | Gives an 'Auto' the ability to "reset" itself on command
--
-- Basically acts like @'fmap' 'fst'@
--
-- @
-- fmap fst :: Monad m => Auto m a (b, Blip c) -> Auto m a b
-- @
--
-- But...whenever the blip stream emits..."resets" the 'Auto' back to the
-- original state, as if nothing ever happened.
--
-- Note that this resetting happens on the step /after/ the blip stream
-- emits.
--
-- Here is a summer that sends out a signal to reset itself whenever the
-- cumulative sum reaches 10 or higher:
--
-- @
-- limitSummer :: Auto' Int (Int, Blip ())
-- limitSummer = (id &&& became (>= 10)) . sumFrom 0
-- @
--
-- And now we throw it into 'resetFrom':
--
-- @
-- resettingSummer :: Auto' Int Int
-- resettingSummer = resetFrom limitSummer
-- @
--
-- >>> streamAuto' resettingSummer [1..10]
-- [ 1, 3, 6, 10 -- and...reset!
-- , 5, 11 -- and...reset!
-- , 7, 15 -- and...reset!
-- , 9, 19 ]
-- | 1,766 | switchFromF_ :: Monad m
=> (c -> Auto m a (b, Blip c)) -- ^ function to generate the
-- next 'Auto' to behave like
-> Auto m a (b, Blip c) -- ^ initial 'Auto'. the @b@
-- is the output, and the
-- blip stream triggers new
-- 'Auto's to replace this
-- one.
-> Auto m a b
switchFromF_ f a0 = mkAutoM_ $ \x -> do
((y, ez), a0') <- stepAuto a0 x
return $ case ez of
Blip z -> (y, switchFromF_ f (f z))
NoBlip -> (y, switchFromF_ f a0' )
-- | Gives an 'Auto' the ability to "reset" itself on command
--
-- Basically acts like @'fmap' 'fst'@
--
-- @
-- fmap fst :: Monad m => Auto m a (b, Blip c) -> Auto m a b
-- @
--
-- But...whenever the blip stream emits..."resets" the 'Auto' back to the
-- original state, as if nothing ever happened.
--
-- Note that this resetting happens on the step /after/ the blip stream
-- emits.
--
-- Here is a summer that sends out a signal to reset itself whenever the
-- cumulative sum reaches 10 or higher:
--
-- @
-- limitSummer :: Auto' Int (Int, Blip ())
-- limitSummer = (id &&& became (>= 10)) . sumFrom 0
-- @
--
-- And now we throw it into 'resetFrom':
--
-- @
-- resettingSummer :: Auto' Int Int
-- resettingSummer = resetFrom limitSummer
-- @
--
-- >>> streamAuto' resettingSummer [1..10]
-- [ 1, 3, 6, 10 -- and...reset!
-- , 5, 11 -- and...reset!
-- , 7, 15 -- and...reset!
-- , 9, 19 ]
-- | 1,766 | switchFromF_ f a0 = mkAutoM_ $ \x -> do
((y, ez), a0') <- stepAuto a0 x
return $ case ez of
Blip z -> (y, switchFromF_ f (f z))
NoBlip -> (y, switchFromF_ f a0' )
-- | Gives an 'Auto' the ability to "reset" itself on command
--
-- Basically acts like @'fmap' 'fst'@
--
-- @
-- fmap fst :: Monad m => Auto m a (b, Blip c) -> Auto m a b
-- @
--
-- But...whenever the blip stream emits..."resets" the 'Auto' back to the
-- original state, as if nothing ever happened.
--
-- Note that this resetting happens on the step /after/ the blip stream
-- emits.
--
-- Here is a summer that sends out a signal to reset itself whenever the
-- cumulative sum reaches 10 or higher:
--
-- @
-- limitSummer :: Auto' Int (Int, Blip ())
-- limitSummer = (id &&& became (>= 10)) . sumFrom 0
-- @
--
-- And now we throw it into 'resetFrom':
--
-- @
-- resettingSummer :: Auto' Int Int
-- resettingSummer = resetFrom limitSummer
-- @
--
-- >>> streamAuto' resettingSummer [1..10]
-- [ 1, 3, 6, 10 -- and...reset!
-- , 5, 11 -- and...reset!
-- , 7, 15 -- and...reset!
-- , 9, 19 ]
-- | 1,218 | false | true | 0 | 17 | 714 | 212 | 126 | 86 | null | null |
romanb/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/Types.hs | mpl-2.0 | -- | The volume ID.
vVolumeId :: Lens' Volume (Maybe Text)
vVolumeId = lens _vVolumeId (\s a -> s { _vVolumeId = a }) | 117 | vVolumeId :: Lens' Volume (Maybe Text)
vVolumeId = lens _vVolumeId (\s a -> s { _vVolumeId = a }) | 97 | vVolumeId = lens _vVolumeId (\s a -> s { _vVolumeId = a }) | 58 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | reserveAction :: String
reserveAction = "reserve" | 49 | reserveAction :: String
reserveAction = "reserve" | 49 | reserveAction = "reserve" | 25 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/InspectorAssessmentTarget.hs | mit | inspectorAssessmentTarget
:: InspectorAssessmentTarget
inspectorAssessmentTarget =
InspectorAssessmentTarget
{ _inspectorAssessmentTargetAssessmentTargetName = Nothing
, _inspectorAssessmentTargetResourceGroupArn = Nothing
} | 235 | inspectorAssessmentTarget
:: InspectorAssessmentTarget
inspectorAssessmentTarget =
InspectorAssessmentTarget
{ _inspectorAssessmentTargetAssessmentTargetName = Nothing
, _inspectorAssessmentTargetResourceGroupArn = Nothing
} | 235 | inspectorAssessmentTarget =
InspectorAssessmentTarget
{ _inspectorAssessmentTargetAssessmentTargetName = Nothing
, _inspectorAssessmentTargetResourceGroupArn = Nothing
} | 178 | false | true | 1 | 7 | 25 | 32 | 16 | 16 | null | null |
holdenlee/notebook | src/MacroMaker.hs | mit | parseLaTeX2 :: String -> LaTeX
parseLaTeX2 str =
case parseLaTeX $ fromString str of
Left _ -> TeXEmpty
Right t -> t | 137 | parseLaTeX2 :: String -> LaTeX
parseLaTeX2 str =
case parseLaTeX $ fromString str of
Left _ -> TeXEmpty
Right t -> t | 136 | parseLaTeX2 str =
case parseLaTeX $ fromString str of
Left _ -> TeXEmpty
Right t -> t | 105 | false | true | 0 | 8 | 42 | 53 | 23 | 30 | null | null |
SamirTalwar/advent-of-code | 2016/AOC_17_2.hs | mit | move (x, y) R = (x + 1, y) | 26 | move (x, y) R = (x + 1, y) | 26 | move (x, y) R = (x + 1, y) | 26 | false | false | 1 | 7 | 8 | 32 | 15 | 17 | null | null |
davedissian/hackcambridge2016 | ParserC.hs | mit | anyOf :: String -> ParserC ext Char
anyOf xs = sat (`elem` xs')
(PErr Nothing (map (:[]) xs'))
where xs' = nub xs | 132 | anyOf :: String -> ParserC ext Char
anyOf xs = sat (`elem` xs')
(PErr Nothing (map (:[]) xs'))
where xs' = nub xs | 132 | anyOf xs = sat (`elem` xs')
(PErr Nothing (map (:[]) xs'))
where xs' = nub xs | 96 | false | true | 0 | 11 | 41 | 67 | 35 | 32 | null | null |
5outh/textlunky | src/Control/Process/Update.hs | mit | -- | Pick up the thing that at the player's feet if it can be held
updateP (Free (Pickup Nothing _)) = do
loc <- use $ player.loc
ents <- use $ room._2.entities -- stuff in the current room
case M.lookup loc ents of
Just x -> do
dropItem -- drop current item
room._2.entities %= (M.delete loc) -- remove new item from room
player.holding .= (Just x) -- put item in hands
Nothing -> return ()
-- | Drop whatever the player is currently holding | 511 | updateP (Free (Pickup Nothing _)) = do
loc <- use $ player.loc
ents <- use $ room._2.entities -- stuff in the current room
case M.lookup loc ents of
Just x -> do
dropItem -- drop current item
room._2.entities %= (M.delete loc) -- remove new item from room
player.holding .= (Just x) -- put item in hands
Nothing -> return ()
-- | Drop whatever the player is currently holding | 444 | updateP (Free (Pickup Nothing _)) = do
loc <- use $ player.loc
ents <- use $ room._2.entities -- stuff in the current room
case M.lookup loc ents of
Just x -> do
dropItem -- drop current item
room._2.entities %= (M.delete loc) -- remove new item from room
player.holding .= (Just x) -- put item in hands
Nothing -> return ()
-- | Drop whatever the player is currently holding | 444 | true | false | 0 | 15 | 153 | 128 | 62 | 66 | null | null |
ilyasergey/GHC-XAppFix | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | etRegister' dflags tree@(CmmRegOff _ _)
= getRegister' dflags (mangleIndexTree tree)
| 87 | getRegister' dflags tree@(CmmRegOff _ _)
= getRegister' dflags (mangleIndexTree tree) | 87 | getRegister' dflags tree@(CmmRegOff _ _)
= getRegister' dflags (mangleIndexTree tree) | 87 | false | false | 0 | 7 | 12 | 36 | 16 | 20 | null | null |
plumlife/cabal | Cabal/Distribution/Simple/Program/GHC.hs | bsd-3-clause | runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> GhcOptions -> IO ()
runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 182 | runGHC :: Verbosity -> ConfiguredProgram -> Compiler -> GhcOptions -> IO ()
runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 182 | runGHC verbosity ghcProg comp opts = do
runProgramInvocation verbosity (ghcInvocation ghcProg comp opts) | 106 | false | true | 0 | 10 | 26 | 59 | 28 | 31 | null | null |
paradoja/numerical-analysis-haskell | NA/Image.hs | gpl-3.0 | cfold :: (Ix i, IArray a b) => (c -> b -> c) -> c -> a i b -> c
cfold f ini = L.foldl' f ini . elems | 100 | cfold :: (Ix i, IArray a b) => (c -> b -> c) -> c -> a i b -> c
cfold f ini = L.foldl' f ini . elems | 100 | cfold f ini = L.foldl' f ini . elems | 36 | false | true | 0 | 9 | 29 | 72 | 36 | 36 | null | null |
ctford/Idris-Elba-dev | src/IRTS/CodegenLLVM.hs | bsd-3-clause | cgOp (LTrunc (ITFixed from) (ITFixed to)) [x]
| nativeTyWidth from > nativeTyWidth to = iCoerce Trunc from to x | 115 | cgOp (LTrunc (ITFixed from) (ITFixed to)) [x]
| nativeTyWidth from > nativeTyWidth to = iCoerce Trunc from to x | 115 | cgOp (LTrunc (ITFixed from) (ITFixed to)) [x]
| nativeTyWidth from > nativeTyWidth to = iCoerce Trunc from to x | 115 | false | false | 0 | 9 | 22 | 59 | 27 | 32 | null | null |
jaspervdj/firefly | src/Firefly/Math/Shape.hs | bsd-3-clause | -- TODO
--------------------------------------------------------------------------------
shapeLines :: Shape -> [(XY, XY)]
shapeLines EmptyShape = [] | 151 | shapeLines :: Shape -> [(XY, XY)]
shapeLines EmptyShape = [] | 60 | shapeLines EmptyShape = [] | 26 | true | true | 0 | 7 | 14 | 31 | 18 | 13 | null | null |
entropia/tip-toi-reveng | src/Utils.hs | mit | forMn :: Monad m => [a] -> (Int -> a -> m b) -> m [b]
forMn l f = forM (zip l [0..]) $ \(x,n) -> f n x | 102 | forMn :: Monad m => [a] -> (Int -> a -> m b) -> m [b]
forMn l f = forM (zip l [0..]) $ \(x,n) -> f n x | 102 | forMn l f = forM (zip l [0..]) $ \(x,n) -> f n x | 48 | false | true | 0 | 11 | 29 | 92 | 46 | 46 | null | null |
kowey/GenI | src/NLP/GenI/Simple/SimpleBuilder.hs | gpl-2.0 | iapplySubst :: Bool -> SimpleItem -> SimpleItem -> SimpleState [SimpleItem]
iapplySubst twophase item1 item2 | siInitial item1 && closed item1 = {-# SCC "applySubstitution" #-}
case siSubstnodes item2 of
[] -> return []
(shead : stail) ->
let doIt =
do -- Maybe monad
let (TagSite n fu fd nOrigin) = toTagSite (lookupOrBug "iapplySubst" item2 shead)
(TagSite rn ru rd rOrigin) = siRoot item1
(newU, subst1) <- hush $ unifyFeat ru fu
(newD, subst2) <- hush $ unifyFeat (replace subst1 rd)
(replace subst1 fd)
let subst = appendSubst subst1 subst2
-- gui stuff
newRoot g = g { gup = newU, gdown = newD, gtype = Other }
let pending = if twophase then []
else rn : (siPendingTb item1 ++ siPendingTb item2)
let item1g = item1 { siNodes = repList (gnnameIs rn) newRoot (siNodes item1) }
return $! replace subst $ combineSimpleItems [rn] item1g $
item2 { siSubstnodes = stail ++ (siSubstnodes item1)
, siAdjnodes = siAdjnodes item1 ++ siAdjnodes item2
, siDerived = plugTree (siDerived item1) n (siDerived item2)
, siDerivation = addToDerivation SubstitutionStep (item1, rOrigin) (item2,nOrigin,n)
, siPendingTb = pending
}
in case doIt of
Nothing -> return []
Just x -> do incrCounter "substitutions" 1
return [x] | 1,595 | iapplySubst :: Bool -> SimpleItem -> SimpleItem -> SimpleState [SimpleItem]
iapplySubst twophase item1 item2 | siInitial item1 && closed item1 = {-# SCC "applySubstitution" #-}
case siSubstnodes item2 of
[] -> return []
(shead : stail) ->
let doIt =
do -- Maybe monad
let (TagSite n fu fd nOrigin) = toTagSite (lookupOrBug "iapplySubst" item2 shead)
(TagSite rn ru rd rOrigin) = siRoot item1
(newU, subst1) <- hush $ unifyFeat ru fu
(newD, subst2) <- hush $ unifyFeat (replace subst1 rd)
(replace subst1 fd)
let subst = appendSubst subst1 subst2
-- gui stuff
newRoot g = g { gup = newU, gdown = newD, gtype = Other }
let pending = if twophase then []
else rn : (siPendingTb item1 ++ siPendingTb item2)
let item1g = item1 { siNodes = repList (gnnameIs rn) newRoot (siNodes item1) }
return $! replace subst $ combineSimpleItems [rn] item1g $
item2 { siSubstnodes = stail ++ (siSubstnodes item1)
, siAdjnodes = siAdjnodes item1 ++ siAdjnodes item2
, siDerived = plugTree (siDerived item1) n (siDerived item2)
, siDerivation = addToDerivation SubstitutionStep (item1, rOrigin) (item2,nOrigin,n)
, siPendingTb = pending
}
in case doIt of
Nothing -> return []
Just x -> do incrCounter "substitutions" 1
return [x] | 1,595 | iapplySubst twophase item1 item2 | siInitial item1 && closed item1 = {-# SCC "applySubstitution" #-}
case siSubstnodes item2 of
[] -> return []
(shead : stail) ->
let doIt =
do -- Maybe monad
let (TagSite n fu fd nOrigin) = toTagSite (lookupOrBug "iapplySubst" item2 shead)
(TagSite rn ru rd rOrigin) = siRoot item1
(newU, subst1) <- hush $ unifyFeat ru fu
(newD, subst2) <- hush $ unifyFeat (replace subst1 rd)
(replace subst1 fd)
let subst = appendSubst subst1 subst2
-- gui stuff
newRoot g = g { gup = newU, gdown = newD, gtype = Other }
let pending = if twophase then []
else rn : (siPendingTb item1 ++ siPendingTb item2)
let item1g = item1 { siNodes = repList (gnnameIs rn) newRoot (siNodes item1) }
return $! replace subst $ combineSimpleItems [rn] item1g $
item2 { siSubstnodes = stail ++ (siSubstnodes item1)
, siAdjnodes = siAdjnodes item1 ++ siAdjnodes item2
, siDerived = plugTree (siDerived item1) n (siDerived item2)
, siDerivation = addToDerivation SubstitutionStep (item1, rOrigin) (item2,nOrigin,n)
, siPendingTb = pending
}
in case doIt of
Nothing -> return []
Just x -> do incrCounter "substitutions" 1
return [x] | 1,519 | false | true | 0 | 22 | 588 | 494 | 246 | 248 | null | null |
ababkin/partial_inspector | src/Vim/Netbeans/Protocol.hs | mit | printCommandName SetTitle {} = "setTitle" | 41 | printCommandName SetTitle {} = "setTitle" | 41 | printCommandName SetTitle {} = "setTitle" | 41 | false | false | 1 | 5 | 4 | 15 | 6 | 9 | null | null |
bergey/gooey | timer/src/Main.hs | bsd-3-clause | handleEvent Resume (AppState s t0 t1 False) = do
t <- now
return $ AppState s (t - (t1 - t0)) t True | 104 | handleEvent Resume (AppState s t0 t1 False) = do
t <- now
return $ AppState s (t - (t1 - t0)) t True | 104 | handleEvent Resume (AppState s t0 t1 False) = do
t <- now
return $ AppState s (t - (t1 - t0)) t True | 104 | false | false | 0 | 12 | 26 | 60 | 29 | 31 | null | null |
dmw/ApacheLogRev | src/Main.hs | bsd-3-clause | processArgs :: IO ()
processArgs = do
argv <- getArgs
let (act, nopt, errs) = getOpt RequireOrder progOptions argv
opts <- foldl (>>=) (return startOptions) act
putStrLn $ printf "Processing: %s\n" (inpFile opts)
inpData <- readFile (inpFile opts)
procResults opts $ foldLogLines opts actionMap $ lines inpData | 334 | processArgs :: IO ()
processArgs = do
argv <- getArgs
let (act, nopt, errs) = getOpt RequireOrder progOptions argv
opts <- foldl (>>=) (return startOptions) act
putStrLn $ printf "Processing: %s\n" (inpFile opts)
inpData <- readFile (inpFile opts)
procResults opts $ foldLogLines opts actionMap $ lines inpData | 334 | processArgs = do
argv <- getArgs
let (act, nopt, errs) = getOpt RequireOrder progOptions argv
opts <- foldl (>>=) (return startOptions) act
putStrLn $ printf "Processing: %s\n" (inpFile opts)
inpData <- readFile (inpFile opts)
procResults opts $ foldLogLines opts actionMap $ lines inpData | 313 | false | true | 0 | 10 | 70 | 127 | 59 | 68 | null | null |
ddssff/lens | src/System/IO/Error/Lens.hs | bsd-3-clause | _NoSuchThing :: Prism' IOErrorType ()
_NoSuchThing = only NoSuchThing | 69 | _NoSuchThing :: Prism' IOErrorType ()
_NoSuchThing = only NoSuchThing | 69 | _NoSuchThing = only NoSuchThing | 31 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
oldmanmike/sdl2 | src/SDL/Raw/Video.hs | bsd-3-clause | glSwapWindow :: MonadIO m => Window -> m ()
glSwapWindow v1 = liftIO $ glSwapWindowFFI v1 | 89 | glSwapWindow :: MonadIO m => Window -> m ()
glSwapWindow v1 = liftIO $ glSwapWindowFFI v1 | 89 | glSwapWindow v1 = liftIO $ glSwapWindowFFI v1 | 45 | false | true | 0 | 8 | 15 | 37 | 17 | 20 | null | null |
jwiegley/ghc-release | libraries/base/Control/Monad.hs | gpl-3.0 | forM_ = flip mapM_ | 28 | forM_ = flip mapM_ | 28 | forM_ = flip mapM_ | 28 | false | false | 0 | 5 | 13 | 9 | 4 | 5 | null | null |
JPMoresmau/leksah-server | tests/TestTool.hs | gpl-2.0 | sendTest testMVar test = do
liftIO $ putMVar testMVar $ Just test | 69 | sendTest testMVar test = do
liftIO $ putMVar testMVar $ Just test | 69 | sendTest testMVar test = do
liftIO $ putMVar testMVar $ Just test | 69 | false | false | 0 | 9 | 15 | 28 | 12 | 16 | null | null |
MerelyAPseudonym/cmdtheline | test/Cipher.hs | mit | toMorse strs = sepCat " / " <$> mapM convertLetters strs
where
convertLetters chars = sepCat " " <$> mapM (`lookup` toCode) chars
sepCat sep = concat . intersperse sep | 174 | toMorse strs = sepCat " / " <$> mapM convertLetters strs
where
convertLetters chars = sepCat " " <$> mapM (`lookup` toCode) chars
sepCat sep = concat . intersperse sep | 174 | toMorse strs = sepCat " / " <$> mapM convertLetters strs
where
convertLetters chars = sepCat " " <$> mapM (`lookup` toCode) chars
sepCat sep = concat . intersperse sep | 174 | false | false | 0 | 7 | 36 | 65 | 31 | 34 | null | null |
mgold/Elm | src/Reporting/Report.hs | bsd-3-clause | toString :: String -> R.Region -> Report -> String -> String
toString location region rprt source =
nonAnsiRender (toDoc location region rprt source) | 151 | toString :: String -> R.Region -> Report -> String -> String
toString location region rprt source =
nonAnsiRender (toDoc location region rprt source) | 151 | toString location region rprt source =
nonAnsiRender (toDoc location region rprt source) | 90 | false | true | 0 | 8 | 24 | 53 | 26 | 27 | null | null |
nevrenato/HyLoRes_Source | src/HyLoRes/Core/Rule/Definitions.hs | gpl-2.0 | {------------- The rule for disjunctions ------------}
disj :: MainPremiseF (At Disj) -> UnaRuleResult
disj (mainF, c) =
---------------
let consequent = newFs `union` c
--
newFs = fromList [at (label mainF) f | f <- subfs (subf mainF)]
in
UR{consequentsU = [consequent],
emptyClauseWasDerivedU = isEmpty consequent} | 393 | disj :: MainPremiseF (At Disj) -> UnaRuleResult
disj (mainF, c) =
---------------
let consequent = newFs `union` c
--
newFs = fromList [at (label mainF) f | f <- subfs (subf mainF)]
in
UR{consequentsU = [consequent],
emptyClauseWasDerivedU = isEmpty consequent} | 336 | disj (mainF, c) =
---------------
let consequent = newFs `union` c
--
newFs = fromList [at (label mainF) f | f <- subfs (subf mainF)]
in
UR{consequentsU = [consequent],
emptyClauseWasDerivedU = isEmpty consequent} | 288 | true | true | 2 | 15 | 122 | 122 | 61 | 61 | null | null |
sol/hakyll | src/Hakyll/Web/Page.hs | bsd-3-clause | pageCompilerWithFields :: ParserState -> WriterOptions
-> (Pandoc -> Pandoc)
-> Compiler (Page String) (Page String)
-> Compiler Resource (Page String)
pageCompilerWithFields state options f g =
readPageCompiler >>> addDefaultFields >>> g >>> arr applySelf
>>> pageReadPandocWith state
>>> arr (fmap (writePandocWith options . f)) | 445 | pageCompilerWithFields :: ParserState -> WriterOptions
-> (Pandoc -> Pandoc)
-> Compiler (Page String) (Page String)
-> Compiler Resource (Page String)
pageCompilerWithFields state options f g =
readPageCompiler >>> addDefaultFields >>> g >>> arr applySelf
>>> pageReadPandocWith state
>>> arr (fmap (writePandocWith options . f)) | 445 | pageCompilerWithFields state options f g =
readPageCompiler >>> addDefaultFields >>> g >>> arr applySelf
>>> pageReadPandocWith state
>>> arr (fmap (writePandocWith options . f)) | 224 | false | true | 6 | 12 | 158 | 123 | 57 | 66 | null | null |
osa1/chsc | Evaluator/Syntax.hs | bsd-3-clause | releaseStackDeeds :: Deeds -> Stack -> Deeds
releaseStackDeeds = foldl' (\deeds kf -> deeds + stackFrameSize (tagee kf)) | 120 | releaseStackDeeds :: Deeds -> Stack -> Deeds
releaseStackDeeds = foldl' (\deeds kf -> deeds + stackFrameSize (tagee kf)) | 120 | releaseStackDeeds = foldl' (\deeds kf -> deeds + stackFrameSize (tagee kf)) | 75 | false | true | 0 | 11 | 17 | 45 | 23 | 22 | null | null |
ttuegel/autonix-deps | src/Autonix/Package.hs | bsd-3-clause | packageOptions :: Options
packageOptions = defaultOptions { fieldLabelModifier = tail } | 87 | packageOptions :: Options
packageOptions = defaultOptions { fieldLabelModifier = tail } | 87 | packageOptions = defaultOptions { fieldLabelModifier = tail } | 61 | false | true | 0 | 6 | 10 | 19 | 11 | 8 | null | null |
peti/postmaster | src/Postmaster/IO.hs | agpl-3.0 | listener :: MonadUnliftIO m => (Maybe HostName, ServiceName) -> SocketHandler m -> m ()
listener (host,port) socketHandler = do
let hints = defaultHints { addrFlags = [AI_PASSIVE], addrSocketType = Stream }
ais <- liftIO (getAddrInfo (Just hints) host (Just port))
if null ais
then throwIO (AssertionFailed ("getAddrInfo " <> show (host,port) <> " returned no result"))
else withListenSocket socketHandler (head ais) | 432 | listener :: MonadUnliftIO m => (Maybe HostName, ServiceName) -> SocketHandler m -> m ()
listener (host,port) socketHandler = do
let hints = defaultHints { addrFlags = [AI_PASSIVE], addrSocketType = Stream }
ais <- liftIO (getAddrInfo (Just hints) host (Just port))
if null ais
then throwIO (AssertionFailed ("getAddrInfo " <> show (host,port) <> " returned no result"))
else withListenSocket socketHandler (head ais) | 432 | listener (host,port) socketHandler = do
let hints = defaultHints { addrFlags = [AI_PASSIVE], addrSocketType = Stream }
ais <- liftIO (getAddrInfo (Just hints) host (Just port))
if null ais
then throwIO (AssertionFailed ("getAddrInfo " <> show (host,port) <> " returned no result"))
else withListenSocket socketHandler (head ais) | 344 | false | true | 0 | 15 | 76 | 166 | 84 | 82 | null | null |
bhickey/TreeStructures | Data/Heap/Skew.hs | bsd-3-clause | insert :: (Ord a) => a -> SkewHeap a -> SkewHeap a
insert a h = merge h (singleton a) | 85 | insert :: (Ord a) => a -> SkewHeap a -> SkewHeap a
insert a h = merge h (singleton a) | 85 | insert a h = merge h (singleton a) | 34 | false | true | 0 | 8 | 19 | 50 | 24 | 26 | null | null |
fpoli/abstat | src/While/Compiler.hs | gpl-3.0 | compileBExpr (BBinary op a b) = "(" ++ compileBExpr a ++ " " ++ compileBBinOp op ++ " " ++ compileBExpr b ++ ")" | 112 | compileBExpr (BBinary op a b) = "(" ++ compileBExpr a ++ " " ++ compileBBinOp op ++ " " ++ compileBExpr b ++ ")" | 112 | compileBExpr (BBinary op a b) = "(" ++ compileBExpr a ++ " " ++ compileBBinOp op ++ " " ++ compileBExpr b ++ ")" | 112 | false | false | 0 | 11 | 23 | 53 | 24 | 29 | null | null |
mdsteele/fallback | src/Fallback/State/Party.hs | gpl-3.0 | partyRemoveItem (CharAccessorySlot charNum) party =
let fn c = c { chrEquipment = (chrEquipment c) { eqpAccessory = Nothing } }
in partyAlterCharacter charNum fn party | 171 | partyRemoveItem (CharAccessorySlot charNum) party =
let fn c = c { chrEquipment = (chrEquipment c) { eqpAccessory = Nothing } }
in partyAlterCharacter charNum fn party | 171 | partyRemoveItem (CharAccessorySlot charNum) party =
let fn c = c { chrEquipment = (chrEquipment c) { eqpAccessory = Nothing } }
in partyAlterCharacter charNum fn party | 171 | false | false | 0 | 13 | 29 | 60 | 30 | 30 | null | null |
nh2/shake | Development/Shake/Pool.hs | bsd-3-clause | nqueue x (Queue p (Right (Just t))) = do bs <- nonDet; return $ Queue p $ Right $ Just $ insertTree bs x t
| 107 | enqueue x (Queue p (Right (Just t))) = do bs <- nonDet; return $ Queue p $ Right $ Just $ insertTree bs x t | 107 | enqueue x (Queue p (Right (Just t))) = do bs <- nonDet; return $ Queue p $ Right $ Just $ insertTree bs x t | 107 | false | false | 0 | 11 | 25 | 68 | 32 | 36 | null | null |
TomMD/cryptol | sbv/Data/SBV/BitVectors/Data.hs | bsd-3-clause | -- | Convert a symbolic value to a symbolic-word
sbvToSW :: State -> SBV a -> IO SW
sbvToSW st (SBV _ (Left c)) = newConst st c | 128 | sbvToSW :: State -> SBV a -> IO SW
sbvToSW st (SBV _ (Left c)) = newConst st c | 79 | sbvToSW st (SBV _ (Left c)) = newConst st c | 44 | true | true | 0 | 9 | 28 | 50 | 24 | 26 | null | null |
mpickering/hackage-server | Data/IntTrie.hs | bsd-3-clause | word16ToEnum :: Enum n => Word32 -> n
word16ToEnum = toEnum . fromIntegral | 74 | word16ToEnum :: Enum n => Word32 -> n
word16ToEnum = toEnum . fromIntegral | 74 | word16ToEnum = toEnum . fromIntegral | 36 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
nicokosi/intro-to-haskell-cis-194 | HW01/HW01.hs | unlicense | sumDigits :: [Integer] -> Integer
sumDigits digits = case digits of
[] -> 0
(h : t) -> (foldl1 (+) (toRevDigits(h))) + (sumDigits t)
-- Exercise 5 -----------------------------------------
-- Validate a credit card number using the above functions. | 266 | sumDigits :: [Integer] -> Integer
sumDigits digits = case digits of
[] -> 0
(h : t) -> (foldl1 (+) (toRevDigits(h))) + (sumDigits t)
-- Exercise 5 -----------------------------------------
-- Validate a credit card number using the above functions. | 266 | sumDigits digits = case digits of
[] -> 0
(h : t) -> (foldl1 (+) (toRevDigits(h))) + (sumDigits t)
-- Exercise 5 -----------------------------------------
-- Validate a credit card number using the above functions. | 232 | false | true | 0 | 13 | 55 | 77 | 42 | 35 | null | null |
danr/structural-induction | test/Env.hs | lgpl-3.0 | arbFromType' :: Sigma Repr -> Gen (Exists Repr)
arbFromType' (Si r) = Val r <$> arbFromType r | 93 | arbFromType' :: Sigma Repr -> Gen (Exists Repr)
arbFromType' (Si r) = Val r <$> arbFromType r | 93 | arbFromType' (Si r) = Val r <$> arbFromType r | 45 | false | true | 0 | 9 | 16 | 50 | 22 | 28 | null | null |
remyoudompheng/hs-language-go | tests/Tests/Parser.hs | gpl-3.0 | testConst3 = testParse "const iota"
goStatement "const ( A = iota; B; C )" $
GoStmtDecl (GoConst [
GoCVSpec [GoId "A"] Nothing [ident "iota"]
, GoCVSpec [GoId "B"] Nothing []
, GoCVSpec [GoId "C"] Nothing []]) | 231 | testConst3 = testParse "const iota"
goStatement "const ( A = iota; B; C )" $
GoStmtDecl (GoConst [
GoCVSpec [GoId "A"] Nothing [ident "iota"]
, GoCVSpec [GoId "B"] Nothing []
, GoCVSpec [GoId "C"] Nothing []]) | 231 | testConst3 = testParse "const iota"
goStatement "const ( A = iota; B; C )" $
GoStmtDecl (GoConst [
GoCVSpec [GoId "A"] Nothing [ident "iota"]
, GoCVSpec [GoId "B"] Nothing []
, GoCVSpec [GoId "C"] Nothing []]) | 231 | false | false | 1 | 11 | 57 | 90 | 41 | 49 | null | null |
sol/pandoc | src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | -- | Convert Pandoc to LaTeX.
writeLaTeX :: WriterOptions -> Pandoc -> String
writeLaTeX options document =
evalState (pandocToLaTeX options document) $
WriterState { stInNote = False, stInTable = False,
stTableNotes = [], stOLLevel = 1, stOptions = options,
stVerbInNote = False, stEnumerate = False,
stTable = False, stStrikeout = False, stSubscript = False,
stUrl = False, stGraphics = False,
stLHS = False, stBook = writerChapters options,
stCsquotes = False, stHighlighting = False,
stIncremental = writerIncremental options,
stInternalLinks = [] } | 685 | writeLaTeX :: WriterOptions -> Pandoc -> String
writeLaTeX options document =
evalState (pandocToLaTeX options document) $
WriterState { stInNote = False, stInTable = False,
stTableNotes = [], stOLLevel = 1, stOptions = options,
stVerbInNote = False, stEnumerate = False,
stTable = False, stStrikeout = False, stSubscript = False,
stUrl = False, stGraphics = False,
stLHS = False, stBook = writerChapters options,
stCsquotes = False, stHighlighting = False,
stIncremental = writerIncremental options,
stInternalLinks = [] } | 655 | writeLaTeX options document =
evalState (pandocToLaTeX options document) $
WriterState { stInNote = False, stInTable = False,
stTableNotes = [], stOLLevel = 1, stOptions = options,
stVerbInNote = False, stEnumerate = False,
stTable = False, stStrikeout = False, stSubscript = False,
stUrl = False, stGraphics = False,
stLHS = False, stBook = writerChapters options,
stCsquotes = False, stHighlighting = False,
stIncremental = writerIncremental options,
stInternalLinks = [] } | 607 | true | true | 0 | 8 | 212 | 169 | 99 | 70 | null | null |
danidiaz/process-streaming | src/System/Process/Streaming.hs | bsd-3-clause | {-| Feed @stdin@ by running a pipes 'Consumer'. This allows bracketing
functions like 'withFile' inside the handler.
-}
feedCont :: (Consumer ByteString IO () -> IO (Either e a)) -> Streams e a
feedCont = liftFeed1 . Feed1 . Other . Feed1_ | 246 | feedCont :: (Consumer ByteString IO () -> IO (Either e a)) -> Streams e a
feedCont = liftFeed1 . Feed1 . Other . Feed1_ | 119 | feedCont = liftFeed1 . Feed1 . Other . Feed1_ | 45 | true | true | 0 | 10 | 48 | 60 | 30 | 30 | null | null |
DanielSchuessler/hstri | TriArcGraph.hs | gpl-3.0 | ta_toDot gr mbQuadVector = graphToDot params gr
where
params = nonClusteredParams {
isDirected = True, -- isJust mbQuadVector,
globalAttributes = [
GraphAttrs gattrs,
EdgeAttrs eattrs,
NodeAttrs nattrs
],
fmtNode = (\(_,int) -> [ toLabel (mathmode (iNormalTriGetVertex int)) ]),
fmtEdge = fmtEdge_
}
gattrs = [ Layout "neato"
, FontSize 10
, d2t (DocPreamble (
Text.unwords [
-- "\\input{/usr/local/share/tikztri.tex}"
"\\usetikzlibrary{decorations.markings}"
, "\\usepackage[a2paper]{geometry}"
]
))
]
eattrs = [
--
-- ,
-- , style "decoration={expanding waves,angle=4,segment length=2pt},decorate"
]
++(
case mbQuadVector of
Nothing -> [Dir NoDir,
d2t (LblStyle "sloped")]
Just _ -> []
)
nattrs = [ Shape Triangle
, Margin (DVal 0)
]
fmtEdge_ (_,_,(InnNA ina1 ina2)) =
case mbQuadVector of
Nothing -> [
mathLabel
(latexTwoRows (toLatex (iNormalArcGetTriangle ina1) ++ "\\sim")
(iNormalArcGetTriangle ina2))
, Len 1.6 ]
Just v ->
let
coeff q = v `quadCount` q
coeffArc = coeff . iNormalQuadByNormalArc
c = coeffArc ina2 ^-^ coeffArc ina1
in
Len 1.3
:
if c==zeroV
then
[
Dir NoDir
]
else
[
style markings
, d2t (LblStyle "fill=gray!30,circle")
, mathLabel c
] | 2,737 | ta_toDot gr mbQuadVector = graphToDot params gr
where
params = nonClusteredParams {
isDirected = True, -- isJust mbQuadVector,
globalAttributes = [
GraphAttrs gattrs,
EdgeAttrs eattrs,
NodeAttrs nattrs
],
fmtNode = (\(_,int) -> [ toLabel (mathmode (iNormalTriGetVertex int)) ]),
fmtEdge = fmtEdge_
}
gattrs = [ Layout "neato"
, FontSize 10
, d2t (DocPreamble (
Text.unwords [
-- "\\input{/usr/local/share/tikztri.tex}"
"\\usetikzlibrary{decorations.markings}"
, "\\usepackage[a2paper]{geometry}"
]
))
]
eattrs = [
--
-- ,
-- , style "decoration={expanding waves,angle=4,segment length=2pt},decorate"
]
++(
case mbQuadVector of
Nothing -> [Dir NoDir,
d2t (LblStyle "sloped")]
Just _ -> []
)
nattrs = [ Shape Triangle
, Margin (DVal 0)
]
fmtEdge_ (_,_,(InnNA ina1 ina2)) =
case mbQuadVector of
Nothing -> [
mathLabel
(latexTwoRows (toLatex (iNormalArcGetTriangle ina1) ++ "\\sim")
(iNormalArcGetTriangle ina2))
, Len 1.6 ]
Just v ->
let
coeff q = v `quadCount` q
coeffArc = coeff . iNormalQuadByNormalArc
c = coeffArc ina2 ^-^ coeffArc ina1
in
Len 1.3
:
if c==zeroV
then
[
Dir NoDir
]
else
[
style markings
, d2t (LblStyle "fill=gray!30,circle")
, mathLabel c
] | 2,737 | ta_toDot gr mbQuadVector = graphToDot params gr
where
params = nonClusteredParams {
isDirected = True, -- isJust mbQuadVector,
globalAttributes = [
GraphAttrs gattrs,
EdgeAttrs eattrs,
NodeAttrs nattrs
],
fmtNode = (\(_,int) -> [ toLabel (mathmode (iNormalTriGetVertex int)) ]),
fmtEdge = fmtEdge_
}
gattrs = [ Layout "neato"
, FontSize 10
, d2t (DocPreamble (
Text.unwords [
-- "\\input{/usr/local/share/tikztri.tex}"
"\\usetikzlibrary{decorations.markings}"
, "\\usepackage[a2paper]{geometry}"
]
))
]
eattrs = [
--
-- ,
-- , style "decoration={expanding waves,angle=4,segment length=2pt},decorate"
]
++(
case mbQuadVector of
Nothing -> [Dir NoDir,
d2t (LblStyle "sloped")]
Just _ -> []
)
nattrs = [ Shape Triangle
, Margin (DVal 0)
]
fmtEdge_ (_,_,(InnNA ina1 ina2)) =
case mbQuadVector of
Nothing -> [
mathLabel
(latexTwoRows (toLatex (iNormalArcGetTriangle ina1) ++ "\\sim")
(iNormalArcGetTriangle ina2))
, Len 1.6 ]
Just v ->
let
coeff q = v `quadCount` q
coeffArc = coeff . iNormalQuadByNormalArc
c = coeffArc ina2 ^-^ coeffArc ina1
in
Len 1.3
:
if c==zeroV
then
[
Dir NoDir
]
else
[
style markings
, d2t (LblStyle "fill=gray!30,circle")
, mathLabel c
] | 2,737 | false | false | 0 | 18 | 1,749 | 402 | 213 | 189 | null | null |
fabianbergmark/APIs | src/Helper/File.hs | bsd-2-clause | loadAPI :: (FilePath, FilePath) -> IO (Maybe (OpenDataTable, Schema))
loadAPI (xml, json) = do
jsonFile <- openFile json ReadMode
schema <- hGetContents jsonFile
rnf schema `seq` hClose jsonFile
xmlFile <- openFile xml ReadMode
document <- hGetContents xmlFile
rnf document `seq` hClose xmlFile
mOpenDataTable <- listToMaybe <$> runX (readString [withRemoveWS yes] document
>>> parseOpenDataTable)
return $ do
!o <- mOpenDataTable
s <- Aeson.decode . BSL.fromString $ schema
return (o, s) | 558 | loadAPI :: (FilePath, FilePath) -> IO (Maybe (OpenDataTable, Schema))
loadAPI (xml, json) = do
jsonFile <- openFile json ReadMode
schema <- hGetContents jsonFile
rnf schema `seq` hClose jsonFile
xmlFile <- openFile xml ReadMode
document <- hGetContents xmlFile
rnf document `seq` hClose xmlFile
mOpenDataTable <- listToMaybe <$> runX (readString [withRemoveWS yes] document
>>> parseOpenDataTable)
return $ do
!o <- mOpenDataTable
s <- Aeson.decode . BSL.fromString $ schema
return (o, s) | 558 | loadAPI (xml, json) = do
jsonFile <- openFile json ReadMode
schema <- hGetContents jsonFile
rnf schema `seq` hClose jsonFile
xmlFile <- openFile xml ReadMode
document <- hGetContents xmlFile
rnf document `seq` hClose xmlFile
mOpenDataTable <- listToMaybe <$> runX (readString [withRemoveWS yes] document
>>> parseOpenDataTable)
return $ do
!o <- mOpenDataTable
s <- Aeson.decode . BSL.fromString $ schema
return (o, s) | 488 | false | true | 0 | 14 | 138 | 202 | 94 | 108 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeableClassKey, typeable1ClassKey, typeable2ClassKey, typeable3ClassKey,
typeable4ClassKey, typeable5ClassKey, typeable6ClassKey, typeable7ClassKey
:: Unique
typeableClassKey = mkPreludeClassUnique 20 | 217 | typeableClassKey, typeable1ClassKey, typeable2ClassKey, typeable3ClassKey,
typeable4ClassKey, typeable5ClassKey, typeable6ClassKey, typeable7ClassKey
:: Unique
typeableClassKey = mkPreludeClassUnique 20 | 217 | typeableClassKey = mkPreludeClassUnique 20 | 49 | false | true | 0 | 5 | 28 | 28 | 21 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.