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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
byorgey/BlogLiterately | src/Text/BlogLiterately/Transform.hs | gpl-3.0 | -- | Prompt the user for a password if the @blog@ field is set but no
-- password has been provided.
passwordXF :: Transform
passwordXF = Transform passwordPrompt passwordCond
where
passwordCond bl = ((bl ^. blog) & has _Just)
&& ((bl ^. password) & isn't _Just)
passwordPrompt = do
liftIO $ putStr "Password: " >> hFlush stdout
pwd <- liftIO getLine
_1 . password .= Just pwd
-- | Read a user-supplied style file and add its contents to the
-- highlighting options. | 525 | passwordXF :: Transform
passwordXF = Transform passwordPrompt passwordCond
where
passwordCond bl = ((bl ^. blog) & has _Just)
&& ((bl ^. password) & isn't _Just)
passwordPrompt = do
liftIO $ putStr "Password: " >> hFlush stdout
pwd <- liftIO getLine
_1 . password .= Just pwd
-- | Read a user-supplied style file and add its contents to the
-- highlighting options. | 422 | passwordXF = Transform passwordPrompt passwordCond
where
passwordCond bl = ((bl ^. blog) & has _Just)
&& ((bl ^. password) & isn't _Just)
passwordPrompt = do
liftIO $ putStr "Password: " >> hFlush stdout
pwd <- liftIO getLine
_1 . password .= Just pwd
-- | Read a user-supplied style file and add its contents to the
-- highlighting options. | 398 | true | true | 1 | 11 | 141 | 116 | 57 | 59 | null | null |
timjb/protocol-buffers | Text/ProtocolBuffers/WireMessage.hs | apache-2.0 | splitWireTag :: WireTag -> (FieldId,WireType)
splitWireTag (WireTag wireTag) = ( FieldId . fromIntegral $ wireTag `shiftR` 3
, WireType . fromIntegral $ wireTag .&. 7 ) | 201 | splitWireTag :: WireTag -> (FieldId,WireType)
splitWireTag (WireTag wireTag) = ( FieldId . fromIntegral $ wireTag `shiftR` 3
, WireType . fromIntegral $ wireTag .&. 7 ) | 201 | splitWireTag (WireTag wireTag) = ( FieldId . fromIntegral $ wireTag `shiftR` 3
, WireType . fromIntegral $ wireTag .&. 7 ) | 155 | false | true | 0 | 9 | 58 | 68 | 35 | 33 | null | null |
brianshourd/adventOfCode2016 | src/Assembunny.hs | mit | parseInput :: String -> [Expr]
parseInput = rights . map (P.parse parseExpr "") . lines | 87 | parseInput :: String -> [Expr]
parseInput = rights . map (P.parse parseExpr "") . lines | 87 | parseInput = rights . map (P.parse parseExpr "") . lines | 56 | false | true | 0 | 10 | 14 | 39 | 20 | 19 | null | null |
rueshyna/gogol | gogol-dataflow/gen/Network/Google/Dataflow/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Step' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sKind'
--
-- * 'sName'
--
-- * 'sProperties'
step
:: Step
step =
Step'
{ _sKind = Nothing
, _sName = Nothing
, _sProperties = Nothing
} | 324 | step
:: Step
step =
Step'
{ _sKind = Nothing
, _sName = Nothing
, _sProperties = Nothing
} | 114 | step =
Step'
{ _sKind = Nothing
, _sName = Nothing
, _sProperties = Nothing
} | 97 | true | true | 0 | 7 | 84 | 50 | 30 | 20 | null | null |
fmthoma/ghc | compiler/types/TyCon.hs | bsd-3-clause | newTyConEtadRhs tycon = pprPanic "newTyConEtadRhs" (ppr tycon) | 62 | newTyConEtadRhs tycon = pprPanic "newTyConEtadRhs" (ppr tycon) | 62 | newTyConEtadRhs tycon = pprPanic "newTyConEtadRhs" (ppr tycon) | 62 | false | false | 1 | 7 | 6 | 23 | 9 | 14 | null | null |
keithodulaigh/Hets | Comorphisms/Hs2HOLCF.hs | gpl-2.0 | getAConstTab :: Continuity -> VaMap -> AConstTab
getAConstTab c =
liftMapByListD Map.toList Map.fromList (mkVName . showIsaName . fst)
(\ (x, y) -> (transMScheme c y, getValInfo x)) nothingFiOut | 207 | getAConstTab :: Continuity -> VaMap -> AConstTab
getAConstTab c =
liftMapByListD Map.toList Map.fromList (mkVName . showIsaName . fst)
(\ (x, y) -> (transMScheme c y, getValInfo x)) nothingFiOut | 207 | getAConstTab c =
liftMapByListD Map.toList Map.fromList (mkVName . showIsaName . fst)
(\ (x, y) -> (transMScheme c y, getValInfo x)) nothingFiOut | 158 | false | true | 0 | 9 | 40 | 76 | 40 | 36 | null | null |
lostbean/Hammer | src/Hammer/VoxConn.hs | gpl-3.0 | mixMaps :: (HasVoxConn c g, GridConn g)=> VoxConn c g -> Vector (g, g) -> VoxConn c g
mixMaps db@VoxConn{..} conn = case (voxConnMap, voxConnList) of
(Just m, Just l) -> let
(new_m, new_l) = V.foldl' (commitConn voxConnRange) (m, l) conn
in db { voxConnMap = return new_m, voxConnList = return new_l }
_ -> db
-- | This function updates the data structure for commit the connection between two
-- positions. | 435 | mixMaps :: (HasVoxConn c g, GridConn g)=> VoxConn c g -> Vector (g, g) -> VoxConn c g
mixMaps db@VoxConn{..} conn = case (voxConnMap, voxConnList) of
(Just m, Just l) -> let
(new_m, new_l) = V.foldl' (commitConn voxConnRange) (m, l) conn
in db { voxConnMap = return new_m, voxConnList = return new_l }
_ -> db
-- | This function updates the data structure for commit the connection between two
-- positions. | 435 | mixMaps db@VoxConn{..} conn = case (voxConnMap, voxConnList) of
(Just m, Just l) -> let
(new_m, new_l) = V.foldl' (commitConn voxConnRange) (m, l) conn
in db { voxConnMap = return new_m, voxConnList = return new_l }
_ -> db
-- | This function updates the data structure for commit the connection between two
-- positions. | 349 | false | true | 2 | 11 | 99 | 165 | 86 | 79 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/base/GHC/IO/Handle.hs | bsd-3-clause | dupHandle_ :: (IODevice dev, BufferedIO dev, Typeable dev) => dev
-> FilePath
-> Maybe (MVar Handle__)
-> Handle__
-> Maybe HandleFinalizer
-> IO Handle
dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-} | 906 | dupHandle_ :: (IODevice dev, BufferedIO dev, Typeable dev) => dev
-> FilePath
-> Maybe (MVar Handle__)
-> Handle__
-> Maybe HandleFinalizer
-> IO Handle
dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-} | 906 | dupHandle_ new_dev filepath other_side h_@Handle__{..} mb_finalizer = do
-- XXX wrong!
mb_codec <- if isJust haEncoder then fmap Just getLocaleEncoding else return Nothing
mkHandle new_dev filepath haType True{-buffered-} mb_codec
NewlineMode { inputNL = haInputNL, outputNL = haOutputNL }
mb_finalizer other_side
-- -----------------------------------------------------------------------------
-- Replacing a Handle
{- |
Makes the second handle a duplicate of the first handle. The second
handle will be closed first, if it is not already.
This can be used to retarget the standard Handles, for example:
> do h <- openFile "mystdout" WriteMode
> hDuplicateTo h stdout
-} | 698 | false | true | 0 | 11 | 198 | 152 | 78 | 74 | null | null |
HaliteChallenge/Halite-II | airesources/Haskell/Hlt/GameMap.hs | mit | -- | Return a list of my Ships.
listMyShips :: GameMap -> [Ship]
listMyShips g = Map.elems $ ships $ Maybe.fromJust $ Map.lookup (myId g) (allPlayers g) | 152 | listMyShips :: GameMap -> [Ship]
listMyShips g = Map.elems $ ships $ Maybe.fromJust $ Map.lookup (myId g) (allPlayers g) | 120 | listMyShips g = Map.elems $ ships $ Maybe.fromJust $ Map.lookup (myId g) (allPlayers g) | 87 | true | true | 0 | 8 | 26 | 57 | 29 | 28 | null | null |
yuncliu/Learn | haskell/fib.hs | bsd-3-clause | len l = do
let a = last l
let b = last (init l)
let newl = l ++ [a + b]
if length newl > len then
newl
else
fib len newl | 156 | len l = do
let a = last l
let b = last (init l)
let newl = l ++ [a + b]
if length newl > len then
newl
else
fib len newl | 156 | len l = do
let a = last l
let b = last (init l)
let newl = l ++ [a + b]
if length newl > len then
newl
else
fib len newl | 156 | false | false | 1 | 13 | 69 | 86 | 38 | 48 | null | null |
underhilllabs/project-euler-in-haskell | primes.hs | mit | sumDigits xs = (read (take 1 xs) :: Int) + sumDigits(tail xs) | 61 | sumDigits xs = (read (take 1 xs) :: Int) + sumDigits(tail xs) | 61 | sumDigits xs = (read (take 1 xs) :: Int) + sumDigits(tail xs) | 61 | false | false | 1 | 9 | 11 | 42 | 19 | 23 | null | null |
sdiehl/ghc | testsuite/tests/pmcheck/should_compile/T17207.hs | bsd-3-clause | g C = () | 8 | g C = () | 8 | g C = () | 8 | false | false | 1 | 6 | 3 | 15 | 5 | 10 | null | null |
ihc/futhark | src/Futhark/Optimise/Simplifier/Rules.hs | isc | simplifyConcat _ _ =
cannotSimplify | 37 | simplifyConcat _ _ =
cannotSimplify | 37 | simplifyConcat _ _ =
cannotSimplify | 37 | false | false | 0 | 5 | 6 | 11 | 5 | 6 | null | null |
beni55/hermit | src/HERMIT/Core.hs | bsd-2-clause | defId :: CoreDef -> Id
defId (Def i _) = i | 42 | defId :: CoreDef -> Id
defId (Def i _) = i | 42 | defId (Def i _) = i | 19 | false | true | 0 | 7 | 10 | 26 | 13 | 13 | null | null |
supki/ldap-client | test/Ldap/Client/BindSpec.hs | bsd-2-clause | spec :: Spec
spec = do
it "binds as ‘admin’" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "secret")
res `shouldBe` Right ()
it "tries to bind as ‘admin’ with the wrong password, unsuccessfully" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "public")
res `shouldBe` Left
(Ldap.ResponseError
(Ldap.ResponseErrorCode
(Ldap.Type.BindRequest 3
(Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=admin"))
(Ldap.Type.Simple "public"))
Ldap.InvalidCredentials
(Dn "cn=admin")
"InvalidCredentialsError"))
it "binds as ‘pikachu’" $ do
res <- locally $ \l -> do
Ldap.bind l (Dn "cn=admin") (Password "secret")
[Ldap.SearchEntry udn _]
<- Ldap.search l (Dn "o=localhost") mempty (Attr "cn" := "pikachu") []
Ldap.bind l udn (Password "i-choose-you")
res `shouldBe` Right () | 984 | spec :: Spec
spec = do
it "binds as ‘admin’" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "secret")
res `shouldBe` Right ()
it "tries to bind as ‘admin’ with the wrong password, unsuccessfully" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "public")
res `shouldBe` Left
(Ldap.ResponseError
(Ldap.ResponseErrorCode
(Ldap.Type.BindRequest 3
(Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=admin"))
(Ldap.Type.Simple "public"))
Ldap.InvalidCredentials
(Dn "cn=admin")
"InvalidCredentialsError"))
it "binds as ‘pikachu’" $ do
res <- locally $ \l -> do
Ldap.bind l (Dn "cn=admin") (Password "secret")
[Ldap.SearchEntry udn _]
<- Ldap.search l (Dn "o=localhost") mempty (Attr "cn" := "pikachu") []
Ldap.bind l udn (Password "i-choose-you")
res `shouldBe` Right () | 984 | spec = do
it "binds as ‘admin’" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "secret")
res `shouldBe` Right ()
it "tries to bind as ‘admin’ with the wrong password, unsuccessfully" $ do
res <- locally $ \l ->
Ldap.bind l (Dn "cn=admin") (Password "public")
res `shouldBe` Left
(Ldap.ResponseError
(Ldap.ResponseErrorCode
(Ldap.Type.BindRequest 3
(Ldap.Type.LdapDn (Ldap.Type.LdapString "cn=admin"))
(Ldap.Type.Simple "public"))
Ldap.InvalidCredentials
(Dn "cn=admin")
"InvalidCredentialsError"))
it "binds as ‘pikachu’" $ do
res <- locally $ \l -> do
Ldap.bind l (Dn "cn=admin") (Password "secret")
[Ldap.SearchEntry udn _]
<- Ldap.search l (Dn "o=localhost") mempty (Attr "cn" := "pikachu") []
Ldap.bind l udn (Password "i-choose-you")
res `shouldBe` Right () | 971 | false | true | 0 | 22 | 300 | 338 | 162 | 176 | null | null |
ocramz/petsc-hs | examples/Test2.hs | gpl-3.0 | petscInitialized :: IO Bool
petscInitialized = withPtr ( \b ->
[C.exp|int{ PetscInitialized($(PetscBool * b)) } |] ) >>= handleErrTup | 139 | petscInitialized :: IO Bool
petscInitialized = withPtr ( \b ->
[C.exp|int{ PetscInitialized($(PetscBool * b)) } |] ) >>= handleErrTup | 139 | petscInitialized = withPtr ( \b ->
[C.exp|int{ PetscInitialized($(PetscBool * b)) } |] ) >>= handleErrTup | 111 | false | true | 0 | 9 | 24 | 35 | 20 | 15 | null | null |
mariefarrell/Hets | CASL/CompositionTable/Keywords.hs | gpl-2.0 | tractableSubsetsS :: String
tractableSubsetsS = "tractable-subsets" | 67 | tractableSubsetsS :: String
tractableSubsetsS = "tractable-subsets" | 67 | tractableSubsetsS = "tractable-subsets" | 39 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
termite2/tsl | Frontend/Grammar.hs | bsd-3-clause | sradval = ((,) <$> ((False, Rad2) <$ (try $ string "'b")) <*> parseBin)
<|> ((,) <$> ((True, Rad2) <$ (try $ string "'sb")) <*> parseBin)
<|> ((,) <$> ((False, Rad8) <$ (try $ string "'o")) <*> parseOct)
<|> ((,) <$> ((True, Rad8) <$ (try $ string "'so")) <*> parseOct)
<|> ((,) <$> ((False, Rad10) <$ (try $ string "'d")) <*> parseDec)
<|> ((,) <$> ((True, Rad10) <$ (try $ string "'sd")) <*> parseSDec)
<|> ((,) <$> ((False, Rad16) <$ (try $ string "'h")) <*> parseHex)
<|> ((,) <$> ((True, Rad16) <$ (try $ string "'sh")) <*> parseHex)
<|> (((False,Rad10),) <$> parseDec) | 643 | sradval = ((,) <$> ((False, Rad2) <$ (try $ string "'b")) <*> parseBin)
<|> ((,) <$> ((True, Rad2) <$ (try $ string "'sb")) <*> parseBin)
<|> ((,) <$> ((False, Rad8) <$ (try $ string "'o")) <*> parseOct)
<|> ((,) <$> ((True, Rad8) <$ (try $ string "'so")) <*> parseOct)
<|> ((,) <$> ((False, Rad10) <$ (try $ string "'d")) <*> parseDec)
<|> ((,) <$> ((True, Rad10) <$ (try $ string "'sd")) <*> parseSDec)
<|> ((,) <$> ((False, Rad16) <$ (try $ string "'h")) <*> parseHex)
<|> ((,) <$> ((True, Rad16) <$ (try $ string "'sh")) <*> parseHex)
<|> (((False,Rad10),) <$> parseDec) | 643 | sradval = ((,) <$> ((False, Rad2) <$ (try $ string "'b")) <*> parseBin)
<|> ((,) <$> ((True, Rad2) <$ (try $ string "'sb")) <*> parseBin)
<|> ((,) <$> ((False, Rad8) <$ (try $ string "'o")) <*> parseOct)
<|> ((,) <$> ((True, Rad8) <$ (try $ string "'so")) <*> parseOct)
<|> ((,) <$> ((False, Rad10) <$ (try $ string "'d")) <*> parseDec)
<|> ((,) <$> ((True, Rad10) <$ (try $ string "'sd")) <*> parseSDec)
<|> ((,) <$> ((False, Rad16) <$ (try $ string "'h")) <*> parseHex)
<|> ((,) <$> ((True, Rad16) <$ (try $ string "'sh")) <*> parseHex)
<|> (((False,Rad10),) <$> parseDec) | 643 | false | false | 0 | 20 | 169 | 351 | 198 | 153 | null | null |
toonn/wyah | src/HOAS.hs | bsd-2-clause | eval (Lam f) = eval . f . Lift | 34 | eval (Lam f) = eval . f . Lift | 34 | eval (Lam f) = eval . f . Lift | 34 | false | false | 0 | 6 | 12 | 24 | 11 | 13 | null | null |
juhp/stack | src/Stack/BuildPlan.hs | bsd-3-clause | showMapPackages :: Map PackageName a -> Text
showMapPackages mp = showItems $ map packageNameString $ Map.keys mp | 113 | showMapPackages :: Map PackageName a -> Text
showMapPackages mp = showItems $ map packageNameString $ Map.keys mp | 113 | showMapPackages mp = showItems $ map packageNameString $ Map.keys mp | 68 | false | true | 0 | 7 | 16 | 39 | 18 | 21 | null | null |
tippenein/scrape_the_truth | src/Database.hs | mit | runDb = runSqlite dbName | 24 | runDb = runSqlite dbName | 24 | runDb = runSqlite dbName | 24 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
oldmanmike/ghc | compiler/iface/IfaceType.hs | bsd-3-clause | splitIfaceSigmaTy :: IfaceType -> ([IfaceForAllBndr], [IfacePredType], IfaceType)
-- Mainly for printing purposes
splitIfaceSigmaTy ty
= (bndrs, theta, tau)
where
(bndrs, rho) = split_foralls ty
(theta, tau) = split_rho rho
split_foralls (IfaceForAllTy bndr ty)
= case split_foralls ty of { (bndrs, rho) -> (bndr:bndrs, rho) }
split_foralls rho = ([], rho)
split_rho (IfaceDFunTy ty1 ty2)
= case split_rho ty2 of { (ps, tau) -> (ty1:ps, tau) }
split_rho tau = ([], tau) | 519 | splitIfaceSigmaTy :: IfaceType -> ([IfaceForAllBndr], [IfacePredType], IfaceType)
splitIfaceSigmaTy ty
= (bndrs, theta, tau)
where
(bndrs, rho) = split_foralls ty
(theta, tau) = split_rho rho
split_foralls (IfaceForAllTy bndr ty)
= case split_foralls ty of { (bndrs, rho) -> (bndr:bndrs, rho) }
split_foralls rho = ([], rho)
split_rho (IfaceDFunTy ty1 ty2)
= case split_rho ty2 of { (ps, tau) -> (ty1:ps, tau) }
split_rho tau = ([], tau) | 487 | splitIfaceSigmaTy ty
= (bndrs, theta, tau)
where
(bndrs, rho) = split_foralls ty
(theta, tau) = split_rho rho
split_foralls (IfaceForAllTy bndr ty)
= case split_foralls ty of { (bndrs, rho) -> (bndr:bndrs, rho) }
split_foralls rho = ([], rho)
split_rho (IfaceDFunTy ty1 ty2)
= case split_rho ty2 of { (ps, tau) -> (ty1:ps, tau) }
split_rho tau = ([], tau) | 405 | true | true | 0 | 9 | 120 | 202 | 113 | 89 | null | null |
marcellussiegburg/autotool | collection/src/CSP/Fail.hs | gpl-2.0 | reject_roller :: ( ToDoc a, Ord a )
=> Config a
-> IO ( Int, (Process a, S.Set a ))
reject_roller conf = do
outs <- forM [ 1 .. generator_repeats conf ] $ \ k -> do
p <- CSP.Roll.roll_free
( how_to_iterate conf )
( process_alphabet conf )
( process_size conf )
let ok = CSP.Property.Guarded.ok p
let cut = max_derivation_length conf
wid = max_derivation_tree_width conf
return $ if not ok then [] else
interesting_rejects p wid cut
return $ maximumBy ( comparing fst ) $ concat outs | 609 | reject_roller :: ( ToDoc a, Ord a )
=> Config a
-> IO ( Int, (Process a, S.Set a ))
reject_roller conf = do
outs <- forM [ 1 .. generator_repeats conf ] $ \ k -> do
p <- CSP.Roll.roll_free
( how_to_iterate conf )
( process_alphabet conf )
( process_size conf )
let ok = CSP.Property.Guarded.ok p
let cut = max_derivation_length conf
wid = max_derivation_tree_width conf
return $ if not ok then [] else
interesting_rejects p wid cut
return $ maximumBy ( comparing fst ) $ concat outs | 609 | reject_roller conf = do
outs <- forM [ 1 .. generator_repeats conf ] $ \ k -> do
p <- CSP.Roll.roll_free
( how_to_iterate conf )
( process_alphabet conf )
( process_size conf )
let ok = CSP.Property.Guarded.ok p
let cut = max_derivation_length conf
wid = max_derivation_tree_width conf
return $ if not ok then [] else
interesting_rejects p wid cut
return $ maximumBy ( comparing fst ) $ concat outs | 509 | false | true | 0 | 17 | 215 | 213 | 102 | 111 | null | null |
jean-edouard/manager | xenmgr/Vm/Config.hs | gpl-2.0 | vmVkbd = property "config.vkbd" | 31 | vmVkbd = property "config.vkbd" | 31 | vmVkbd = property "config.vkbd" | 31 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
lexml/lexml-linker | src/main/haskell/LexML/Linker/ParserBase.hs | gpl-2.0 | anyPalavra :: LinkerParserMonad (Pos,String)
anyPalavra = lToken f
where
f (Palavra s) = return s
f _ = fail "expecting palavra" | 138 | anyPalavra :: LinkerParserMonad (Pos,String)
anyPalavra = lToken f
where
f (Palavra s) = return s
f _ = fail "expecting palavra" | 138 | anyPalavra = lToken f
where
f (Palavra s) = return s
f _ = fail "expecting palavra" | 93 | false | true | 0 | 7 | 30 | 54 | 26 | 28 | null | null |
HIPERFIT/futhark | src/Futhark/CLI/Literate.hs | isc | parseInt :: Parser Int
parseInt = lexeme $ read <$> some (satisfy isDigit) | 74 | parseInt :: Parser Int
parseInt = lexeme $ read <$> some (satisfy isDigit) | 74 | parseInt = lexeme $ read <$> some (satisfy isDigit) | 51 | false | true | 0 | 8 | 12 | 31 | 15 | 16 | null | null |
typedvar/hLand | hcore/Language.hs | mit | recursive, nonRecursive :: IsRec
recursive = True | 49 | recursive, nonRecursive :: IsRec
recursive = True | 49 | recursive = True | 16 | false | true | 2 | 6 | 6 | 21 | 8 | 13 | null | null |
mhlakhani/hlisp | src/Parser.hs | mit | macro :: Parser LispVal
macro = do
L.reserved "defmacro"
name <- L.identifier
args <- L.parens $ many L.identifier
expr <- form
return $ Macro name args expr | 167 | macro :: Parser LispVal
macro = do
L.reserved "defmacro"
name <- L.identifier
args <- L.parens $ many L.identifier
expr <- form
return $ Macro name args expr | 167 | macro = do
L.reserved "defmacro"
name <- L.identifier
args <- L.parens $ many L.identifier
expr <- form
return $ Macro name args expr | 143 | false | true | 0 | 10 | 36 | 70 | 31 | 39 | null | null |
mokus0/s-expression | src/Text/SExpr/Convert.hs | bsd-3-clause | printSExpr :: (Atom a, List l, Functor l) =>
SExpr l a -> Doc
printSExpr = foldSExpr printAtom printList | 109 | printSExpr :: (Atom a, List l, Functor l) =>
SExpr l a -> Doc
printSExpr = foldSExpr printAtom printList | 109 | printSExpr = foldSExpr printAtom printList | 42 | false | true | 0 | 7 | 23 | 46 | 23 | 23 | null | null |
dimara/ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | pIgnoreErrors :: Field
pIgnoreErrors =
withDoc "List of error codes that should be treated as warnings" .
defaultField [| emptyListSet |] $
simpleField "ignore_errors" [t| ListSet CVErrorCode |] | 200 | pIgnoreErrors :: Field
pIgnoreErrors =
withDoc "List of error codes that should be treated as warnings" .
defaultField [| emptyListSet |] $
simpleField "ignore_errors" [t| ListSet CVErrorCode |] | 200 | pIgnoreErrors =
withDoc "List of error codes that should be treated as warnings" .
defaultField [| emptyListSet |] $
simpleField "ignore_errors" [t| ListSet CVErrorCode |] | 177 | false | true | 0 | 7 | 33 | 37 | 21 | 16 | null | null |
pbl64k/HackerRank-Contests | 2014-10-10-FP/Infer/i.accepted.hs | bsd-2-clause | add_ct0 t = do
n <- add_t0
replace n t
env <- get
return n | 74 | add_ct0 t = do
n <- add_t0
replace n t
env <- get
return n | 74 | add_ct0 t = do
n <- add_t0
replace n t
env <- get
return n | 74 | false | false | 0 | 7 | 30 | 37 | 15 | 22 | null | null |
jystic/QuickSpec | experiment/Experiment.hs | bsd-3-clause | split (Constraint m n _) | m <= 0 || n <= 0 = [] | 48 | split (Constraint m n _) | m <= 0 || n <= 0 = [] | 48 | split (Constraint m n _) | m <= 0 || n <= 0 = [] | 48 | false | false | 0 | 10 | 14 | 39 | 18 | 21 | null | null |
23Skidoo/snap-core | src/Snap/Internal/Parsing.hs | bsd-3-clause | finish :: Result a -> Result a
finish (Partial f) = flip feed "" $ f "" | 71 | finish :: Result a -> Result a
finish (Partial f) = flip feed "" $ f "" | 71 | finish (Partial f) = flip feed "" $ f "" | 40 | false | true | 2 | 9 | 16 | 48 | 20 | 28 | null | null |
alexander-at-github/eta | compiler/ETA/Types/CoAxiom.hs | bsd-3-clause | fromBranchList (NextBranch h t) = h : (fromBranchList t) | 56 | fromBranchList (NextBranch h t) = h : (fromBranchList t) | 56 | fromBranchList (NextBranch h t) = h : (fromBranchList t) | 56 | false | false | 0 | 7 | 8 | 27 | 13 | 14 | null | null |
copumpkin/charm | src/Architecture/ARM/Decoder/Common.hs | bsd-3-clause | hint :: (Bits a, Integral a) => a -> Hint
hint =
do opt <- integral 0 3
return $ case opt of
2 -> OSHST
3 -> OSH
6 -> NSH
7 -> NSHST
10 -> ISH
11 -> ISHST
14 -> SY
15 -> ST
x -> InvalidHint x | 266 | hint :: (Bits a, Integral a) => a -> Hint
hint =
do opt <- integral 0 3
return $ case opt of
2 -> OSHST
3 -> OSH
6 -> NSH
7 -> NSHST
10 -> ISH
11 -> ISHST
14 -> SY
15 -> ST
x -> InvalidHint x | 266 | hint =
do opt <- integral 0 3
return $ case opt of
2 -> OSHST
3 -> OSH
6 -> NSH
7 -> NSHST
10 -> ISH
11 -> ISHST
14 -> SY
15 -> ST
x -> InvalidHint x | 224 | false | true | 0 | 12 | 125 | 117 | 55 | 62 | null | null |
ekmett/multipass | Data/Pass/L.hs | bsd-3-clause | callL LMean n = IM.fromList [ (i, oon) | i <- [0..n-1]]
where oon = recip (fromIntegral n) | 92 | callL LMean n = IM.fromList [ (i, oon) | i <- [0..n-1]]
where oon = recip (fromIntegral n) | 92 | callL LMean n = IM.fromList [ (i, oon) | i <- [0..n-1]]
where oon = recip (fromIntegral n) | 92 | false | false | 0 | 10 | 19 | 59 | 30 | 29 | null | null |
urbanslug/ghc | testsuite/tests/cabal/cabal05/p/P.hs | bsd-3-clause | p = True | 8 | p = True | 8 | p = True | 8 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
farnoy/torrent | test/PeerMonadSpec.hs | bsd-3-clause | evalPeerMonadTest (Log exp next) = next | 39 | evalPeerMonadTest (Log exp next) = next | 39 | evalPeerMonadTest (Log exp next) = next | 39 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
tolysz/hiccup | BSParse.hs | lgpl-2.1 | parseStr :: Parser BString
parseStr = B.pack <$> quotes ( concat <$> inside)
where noquotes = noneOf "\"\\"
-- "non-quote chars"
inside = many ((:[]) <$> try noquotes <|> escapedChar) | 193 | parseStr :: Parser BString
parseStr = B.pack <$> quotes ( concat <$> inside)
where noquotes = noneOf "\"\\"
-- "non-quote chars"
inside = many ((:[]) <$> try noquotes <|> escapedChar) | 193 | parseStr = B.pack <$> quotes ( concat <$> inside)
where noquotes = noneOf "\"\\"
-- "non-quote chars"
inside = many ((:[]) <$> try noquotes <|> escapedChar) | 166 | false | true | 1 | 10 | 39 | 70 | 36 | 34 | null | null |
willdonnelly/dyre | Tests/config-check/configCheckTestA.hs | bsd-3-clause | main = configCheckTest "custom-a" | 33 | main = configCheckTest "custom-a" | 33 | main = configCheckTest "custom-a" | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
phischu/fragnix | builtins/integer-gmp/GHC.Integer.Type.hs | bsd-3-clause | return :: a -> S s a
return a = \s -> (# s, a #) | 48 | return :: a -> S s a
return a = \s -> (# s, a #) | 48 | return a = \s -> (# s, a #) | 27 | false | true | 0 | 7 | 15 | 38 | 18 | 20 | null | null |
jwiegley/ghc-release | libraries/base/Control/Monad.hs | gpl-3.0 | (=<<) :: Monad m => (a -> m b) -> m a -> m b
f =<< x = x >>= f | 80 | (=<<) :: Monad m => (a -> m b) -> m a -> m b
f =<< x = x >>= f | 80 | f =<< x = x >>= f | 25 | false | true | 0 | 10 | 39 | 54 | 26 | 28 | null | null |
christiaanb/clash-compiler | clash-systemverilog/src/CLaSH/Backend/SystemVerilog.hs | bsd-2-clause | listBraces :: Monad m => m [Doc] -> m Doc
listBraces = encloseSep lbrace rbrace comma | 85 | listBraces :: Monad m => m [Doc] -> m Doc
listBraces = encloseSep lbrace rbrace comma | 85 | listBraces = encloseSep lbrace rbrace comma | 43 | false | true | 0 | 8 | 15 | 38 | 18 | 20 | null | null |
mstksg/hledger | hledger-lib/Hledger/Read/CsvReader.hs | gpl-3.0 | -- Convert a CSV record to a transaction using the rules, or raise an
-- error if the data can not be parsed.
transactionFromCsvRecord :: SourcePos -> CsvRules -> CsvRecord -> Transaction
transactionFromCsvRecord sourcepos rules record = t
where
mdirective = (`getDirective` rules)
mfieldtemplate = getEffectiveAssignment rules record
render = renderTemplate rules record
mskip = mdirective "skip"
mdefaultcurrency = mdirective "default-currency"
mparsedate = parseDateWithFormatOrDefaultFormats (mdirective "date-format")
-- render each field using its template and the csv record, and
-- in some cases parse the rendered string (eg dates and amounts)
mdateformat = mdirective "date-format"
date = render $ fromMaybe "" $ mfieldtemplate "date"
date' = fromMaybe (error' $ dateerror "date" date mdateformat) $ mparsedate date
mdate2 = maybe Nothing (Just . render) $ mfieldtemplate "date2"
mdate2' = maybe Nothing (maybe (error' $ dateerror "date2" (fromMaybe "" mdate2) mdateformat) Just . mparsedate) mdate2
dateerror datefield value mdateformat = unlines
["error: could not parse \""++value++"\" as a date using date format "++maybe "\"YYYY/M/D\", \"YYYY-M-D\" or \"YYYY.M.D\"" show mdateformat
,"the CSV record is: "++intercalate ", " (map show record)
,"the "++datefield++" rule is: "++(fromMaybe "required, but missing" $ mfieldtemplate datefield)
,"the date-format is: "++fromMaybe "unspecified" mdateformat
,"you may need to "
++"change your "++datefield++" rule, "
++maybe "add a" (const "change your") mdateformat++" date-format rule, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
,"for m/d/y or d/m/y dates, use date-format %-m/%-d/%Y or date-format %-d/%-m/%Y"
]
status =
case mfieldtemplate "status" of
Nothing -> Unmarked
Just str -> either statuserror id .
runParser (statusp <* eof) "" .
T.pack $ render str
where
statuserror err = error' $ unlines
["error: could not parse \""++str++"\" as a cleared status (should be *, ! or empty)"
,"the parse error is: "++show err
]
code = maybe "" render $ mfieldtemplate "code"
description = maybe "" render $ mfieldtemplate "description"
comment = maybe "" render $ mfieldtemplate "comment"
precomment = maybe "" render $ mfieldtemplate "precomment"
currency = maybe (fromMaybe "" mdefaultcurrency) render $ mfieldtemplate "currency"
amountstr = (currency++) $ simplifySign $ getAmountStr rules record
amount = either amounterror (Mixed . (:[])) $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack amountstr
amounterror err = error' $ unlines
["error: could not parse \""++amountstr++"\" as an amount"
,showRecord record
,"the amount rule is: "++(fromMaybe "" $ mfieldtemplate "amount")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
,"you may need to "
++"change your amount or currency rules, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
]
-- Using costOfMixedAmount here to allow complex costs like "10 GBP @@ 15 USD".
-- Aim is to have "10 GBP @@ 15 USD" applied to account2, but have "-15USD" applied to account1
amount1 = costOfMixedAmount amount
amount2 = (-amount)
s `or` def = if null s then def else s
defaccount1 = fromMaybe "unknown" $ mdirective "default-account1"
defaccount2 = case isNegativeMixedAmount amount2 of
Just True -> "income:unknown"
_ -> "expenses:unknown"
account1 = T.pack $ maybe "" render (mfieldtemplate "account1") `or` defaccount1
account2 = T.pack $ maybe "" render (mfieldtemplate "account2") `or` defaccount2
balance = maybe Nothing (parsebalance.render) $ mfieldtemplate "balance"
parsebalance str
| all isSpace str = Nothing
| otherwise = Just $ either (balanceerror str) id $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack $ (currency++) $ simplifySign str
balanceerror str err = error' $ unlines
["error: could not parse \""++str++"\" as balance amount"
,showRecord record
,"the balance rule is: "++(fromMaybe "" $ mfieldtemplate "balance")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
]
-- build the transaction
t = nulltransaction{
tsourcepos = genericSourcePos sourcepos,
tdate = date',
tdate2 = mdate2',
tstatus = status,
tcode = T.pack code,
tdescription = T.pack description,
tcomment = T.pack comment,
tpreceding_comment_lines = T.pack precomment,
tpostings =
[posting {paccount=account2, pamount=amount2, ptransaction=Just t}
,posting {paccount=account1, pamount=amount1, ptransaction=Just t, pbalanceassertion=balance}
]
} | 5,536 | transactionFromCsvRecord :: SourcePos -> CsvRules -> CsvRecord -> Transaction
transactionFromCsvRecord sourcepos rules record = t
where
mdirective = (`getDirective` rules)
mfieldtemplate = getEffectiveAssignment rules record
render = renderTemplate rules record
mskip = mdirective "skip"
mdefaultcurrency = mdirective "default-currency"
mparsedate = parseDateWithFormatOrDefaultFormats (mdirective "date-format")
-- render each field using its template and the csv record, and
-- in some cases parse the rendered string (eg dates and amounts)
mdateformat = mdirective "date-format"
date = render $ fromMaybe "" $ mfieldtemplate "date"
date' = fromMaybe (error' $ dateerror "date" date mdateformat) $ mparsedate date
mdate2 = maybe Nothing (Just . render) $ mfieldtemplate "date2"
mdate2' = maybe Nothing (maybe (error' $ dateerror "date2" (fromMaybe "" mdate2) mdateformat) Just . mparsedate) mdate2
dateerror datefield value mdateformat = unlines
["error: could not parse \""++value++"\" as a date using date format "++maybe "\"YYYY/M/D\", \"YYYY-M-D\" or \"YYYY.M.D\"" show mdateformat
,"the CSV record is: "++intercalate ", " (map show record)
,"the "++datefield++" rule is: "++(fromMaybe "required, but missing" $ mfieldtemplate datefield)
,"the date-format is: "++fromMaybe "unspecified" mdateformat
,"you may need to "
++"change your "++datefield++" rule, "
++maybe "add a" (const "change your") mdateformat++" date-format rule, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
,"for m/d/y or d/m/y dates, use date-format %-m/%-d/%Y or date-format %-d/%-m/%Y"
]
status =
case mfieldtemplate "status" of
Nothing -> Unmarked
Just str -> either statuserror id .
runParser (statusp <* eof) "" .
T.pack $ render str
where
statuserror err = error' $ unlines
["error: could not parse \""++str++"\" as a cleared status (should be *, ! or empty)"
,"the parse error is: "++show err
]
code = maybe "" render $ mfieldtemplate "code"
description = maybe "" render $ mfieldtemplate "description"
comment = maybe "" render $ mfieldtemplate "comment"
precomment = maybe "" render $ mfieldtemplate "precomment"
currency = maybe (fromMaybe "" mdefaultcurrency) render $ mfieldtemplate "currency"
amountstr = (currency++) $ simplifySign $ getAmountStr rules record
amount = either amounterror (Mixed . (:[])) $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack amountstr
amounterror err = error' $ unlines
["error: could not parse \""++amountstr++"\" as an amount"
,showRecord record
,"the amount rule is: "++(fromMaybe "" $ mfieldtemplate "amount")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
,"you may need to "
++"change your amount or currency rules, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
]
-- Using costOfMixedAmount here to allow complex costs like "10 GBP @@ 15 USD".
-- Aim is to have "10 GBP @@ 15 USD" applied to account2, but have "-15USD" applied to account1
amount1 = costOfMixedAmount amount
amount2 = (-amount)
s `or` def = if null s then def else s
defaccount1 = fromMaybe "unknown" $ mdirective "default-account1"
defaccount2 = case isNegativeMixedAmount amount2 of
Just True -> "income:unknown"
_ -> "expenses:unknown"
account1 = T.pack $ maybe "" render (mfieldtemplate "account1") `or` defaccount1
account2 = T.pack $ maybe "" render (mfieldtemplate "account2") `or` defaccount2
balance = maybe Nothing (parsebalance.render) $ mfieldtemplate "balance"
parsebalance str
| all isSpace str = Nothing
| otherwise = Just $ either (balanceerror str) id $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack $ (currency++) $ simplifySign str
balanceerror str err = error' $ unlines
["error: could not parse \""++str++"\" as balance amount"
,showRecord record
,"the balance rule is: "++(fromMaybe "" $ mfieldtemplate "balance")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
]
-- build the transaction
t = nulltransaction{
tsourcepos = genericSourcePos sourcepos,
tdate = date',
tdate2 = mdate2',
tstatus = status,
tcode = T.pack code,
tdescription = T.pack description,
tcomment = T.pack comment,
tpreceding_comment_lines = T.pack precomment,
tpostings =
[posting {paccount=account2, pamount=amount2, ptransaction=Just t}
,posting {paccount=account1, pamount=amount1, ptransaction=Just t, pbalanceassertion=balance}
]
} | 5,426 | transactionFromCsvRecord sourcepos rules record = t
where
mdirective = (`getDirective` rules)
mfieldtemplate = getEffectiveAssignment rules record
render = renderTemplate rules record
mskip = mdirective "skip"
mdefaultcurrency = mdirective "default-currency"
mparsedate = parseDateWithFormatOrDefaultFormats (mdirective "date-format")
-- render each field using its template and the csv record, and
-- in some cases parse the rendered string (eg dates and amounts)
mdateformat = mdirective "date-format"
date = render $ fromMaybe "" $ mfieldtemplate "date"
date' = fromMaybe (error' $ dateerror "date" date mdateformat) $ mparsedate date
mdate2 = maybe Nothing (Just . render) $ mfieldtemplate "date2"
mdate2' = maybe Nothing (maybe (error' $ dateerror "date2" (fromMaybe "" mdate2) mdateformat) Just . mparsedate) mdate2
dateerror datefield value mdateformat = unlines
["error: could not parse \""++value++"\" as a date using date format "++maybe "\"YYYY/M/D\", \"YYYY-M-D\" or \"YYYY.M.D\"" show mdateformat
,"the CSV record is: "++intercalate ", " (map show record)
,"the "++datefield++" rule is: "++(fromMaybe "required, but missing" $ mfieldtemplate datefield)
,"the date-format is: "++fromMaybe "unspecified" mdateformat
,"you may need to "
++"change your "++datefield++" rule, "
++maybe "add a" (const "change your") mdateformat++" date-format rule, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
,"for m/d/y or d/m/y dates, use date-format %-m/%-d/%Y or date-format %-d/%-m/%Y"
]
status =
case mfieldtemplate "status" of
Nothing -> Unmarked
Just str -> either statuserror id .
runParser (statusp <* eof) "" .
T.pack $ render str
where
statuserror err = error' $ unlines
["error: could not parse \""++str++"\" as a cleared status (should be *, ! or empty)"
,"the parse error is: "++show err
]
code = maybe "" render $ mfieldtemplate "code"
description = maybe "" render $ mfieldtemplate "description"
comment = maybe "" render $ mfieldtemplate "comment"
precomment = maybe "" render $ mfieldtemplate "precomment"
currency = maybe (fromMaybe "" mdefaultcurrency) render $ mfieldtemplate "currency"
amountstr = (currency++) $ simplifySign $ getAmountStr rules record
amount = either amounterror (Mixed . (:[])) $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack amountstr
amounterror err = error' $ unlines
["error: could not parse \""++amountstr++"\" as an amount"
,showRecord record
,"the amount rule is: "++(fromMaybe "" $ mfieldtemplate "amount")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
,"you may need to "
++"change your amount or currency rules, "
++"or "++maybe "add a" (const "change your") mskip++" skip rule"
]
-- Using costOfMixedAmount here to allow complex costs like "10 GBP @@ 15 USD".
-- Aim is to have "10 GBP @@ 15 USD" applied to account2, but have "-15USD" applied to account1
amount1 = costOfMixedAmount amount
amount2 = (-amount)
s `or` def = if null s then def else s
defaccount1 = fromMaybe "unknown" $ mdirective "default-account1"
defaccount2 = case isNegativeMixedAmount amount2 of
Just True -> "income:unknown"
_ -> "expenses:unknown"
account1 = T.pack $ maybe "" render (mfieldtemplate "account1") `or` defaccount1
account2 = T.pack $ maybe "" render (mfieldtemplate "account2") `or` defaccount2
balance = maybe Nothing (parsebalance.render) $ mfieldtemplate "balance"
parsebalance str
| all isSpace str = Nothing
| otherwise = Just $ either (balanceerror str) id $ runParser (evalStateT (amountp <* eof) mempty) "" $ T.pack $ (currency++) $ simplifySign str
balanceerror str err = error' $ unlines
["error: could not parse \""++str++"\" as balance amount"
,showRecord record
,"the balance rule is: "++(fromMaybe "" $ mfieldtemplate "balance")
,"the currency rule is: "++(fromMaybe "unspecified" $ mfieldtemplate "currency")
,"the default-currency is: "++fromMaybe "unspecified" mdefaultcurrency
,"the parse error is: "++show err
]
-- build the transaction
t = nulltransaction{
tsourcepos = genericSourcePos sourcepos,
tdate = date',
tdate2 = mdate2',
tstatus = status,
tcode = T.pack code,
tdescription = T.pack description,
tcomment = T.pack comment,
tpreceding_comment_lines = T.pack precomment,
tpostings =
[posting {paccount=account2, pamount=amount2, ptransaction=Just t}
,posting {paccount=account1, pamount=amount1, ptransaction=Just t, pbalanceassertion=balance}
]
} | 5,348 | true | true | 45 | 14 | 1,522 | 1,383 | 660 | 723 | null | null |
DestructHub/ProjectEuler | Problem029/Haskell/solution_1.hs | mit | main :: IO ()
main = print . length $ f list
where f = map head . group . sort | 87 | main :: IO ()
main = print . length $ f list
where f = map head . group . sort | 87 | main = print . length $ f list
where f = map head . group . sort | 73 | false | true | 0 | 9 | 29 | 45 | 22 | 23 | null | null |
asakamirai/kazura-queue | src/Control/Concurrent/KazuraQueue.hs | bsd-3-clause | lengthQueue :: Queue a -> IO Int
lengthQueue (Queue _ wcounter _ rsvar _) = do
rs <- WVar.readWVar rsvar
wcount <- Atm.readCounter wcounter
rcount <- Atm.readCounter $ rsCounter rs
return $ wcount - rcount
-- | Non-minus version of 'lengthQueue'. | 263 | lengthQueue :: Queue a -> IO Int
lengthQueue (Queue _ wcounter _ rsvar _) = do
rs <- WVar.readWVar rsvar
wcount <- Atm.readCounter wcounter
rcount <- Atm.readCounter $ rsCounter rs
return $ wcount - rcount
-- | Non-minus version of 'lengthQueue'. | 263 | lengthQueue (Queue _ wcounter _ rsvar _) = do
rs <- WVar.readWVar rsvar
wcount <- Atm.readCounter wcounter
rcount <- Atm.readCounter $ rsCounter rs
return $ wcount - rcount
-- | Non-minus version of 'lengthQueue'. | 230 | false | true | 0 | 9 | 57 | 90 | 41 | 49 | null | null |
spire/spire | src/Spire/Canonical/Embedder.hs | bsd-3-clause | embedV VTel = return $ cVar B._Tel | 48 | embedV VTel = return $ cVar B._Tel | 48 | embedV VTel = return $ cVar B._Tel | 48 | false | false | 0 | 7 | 20 | 18 | 8 | 10 | null | null |
sdiehl/ghc | libraries/base/GHC/Err.hs | bsd-3-clause | -- | Used for compiler-generated error message;
-- encoding saves bytes of string junk.
absentErr :: a
absentErr = errorWithoutStackTrace "Oops! The program has entered an `absent' argument!\n" | 193 | absentErr :: a
absentErr = errorWithoutStackTrace "Oops! The program has entered an `absent' argument!\n" | 105 | absentErr = errorWithoutStackTrace "Oops! The program has entered an `absent' argument!\n" | 90 | true | true | 0 | 6 | 27 | 23 | 10 | 13 | null | null |
ralphmorton/simple-couch | src/Database/CouchDB.hs | bsd-3-clause | view :: (MonadReader r m, MonadError e m, HasCouchCfg r, HasHttpCfg r, AsHttpError e, MonadIO m, FromJSON a) => String -> String -> KeySpec -> m [a]
view docName viewName ks = fmap (fmap cliValue) $ view' docName viewName ks | 224 | view :: (MonadReader r m, MonadError e m, HasCouchCfg r, HasHttpCfg r, AsHttpError e, MonadIO m, FromJSON a) => String -> String -> KeySpec -> m [a]
view docName viewName ks = fmap (fmap cliValue) $ view' docName viewName ks | 224 | view docName viewName ks = fmap (fmap cliValue) $ view' docName viewName ks | 75 | false | true | 0 | 11 | 39 | 109 | 53 | 56 | null | null |
muspellsson/hiccup | TclParse.hs | lgpl-2.1 | parseList_ :: Parser [BString]
parseList_ = trimmed listItems
where listItems = listElt `sepBy` whiteSpace | 107 | parseList_ :: Parser [BString]
parseList_ = trimmed listItems
where listItems = listElt `sepBy` whiteSpace | 107 | parseList_ = trimmed listItems
where listItems = listElt `sepBy` whiteSpace | 76 | false | true | 1 | 7 | 14 | 42 | 19 | 23 | null | null |
hvr/jhc | src/Options.hs | mit | -- | Is the \"lint\" option flag set?
flint :: Bool
flint = FO.Lint `S.member` optFOptsSet options | 98 | flint :: Bool
flint = FO.Lint `S.member` optFOptsSet options | 60 | flint = FO.Lint `S.member` optFOptsSet options | 46 | true | true | 0 | 6 | 16 | 34 | 16 | 18 | null | null |
snowleopard/shaking-up-ghc | src/Settings/Default.hs | bsd-3-clause | defaultLibraryWays :: Ways
defaultLibraryWays = mconcat
[ pure [vanilla]
, notStage0 ? pure [profiling]
, notStage0 ? platformSupportsSharedLibs ? pure [dynamic]
] | 179 | defaultLibraryWays :: Ways
defaultLibraryWays = mconcat
[ pure [vanilla]
, notStage0 ? pure [profiling]
, notStage0 ? platformSupportsSharedLibs ? pure [dynamic]
] | 179 | defaultLibraryWays = mconcat
[ pure [vanilla]
, notStage0 ? pure [profiling]
, notStage0 ? platformSupportsSharedLibs ? pure [dynamic]
] | 152 | false | true | 0 | 8 | 37 | 53 | 28 | 25 | null | null |
tdammers/templar | src/Web/Sprinkles/ProjectConfig.hs | bsd-3-clause | pcAppend :: ProjectConfig -> ProjectConfig -> ProjectConfig
pcAppend a b =
ProjectConfig
{ pcContextData = pcContextData a <> pcContextData b
, pcRules = pcRules a <> pcRules b
} | 206 | pcAppend :: ProjectConfig -> ProjectConfig -> ProjectConfig
pcAppend a b =
ProjectConfig
{ pcContextData = pcContextData a <> pcContextData b
, pcRules = pcRules a <> pcRules b
} | 206 | pcAppend a b =
ProjectConfig
{ pcContextData = pcContextData a <> pcContextData b
, pcRules = pcRules a <> pcRules b
} | 146 | false | true | 0 | 9 | 56 | 67 | 31 | 36 | null | null |
kim/amazonka | amazonka-cloudwatch/gen/Network/AWS/CloudWatch/DisableAlarmActions.hs | mpl-2.0 | disableAlarmActions :: DisableAlarmActions
disableAlarmActions = DisableAlarmActions
{ _daaAlarmNames = mempty
} | 120 | disableAlarmActions :: DisableAlarmActions
disableAlarmActions = DisableAlarmActions
{ _daaAlarmNames = mempty
} | 120 | disableAlarmActions = DisableAlarmActions
{ _daaAlarmNames = mempty
} | 77 | false | true | 0 | 6 | 18 | 19 | 11 | 8 | null | null |
beni55/ghcjs | src/Gen2/Prim.hs | mit | genPrim _ _ CharLeOp [r] [x,y] = PrimInline [j| `r` = (`x` <= `y`) ? 1 : 0; |] | 87 | genPrim _ _ CharLeOp [r] [x,y] = PrimInline [j| `r` = (`x` <= `y`) ? 1 : 0; |] | 87 | genPrim _ _ CharLeOp [r] [x,y] = PrimInline [j| `r` = (`x` <= `y`) ? 1 : 0; |] | 87 | false | false | 0 | 6 | 27 | 33 | 19 | 14 | null | null |
ygale/yesod | yesod-core/Yesod/Core/Handler.hs | mit | -- | Deprecated synonym for addHeader.
setHeader :: MonadHandler m => Text -> Text -> m ()
setHeader = addHeader | 112 | setHeader :: MonadHandler m => Text -> Text -> m ()
setHeader = addHeader | 73 | setHeader = addHeader | 21 | true | true | 0 | 10 | 19 | 38 | 17 | 21 | null | null |
tidalcycles/tidal-midi | Sound/Tidal/MIDI/Synthino.hs | gpl-3.0 | (pitchlforate, pitchlforate_p) = pF "pitchlforate" (Just 0) | 59 | (pitchlforate, pitchlforate_p) = pF "pitchlforate" (Just 0) | 59 | (pitchlforate, pitchlforate_p) = pF "pitchlforate" (Just 0) | 59 | false | false | 0 | 7 | 6 | 24 | 12 | 12 | null | null |
frantisekfarka/ghc-dsi | libraries/base/Data/List.hs | bsd-3-clause | isPrefixOf _ [] = False | 32 | isPrefixOf _ [] = False | 32 | isPrefixOf _ [] = False | 32 | false | false | 0 | 6 | 13 | 13 | 6 | 7 | null | null |
adityashah30/haskellchess | chessEngine/Search2.hs | gpl-2.0 | evalBoardStates::[BoardState]->[(Board, Int)]
evalBoardStates [] = [] | 69 | evalBoardStates::[BoardState]->[(Board, Int)]
evalBoardStates [] = [] | 69 | evalBoardStates [] = [] | 23 | false | true | 0 | 7 | 5 | 34 | 19 | 15 | null | null |
aochagavia/CompilerConstruction | tdiagrams/lib/CCO/Diag/Parser.hs | apache-2.0 | -- | Parses an 'Interpreter'.
pInterpreter :: TokenParser Diag_
pInterpreter = Interpreter <$ keyword "interpreter" <*> ident <*
keyword "for" <*> ident <*
keyword "in" <*> ident | 255 | pInterpreter :: TokenParser Diag_
pInterpreter = Interpreter <$ keyword "interpreter" <*> ident <*
keyword "for" <*> ident <*
keyword "in" <*> ident | 225 | pInterpreter = Interpreter <$ keyword "interpreter" <*> ident <*
keyword "for" <*> ident <*
keyword "in" <*> ident | 191 | true | true | 1 | 11 | 103 | 52 | 23 | 29 | null | null |
joeyadams/haskell-iocp | IOCP/PSQ.hs | bsd-3-clause | ldoubleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a
ldoubleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =
lsingleLeft k1 p1 v1 t1 m1 (lsingleRight k2 p2 v2 t2 m2 t3) | 197 | ldoubleLeft :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a
ldoubleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =
lsingleLeft k1 p1 v1 t1 m1 (lsingleRight k2 p2 v2 t2 m2 t3) | 197 | ldoubleLeft k1 p1 v1 t1 m1 (LLoser _ (E k2 p2 v2) t2 m2 t3) =
lsingleLeft k1 p1 v1 t1 m1 (lsingleRight k2 p2 v2 t2 m2 t3) | 125 | false | true | 0 | 11 | 50 | 110 | 53 | 57 | null | null |
Cognimeta/cognimeta-utils | src/Cgm/System/Endian.hs | apache-2.0 | bigEndianIxBytes :: forall w. Prim w => Tagged w [Word8]
bigEndianIxBytes = reverse <$> increasingBytes | 104 | bigEndianIxBytes :: forall w. Prim w => Tagged w [Word8]
bigEndianIxBytes = reverse <$> increasingBytes | 103 | bigEndianIxBytes = reverse <$> increasingBytes | 46 | false | true | 0 | 8 | 15 | 35 | 18 | 17 | null | null |
alexander-at-github/eta | compiler/ETA/Types/TyCon.hs | bsd-3-clause | -- NB. might not take a full word
primRepSizeW dflags DoubleRep = 2 | 71 | primRepSizeW dflags DoubleRep = 2 | 37 | primRepSizeW dflags DoubleRep = 2 | 37 | true | false | 0 | 5 | 16 | 12 | 6 | 6 | null | null |
Hi-Angel/yi | yi-core/src/Yi/Buffer/Misc.hs | gpl-2.0 | -- | Returns the contents of the buffer between the two points.
--
-- If the @startPoint >= endPoint@, empty string is returned. If the
-- points are out of bounds, as much of the content as possible is
-- taken: you're not guaranteed to get @endPoint - startPoint@
-- characters.
betweenB :: Point -- ^ Point to start at
-> Point -- ^ Point to stop at
-> BufferM YiString
betweenB (Point s) (Point e) =
if s >= e
then return (mempty :: YiString)
else snd . R.splitAt s . fst . R.splitAt e <$> elemsB | 524 | betweenB :: Point -- ^ Point to start at
-> Point -- ^ Point to stop at
-> BufferM YiString
betweenB (Point s) (Point e) =
if s >= e
then return (mempty :: YiString)
else snd . R.splitAt s . fst . R.splitAt e <$> elemsB | 243 | betweenB (Point s) (Point e) =
if s >= e
then return (mempty :: YiString)
else snd . R.splitAt s . fst . R.splitAt e <$> elemsB | 133 | true | true | 0 | 11 | 121 | 94 | 51 | 43 | null | null |
rrnewton/accelerate | Data/Array/Accelerate/Smart.hs | bsd-3-clause | showPreAccOp (Use a) = "Use " ++ showArrays a | 57 | showPreAccOp (Use a) = "Use " ++ showArrays a | 57 | showPreAccOp (Use a) = "Use " ++ showArrays a | 57 | false | false | 0 | 7 | 20 | 22 | 10 | 12 | null | null |
aartamonau/repo-bisect | src/Snapshot.hs | gpl-3.0 | saveCmd :: Command Options
saveCmd = defCmd { cmdName = "save"
, cmdHandler = saveHandler
, cmdShortDesc = "save current state of all projects"
, cmdCategory = mainCategory
} | 242 | saveCmd :: Command Options
saveCmd = defCmd { cmdName = "save"
, cmdHandler = saveHandler
, cmdShortDesc = "save current state of all projects"
, cmdCategory = mainCategory
} | 242 | saveCmd = defCmd { cmdName = "save"
, cmdHandler = saveHandler
, cmdShortDesc = "save current state of all projects"
, cmdCategory = mainCategory
} | 215 | false | true | 0 | 6 | 96 | 40 | 24 | 16 | null | null |
petester42/haskell-hockey | src/Hockey/Types.hs | mit | toEventType _ = Unknown | 23 | toEventType _ = Unknown | 23 | toEventType _ = Unknown | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
tibbe/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkUpdInfoLabel = CmmLabel rtsPackageId (fsLit "stg_upd_frame") CmmInfo | 95 | mkUpdInfoLabel = CmmLabel rtsPackageId (fsLit "stg_upd_frame") CmmInfo | 95 | mkUpdInfoLabel = CmmLabel rtsPackageId (fsLit "stg_upd_frame") CmmInfo | 95 | false | false | 0 | 7 | 31 | 19 | 9 | 10 | null | null |
ghcjs/ghcjs | src/Compiler/GhcjsHooks.hs | mit | runGhcjsPhase settings env (HscOut src_flavour mod_name result) _ dflags = do
location <- getLocation src_flavour mod_name
setModLocation location
let o_file = ml_obj_file location -- The real object file
hsc_lang = hscTarget dflags
next_phase = hscPostBackendPhase {-dflags-} src_flavour hsc_lang
case result of
HscNotGeneratingCode _ ->
return (RealPhase next_phase,
panic "No output filename from Hsc when no-code")
HscUpToDate _ ->
do liftIO $ touchObjectFile dflags o_file
-- The .o file must have a later modification date
-- than the source file (else we wouldn't get Nothing)
-- but we touch it anyway, to keep 'make' happy (we think).
return (RealPhase StopLn, o_file)
HscUpdateBoot _ ->
do -- In the case of hs-boot files, generate a dummy .o-boot
-- stamp file for the benefit of Make
liftIO $ touchObjectFile dflags o_file
return (RealPhase next_phase, o_file)
HscUpdateSig _ ->
do -- We need to create a REAL but empty .o file
-- because we are going to attempt to put it in a library
{-
PipeState{hsc_env=hsc_env'} <- getPipeState
let input_fn = expectJust "runPhase" (ml_hs_file location)
basename = dropExtension input_fn
-}
-- fixme do we need to create a js_o file here?
-- liftIO $ compileEmptyStub dflags hsc_env' basename location
return (RealPhase next_phase, o_file)
HscRecomp { hscs_guts = cgguts,
hscs_mod_location = mod_location,
hscs_partial_iface = partial_iface,
hscs_old_iface_hash = mb_old_iface_hash,
hscs_iface_dflags = iface_dflags }
-> do output_fn <- phaseOutputFilename next_phase
PipeState{hsc_env=hsc_env'} <- getPipeState
outputFilename <- liftIO $
ghcjsWriteModule settings env
hsc_env' cgguts (mi_module partial_iface) mod_location output_fn
final_iface <- liftIO (mkFullIface hsc_env'{hsc_dflags=iface_dflags} partial_iface)
setIface final_iface
-- See Note [Writing interface files]
let if_dflags = dflags `gopt_unset` Opt_BuildDynamicToo
liftIO $ hscMaybeWriteIface if_dflags final_iface mb_old_iface_hash mod_location
{-
stub_o <- liftIO (mapM (compileStub hsc_env') mStub)
foreign_os <- liftIO $
mapM (uncurry (compileForeign hsc_env')) foreign_files
setForeignOs (maybe [] return stub_o ++ foreign_os)
-}
return (RealPhase next_phase, outputFilename)
-- skip these, but copy the result | 3,214 | runGhcjsPhase settings env (HscOut src_flavour mod_name result) _ dflags = do
location <- getLocation src_flavour mod_name
setModLocation location
let o_file = ml_obj_file location -- The real object file
hsc_lang = hscTarget dflags
next_phase = hscPostBackendPhase {-dflags-} src_flavour hsc_lang
case result of
HscNotGeneratingCode _ ->
return (RealPhase next_phase,
panic "No output filename from Hsc when no-code")
HscUpToDate _ ->
do liftIO $ touchObjectFile dflags o_file
-- The .o file must have a later modification date
-- than the source file (else we wouldn't get Nothing)
-- but we touch it anyway, to keep 'make' happy (we think).
return (RealPhase StopLn, o_file)
HscUpdateBoot _ ->
do -- In the case of hs-boot files, generate a dummy .o-boot
-- stamp file for the benefit of Make
liftIO $ touchObjectFile dflags o_file
return (RealPhase next_phase, o_file)
HscUpdateSig _ ->
do -- We need to create a REAL but empty .o file
-- because we are going to attempt to put it in a library
{-
PipeState{hsc_env=hsc_env'} <- getPipeState
let input_fn = expectJust "runPhase" (ml_hs_file location)
basename = dropExtension input_fn
-}
-- fixme do we need to create a js_o file here?
-- liftIO $ compileEmptyStub dflags hsc_env' basename location
return (RealPhase next_phase, o_file)
HscRecomp { hscs_guts = cgguts,
hscs_mod_location = mod_location,
hscs_partial_iface = partial_iface,
hscs_old_iface_hash = mb_old_iface_hash,
hscs_iface_dflags = iface_dflags }
-> do output_fn <- phaseOutputFilename next_phase
PipeState{hsc_env=hsc_env'} <- getPipeState
outputFilename <- liftIO $
ghcjsWriteModule settings env
hsc_env' cgguts (mi_module partial_iface) mod_location output_fn
final_iface <- liftIO (mkFullIface hsc_env'{hsc_dflags=iface_dflags} partial_iface)
setIface final_iface
-- See Note [Writing interface files]
let if_dflags = dflags `gopt_unset` Opt_BuildDynamicToo
liftIO $ hscMaybeWriteIface if_dflags final_iface mb_old_iface_hash mod_location
{-
stub_o <- liftIO (mapM (compileStub hsc_env') mStub)
foreign_os <- liftIO $
mapM (uncurry (compileForeign hsc_env')) foreign_files
setForeignOs (maybe [] return stub_o ++ foreign_os)
-}
return (RealPhase next_phase, outputFilename)
-- skip these, but copy the result | 3,214 | runGhcjsPhase settings env (HscOut src_flavour mod_name result) _ dflags = do
location <- getLocation src_flavour mod_name
setModLocation location
let o_file = ml_obj_file location -- The real object file
hsc_lang = hscTarget dflags
next_phase = hscPostBackendPhase {-dflags-} src_flavour hsc_lang
case result of
HscNotGeneratingCode _ ->
return (RealPhase next_phase,
panic "No output filename from Hsc when no-code")
HscUpToDate _ ->
do liftIO $ touchObjectFile dflags o_file
-- The .o file must have a later modification date
-- than the source file (else we wouldn't get Nothing)
-- but we touch it anyway, to keep 'make' happy (we think).
return (RealPhase StopLn, o_file)
HscUpdateBoot _ ->
do -- In the case of hs-boot files, generate a dummy .o-boot
-- stamp file for the benefit of Make
liftIO $ touchObjectFile dflags o_file
return (RealPhase next_phase, o_file)
HscUpdateSig _ ->
do -- We need to create a REAL but empty .o file
-- because we are going to attempt to put it in a library
{-
PipeState{hsc_env=hsc_env'} <- getPipeState
let input_fn = expectJust "runPhase" (ml_hs_file location)
basename = dropExtension input_fn
-}
-- fixme do we need to create a js_o file here?
-- liftIO $ compileEmptyStub dflags hsc_env' basename location
return (RealPhase next_phase, o_file)
HscRecomp { hscs_guts = cgguts,
hscs_mod_location = mod_location,
hscs_partial_iface = partial_iface,
hscs_old_iface_hash = mb_old_iface_hash,
hscs_iface_dflags = iface_dflags }
-> do output_fn <- phaseOutputFilename next_phase
PipeState{hsc_env=hsc_env'} <- getPipeState
outputFilename <- liftIO $
ghcjsWriteModule settings env
hsc_env' cgguts (mi_module partial_iface) mod_location output_fn
final_iface <- liftIO (mkFullIface hsc_env'{hsc_dflags=iface_dflags} partial_iface)
setIface final_iface
-- See Note [Writing interface files]
let if_dflags = dflags `gopt_unset` Opt_BuildDynamicToo
liftIO $ hscMaybeWriteIface if_dflags final_iface mb_old_iface_hash mod_location
{-
stub_o <- liftIO (mapM (compileStub hsc_env') mStub)
foreign_os <- liftIO $
mapM (uncurry (compileForeign hsc_env')) foreign_files
setForeignOs (maybe [] return stub_o ++ foreign_os)
-}
return (RealPhase next_phase, outputFilename)
-- skip these, but copy the result | 3,214 | false | false | 0 | 17 | 1,282 | 392 | 194 | 198 | null | null |
wxwxwwxxx/ghc | compiler/utils/Outputable.hs | bsd-3-clause | showPpr :: Outputable a => DynFlags -> a -> String
showPpr dflags thing = showSDoc dflags (ppr thing) | 101 | showPpr :: Outputable a => DynFlags -> a -> String
showPpr dflags thing = showSDoc dflags (ppr thing) | 101 | showPpr dflags thing = showSDoc dflags (ppr thing) | 50 | false | true | 0 | 9 | 17 | 47 | 21 | 26 | null | null |
wjzz/GoStat | test/Data/SGF/Parsing/Tests.hs | bsd-3-clause | inBounds :: Int -> Bool
inBounds n = 1 <= n && n <= 9 | 53 | inBounds :: Int -> Bool
inBounds n = 1 <= n && n <= 9 | 53 | inBounds n = 1 <= n && n <= 9 | 29 | false | true | 0 | 7 | 14 | 30 | 15 | 15 | null | null |
LeifW/yaml2owl | src/SchemaScaffold.hs | lgpl-2.1 | --classNames g = [ getScopeLocal sn | Res sn <- classesOf g ]
classInfos :: NSGraph RDFLabel -> [Subject]
classInfos g = map classInfo $ classesOf g
where
classInfo klass = Subject (getScopedName klass) dataProps' objectProps'
where
props = rdfFindValSubj resRdfsDomain klass g
graphDataProps = rdfFindValSubj resRdfType (Res owlDatatypeProperty) g
(dataProperties, objectProperties) = partition (\p-> elem p graphDataProps) props
dataProps' = [ (show p, (unpack . getLName . localName) p, show $ head $ rdfFindPredVal p resRdfsRange g) | p <- dataProperties ]
objectProps' = [ (show p, (unpack . getLName . localName) p) | p <- objectProperties ] | 701 | classInfos :: NSGraph RDFLabel -> [Subject]
classInfos g = map classInfo $ classesOf g
where
classInfo klass = Subject (getScopedName klass) dataProps' objectProps'
where
props = rdfFindValSubj resRdfsDomain klass g
graphDataProps = rdfFindValSubj resRdfType (Res owlDatatypeProperty) g
(dataProperties, objectProperties) = partition (\p-> elem p graphDataProps) props
dataProps' = [ (show p, (unpack . getLName . localName) p, show $ head $ rdfFindPredVal p resRdfsRange g) | p <- dataProperties ]
objectProps' = [ (show p, (unpack . getLName . localName) p) | p <- objectProperties ] | 638 | classInfos g = map classInfo $ classesOf g
where
classInfo klass = Subject (getScopedName klass) dataProps' objectProps'
where
props = rdfFindValSubj resRdfsDomain klass g
graphDataProps = rdfFindValSubj resRdfType (Res owlDatatypeProperty) g
(dataProperties, objectProperties) = partition (\p-> elem p graphDataProps) props
dataProps' = [ (show p, (unpack . getLName . localName) p, show $ head $ rdfFindPredVal p resRdfsRange g) | p <- dataProperties ]
objectProps' = [ (show p, (unpack . getLName . localName) p) | p <- objectProperties ] | 594 | true | true | 0 | 12 | 152 | 216 | 111 | 105 | null | null |
flaviusb/moss-submitter-webapp | src/Settings.hs | mit | -- | How static files should be combined.
combineSettings :: CombineSettings
combineSettings = def | 98 | combineSettings :: CombineSettings
combineSettings = def | 56 | combineSettings = def | 21 | true | true | 0 | 4 | 13 | 12 | 7 | 5 | null | null |
bgold-cosmos/Tidal | src/Sound/Tidal/Params.hs | gpl-3.0 | -- | a pattern of numbers between -1.0 and 1.0, which controls the relative position of the centre pan in a pair of adjacent speakers (multichannel only)
panorient :: Pattern Double -> ControlPattern
panorient = pF "panorient" | 226 | panorient :: Pattern Double -> ControlPattern
panorient = pF "panorient" | 72 | panorient = pF "panorient" | 26 | true | true | 0 | 7 | 36 | 29 | 12 | 17 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/CampaignCreativeAssociations/List.hs | mpl-2.0 | -- | Maximum number of results to return.
ccalMaxResults :: Lens' CampaignCreativeAssociationsList (Maybe Int32)
ccalMaxResults
= lens _ccalMaxResults
(\ s a -> s{_ccalMaxResults = a})
. mapping _Coerce | 216 | ccalMaxResults :: Lens' CampaignCreativeAssociationsList (Maybe Int32)
ccalMaxResults
= lens _ccalMaxResults
(\ s a -> s{_ccalMaxResults = a})
. mapping _Coerce | 174 | ccalMaxResults
= lens _ccalMaxResults
(\ s a -> s{_ccalMaxResults = a})
. mapping _Coerce | 103 | true | true | 0 | 10 | 41 | 55 | 28 | 27 | null | null |
mcmaniac/mstate | src/Control/Concurrent/MState.hs | bsd-3-clause | -- | Map a stateful computation from one @(return value, state)@ pair to
-- another. See "Control.Monad.State.Lazy" for more information. Be aware that
-- both MStates still share the same state.
mapMState :: (MonadIO m, MonadIO n)
=> (m (a,t) -> n (b,t))
-> MState t m a
-> MState t n b
mapMState f m = MState $ \s@(r,_) -> do
~(b,v') <- f $ do
a <- runMState' m s
v <- liftIO $ readTVarIO r
return (a,v)
liftIO . atomically $ writeTVar r v'
return b | 517 | mapMState :: (MonadIO m, MonadIO n)
=> (m (a,t) -> n (b,t))
-> MState t m a
-> MState t n b
mapMState f m = MState $ \s@(r,_) -> do
~(b,v') <- f $ do
a <- runMState' m s
v <- liftIO $ readTVarIO r
return (a,v)
liftIO . atomically $ writeTVar r v'
return b | 321 | mapMState f m = MState $ \s@(r,_) -> do
~(b,v') <- f $ do
a <- runMState' m s
v <- liftIO $ readTVarIO r
return (a,v)
liftIO . atomically $ writeTVar r v'
return b | 199 | true | true | 0 | 15 | 154 | 177 | 89 | 88 | null | null |
satai/FrozenBeagle | Simulation/Lib/src/SimulationConstants.hs | bsd-3-clause | optimumChangeSizeCoefficient :: Double
optimumChangeSizeCoefficient = 12.0 | 74 | optimumChangeSizeCoefficient :: Double
optimumChangeSizeCoefficient = 12.0 | 74 | optimumChangeSizeCoefficient = 12.0 | 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
mtesseract/silverratio-jeopardy | src/jeopardy-editor.hs | gpl-2.0 | retrieveFlag :: Builder -> String -> String -> IO Bool
retrieveFlag builder name identifier = do
let widgetName = "flag_" ++ name ++ "_" ++ identifier
button <- builderGetObject builder castToToggleButton widgetName
toggleButtonGetActive button | 250 | retrieveFlag :: Builder -> String -> String -> IO Bool
retrieveFlag builder name identifier = do
let widgetName = "flag_" ++ name ++ "_" ++ identifier
button <- builderGetObject builder castToToggleButton widgetName
toggleButtonGetActive button | 250 | retrieveFlag builder name identifier = do
let widgetName = "flag_" ++ name ++ "_" ++ identifier
button <- builderGetObject builder castToToggleButton widgetName
toggleButtonGetActive button | 195 | false | true | 1 | 12 | 39 | 74 | 34 | 40 | null | null |
brendanhay/gogol | gogol-chat/gen/Network/Google/Chat/Types/Product.hs | mpl-2.0 | -- | Indicating whether the slash command is for a dialog.
scmTriggersDialog :: Lens' SlashCommandMetadata (Maybe Bool)
scmTriggersDialog
= lens _scmTriggersDialog
(\ s a -> s{_scmTriggersDialog = a}) | 208 | scmTriggersDialog :: Lens' SlashCommandMetadata (Maybe Bool)
scmTriggersDialog
= lens _scmTriggersDialog
(\ s a -> s{_scmTriggersDialog = a}) | 149 | scmTriggersDialog
= lens _scmTriggersDialog
(\ s a -> s{_scmTriggersDialog = a}) | 88 | true | true | 1 | 9 | 35 | 51 | 25 | 26 | null | null |
bitemyapp/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | -----
mkCmmInfoLabel, mkCmmEntryLabel, mkCmmRetInfoLabel, mkCmmRetLabel,
mkCmmCodeLabel, mkCmmDataLabel, mkCmmClosureLabel
:: PackageKey -> FastString -> CLabel
mkCmmInfoLabel pkg str = CmmLabel pkg str CmmInfo | 233 | mkCmmInfoLabel, mkCmmEntryLabel, mkCmmRetInfoLabel, mkCmmRetLabel,
mkCmmCodeLabel, mkCmmDataLabel, mkCmmClosureLabel
:: PackageKey -> FastString -> CLabel
mkCmmInfoLabel pkg str = CmmLabel pkg str CmmInfo | 226 | mkCmmInfoLabel pkg str = CmmLabel pkg str CmmInfo | 58 | true | true | 0 | 6 | 44 | 44 | 28 | 16 | null | null |
mboes/hs-asn1 | encoding/Data/ASN1/Serialize.hs | bsd-3-clause | putLength :: ASN1Length -> [Word8]
putLength (LenShort i)
| i < 0 || i > 0x7f = error "putLength: short length is not between 0x0 and 0x80"
| otherwise = [fromIntegral i] | 186 | putLength :: ASN1Length -> [Word8]
putLength (LenShort i)
| i < 0 || i > 0x7f = error "putLength: short length is not between 0x0 and 0x80"
| otherwise = [fromIntegral i] | 186 | putLength (LenShort i)
| i < 0 || i > 0x7f = error "putLength: short length is not between 0x0 and 0x80"
| otherwise = [fromIntegral i] | 151 | false | true | 1 | 10 | 47 | 66 | 31 | 35 | null | null |
joachifm/hsmtp | src/MTP.hs | lgpl-2.1 | sendFile :: MTPHandle -> FilePath -> IO ()
sendFile h n =
withMTPHandle h $ \devptr ->
withCAString n $ \str_ptr -> do
r <- c_send_file_from_file devptr str_ptr nullPtr nullPtr
unless (r == 0) (checkError h)
-- | Get a file from the device to a file handle. | 282 | sendFile :: MTPHandle -> FilePath -> IO ()
sendFile h n =
withMTPHandle h $ \devptr ->
withCAString n $ \str_ptr -> do
r <- c_send_file_from_file devptr str_ptr nullPtr nullPtr
unless (r == 0) (checkError h)
-- | Get a file from the device to a file handle. | 282 | sendFile h n =
withMTPHandle h $ \devptr ->
withCAString n $ \str_ptr -> do
r <- c_send_file_from_file devptr str_ptr nullPtr nullPtr
unless (r == 0) (checkError h)
-- | Get a file from the device to a file handle. | 239 | false | true | 0 | 12 | 72 | 96 | 45 | 51 | null | null |
siddhanathan/ghc | compiler/basicTypes/RdrName.hs | bsd-3-clause | insertGRE new_g (old_g : old_gs)
| gre_name new_g == gre_name old_g
= new_g `plusGRE` old_g : old_gs
| otherwise
= old_g : insertGRE new_g old_gs | 177 | insertGRE new_g (old_g : old_gs)
| gre_name new_g == gre_name old_g
= new_g `plusGRE` old_g : old_gs
| otherwise
= old_g : insertGRE new_g old_gs | 177 | insertGRE new_g (old_g : old_gs)
| gre_name new_g == gre_name old_g
= new_g `plusGRE` old_g : old_gs
| otherwise
= old_g : insertGRE new_g old_gs | 177 | false | false | 2 | 9 | 56 | 71 | 30 | 41 | null | null |
saep/neil | src/Paper/Haskell.hs | bsd-3-clause | checkRange (x:xs) i = inRange x i || checkRange xs i | 52 | checkRange (x:xs) i = inRange x i || checkRange xs i | 52 | checkRange (x:xs) i = inRange x i || checkRange xs i | 52 | false | false | 1 | 6 | 10 | 36 | 15 | 21 | null | null |
olsner/ghc | compiler/typecheck/TcDerivUtils.hs | bsd-3-clause | cond_enumOrProduct :: Class -> Condition
cond_enumOrProduct cls = cond_isEnumeration `orCond`
(cond_isProduct `andCond` cond_args cls) | 159 | cond_enumOrProduct :: Class -> Condition
cond_enumOrProduct cls = cond_isEnumeration `orCond`
(cond_isProduct `andCond` cond_args cls) | 159 | cond_enumOrProduct cls = cond_isEnumeration `orCond`
(cond_isProduct `andCond` cond_args cls) | 118 | false | true | 0 | 8 | 38 | 36 | 20 | 16 | null | null |
thiagoarrais/gtk2hs | demo/cairo/CairoGhci.hs | lgpl-2.1 | drawStr :: String -> Render ()
drawStr txt = do
lay <- createLayout txt
showLayout lay | 90 | drawStr :: String -> Render ()
drawStr txt = do
lay <- createLayout txt
showLayout lay | 90 | drawStr txt = do
lay <- createLayout txt
showLayout lay | 59 | false | true | 0 | 9 | 19 | 44 | 18 | 26 | null | null |
rueshyna/gogol | gogol-admin-directory/gen/Network/Google/Resource/Directory/MobileDevices/List.hs | mpl-2.0 | -- | Immutable id of the Google Apps account
mdlCustomerId :: Lens' MobileDevicesList Text
mdlCustomerId
= lens _mdlCustomerId
(\ s a -> s{_mdlCustomerId = a}) | 167 | mdlCustomerId :: Lens' MobileDevicesList Text
mdlCustomerId
= lens _mdlCustomerId
(\ s a -> s{_mdlCustomerId = a}) | 122 | mdlCustomerId
= lens _mdlCustomerId
(\ s a -> s{_mdlCustomerId = a}) | 76 | true | true | 1 | 9 | 32 | 45 | 22 | 23 | null | null |
tomberek/rulestesting | src/Control/Arrow/CCA/Rules.hs | bsd-3-clause | cca_ruleset_arr _ = nothing | 27 | cca_ruleset_arr _ = nothing | 27 | cca_ruleset_arr _ = nothing | 27 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dylanmc/cryptol | sbv/Data/SBV/BitVectors/PrettyNum.hs | bsd-3-clause | showCFloat :: Float -> String
showCFloat f
| isNaN f = "((float) NAN)"
| isInfinite f, f < 0 = "((float) (-INFINITY))"
| isInfinite f = "((float) INFINITY)"
| True = show f ++ "F" | 225 | showCFloat :: Float -> String
showCFloat f
| isNaN f = "((float) NAN)"
| isInfinite f, f < 0 = "((float) (-INFINITY))"
| isInfinite f = "((float) INFINITY)"
| True = show f ++ "F" | 225 | showCFloat f
| isNaN f = "((float) NAN)"
| isInfinite f, f < 0 = "((float) (-INFINITY))"
| isInfinite f = "((float) INFINITY)"
| True = show f ++ "F" | 195 | false | true | 2 | 8 | 80 | 80 | 35 | 45 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 3583 = 3582 | 11 | 3583 = 3582 | 11 | 3583 = 3582 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
tanakh/tanakh.jp | tools/copipe-gen-gen.hs | bsd-3-clause | generator cg = do
let genName = uriDecode (title cg) <> "ジェネレータ"
ptmpl = parse $ uriDecode $ template cg
select (T.pack "#tool-title") >>= setText genName >>= setAttr "style" "display:block"
getElementById "template-ctrls" >>= genTemplate ptmpl
when (author cg /= "") $
getElementById "presented-by" >>= \pby -> do
pre <- createTextNode "by @"
appendChild pre pby
a <- createElement "a"
setId a "author-id"
appendChild a pby
select (T.pack "#author-id")
>>= setText (author cg)
>>= setProp "href" ("https://twitter.com/" <> author cg)
select (T.pack "#use-tmpl") >>= setAttr "style" "display:block"
setTitle genName
select (T.pack "#outputText")
>>= onChange (updateCount "#outputText" id)
>>= keyup (const $ updateCount "#outputText" id)
update ptmpl
onClick' "#tweet" $ select (T.pack "#outputText") >>= getVal >>= tweet
onClick' "#ret" $ location selfUrl
return () | 994 | generator cg = do
let genName = uriDecode (title cg) <> "ジェネレータ"
ptmpl = parse $ uriDecode $ template cg
select (T.pack "#tool-title") >>= setText genName >>= setAttr "style" "display:block"
getElementById "template-ctrls" >>= genTemplate ptmpl
when (author cg /= "") $
getElementById "presented-by" >>= \pby -> do
pre <- createTextNode "by @"
appendChild pre pby
a <- createElement "a"
setId a "author-id"
appendChild a pby
select (T.pack "#author-id")
>>= setText (author cg)
>>= setProp "href" ("https://twitter.com/" <> author cg)
select (T.pack "#use-tmpl") >>= setAttr "style" "display:block"
setTitle genName
select (T.pack "#outputText")
>>= onChange (updateCount "#outputText" id)
>>= keyup (const $ updateCount "#outputText" id)
update ptmpl
onClick' "#tweet" $ select (T.pack "#outputText") >>= getVal >>= tweet
onClick' "#ret" $ location selfUrl
return () | 994 | generator cg = do
let genName = uriDecode (title cg) <> "ジェネレータ"
ptmpl = parse $ uriDecode $ template cg
select (T.pack "#tool-title") >>= setText genName >>= setAttr "style" "display:block"
getElementById "template-ctrls" >>= genTemplate ptmpl
when (author cg /= "") $
getElementById "presented-by" >>= \pby -> do
pre <- createTextNode "by @"
appendChild pre pby
a <- createElement "a"
setId a "author-id"
appendChild a pby
select (T.pack "#author-id")
>>= setText (author cg)
>>= setProp "href" ("https://twitter.com/" <> author cg)
select (T.pack "#use-tmpl") >>= setAttr "style" "display:block"
setTitle genName
select (T.pack "#outputText")
>>= onChange (updateCount "#outputText" id)
>>= keyup (const $ updateCount "#outputText" id)
update ptmpl
onClick' "#tweet" $ select (T.pack "#outputText") >>= getVal >>= tweet
onClick' "#ret" $ location selfUrl
return () | 994 | false | false | 1 | 17 | 248 | 349 | 150 | 199 | null | null |
ocramz/slepc-hs | src/Numerical/SLEPc/Raw/PutGet.hs | lgpl-3.0 | petscMatrixMat (PetscMatrix (MIVarNZPR _ _ ) m) = m | 51 | petscMatrixMat (PetscMatrix (MIVarNZPR _ _ ) m) = m | 51 | petscMatrixMat (PetscMatrix (MIVarNZPR _ _ ) m) = m | 51 | false | false | 0 | 9 | 8 | 25 | 12 | 13 | null | null |
joprice/snippets | haskell/basics.hs | unlicense | -- IO
yell = forever $ do
l <- getLine
putStrLn $ map toUpper l | 69 | yell = forever $ do
l <- getLine
putStrLn $ map toUpper l | 62 | yell = forever $ do
l <- getLine
putStrLn $ map toUpper l | 62 | true | false | 3 | 9 | 20 | 35 | 14 | 21 | null | null |
karun012/projecteuler-haskell | src/LargestProductInASeries.hs | unlicense | main :: IO ()
main = do
let ints = stringToListOfInts num
let p = products 13 ints
putStrLn (show $ maximum p) | 128 | main :: IO ()
main = do
let ints = stringToListOfInts num
let p = products 13 ints
putStrLn (show $ maximum p) | 128 | main = do
let ints = stringToListOfInts num
let p = products 13 ints
putStrLn (show $ maximum p) | 114 | false | true | 1 | 11 | 40 | 62 | 26 | 36 | null | null |
ml9951/ghc | compiler/main/DynFlags.hs | bsd-3-clause | setHcSuf f d = d{ hcSuf = f} | 42 | setHcSuf f d = d{ hcSuf = f} | 42 | setHcSuf f d = d{ hcSuf = f} | 42 | false | false | 0 | 6 | 21 | 19 | 10 | 9 | null | null |
kmels/hledger | hledger-lib/Hledger/Utils.hs | gpl-3.0 | underline :: String -> String
underline s = s' ++ replicate (length s) '-' ++ "\n"
where s'
| last s == '\n' = s
| otherwise = s ++ "\n"
-- | Wrap a string in double quotes, and \-prefix any embedded single
-- quotes, if it contains whitespace and is not already single- or
-- double-quoted. | 320 | underline :: String -> String
underline s = s' ++ replicate (length s) '-' ++ "\n"
where s'
| last s == '\n' = s
| otherwise = s ++ "\n"
-- | Wrap a string in double quotes, and \-prefix any embedded single
-- quotes, if it contains whitespace and is not already single- or
-- double-quoted. | 320 | underline s = s' ++ replicate (length s) '-' ++ "\n"
where s'
| last s == '\n' = s
| otherwise = s ++ "\n"
-- | Wrap a string in double quotes, and \-prefix any embedded single
-- quotes, if it contains whitespace and is not already single- or
-- double-quoted. | 290 | false | true | 3 | 9 | 86 | 82 | 38 | 44 | null | null |
michalkonecny/aern2 | aern2-erc/src/ERC/Monad.hs | bsd-3-clause | getPrecisionERC :: ERC s Precision
getPrecisionERC = lift $ fst <$> get | 71 | getPrecisionERC :: ERC s Precision
getPrecisionERC = lift $ fst <$> get | 71 | getPrecisionERC = lift $ fst <$> get | 36 | false | true | 0 | 6 | 11 | 24 | 12 | 12 | null | null |
hvr/containers | Data/IntMap/Base.hs | bsd-3-clause | -- | The union of a list of maps, with a combining operation.
--
-- > unionsWith (++) [(fromList [(5, "a"), (3, "b")]), (fromList [(5, "A"), (7, "C")]), (fromList [(5, "A3"), (3, "B3")])]
-- > == fromList [(3, "bB3"), (5, "aAA3"), (7, "C")]
unionsWith :: (a->a->a) -> [IntMap a] -> IntMap a
unionsWith f ts
= foldlStrict (unionWith f) empty ts | 350 | unionsWith :: (a->a->a) -> [IntMap a] -> IntMap a
unionsWith f ts
= foldlStrict (unionWith f) empty ts | 104 | unionsWith f ts
= foldlStrict (unionWith f) empty ts | 54 | true | true | 0 | 8 | 67 | 61 | 32 | 29 | null | null |
ptitfred/slidecoding | demo/app/Main.hs | gpl-3.0 | main :: IO ()
main = putStrLn "Bye" | 35 | main :: IO ()
main = putStrLn "Bye" | 35 | main = putStrLn "Bye" | 21 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
agrafix/funblog | src/Web/Forms/Post.hs | apache-2.0 | postForm :: Monad m => UTCTime -> Form Html m Post
postForm now =
Post <$> "title" .: text Nothing
<*> "date" .: stringRead "Couldn't parse as UTCTime" (Just now)
<*> "content" .: text Nothing | 214 | postForm :: Monad m => UTCTime -> Form Html m Post
postForm now =
Post <$> "title" .: text Nothing
<*> "date" .: stringRead "Couldn't parse as UTCTime" (Just now)
<*> "content" .: text Nothing | 214 | postForm now =
Post <$> "title" .: text Nothing
<*> "date" .: stringRead "Couldn't parse as UTCTime" (Just now)
<*> "content" .: text Nothing | 163 | false | true | 0 | 10 | 56 | 73 | 34 | 39 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.