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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
agocorona/MFlow | src/MFlow/Wai.hs | bsd-3-clause | statCookieName= "stat" | 22 | statCookieName= "stat" | 22 | statCookieName= "stat" | 22 | false | false | 1 | 5 | 1 | 11 | 3 | 8 | null | null |
grnet/snf-ganeti | src/Ganeti/HTools/Node.hs | bsd-2-clause | calcNewFreeSpindlesForth act n@(Node {exclStorage = True}) i =
case Instance.getTotalSpindles i of
Nothing -> if act
then -1 -- Force a spindle error, so the instance don't go here
else fSpindlesForth n -- No change, as we aren't sure
Just s -> (if act then (-) else (+)) (fSpindlesForth n) s | 332 | calcNewFreeSpindlesForth act n@(Node {exclStorage = True}) i =
case Instance.getTotalSpindles i of
Nothing -> if act
then -1 -- Force a spindle error, so the instance don't go here
else fSpindlesForth n -- No change, as we aren't sure
Just s -> (if act then (-) else (+)) (fSpindlesForth n) s | 332 | calcNewFreeSpindlesForth act n@(Node {exclStorage = True}) i =
case Instance.getTotalSpindles i of
Nothing -> if act
then -1 -- Force a spindle error, so the instance don't go here
else fSpindlesForth n -- No change, as we aren't sure
Just s -> (if act then (-) else (+)) (fSpindlesForth n) s | 332 | false | false | 3 | 10 | 90 | 95 | 50 | 45 | null | null |
jimenezrick/termplot | Main.hs | mit | nonInteractivePlot :: Bool -> IO ()
nonInteractivePlot useLog = do
series <- map (map toPosNum . concatMap (splitOn ",") . splitOn " ") . lines <$> getContents
if all ((== 1) . length) series
then putStrLn $ getBars' $ concat series
else mapM_ (putStrLn . getBars') series
where getBars' | useLog = getBars . logScale
| otherwise = getBars | 385 | nonInteractivePlot :: Bool -> IO ()
nonInteractivePlot useLog = do
series <- map (map toPosNum . concatMap (splitOn ",") . splitOn " ") . lines <$> getContents
if all ((== 1) . length) series
then putStrLn $ getBars' $ concat series
else mapM_ (putStrLn . getBars') series
where getBars' | useLog = getBars . logScale
| otherwise = getBars | 385 | nonInteractivePlot useLog = do
series <- map (map toPosNum . concatMap (splitOn ",") . splitOn " ") . lines <$> getContents
if all ((== 1) . length) series
then putStrLn $ getBars' $ concat series
else mapM_ (putStrLn . getBars') series
where getBars' | useLog = getBars . logScale
| otherwise = getBars | 349 | false | true | 2 | 16 | 104 | 145 | 70 | 75 | null | null |
abbradar/aeson | Data/Aeson/TH.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Parsing errors
--------------------------------------------------------------------------------
matchFailed :: Name -> Name -> String -> MatchQ
matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 496 | matchFailed :: Name -> Name -> String -> MatchQ
matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 315 | matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 267 | true | true | 0 | 13 | 115 | 102 | 53 | 49 | null | null |
hausdorff/pyli | src/LexerUtils.hs | mit | fraction :: Regex
fraction = oneOf "." <.> intpart | 50 | fraction :: Regex
fraction = oneOf "." <.> intpart | 50 | fraction = oneOf "." <.> intpart | 32 | false | true | 0 | 6 | 8 | 18 | 9 | 9 | null | null |
mhwombat/exp-uivector-cluster-wains | test/ALife/Creatur/Wain/UIVector/Cluster/ExperimentQC.hs | bsd-3-clause | -- import Test.Framework.Providers.QuickCheck2 (testProperty)
-- import Test.QuickCheck
-- prop_idealPopControlDeltaE_counteracts_overpopulation
-- :: Positive Int -> Positive Int -> Positive Int -> Positive Double -> Property
-- prop_idealPopControlDeltaE_counteracts_overpopulation
-- (Positive pIdeal) (Positive deltaP) (Positive deltaP2) (Positive deltaE)
-- = property $ ec1 < 0 && ec2 < 0 && ec2 < ec1
-- where p1 = pIdeal + deltaP
-- p2 = p1 + deltaP2
-- ec1 = idealPopControlDeltaE pIdeal p1 deltaE
-- ec2 = idealPopControlDeltaE pIdeal p2 deltaE
-- prop_idealPopControlDeltaE_counteracts_underpopulation
-- :: Positive Int -> Positive Int -> Positive Int -> Positive Double -> Property
-- prop_idealPopControlDeltaE_counteracts_underpopulation
-- (Positive p1) (Positive deltaP) (Positive deltaP2) (Positive deltaE)
-- = property $ ec1 > 0 && ec2 > 0 && ec2 < ec1
-- where p2 = p1 + deltaP
-- pIdeal = p2 + deltaP2
-- ec1 = idealPopControlDeltaE pIdeal p1 deltaE
-- ec2 = idealPopControlDeltaE pIdeal p2 deltaE
test :: Test
test = testGroup "ALife.Creatur.Wain.UIVector.Cluster.ExperimentQC"
[
-- testProperty "prop_idealPopControlDeltaE_counteracts_overpopulation"
-- prop_idealPopControlDeltaE_counteracts_overpopulation,
-- testProperty "prop_idealPopControlDeltaE_counteracts_underpopulation"
-- prop_idealPopControlDeltaE_counteracts_underpopulation
] | 1,460 | test :: Test
test = testGroup "ALife.Creatur.Wain.UIVector.Cluster.ExperimentQC"
[
-- testProperty "prop_idealPopControlDeltaE_counteracts_overpopulation"
-- prop_idealPopControlDeltaE_counteracts_overpopulation,
-- testProperty "prop_idealPopControlDeltaE_counteracts_underpopulation"
-- prop_idealPopControlDeltaE_counteracts_underpopulation
] | 369 | test = testGroup "ALife.Creatur.Wain.UIVector.Cluster.ExperimentQC"
[
-- testProperty "prop_idealPopControlDeltaE_counteracts_overpopulation"
-- prop_idealPopControlDeltaE_counteracts_overpopulation,
-- testProperty "prop_idealPopControlDeltaE_counteracts_underpopulation"
-- prop_idealPopControlDeltaE_counteracts_underpopulation
] | 356 | true | true | 0 | 5 | 260 | 43 | 33 | 10 | null | null |
Philonous/hs-jingle-iceudp | source/Network/Xmpp/Xep/Jingle/IceUdp.hs | mit | xpRemoteCandidate :: PU [Node] RemoteCandidate
xpRemoteCandidate = xpWrap (\(comp, i, p) -> RemoteCandidate comp i p)
(\(RemoteCandidate comp i p) -> (comp, i, p)) $
xpElemAttrs (iceUdpName "candidate")
(xp3Tuple
(xpAttribute "component" xpPrim)
(xpAttribute "ip" xpText)
(xpAttribute "port" xpPrim)) | 474 | xpRemoteCandidate :: PU [Node] RemoteCandidate
xpRemoteCandidate = xpWrap (\(comp, i, p) -> RemoteCandidate comp i p)
(\(RemoteCandidate comp i p) -> (comp, i, p)) $
xpElemAttrs (iceUdpName "candidate")
(xp3Tuple
(xpAttribute "component" xpPrim)
(xpAttribute "ip" xpText)
(xpAttribute "port" xpPrim)) | 474 | xpRemoteCandidate = xpWrap (\(comp, i, p) -> RemoteCandidate comp i p)
(\(RemoteCandidate comp i p) -> (comp, i, p)) $
xpElemAttrs (iceUdpName "candidate")
(xp3Tuple
(xpAttribute "component" xpPrim)
(xpAttribute "ip" xpText)
(xpAttribute "port" xpPrim)) | 427 | false | true | 1 | 10 | 211 | 127 | 66 | 61 | null | null |
ryzhyk/cocoon | cocoon/Validate.hs | apache-2.0 | typeValidate r (TUser p n) = do _ <- checkType p r n
return () | 100 | typeValidate r (TUser p n) = do _ <- checkType p r n
return () | 100 | typeValidate r (TUser p n) = do _ <- checkType p r n
return () | 100 | false | false | 0 | 8 | 52 | 43 | 18 | 25 | null | null |
fredmorcos/attic | projects/pet/archive/pet_haskell_master_complete/Expense.hs | isc | yearOf :: Expense -> Year
yearOf = yearFrom . dateOf | 52 | yearOf :: Expense -> Year
yearOf = yearFrom . dateOf | 52 | yearOf = yearFrom . dateOf | 26 | false | true | 0 | 5 | 9 | 19 | 10 | 9 | null | null |
pcapriotti/pipes-conduit | Control/Pipe/Conduit.hs | bsd-3-clause | -- | Convert a 'Source' into a 'Pipe'.
--
-- The resulting 'Pipe' is a 'Producer' which pulls from the 'Source' until
-- exhaustion and yields the received data.
sourcePipe :: Resource m => Source m a -> Pipe x a (ResourceT m) ()
sourcePipe (Source pull _) = do
result <- lift pull
case result of
Open s x -> yield x >> sourcePipe s
Closed -> return ()
-- | Convert a 'Sink' into a 'Pipe'.
--
-- Optional consumed input is returned, together with the sink result. | 476 | sourcePipe :: Resource m => Source m a -> Pipe x a (ResourceT m) ()
sourcePipe (Source pull _) = do
result <- lift pull
case result of
Open s x -> yield x >> sourcePipe s
Closed -> return ()
-- | Convert a 'Sink' into a 'Pipe'.
--
-- Optional consumed input is returned, together with the sink result. | 314 | sourcePipe (Source pull _) = do
result <- lift pull
case result of
Open s x -> yield x >> sourcePipe s
Closed -> return ()
-- | Convert a 'Sink' into a 'Pipe'.
--
-- Optional consumed input is returned, together with the sink result. | 246 | true | true | 0 | 11 | 102 | 111 | 54 | 57 | null | null |
OpenXT/manager | xenmgr/XenMgr/Connect/NetworkDaemon.hs | gpl-2.0 | joinNetwork :: Network -> DomainID -> NicID -> Rpc ()
joinNetwork n domid devid = comCitrixXenclientNetworkdaemonMoveToNetwork service rootS (vifS domid devid) (npathS n) | 170 | joinNetwork :: Network -> DomainID -> NicID -> Rpc ()
joinNetwork n domid devid = comCitrixXenclientNetworkdaemonMoveToNetwork service rootS (vifS domid devid) (npathS n) | 170 | joinNetwork n domid devid = comCitrixXenclientNetworkdaemonMoveToNetwork service rootS (vifS domid devid) (npathS n) | 116 | false | true | 0 | 9 | 22 | 58 | 28 | 30 | null | null |
davdar/quals | src/FP/Pretty.hs | bsd-3-clause | maxRibbonWidthL :: Lens PEnv Int
maxRibbonWidthL = lens maxRibbonWidth $ \ e w -> e { maxRibbonWidth = w } | 106 | maxRibbonWidthL :: Lens PEnv Int
maxRibbonWidthL = lens maxRibbonWidth $ \ e w -> e { maxRibbonWidth = w } | 106 | maxRibbonWidthL = lens maxRibbonWidth $ \ e w -> e { maxRibbonWidth = w } | 73 | false | true | 0 | 9 | 19 | 44 | 21 | 23 | null | null |
KevinCotrone/hackage-twitter-bot | src/Main.hs | bsd-3-clause | createPost :: RSSItem -> Maybe FullPost
createPost item =
let partialPost = join $ (\desc -> eitherToMaybe . APT.parseOnly parsePost $ pack desc) <$> (rssItemDescription item)
title = rssItemTitle item
link = rssItemLink item
in (\t l part -> fromPartial t l part) <$> title <*> link <*> partialPost | 315 | createPost :: RSSItem -> Maybe FullPost
createPost item =
let partialPost = join $ (\desc -> eitherToMaybe . APT.parseOnly parsePost $ pack desc) <$> (rssItemDescription item)
title = rssItemTitle item
link = rssItemLink item
in (\t l part -> fromPartial t l part) <$> title <*> link <*> partialPost | 315 | createPost item =
let partialPost = join $ (\desc -> eitherToMaybe . APT.parseOnly parsePost $ pack desc) <$> (rssItemDescription item)
title = rssItemTitle item
link = rssItemLink item
in (\t l part -> fromPartial t l part) <$> title <*> link <*> partialPost | 275 | false | true | 0 | 16 | 64 | 122 | 59 | 63 | null | null |
Fizzixnerd/silveretta-hs | exp/Indents.hs | gpl-3.0 | t3 = "hello:\n\tthere\n\tdude" | 30 | t3 = "hello:\n\tthere\n\tdude" | 30 | t3 = "hello:\n\tthere\n\tdude" | 30 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
fmthoma/ghc | compiler/main/TidyPgm.hs | bsd-3-clause | chooseExternalIds :: HscEnv
-> Module
-> Bool -> Bool
-> [CoreBind]
-> [CoreBind]
-> [CoreRule]
-> VarEnv (Var, Var)
-> IO (UnfoldEnv, TidyOccEnv)
-- Step 1 from the notes above
chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_rules vect_vars
= do { (unfold_env1,occ_env1) <- search init_work_list emptyVarEnv init_occ_env
; let internal_ids = filter (not . (`elemVarEnv` unfold_env1)) binders
; tidy_internal internal_ids unfold_env1 occ_env1 }
where
nc_var = hsc_NC hsc_env
-- init_ext_ids is the intial list of Ids that should be
-- externalised. It serves as the starting point for finding a
-- deterministic, tidy, renaming for all external Ids in this
-- module.
--
-- It is sorted, so that it has adeterministic order (i.e. it's the
-- same list every time this module is compiled), in contrast to the
-- bindings, which are ordered non-deterministically.
init_work_list = zip init_ext_ids init_ext_ids
init_ext_ids = sortBy (compare `on` getOccName) $
filter is_external binders
-- An Id should be external if either (a) it is exported,
-- (b) it appears in the RHS of a local rule for an imported Id, or
-- (c) it is the vectorised version of an imported Id
-- See Note [Which rules to expose]
is_external id = isExportedId id || id `elemVarSet` rule_rhs_vars || id `elemVarSet` vect_var_vs
rule_rhs_vars = mapUnionVarSet ruleRhsFreeVars imp_id_rules
vect_var_vs = mkVarSet [var_v | (var, var_v) <- nameEnvElts vect_vars, isGlobalId var]
binders = bindersOfBinds binds
implicit_binders = bindersOfBinds implicit_binds
binder_set = mkVarSet binders
avoids = [getOccName name | bndr <- binders ++ implicit_binders,
let name = idName bndr,
isExternalName name ]
-- In computing our "avoids" list, we must include
-- all implicit Ids
-- all things with global names (assigned once and for
-- all by the renamer)
-- since their names are "taken".
-- The type environment is a convenient source of such things.
-- In particular, the set of binders doesn't include
-- implicit Ids at this stage.
-- We also make sure to avoid any exported binders. Consider
-- f{-u1-} = 1 -- Local decl
-- ...
-- f{-u2-} = 2 -- Exported decl
--
-- The second exported decl must 'get' the name 'f', so we
-- have to put 'f' in the avoids list before we get to the first
-- decl. tidyTopId then does a no-op on exported binders.
init_occ_env = initTidyOccEnv avoids
search :: [(Id,Id)] -- The work-list: (external id, referrring id)
-- Make a tidy, external Name for the external id,
-- add it to the UnfoldEnv, and do the same for the
-- transitive closure of Ids it refers to
-- The referring id is used to generate a tidy
--- name for the external id
-> UnfoldEnv -- id -> (new Name, show_unfold)
-> TidyOccEnv -- occ env for choosing new Names
-> IO (UnfoldEnv, TidyOccEnv)
search [] unfold_env occ_env = return (unfold_env, occ_env)
search ((idocc,referrer) : rest) unfold_env occ_env
| idocc `elemVarEnv` unfold_env = search rest unfold_env occ_env
| otherwise = do
(occ_env', name') <- tidyTopName mod nc_var (Just referrer) occ_env idocc
let
(new_ids, show_unfold)
| omit_prags = ([], False)
| otherwise = addExternal expose_all refined_id
-- add vectorised version if any exists
new_ids' = new_ids ++ maybeToList (fmap snd $ lookupVarEnv vect_vars idocc)
-- 'idocc' is an *occurrence*, but we need to see the
-- unfolding in the *definition*; so look up in binder_set
refined_id = case lookupVarSet binder_set idocc of
Just id -> id
Nothing -> WARN( True, ppr idocc ) idocc
unfold_env' = extendVarEnv unfold_env idocc (name',show_unfold)
referrer' | isExportedId refined_id = refined_id
| otherwise = referrer
--
search (zip new_ids' (repeat referrer') ++ rest) unfold_env' occ_env'
tidy_internal :: [Id] -> UnfoldEnv -> TidyOccEnv
-> IO (UnfoldEnv, TidyOccEnv)
tidy_internal [] unfold_env occ_env = return (unfold_env,occ_env)
tidy_internal (id:ids) unfold_env occ_env = do
(occ_env', name') <- tidyTopName mod nc_var Nothing occ_env id
let unfold_env' = extendVarEnv unfold_env id (name',False)
tidy_internal ids unfold_env' occ_env' | 5,114 | chooseExternalIds :: HscEnv
-> Module
-> Bool -> Bool
-> [CoreBind]
-> [CoreBind]
-> [CoreRule]
-> VarEnv (Var, Var)
-> IO (UnfoldEnv, TidyOccEnv)
chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_rules vect_vars
= do { (unfold_env1,occ_env1) <- search init_work_list emptyVarEnv init_occ_env
; let internal_ids = filter (not . (`elemVarEnv` unfold_env1)) binders
; tidy_internal internal_ids unfold_env1 occ_env1 }
where
nc_var = hsc_NC hsc_env
-- init_ext_ids is the intial list of Ids that should be
-- externalised. It serves as the starting point for finding a
-- deterministic, tidy, renaming for all external Ids in this
-- module.
--
-- It is sorted, so that it has adeterministic order (i.e. it's the
-- same list every time this module is compiled), in contrast to the
-- bindings, which are ordered non-deterministically.
init_work_list = zip init_ext_ids init_ext_ids
init_ext_ids = sortBy (compare `on` getOccName) $
filter is_external binders
-- An Id should be external if either (a) it is exported,
-- (b) it appears in the RHS of a local rule for an imported Id, or
-- (c) it is the vectorised version of an imported Id
-- See Note [Which rules to expose]
is_external id = isExportedId id || id `elemVarSet` rule_rhs_vars || id `elemVarSet` vect_var_vs
rule_rhs_vars = mapUnionVarSet ruleRhsFreeVars imp_id_rules
vect_var_vs = mkVarSet [var_v | (var, var_v) <- nameEnvElts vect_vars, isGlobalId var]
binders = bindersOfBinds binds
implicit_binders = bindersOfBinds implicit_binds
binder_set = mkVarSet binders
avoids = [getOccName name | bndr <- binders ++ implicit_binders,
let name = idName bndr,
isExternalName name ]
-- In computing our "avoids" list, we must include
-- all implicit Ids
-- all things with global names (assigned once and for
-- all by the renamer)
-- since their names are "taken".
-- The type environment is a convenient source of such things.
-- In particular, the set of binders doesn't include
-- implicit Ids at this stage.
-- We also make sure to avoid any exported binders. Consider
-- f{-u1-} = 1 -- Local decl
-- ...
-- f{-u2-} = 2 -- Exported decl
--
-- The second exported decl must 'get' the name 'f', so we
-- have to put 'f' in the avoids list before we get to the first
-- decl. tidyTopId then does a no-op on exported binders.
init_occ_env = initTidyOccEnv avoids
search :: [(Id,Id)] -- The work-list: (external id, referrring id)
-- Make a tidy, external Name for the external id,
-- add it to the UnfoldEnv, and do the same for the
-- transitive closure of Ids it refers to
-- The referring id is used to generate a tidy
--- name for the external id
-> UnfoldEnv -- id -> (new Name, show_unfold)
-> TidyOccEnv -- occ env for choosing new Names
-> IO (UnfoldEnv, TidyOccEnv)
search [] unfold_env occ_env = return (unfold_env, occ_env)
search ((idocc,referrer) : rest) unfold_env occ_env
| idocc `elemVarEnv` unfold_env = search rest unfold_env occ_env
| otherwise = do
(occ_env', name') <- tidyTopName mod nc_var (Just referrer) occ_env idocc
let
(new_ids, show_unfold)
| omit_prags = ([], False)
| otherwise = addExternal expose_all refined_id
-- add vectorised version if any exists
new_ids' = new_ids ++ maybeToList (fmap snd $ lookupVarEnv vect_vars idocc)
-- 'idocc' is an *occurrence*, but we need to see the
-- unfolding in the *definition*; so look up in binder_set
refined_id = case lookupVarSet binder_set idocc of
Just id -> id
Nothing -> WARN( True, ppr idocc ) idocc
unfold_env' = extendVarEnv unfold_env idocc (name',show_unfold)
referrer' | isExportedId refined_id = refined_id
| otherwise = referrer
--
search (zip new_ids' (repeat referrer') ++ rest) unfold_env' occ_env'
tidy_internal :: [Id] -> UnfoldEnv -> TidyOccEnv
-> IO (UnfoldEnv, TidyOccEnv)
tidy_internal [] unfold_env occ_env = return (unfold_env,occ_env)
tidy_internal (id:ids) unfold_env occ_env = do
(occ_env', name') <- tidyTopName mod nc_var Nothing occ_env id
let unfold_env' = extendVarEnv unfold_env id (name',False)
tidy_internal ids unfold_env' occ_env' | 5,064 | chooseExternalIds hsc_env mod omit_prags expose_all binds implicit_binds imp_id_rules vect_vars
= do { (unfold_env1,occ_env1) <- search init_work_list emptyVarEnv init_occ_env
; let internal_ids = filter (not . (`elemVarEnv` unfold_env1)) binders
; tidy_internal internal_ids unfold_env1 occ_env1 }
where
nc_var = hsc_NC hsc_env
-- init_ext_ids is the intial list of Ids that should be
-- externalised. It serves as the starting point for finding a
-- deterministic, tidy, renaming for all external Ids in this
-- module.
--
-- It is sorted, so that it has adeterministic order (i.e. it's the
-- same list every time this module is compiled), in contrast to the
-- bindings, which are ordered non-deterministically.
init_work_list = zip init_ext_ids init_ext_ids
init_ext_ids = sortBy (compare `on` getOccName) $
filter is_external binders
-- An Id should be external if either (a) it is exported,
-- (b) it appears in the RHS of a local rule for an imported Id, or
-- (c) it is the vectorised version of an imported Id
-- See Note [Which rules to expose]
is_external id = isExportedId id || id `elemVarSet` rule_rhs_vars || id `elemVarSet` vect_var_vs
rule_rhs_vars = mapUnionVarSet ruleRhsFreeVars imp_id_rules
vect_var_vs = mkVarSet [var_v | (var, var_v) <- nameEnvElts vect_vars, isGlobalId var]
binders = bindersOfBinds binds
implicit_binders = bindersOfBinds implicit_binds
binder_set = mkVarSet binders
avoids = [getOccName name | bndr <- binders ++ implicit_binders,
let name = idName bndr,
isExternalName name ]
-- In computing our "avoids" list, we must include
-- all implicit Ids
-- all things with global names (assigned once and for
-- all by the renamer)
-- since their names are "taken".
-- The type environment is a convenient source of such things.
-- In particular, the set of binders doesn't include
-- implicit Ids at this stage.
-- We also make sure to avoid any exported binders. Consider
-- f{-u1-} = 1 -- Local decl
-- ...
-- f{-u2-} = 2 -- Exported decl
--
-- The second exported decl must 'get' the name 'f', so we
-- have to put 'f' in the avoids list before we get to the first
-- decl. tidyTopId then does a no-op on exported binders.
init_occ_env = initTidyOccEnv avoids
search :: [(Id,Id)] -- The work-list: (external id, referrring id)
-- Make a tidy, external Name for the external id,
-- add it to the UnfoldEnv, and do the same for the
-- transitive closure of Ids it refers to
-- The referring id is used to generate a tidy
--- name for the external id
-> UnfoldEnv -- id -> (new Name, show_unfold)
-> TidyOccEnv -- occ env for choosing new Names
-> IO (UnfoldEnv, TidyOccEnv)
search [] unfold_env occ_env = return (unfold_env, occ_env)
search ((idocc,referrer) : rest) unfold_env occ_env
| idocc `elemVarEnv` unfold_env = search rest unfold_env occ_env
| otherwise = do
(occ_env', name') <- tidyTopName mod nc_var (Just referrer) occ_env idocc
let
(new_ids, show_unfold)
| omit_prags = ([], False)
| otherwise = addExternal expose_all refined_id
-- add vectorised version if any exists
new_ids' = new_ids ++ maybeToList (fmap snd $ lookupVarEnv vect_vars idocc)
-- 'idocc' is an *occurrence*, but we need to see the
-- unfolding in the *definition*; so look up in binder_set
refined_id = case lookupVarSet binder_set idocc of
Just id -> id
Nothing -> WARN( True, ppr idocc ) idocc
unfold_env' = extendVarEnv unfold_env idocc (name',show_unfold)
referrer' | isExportedId refined_id = refined_id
| otherwise = referrer
--
search (zip new_ids' (repeat referrer') ++ rest) unfold_env' occ_env'
tidy_internal :: [Id] -> UnfoldEnv -> TidyOccEnv
-> IO (UnfoldEnv, TidyOccEnv)
tidy_internal [] unfold_env occ_env = return (unfold_env,occ_env)
tidy_internal (id:ids) unfold_env occ_env = do
(occ_env', name') <- tidyTopName mod nc_var Nothing occ_env id
let unfold_env' = extendVarEnv unfold_env id (name',False)
tidy_internal ids unfold_env' occ_env' | 4,791 | true | true | 8 | 16 | 1,697 | 876 | 453 | 423 | null | null |
jdreaver/iris | tests/Iris/CameraSpec.hs | mit | spec :: Spec
spec =
describe "recordClick" $ do
let buttons = pressedButtons :: PressedButtons
b = MouseButtonLeft
bs1 = recordClick (MousePosition 0 0) b Pressed buttons
bs2 = recordClick (MousePosition 1 1) b Pressed bs1
it "doesn't overwrite clicks" $ do
length (Map.toList bs1) `shouldBe` 1
length (Map.toList bs2) `shouldBe` 1
let b3 = recordClick (MousePosition 2 2) b Released bs2
it "removes clicks" $
length (Map.toList b3) `shouldBe` 0 | 521 | spec :: Spec
spec =
describe "recordClick" $ do
let buttons = pressedButtons :: PressedButtons
b = MouseButtonLeft
bs1 = recordClick (MousePosition 0 0) b Pressed buttons
bs2 = recordClick (MousePosition 1 1) b Pressed bs1
it "doesn't overwrite clicks" $ do
length (Map.toList bs1) `shouldBe` 1
length (Map.toList bs2) `shouldBe` 1
let b3 = recordClick (MousePosition 2 2) b Released bs2
it "removes clicks" $
length (Map.toList b3) `shouldBe` 0 | 521 | spec =
describe "recordClick" $ do
let buttons = pressedButtons :: PressedButtons
b = MouseButtonLeft
bs1 = recordClick (MousePosition 0 0) b Pressed buttons
bs2 = recordClick (MousePosition 1 1) b Pressed bs1
it "doesn't overwrite clicks" $ do
length (Map.toList bs1) `shouldBe` 1
length (Map.toList bs2) `shouldBe` 1
let b3 = recordClick (MousePosition 2 2) b Released bs2
it "removes clicks" $
length (Map.toList b3) `shouldBe` 0 | 508 | false | true | 0 | 15 | 146 | 182 | 89 | 93 | null | null |
anttisalonen/freekick | haskell/addutil/Libaddutil/ListUtils.hs | agpl-3.0 | removeItems :: Eq a => [a] -> [Int] -> [a]
removeItems d [] = d | 67 | removeItems :: Eq a => [a] -> [Int] -> [a]
removeItems d [] = d | 67 | removeItems d [] = d | 24 | false | true | 0 | 8 | 18 | 42 | 22 | 20 | null | null |
voidlizard/emufat | src/CWriter.hs | bsd-3-clause | stackCellType = "uint32_t" | 26 | stackCellType = "uint32_t" | 26 | stackCellType = "uint32_t" | 26 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
bch29/cassandra-th | src/Cassandra/TH.hs | bsd-3-clause | fromEither _ = error "fromEither found left" | 44 | fromEither _ = error "fromEither found left" | 44 | fromEither _ = error "fromEither found left" | 44 | false | false | 0 | 5 | 6 | 12 | 5 | 7 | null | null |
dimara/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | socatPath :: String
socatPath = AutoConf.socatPath | 50 | socatPath :: String
socatPath = AutoConf.socatPath | 50 | socatPath = AutoConf.socatPath | 30 | false | true | 0 | 6 | 5 | 20 | 8 | 12 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | packageExpr (SignI16 e) = packageSubExpr (exprCmdVal EXPR_INT16 EXPR_SIGN) e | 76 | packageExpr (SignI16 e) = packageSubExpr (exprCmdVal EXPR_INT16 EXPR_SIGN) e | 76 | packageExpr (SignI16 e) = packageSubExpr (exprCmdVal EXPR_INT16 EXPR_SIGN) e | 76 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
mgomezch/yesod-squealer | source/Yesod/Squealer/Handler.hs | bsd-3-clause | runSQLDebug
∷ (Connection → Query → IO a)
→ Statement
→ SquealerHandler a
runSQLDebug q s
= do
liftIO ∘ putStr ∘ printStatements $ pure s
runSQL q s | 165 | runSQLDebug
∷ (Connection → Query → IO a)
→ Statement
→ SquealerHandler a
runSQLDebug q s
= do
liftIO ∘ putStr ∘ printStatements $ pure s
runSQL q s | 164 | runSQLDebug q s
= do
liftIO ∘ putStr ∘ printStatements $ pure s
runSQL q s | 84 | false | true | 0 | 10 | 45 | 72 | 32 | 40 | null | null |
jacekszymanski/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxSTC_ERR_LUA :: Int
wxSTC_ERR_LUA = 8 | 38 | wxSTC_ERR_LUA :: Int
wxSTC_ERR_LUA = 8 | 38 | wxSTC_ERR_LUA = 8 | 17 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
dawedawe/kripkeweb | src/Tfidf.hs | bsd-3-clause | -- |Compute all tf-idfs for the given world and sort them descending.
-- With precomputed number of worlds and document frequencies.
worldsTfidfPre :: Connection -> LambdaType -> Int -> M.Map T.Text Int ->
T.Text -> IO [(T.Text, Double)]
worldsTfidfPre c lamType n dfs w = do
terms <- lambda c lamType w
freqs <- mapM (tfidfPre c lamType n dfs w) terms
let tefrs = zip terms freqs
return $ reverse (sortBy (compare `on` snd) tefrs)
-- |Calculate all Document Frequencies. | 514 | worldsTfidfPre :: Connection -> LambdaType -> Int -> M.Map T.Text Int ->
T.Text -> IO [(T.Text, Double)]
worldsTfidfPre c lamType n dfs w = do
terms <- lambda c lamType w
freqs <- mapM (tfidfPre c lamType n dfs w) terms
let tefrs = zip terms freqs
return $ reverse (sortBy (compare `on` snd) tefrs)
-- |Calculate all Document Frequencies. | 381 | worldsTfidfPre c lamType n dfs w = do
terms <- lambda c lamType w
freqs <- mapM (tfidfPre c lamType n dfs w) terms
let tefrs = zip terms freqs
return $ reverse (sortBy (compare `on` snd) tefrs)
-- |Calculate all Document Frequencies. | 258 | true | true | 0 | 13 | 123 | 151 | 75 | 76 | null | null |
deontologician/orbRPG | Game/OrbRPG/Combinations.hs | gpl-3.0 | L Omega @>> T Piston = White | 28 | L Omega @>> T Piston = White | 28 | L Omega @>> T Piston = White | 28 | false | false | 0 | 6 | 6 | 18 | 7 | 11 | null | null |
Mathnerd314/lamdu | src/Lamdu/CodeEdit/ExpressionEdit/ListEdit.hs | gpl-3.0 | makeItem ::
MonadA m =>
Sugar.ListItem m (ExprGuiM.SugarExpr m) ->
ExprGuiM m (ExpressionGui m, ExpressionGui m)
makeItem item = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
mkItemEventMap resultPickers Sugar.ListItemActions
{ Sugar._itemAddNext = addItem
, Sugar._itemDelete = delItem
} =
mconcat
[ Widget.keysEventMapMovesCursor
(Config.listAddItemKeys config) (doc resultPickers) $ do
sequence_ resultPickers
WidgetIds.fromGuid <$> addItem
, Widget.keysEventMapMovesCursor (Config.delKeys config)
(E.Doc ["Edit", "List", "Delete Item"]) $
WidgetIds.fromGuid <$> delItem
]
(pair, resultPickers) <-
ExprGuiM.listenResultPickers $
Lens.sequenceOf Lens.both
( fmap ExpressionGui.fromValueWidget .
ExpressionGui.makeColoredLabel (Config.listCommaTextSize config)
(Config.listCommaColor config) ", " $ Widget.augmentId ',' itemWidgetId
, ExprGuiM.makeSubexpresion 0 itemExpr
)
return $ pair
& Lens._2 . ExpressionGui.egWidget %~
Widget.weakerEvents
(maybe mempty (mkItemEventMap resultPickers) (item ^. Sugar.liMActions))
where
itemExpr = item ^. Sugar.liExpr
itemWidgetId = WidgetIds.fromGuid $ itemExpr ^. Sugar.rPayload . Sugar.plGuid
doc [] = E.Doc ["Edit", "List", "Add Next Item"]
doc _ = E.Doc ["Edit", "List", "Pick Result and Add Next Item"] | 1,418 | makeItem ::
MonadA m =>
Sugar.ListItem m (ExprGuiM.SugarExpr m) ->
ExprGuiM m (ExpressionGui m, ExpressionGui m)
makeItem item = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
mkItemEventMap resultPickers Sugar.ListItemActions
{ Sugar._itemAddNext = addItem
, Sugar._itemDelete = delItem
} =
mconcat
[ Widget.keysEventMapMovesCursor
(Config.listAddItemKeys config) (doc resultPickers) $ do
sequence_ resultPickers
WidgetIds.fromGuid <$> addItem
, Widget.keysEventMapMovesCursor (Config.delKeys config)
(E.Doc ["Edit", "List", "Delete Item"]) $
WidgetIds.fromGuid <$> delItem
]
(pair, resultPickers) <-
ExprGuiM.listenResultPickers $
Lens.sequenceOf Lens.both
( fmap ExpressionGui.fromValueWidget .
ExpressionGui.makeColoredLabel (Config.listCommaTextSize config)
(Config.listCommaColor config) ", " $ Widget.augmentId ',' itemWidgetId
, ExprGuiM.makeSubexpresion 0 itemExpr
)
return $ pair
& Lens._2 . ExpressionGui.egWidget %~
Widget.weakerEvents
(maybe mempty (mkItemEventMap resultPickers) (item ^. Sugar.liMActions))
where
itemExpr = item ^. Sugar.liExpr
itemWidgetId = WidgetIds.fromGuid $ itemExpr ^. Sugar.rPayload . Sugar.plGuid
doc [] = E.Doc ["Edit", "List", "Add Next Item"]
doc _ = E.Doc ["Edit", "List", "Pick Result and Add Next Item"] | 1,418 | makeItem item = do
config <- ExprGuiM.widgetEnv WE.readConfig
let
mkItemEventMap resultPickers Sugar.ListItemActions
{ Sugar._itemAddNext = addItem
, Sugar._itemDelete = delItem
} =
mconcat
[ Widget.keysEventMapMovesCursor
(Config.listAddItemKeys config) (doc resultPickers) $ do
sequence_ resultPickers
WidgetIds.fromGuid <$> addItem
, Widget.keysEventMapMovesCursor (Config.delKeys config)
(E.Doc ["Edit", "List", "Delete Item"]) $
WidgetIds.fromGuid <$> delItem
]
(pair, resultPickers) <-
ExprGuiM.listenResultPickers $
Lens.sequenceOf Lens.both
( fmap ExpressionGui.fromValueWidget .
ExpressionGui.makeColoredLabel (Config.listCommaTextSize config)
(Config.listCommaColor config) ", " $ Widget.augmentId ',' itemWidgetId
, ExprGuiM.makeSubexpresion 0 itemExpr
)
return $ pair
& Lens._2 . ExpressionGui.egWidget %~
Widget.weakerEvents
(maybe mempty (mkItemEventMap resultPickers) (item ^. Sugar.liMActions))
where
itemExpr = item ^. Sugar.liExpr
itemWidgetId = WidgetIds.fromGuid $ itemExpr ^. Sugar.rPayload . Sugar.plGuid
doc [] = E.Doc ["Edit", "List", "Add Next Item"]
doc _ = E.Doc ["Edit", "List", "Pick Result and Add Next Item"] | 1,299 | false | true | 5 | 17 | 310 | 434 | 209 | 225 | null | null |
cloudhead/spinsv | test/Main.hs | gpl-3.0 | testConsoleUpDown :: PortNumber -> IO ()
testConsoleUpDown p = withRunner config p $ \env -> do
p1 <- waitForNewProcess env
p2 <- waitForNewProcess env
let
(worker, logger) =
if fst (pCmd p1) == "worker" then (p1, p2) else (p2, p1)
runner <- connect (PortNumber p)
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
r <- runnerDown runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'down'" Down want
waitForProcessExit env worker
r <- runnerUp runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
p3 <- waitForNewProcess env
assertEqual "process commands are equal" (pCmd worker) (pCmd p3)
unless (pID p3 /= pID worker) $ assertFailure "process pids shouldn't match"
status <- getProcessStatus' env False True (pID logger)
case status of
Nothing -> return ()
_ -> assertFailure "logger process has exited" | 1,124 | testConsoleUpDown :: PortNumber -> IO ()
testConsoleUpDown p = withRunner config p $ \env -> do
p1 <- waitForNewProcess env
p2 <- waitForNewProcess env
let
(worker, logger) =
if fst (pCmd p1) == "worker" then (p1, p2) else (p2, p1)
runner <- connect (PortNumber p)
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
r <- runnerDown runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'down'" Down want
waitForProcessExit env worker
r <- runnerUp runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
p3 <- waitForNewProcess env
assertEqual "process commands are equal" (pCmd worker) (pCmd p3)
unless (pID p3 /= pID worker) $ assertFailure "process pids shouldn't match"
status <- getProcessStatus' env False True (pID logger)
case status of
Nothing -> return ()
_ -> assertFailure "logger process has exited" | 1,124 | testConsoleUpDown p = withRunner config p $ \env -> do
p1 <- waitForNewProcess env
p2 <- waitForNewProcess env
let
(worker, logger) =
if fst (pCmd p1) == "worker" then (p1, p2) else (p2, p1)
runner <- connect (PortNumber p)
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
r <- runnerDown runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'down'" Down want
waitForProcessExit env worker
r <- runnerUp runner
assertEqual "response should be 'OK'" "OK" r
(want, _, _) <- getRunnerStatus runner
assertEqual "status should be 'up'" Up want
p3 <- waitForNewProcess env
assertEqual "process commands are equal" (pCmd worker) (pCmd p3)
unless (pID p3 /= pID worker) $ assertFailure "process pids shouldn't match"
status <- getProcessStatus' env False True (pID logger)
case status of
Nothing -> return ()
_ -> assertFailure "logger process has exited" | 1,083 | false | true | 0 | 16 | 289 | 364 | 168 | 196 | null | null |
Cortlandd/haskell-opencv | src/OpenCV/Internal/ImgProc/MiscImgTransform/ColorCodes.hs | bsd-3-clause | bgra_I420 :: Proxy 'BGRA_I420; bgra_I420 = Proxy | 50 | bgra_I420 :: Proxy 'BGRA_I420
bgra_I420 = Proxy | 49 | bgra_I420 = Proxy | 18 | false | true | 0 | 6 | 8 | 17 | 9 | 8 | null | null |
kojiromike/Idris-dev | src/Idris/Elab/Quasiquote.hs | bsd-3-clause | extractUnquotes n (PApp fc f args)
= do (f', ex1) <- extractUnquotes n f
args' <- mapM (extractPArgUnquotes n) args
let (args'', exs) = unzip args'
return (PApp fc f' args'', ex1 ++ concat exs) | 216 | extractUnquotes n (PApp fc f args)
= do (f', ex1) <- extractUnquotes n f
args' <- mapM (extractPArgUnquotes n) args
let (args'', exs) = unzip args'
return (PApp fc f' args'', ex1 ++ concat exs) | 216 | extractUnquotes n (PApp fc f args)
= do (f', ex1) <- extractUnquotes n f
args' <- mapM (extractPArgUnquotes n) args
let (args'', exs) = unzip args'
return (PApp fc f' args'', ex1 ++ concat exs) | 216 | false | false | 0 | 10 | 57 | 102 | 48 | 54 | null | null |
TomMD/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprSkolInfo (InstSC n) = ptext (sLit "the instance declaration") <> ifPprDebug (parens (ppr n)) | 102 | pprSkolInfo (InstSC n) = ptext (sLit "the instance declaration") <> ifPprDebug (parens (ppr n)) | 102 | pprSkolInfo (InstSC n) = ptext (sLit "the instance declaration") <> ifPprDebug (parens (ppr n)) | 102 | false | false | 0 | 10 | 20 | 44 | 20 | 24 | null | null |
cognominal/docs.elm-lang.org | server/Utils.hs | bsd-3-clause | -- | Add analytics to a page.
analytics :: H.Html
analytics =
H.script ! A.type_ "text/javascript" $
"var _gaq = _gaq || [];\n\
\_gaq.push(['_setAccount', 'UA-25827182-1']);\n\
\_gaq.push(['_setDomainName', 'elm-lang.org']);\n\
\_gaq.push(['_trackPageview']);\n\
\(function() {\n\
\ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n\
\ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n\
\ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n\
\})();" | 680 | analytics :: H.Html
analytics =
H.script ! A.type_ "text/javascript" $
"var _gaq = _gaq || [];\n\
\_gaq.push(['_setAccount', 'UA-25827182-1']);\n\
\_gaq.push(['_setDomainName', 'elm-lang.org']);\n\
\_gaq.push(['_trackPageview']);\n\
\(function() {\n\
\ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n\
\ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n\
\ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n\
\})();" | 650 | analytics =
H.script ! A.type_ "text/javascript" $
"var _gaq = _gaq || [];\n\
\_gaq.push(['_setAccount', 'UA-25827182-1']);\n\
\_gaq.push(['_setDomainName', 'elm-lang.org']);\n\
\_gaq.push(['_trackPageview']);\n\
\(function() {\n\
\ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n\
\ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n\
\ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n\
\})();" | 630 | true | true | 0 | 8 | 148 | 29 | 15 | 14 | null | null |
haskell-lisp/historic-lisk | src/Language/Lisk/Parser.hs | bsd-3-clause | liskTypeDecl = parens $ do
loc <- getLoc
string "type"
spaces1
ident <- liskName
spaces1
typ <- liskType
return $ TypeDecl loc ident [] typ | 153 | liskTypeDecl = parens $ do
loc <- getLoc
string "type"
spaces1
ident <- liskName
spaces1
typ <- liskType
return $ TypeDecl loc ident [] typ | 153 | liskTypeDecl = parens $ do
loc <- getLoc
string "type"
spaces1
ident <- liskName
spaces1
typ <- liskType
return $ TypeDecl loc ident [] typ | 153 | false | false | 0 | 10 | 38 | 61 | 26 | 35 | null | null |
toddmohney/tweeter-bot | lib/Tweet/Tweet.hs | mit | parseTweet [_] = Nothing | 24 | parseTweet [_] = Nothing | 24 | parseTweet [_] = Nothing | 24 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
brendanhay/gogol | gogol-file/gen/Network/Google/File/Types/Product.hs | mpl-2.0 | -- | Optional. The MaintenancePolicies that have been attached to the
-- instance. The key must be of the type name of the oneof policy name
-- defined in MaintenancePolicy, and the embedded policy must define the
-- same policy type. For complete details of MaintenancePolicy, please
-- refer to go\/cloud-saas-mw-ug. If only the name is needed (like in the
-- deprecated Instance.maintenance_policy_names field) then only populate
-- MaintenancePolicy.name.
gcsmpvmsMaintenancePolicies :: Lens' GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettings (Maybe GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettingsMaintenancePolicies)
gcsmpvmsMaintenancePolicies
= lens _gcsmpvmsMaintenancePolicies
(\ s a -> s{_gcsmpvmsMaintenancePolicies = a}) | 776 | gcsmpvmsMaintenancePolicies :: Lens' GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettings (Maybe GoogleCloudSaasacceleratorManagementProvidersV1MaintenanceSettingsMaintenancePolicies)
gcsmpvmsMaintenancePolicies
= lens _gcsmpvmsMaintenancePolicies
(\ s a -> s{_gcsmpvmsMaintenancePolicies = a}) | 316 | gcsmpvmsMaintenancePolicies
= lens _gcsmpvmsMaintenancePolicies
(\ s a -> s{_gcsmpvmsMaintenancePolicies = a}) | 118 | true | true | 0 | 9 | 93 | 54 | 31 | 23 | null | null |
glutamate/space | Vectors.hs | bsd-3-clause | orig :: Vec Three Double
orig = 0::: 0 ::: 0 ::: VNil | 53 | orig :: Vec Three Double
orig = 0::: 0 ::: 0 ::: VNil | 53 | orig = 0::: 0 ::: 0 ::: VNil | 28 | false | true | 0 | 7 | 12 | 28 | 14 | 14 | null | null |
amar47shah/summer-2015-haskell-class | Lisp/Parser.hs | mit | parseString :: Parsec String u SExp
parseString = (SAtom . enquote) <$> stringLit | 81 | parseString :: Parsec String u SExp
parseString = (SAtom . enquote) <$> stringLit | 81 | parseString = (SAtom . enquote) <$> stringLit | 45 | false | true | 0 | 7 | 12 | 29 | 15 | 14 | null | null |
sjfloat/bloodhound | src/Database/Bloodhound/Types.hs | bsd-3-clause | runBH :: BHEnv -> BH m a -> m a
runBH e f = runReaderT (unBH f) e | 65 | runBH :: BHEnv -> BH m a -> m a
runBH e f = runReaderT (unBH f) e | 65 | runBH e f = runReaderT (unBH f) e | 33 | false | true | 0 | 8 | 17 | 47 | 21 | 26 | null | null |
brendanhay/gogol | gogol-container/gen/Network/Google/Resource/Container/Projects/Locations/Clusters/SetLegacyAbac.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
plcslaUploadType :: Lens' ProjectsLocationsClustersSetLegacyAbac (Maybe Text)
plcslaUploadType
= lens _plcslaUploadType
(\ s a -> s{_plcslaUploadType = a}) | 234 | plcslaUploadType :: Lens' ProjectsLocationsClustersSetLegacyAbac (Maybe Text)
plcslaUploadType
= lens _plcslaUploadType
(\ s a -> s{_plcslaUploadType = a}) | 163 | plcslaUploadType
= lens _plcslaUploadType
(\ s a -> s{_plcslaUploadType = a}) | 85 | true | true | 0 | 9 | 34 | 48 | 25 | 23 | null | null |
vluukkal/aspreify | factrender.hs | mit | --- A wrapper around factbody, keeping track of the
--- items in a typed or qualified list.
-- factcard' :: [Char] -> Int -> IO Int -> Body -> ([[Char]], Int) -> ([[Char]], Int)
factcard' :: [Char] -> Integer -> Integer -> IO Integer -> Body -> ([[Char]], Int) -> ([[Char]], Int)
factcard' rel ruleid parentid ctr r (accu, previd) =
let nxt = 0 in
--- let newaccu = (accu ++ ["tlist(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ] ++ (factbody "type" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody "typed" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody rel parentid ctr r accu))
let newaccu = (factbody rel ruleid parentid ctr r accu)
-- let newaccu = tmp ++ ["tlist'(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ]
in (newaccu, (previd+1)) | 845 | factcard' :: [Char] -> Integer -> Integer -> IO Integer -> Body -> ([[Char]], Int) -> ([[Char]], Int)
factcard' rel ruleid parentid ctr r (accu, previd) =
let nxt = 0 in
--- let newaccu = (accu ++ ["tlist(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ] ++ (factbody "type" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody "typed" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody rel parentid ctr r accu))
let newaccu = (factbody rel ruleid parentid ctr r accu)
-- let newaccu = tmp ++ ["tlist'(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ]
in (newaccu, (previd+1)) | 665 | factcard' rel ruleid parentid ctr r (accu, previd) =
let nxt = 0 in
--- let newaccu = (accu ++ ["tlist(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ] ++ (factbody "type" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody "typed" parentid ctr r accu))
-- let newaccu = (accu ++ (factbody rel parentid ctr r accu))
let newaccu = (factbody rel ruleid parentid ctr r accu)
-- let newaccu = tmp ++ ["tlist'(" ++ show(parentid) ++ "," ++ show(previd) ++ "," ++ show(nxt) ++ ").\n" ]
in (newaccu, (previd+1)) | 563 | true | true | 0 | 13 | 178 | 142 | 80 | 62 | null | null |
kim/amazonka | amazonka-swf/gen/Network/AWS/SWF/Types.hs | mpl-2.0 | -- | 'WorkflowExecutionFilter' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'wefWorkflowId' @::@ 'Text'
--
workflowExecutionFilter :: Text -- ^ 'wefWorkflowId'
-> WorkflowExecutionFilter
workflowExecutionFilter p1 = WorkflowExecutionFilter
{ _wefWorkflowId = p1
} | 333 | workflowExecutionFilter :: Text -- ^ 'wefWorkflowId'
-> WorkflowExecutionFilter
workflowExecutionFilter p1 = WorkflowExecutionFilter
{ _wefWorkflowId = p1
} | 188 | workflowExecutionFilter p1 = WorkflowExecutionFilter
{ _wefWorkflowId = p1
} | 84 | true | true | 0 | 6 | 68 | 33 | 21 | 12 | null | null |
garrettpauls/Hablog | src/Hablog/Data/Config/Internal.hs | mit | nullConfig :: FilePath -> Config
nullConfig temp = Config "http://localhost" 8000 "" nullDBConfig (nullConfigBodyPolicy temp) | 125 | nullConfig :: FilePath -> Config
nullConfig temp = Config "http://localhost" 8000 "" nullDBConfig (nullConfigBodyPolicy temp) | 125 | nullConfig temp = Config "http://localhost" 8000 "" nullDBConfig (nullConfigBodyPolicy temp) | 92 | false | true | 0 | 7 | 14 | 35 | 17 | 18 | null | null |
Mahdi89/eTeak | src/Bits.hs | bsd-3-clause | impExpand (Imp value dcs) = impExpand (Imp (clearBit value topDC) dcs') ++
impExpand (Imp (setBit value topDC) dcs')
where
topDC = log2 dcs
dcs' = clearBit dcs topDC | 205 | impExpand (Imp value dcs) = impExpand (Imp (clearBit value topDC) dcs') ++
impExpand (Imp (setBit value topDC) dcs')
where
topDC = log2 dcs
dcs' = clearBit dcs topDC | 205 | impExpand (Imp value dcs) = impExpand (Imp (clearBit value topDC) dcs') ++
impExpand (Imp (setBit value topDC) dcs')
where
topDC = log2 dcs
dcs' = clearBit dcs topDC | 205 | false | false | 0 | 10 | 67 | 79 | 38 | 41 | null | null |
brendanhay/gogol | gogol-youtube-analytics/gen/Network/Google/Resource/YouTubeAnalytics/Groups/Delete.hs | mpl-2.0 | -- | This parameter can only be used in a properly authorized request.
-- **Note:** This parameter is intended exclusively for YouTube content
-- partners that own and manage many different YouTube channels. The
-- \`onBehalfOfContentOwner\` parameter indicates that the request\'s
-- authorization credentials identify a YouTube user who is acting on
-- behalf of the content owner specified in the parameter value. It allows
-- content owners to authenticate once and get access to all their video
-- and channel data, without having to provide authentication credentials
-- for each individual channel. The account that the user authenticates
-- with must be linked to the specified YouTube content owner.
gdOnBehalfOfContentOwner :: Lens' GroupsDelete (Maybe Text)
gdOnBehalfOfContentOwner
= lens _gdOnBehalfOfContentOwner
(\ s a -> s{_gdOnBehalfOfContentOwner = a}) | 878 | gdOnBehalfOfContentOwner :: Lens' GroupsDelete (Maybe Text)
gdOnBehalfOfContentOwner
= lens _gdOnBehalfOfContentOwner
(\ s a -> s{_gdOnBehalfOfContentOwner = a}) | 169 | gdOnBehalfOfContentOwner
= lens _gdOnBehalfOfContentOwner
(\ s a -> s{_gdOnBehalfOfContentOwner = a}) | 109 | true | true | 0 | 9 | 134 | 57 | 34 | 23 | null | null |
DiegoNolan/Asciify | Asciify.hs | mit | nShapeToAsccii :: NovemShape -> Char
nShapeToAsccii = (bestMatch allChars) . novShape | 85 | nShapeToAsccii :: NovemShape -> Char
nShapeToAsccii = (bestMatch allChars) . novShape | 85 | nShapeToAsccii = (bestMatch allChars) . novShape | 48 | false | true | 0 | 7 | 10 | 32 | 14 | 18 | null | null |
swift-nav/plover | src/Language/Plover/CodeGen.hs | mit | sensitiveExpLoc :: Type -> CM C.Exp -> CmLoc
sensitiveExpLoc ty mexp = case normalizeTypes ty of
ty'@(VecType {}) -> expLoc ty mexp
ty' -> simpleLoc ty'
where simpleLoc ty = CmLoc
{ apIndex = error "Cannot apIndex simple sensitiveExpLoc"
, store = \v -> do exp <- mexp
writeCode [citems| $exp = $v; |]
, asRValue = compPureExpr ty mexp
, asArgument = do exp <- mexp
return ([], exp, [])
, prepLoc = spillLoc $ simpleLoc ty
, locType = ty
}
-- | takes a C identifier and makes a simple-valued location | 752 | sensitiveExpLoc :: Type -> CM C.Exp -> CmLoc
sensitiveExpLoc ty mexp = case normalizeTypes ty of
ty'@(VecType {}) -> expLoc ty mexp
ty' -> simpleLoc ty'
where simpleLoc ty = CmLoc
{ apIndex = error "Cannot apIndex simple sensitiveExpLoc"
, store = \v -> do exp <- mexp
writeCode [citems| $exp = $v; |]
, asRValue = compPureExpr ty mexp
, asArgument = do exp <- mexp
return ([], exp, [])
, prepLoc = spillLoc $ simpleLoc ty
, locType = ty
}
-- | takes a C identifier and makes a simple-valued location | 752 | sensitiveExpLoc ty mexp = case normalizeTypes ty of
ty'@(VecType {}) -> expLoc ty mexp
ty' -> simpleLoc ty'
where simpleLoc ty = CmLoc
{ apIndex = error "Cannot apIndex simple sensitiveExpLoc"
, store = \v -> do exp <- mexp
writeCode [citems| $exp = $v; |]
, asRValue = compPureExpr ty mexp
, asArgument = do exp <- mexp
return ([], exp, [])
, prepLoc = spillLoc $ simpleLoc ty
, locType = ty
}
-- | takes a C identifier and makes a simple-valued location | 707 | false | true | 1 | 12 | 345 | 191 | 96 | 95 | null | null |
johnjcamilleri/maltese-functional-morphology | lib-1.1/General.hs | lgpl-3.0 | -- search-replace operation
changes :: [(String,String)] -> String -> String
changes cs s = case lookupMark s cs of
Just (b,e) -> e ++ changes cs (drop (length b) s)
_ -> case s of
c:t -> c : changes cs t
[] -> []
where
lookupMark _ [] = Nothing
lookupMark st ((b,e):ms) =
if isPrefixOf b st then Just (b,e) else lookupMark st ms
-- change in the beginning of a morpheme only | 400 | changes :: [(String,String)] -> String -> String
changes cs s = case lookupMark s cs of
Just (b,e) -> e ++ changes cs (drop (length b) s)
_ -> case s of
c:t -> c : changes cs t
[] -> []
where
lookupMark _ [] = Nothing
lookupMark st ((b,e):ms) =
if isPrefixOf b st then Just (b,e) else lookupMark st ms
-- change in the beginning of a morpheme only | 372 | changes cs s = case lookupMark s cs of
Just (b,e) -> e ++ changes cs (drop (length b) s)
_ -> case s of
c:t -> c : changes cs t
[] -> []
where
lookupMark _ [] = Nothing
lookupMark st ((b,e):ms) =
if isPrefixOf b st then Just (b,e) else lookupMark st ms
-- change in the beginning of a morpheme only | 323 | true | true | 0 | 13 | 99 | 192 | 97 | 95 | null | null |
np/ling | Ling/Prelude.hs | bsd-3-clause | False &&> _ = return False | 26 | False &&> _ = return False | 26 | False &&> _ = return False | 26 | false | false | 0 | 5 | 5 | 15 | 6 | 9 | null | null |
snoyberg/ghc | compiler/simplCore/SimplEnv.hs | bsd-3-clause | substCo :: SimplEnv -> Coercion -> Coercion
substCo env co = Coercion.substCo (getTCvSubst env) co | 98 | substCo :: SimplEnv -> Coercion -> Coercion
substCo env co = Coercion.substCo (getTCvSubst env) co | 98 | substCo env co = Coercion.substCo (getTCvSubst env) co | 54 | false | true | 0 | 7 | 14 | 37 | 18 | 19 | null | null |
kalouantonis/kriek | src/hs/Kriek/Compiler.hs | mit | compileFile :: FilePath -> FilePath -> IO ()
compileFile src out = do
contents <- readFile src
writeFile out $ compile (Just src) contents | 142 | compileFile :: FilePath -> FilePath -> IO ()
compileFile src out = do
contents <- readFile src
writeFile out $ compile (Just src) contents | 142 | compileFile src out = do
contents <- readFile src
writeFile out $ compile (Just src) contents | 97 | false | true | 0 | 10 | 27 | 60 | 27 | 33 | null | null |
brendanhay/gogol | gogol-pubsub/gen/Network/Google/Resource/PubSub/Projects/Snapshots/TestIAMPermissions.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
pstipUploadType :: Lens' ProjectsSnapshotsTestIAMPermissions (Maybe Text)
pstipUploadType
= lens _pstipUploadType
(\ s a -> s{_pstipUploadType = a}) | 227 | pstipUploadType :: Lens' ProjectsSnapshotsTestIAMPermissions (Maybe Text)
pstipUploadType
= lens _pstipUploadType
(\ s a -> s{_pstipUploadType = a}) | 156 | pstipUploadType
= lens _pstipUploadType
(\ s a -> s{_pstipUploadType = a}) | 82 | true | true | 0 | 8 | 34 | 49 | 25 | 24 | null | null |
peddie/latc | Numeric/LATC/NestedList.hs | gpl-3.0 | -- | Return the tail of a vector.
vtail :: Vector a -> Vector a
vtail = vlift tail | 82 | vtail :: Vector a -> Vector a
vtail = vlift tail | 48 | vtail = vlift tail | 18 | true | true | 0 | 7 | 18 | 31 | 13 | 18 | null | null |
crossroads1112/hlocate | src/HUpdate/Config.hs | gpl-3.0 | line :: Parser (Maybe (String, String))
line = skipMany space >> (try (comment >> return Nothing) <|> (item >>= return . Just)) | 127 | line :: Parser (Maybe (String, String))
line = skipMany space >> (try (comment >> return Nothing) <|> (item >>= return . Just)) | 127 | line = skipMany space >> (try (comment >> return Nothing) <|> (item >>= return . Just)) | 87 | false | true | 0 | 12 | 21 | 70 | 34 | 36 | null | null |
s9gf4ult/yesod | yesod-static/test/GeneratorTestUtil.hs | mit | testEntry _ loc _ e | ebLocation e /= loc =
[| GenError ("location " ++ $(litE $ stringL $ show $ ebLocation e)) |] | 120 | testEntry _ loc _ e | ebLocation e /= loc =
[| GenError ("location " ++ $(litE $ stringL $ show $ ebLocation e)) |] | 120 | testEntry _ loc _ e | ebLocation e /= loc =
[| GenError ("location " ++ $(litE $ stringL $ show $ ebLocation e)) |] | 120 | false | false | 2 | 9 | 29 | 34 | 15 | 19 | null | null |
rueshyna/gogol | gogol-civicinfo/gen/Network/Google/CivicInfo/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'DivisionRepresentativeInfoRequest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'drirContextParams'
divisionRepresentativeInfoRequest
:: DivisionRepresentativeInfoRequest
divisionRepresentativeInfoRequest =
DivisionRepresentativeInfoRequest'
{ _drirContextParams = Nothing
} | 403 | divisionRepresentativeInfoRequest
:: DivisionRepresentativeInfoRequest
divisionRepresentativeInfoRequest =
DivisionRepresentativeInfoRequest'
{ _drirContextParams = Nothing
} | 190 | divisionRepresentativeInfoRequest =
DivisionRepresentativeInfoRequest'
{ _drirContextParams = Nothing
} | 115 | true | true | 1 | 6 | 60 | 30 | 17 | 13 | null | null |
ecaustin/haskhol-deductive | src/HaskHOL/Lib/Classic/PQ.hs | bsd-2-clause | -- Lift Parse Context and define quasi-quoter
pcClassic :: ParseContext
pcClassic = $(liftParseContext ctxtClassic) | 115 | pcClassic :: ParseContext
pcClassic = $(liftParseContext ctxtClassic) | 69 | pcClassic = $(liftParseContext ctxtClassic) | 43 | true | true | 0 | 8 | 13 | 26 | 11 | 15 | null | null |
Gleuton/curso-haskell | reverse_list.hs | gpl-3.0 | reverse_list (x:xs) = reverse_list xs ++ [x] | 44 | reverse_list (x:xs) = reverse_list xs ++ [x] | 44 | reverse_list (x:xs) = reverse_list xs ++ [x] | 44 | false | false | 0 | 7 | 6 | 26 | 13 | 13 | null | null |
jstolarek/ghc | libraries/integer-gmp2/src/GHC/Integer/GMP/Internals.hs | bsd-3-clause | -- | Compute number of digits (without sign) in given @/base/@.
--
-- This function wraps @mpz_sizeinbase()@ which has some
-- implementation pecularities to take into account:
--
-- * \"@'sizeInBaseInteger' 0 /base/ = 1@\"
-- (see also comment in 'exportIntegerToMutableByteArray').
--
-- * This function is only defined if @/base/ >= 2#@ and @/base/ <= 256#@
-- (Note: the documentation claims that only @/base/ <= 62#@ is
-- supported, however the actual implementation supports up to base 256).
--
-- * If @/base/@ is a power of 2, the result will be exact. In other
-- cases (e.g. for @/base/ = 10#@), the result /may/ be 1 digit too large
-- sometimes.
--
-- * \"@'sizeInBaseInteger' /i/ 2#@\" can be used to determine the most
-- significant bit of @/i/@.
--
-- /Since: 0.5.1.0/
sizeInBaseInteger :: Integer -> Int# -> Word#
sizeInBaseInteger (S# i#) = sizeInBaseWord# (int2Word# (absI# i#)) | 911 | sizeInBaseInteger :: Integer -> Int# -> Word#
sizeInBaseInteger (S# i#) = sizeInBaseWord# (int2Word# (absI# i#)) | 113 | sizeInBaseInteger (S# i#) = sizeInBaseWord# (int2Word# (absI# i#)) | 67 | true | true | 0 | 10 | 162 | 68 | 42 | 26 | null | null |
brendanhay/gogol | gogol-partners/gen/Network/Google/Resource/Partners/Companies/Get.hs | mpl-2.0 | -- | V1 error format.
cgXgafv :: Lens' CompaniesGet (Maybe Xgafv)
cgXgafv = lens _cgXgafv (\ s a -> s{_cgXgafv = a}) | 116 | cgXgafv :: Lens' CompaniesGet (Maybe Xgafv)
cgXgafv = lens _cgXgafv (\ s a -> s{_cgXgafv = a}) | 94 | cgXgafv = lens _cgXgafv (\ s a -> s{_cgXgafv = a}) | 50 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
adarqui/LogFS | examples/simple.hs | gpl-3.0 | runBackendStdout :: Integer -> Chan Packet -> IO ()
runBackendStdout n ch = do
pkt <- readChan ch
putStrLn $ "got("++show n++"): " ++ show pkt | 144 | runBackendStdout :: Integer -> Chan Packet -> IO ()
runBackendStdout n ch = do
pkt <- readChan ch
putStrLn $ "got("++show n++"): " ++ show pkt | 144 | runBackendStdout n ch = do
pkt <- readChan ch
putStrLn $ "got("++show n++"): " ++ show pkt | 92 | false | true | 0 | 10 | 27 | 67 | 30 | 37 | null | null |
acowley/ghc | compiler/utils/StringBuffer.hs | bsd-3-clause | stepOn :: StringBuffer -> StringBuffer
stepOn s = snd (nextChar s) | 66 | stepOn :: StringBuffer -> StringBuffer
stepOn s = snd (nextChar s) | 66 | stepOn s = snd (nextChar s) | 27 | false | true | 0 | 7 | 10 | 30 | 14 | 16 | null | null |
fgaz/shine | src/Graphics/Shine/Render.hs | mit | render ctx (Colored _ (Colored col pic)) =
render ctx $ Colored col pic | 75 | render ctx (Colored _ (Colored col pic)) =
render ctx $ Colored col pic | 75 | render ctx (Colored _ (Colored col pic)) =
render ctx $ Colored col pic | 75 | false | false | 2 | 8 | 17 | 42 | 18 | 24 | null | null |
marcinmrotek/hsqml-fork | test/Graphics/QML/Test/ScriptDSL.hs | bsd-3-clause | var :: Int -> Expr
var 0 = Global | 33 | var :: Int -> Expr
var 0 = Global | 33 | var 0 = Global | 14 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
andyarvanitis/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | constIsType (B32 _) = False | 27 | constIsType (B32 _) = False | 27 | constIsType (B32 _) = False | 27 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
deciduously/Haskell-First-Principles-Exercises | 3-Getting serious/11-Algebraic Datatypes/code/vehicles.hs | mit | myCar = Car Mini (Price 14000) | 33 | myCar = Car Mini (Price 14000) | 33 | myCar = Car Mini (Price 14000) | 33 | false | false | 0 | 7 | 8 | 17 | 8 | 9 | null | null |
tpsinnem/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | writeIBC :: FilePath -> FilePath -> Idris ()
writeIBC src f
= do logIBC 1 $ "Writing ibc " ++ show f
i <- getIState
-- case (Data.List.map fst (idris_metavars i)) \\ primDefs of
-- (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
-- [] -> return ()
resetNameIdx
ibcf <- mkIBC (ibc_write i) (initIBC { sourcefile = src })
idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
writeArchive f ibcf
logIBC 1 "Written")
(\c -> do logIBC 1 $ "Failed " ++ pshow i c)
return ()
-- | Write a package index containing all the imports in the current
-- IState Used for ':search' of an entire package, to ensure
-- everything is loaded. | 813 | writeIBC :: FilePath -> FilePath -> Idris ()
writeIBC src f
= do logIBC 1 $ "Writing ibc " ++ show f
i <- getIState
-- case (Data.List.map fst (idris_metavars i)) \\ primDefs of
-- (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
-- [] -> return ()
resetNameIdx
ibcf <- mkIBC (ibc_write i) (initIBC { sourcefile = src })
idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
writeArchive f ibcf
logIBC 1 "Written")
(\c -> do logIBC 1 $ "Failed " ++ pshow i c)
return ()
-- | Write a package index containing all the imports in the current
-- IState Used for ':search' of an entire package, to ensure
-- everything is loaded. | 813 | writeIBC src f
= do logIBC 1 $ "Writing ibc " ++ show f
i <- getIState
-- case (Data.List.map fst (idris_metavars i)) \\ primDefs of
-- (_:_) -> ifail "Can't write ibc when there are unsolved metavariables"
-- [] -> return ()
resetNameIdx
ibcf <- mkIBC (ibc_write i) (initIBC { sourcefile = src })
idrisCatch (do runIO $ createDirectoryIfMissing True (dropFileName f)
writeArchive f ibcf
logIBC 1 "Written")
(\c -> do logIBC 1 $ "Failed " ++ pshow i c)
return ()
-- | Write a package index containing all the imports in the current
-- IState Used for ':search' of an entire package, to ensure
-- everything is loaded. | 768 | false | true | 0 | 15 | 269 | 176 | 82 | 94 | null | null |
ocharles/hackage-server | Distribution/Server/Features/Search/DocIdSet.hs | bsd-3-clause | union (DocIdSet xs) (DocIdSet ys) =
DocIdSet (VU.create (MVU.new sizeBound >>= writeMerged xs ys))
where
sizeBound = VU.length xs + VU.length ys | 154 | union (DocIdSet xs) (DocIdSet ys) =
DocIdSet (VU.create (MVU.new sizeBound >>= writeMerged xs ys))
where
sizeBound = VU.length xs + VU.length ys | 154 | union (DocIdSet xs) (DocIdSet ys) =
DocIdSet (VU.create (MVU.new sizeBound >>= writeMerged xs ys))
where
sizeBound = VU.length xs + VU.length ys | 154 | false | false | 2 | 10 | 31 | 80 | 34 | 46 | null | null |
gridaphobe/target | src/Test/Target/Targetable/Function.hs | mit | getCtors :: SpecType -> [GHC.DataCon]
getCtors (RApp c _ _ _) = GHC.tyConDataCons $ rtc_tc c | 92 | getCtors :: SpecType -> [GHC.DataCon]
getCtors (RApp c _ _ _) = GHC.tyConDataCons $ rtc_tc c | 92 | getCtors (RApp c _ _ _) = GHC.tyConDataCons $ rtc_tc c | 54 | false | true | 0 | 7 | 15 | 48 | 23 | 25 | null | null |
elopez/QuickFuzz | app/Utils/Patch.hs | gpl-3.0 | patch :: [Patch] -> ByteString -> ByteString
patch [] orig = orig | 65 | patch :: [Patch] -> ByteString -> ByteString
patch [] orig = orig | 65 | patch [] orig = orig | 20 | false | true | 0 | 6 | 11 | 29 | 15 | 14 | null | null |
jyp/ling | Ling/Term/Checker.hs | bsd-3-clause | checkApp :: Typ -> [Term] -> TC Typ
checkApp typ [] = return typ | 68 | checkApp :: Typ -> [Term] -> TC Typ
checkApp typ [] = return typ | 68 | checkApp typ [] = return typ | 32 | false | true | 0 | 7 | 17 | 35 | 17 | 18 | null | null |
nagyf/wyas | src/Parser.hs | mit | parseNumber :: Parser LispVal
parseNumber = liftM (Number . read) $ many1 digit | 79 | parseNumber :: Parser LispVal
parseNumber = liftM (Number . read) $ many1 digit | 79 | parseNumber = liftM (Number . read) $ many1 digit | 49 | false | true | 0 | 7 | 12 | 36 | 16 | 20 | null | null |
keithodulaigh/Hets | Temporal/NuSmv.hs | gpl-2.0 | showBasicExpr (Neg expr) outer = '-' : showBasicExpr expr False | 63 | showBasicExpr (Neg expr) outer = '-' : showBasicExpr expr False | 63 | showBasicExpr (Neg expr) outer = '-' : showBasicExpr expr False | 63 | false | false | 1 | 6 | 9 | 30 | 12 | 18 | null | null |
asr/apia | src/Apia/Utils/Text.hs | mit | -----------------------------------------------------------------------------
-- | Append synonymous.
(+++) ∷ Text → Text → Text
(+++) = T.append
| 146 | (+++) ∷ Text → Text → Text
(+++) = T.append | 43 | (+++) = T.append | 16 | true | true | 0 | 8 | 15 | 33 | 18 | 15 | null | null |
achirkin/qua-kit | apps/hs/qua-server/src/Handler/Mooc/Survey.hs | mit | intInput :: Text -> AForm Handler (Text,Maybe Text)
intInput n = (,) n . fmap (pack . (show :: Int -> String)) <$> aopt intField (bfs n) Nothing | 144 | intInput :: Text -> AForm Handler (Text,Maybe Text)
intInput n = (,) n . fmap (pack . (show :: Int -> String)) <$> aopt intField (bfs n) Nothing | 144 | intInput n = (,) n . fmap (pack . (show :: Int -> String)) <$> aopt intField (bfs n) Nothing | 92 | false | true | 0 | 11 | 27 | 79 | 40 | 39 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Compiler.hs | bsd-3-clause | compileProcedure (IfThenElseBoolBool e cb1 cb2) =
compileIfThenElseEitherProcedure BoolType BoolType e cb1 cb2 | 114 | compileProcedure (IfThenElseBoolBool e cb1 cb2) =
compileIfThenElseEitherProcedure BoolType BoolType e cb1 cb2 | 114 | compileProcedure (IfThenElseBoolBool e cb1 cb2) =
compileIfThenElseEitherProcedure BoolType BoolType e cb1 cb2 | 114 | false | false | 0 | 7 | 15 | 30 | 14 | 16 | null | null |
arjantop/gifter | src/Gifter/TaggedValue.hs | bsd-3-clause | getValue :: TaggedValue t a -> a
getValue (TaggedValue _ a) = a | 63 | getValue :: TaggedValue t a -> a
getValue (TaggedValue _ a) = a | 63 | getValue (TaggedValue _ a) = a | 30 | false | true | 0 | 9 | 12 | 37 | 16 | 21 | null | null |
joe9/barrelfish | tools/mackerel/BitFieldDriver.hs | mit | -- Device representation structure generator
device_struct_def :: Dev.Rec -> [String]
device_struct_def d =
[ C.multi_comment "Device representation structure",
C.typedef dev_t (unlines strct) ]
where
args = map convert_arg (Dev.args d)
strct = C.struct dev_t ( [ C.comment "Device arguments" ]
++
[ (C.struct_field n v) | Arg n v <- args ]
++
[ C.comment "Shadow registers" ]
++
[ device_struct_shadow s | s <- (Dev.shdws d)]
) | 685 | device_struct_def :: Dev.Rec -> [String]
device_struct_def d =
[ C.multi_comment "Device representation structure",
C.typedef dev_t (unlines strct) ]
where
args = map convert_arg (Dev.args d)
strct = C.struct dev_t ( [ C.comment "Device arguments" ]
++
[ (C.struct_field n v) | Arg n v <- args ]
++
[ C.comment "Shadow registers" ]
++
[ device_struct_shadow s | s <- (Dev.shdws d)]
) | 626 | device_struct_def d =
[ C.multi_comment "Device representation structure",
C.typedef dev_t (unlines strct) ]
where
args = map convert_arg (Dev.args d)
strct = C.struct dev_t ( [ C.comment "Device arguments" ]
++
[ (C.struct_field n v) | Arg n v <- args ]
++
[ C.comment "Shadow registers" ]
++
[ device_struct_shadow s | s <- (Dev.shdws d)]
) | 585 | true | true | 0 | 15 | 324 | 159 | 81 | 78 | null | null |
justinethier/husk-scheme | hs-src/Language/Scheme/Types.hs | mit | showVal (String contents) = "\"" ++ contents ++ "\"" | 52 | showVal (String contents) = "\"" ++ contents ++ "\"" | 52 | showVal (String contents) = "\"" ++ contents ++ "\"" | 52 | false | false | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Client/UI/Key.hs | bsd-3-clause | keyTranslate "Caps_Lock" = DeadKey | 41 | keyTranslate "Caps_Lock" = DeadKey | 41 | keyTranslate "Caps_Lock" = DeadKey | 41 | false | false | 0 | 5 | 10 | 9 | 4 | 5 | null | null |
piotrm0/planar | Parser.hs | artistic-2.0 | binary s assoc = Ex.Infix (reservedOp s >> return (BinaryOp s)) assoc | 69 | binary s assoc = Ex.Infix (reservedOp s >> return (BinaryOp s)) assoc | 69 | binary s assoc = Ex.Infix (reservedOp s >> return (BinaryOp s)) assoc | 69 | false | false | 0 | 10 | 11 | 37 | 17 | 20 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | The name of the prefix.
plPrefixListName :: Lens' PrefixList (Maybe Text)
plPrefixListName = lens _plPrefixListName (\ s a -> s{_plPrefixListName = a}) | 156 | plPrefixListName :: Lens' PrefixList (Maybe Text)
plPrefixListName = lens _plPrefixListName (\ s a -> s{_plPrefixListName = a}) | 127 | plPrefixListName = lens _plPrefixListName (\ s a -> s{_plPrefixListName = a}) | 77 | true | true | 0 | 9 | 23 | 46 | 25 | 21 | null | null |
kazu-yamamoto/wai | warp/test/RequestSpec.hs | mit | main :: IO ()
main = hspec spec | 31 | main :: IO ()
main = hspec spec | 31 | main = hspec spec | 17 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
OpenXT/manager | xenmgr/Vm/Queries.hs | gpl-2.0 | getVmMeasured uuid = readConfigPropertyDef uuid vmMeasured False | 64 | getVmMeasured uuid = readConfigPropertyDef uuid vmMeasured False | 64 | getVmMeasured uuid = readConfigPropertyDef uuid vmMeasured False | 64 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
fmapfmapfmap/amazonka | amazonka-ds/gen/Network/AWS/DirectoryService/Types/Product.hs | mpl-2.0 | -- | The shared secret code that was specified when your RADIUS endpoints
-- were created.
rsSharedSecret :: Lens' RadiusSettings (Maybe Text)
rsSharedSecret = lens _rsSharedSecret (\ s a -> s{_rsSharedSecret = a}) . mapping _Sensitive | 235 | rsSharedSecret :: Lens' RadiusSettings (Maybe Text)
rsSharedSecret = lens _rsSharedSecret (\ s a -> s{_rsSharedSecret = a}) . mapping _Sensitive | 144 | rsSharedSecret = lens _rsSharedSecret (\ s a -> s{_rsSharedSecret = a}) . mapping _Sensitive | 92 | true | true | 1 | 10 | 35 | 57 | 29 | 28 | null | null |
gcampax/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey,
mutVarPrimTyConKey, ioTyConKey,
wordPrimTyConKey, wordTyConKey, word8TyConKey, word16TyConKey,
word32PrimTyConKey, word32TyConKey, word64PrimTyConKey, word64TyConKey,
liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey,
typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey,
funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey,
eqReprPrimTyConKey, voidPrimTyConKey :: Unique
statePrimTyConKey = mkPreludeTyConUnique 50 | 554 | statePrimTyConKey, stableNamePrimTyConKey, stableNameTyConKey,
mutVarPrimTyConKey, ioTyConKey,
wordPrimTyConKey, wordTyConKey, word8TyConKey, word16TyConKey,
word32PrimTyConKey, word32TyConKey, word64PrimTyConKey, word64TyConKey,
liftedConKey, unliftedConKey, anyBoxConKey, kindConKey, boxityConKey,
typeConKey, threadIdPrimTyConKey, bcoPrimTyConKey, ptrTyConKey,
funPtrTyConKey, tVarPrimTyConKey, eqPrimTyConKey,
eqReprPrimTyConKey, voidPrimTyConKey :: Unique
statePrimTyConKey = mkPreludeTyConUnique 50 | 554 | statePrimTyConKey = mkPreludeTyConUnique 50 | 65 | false | true | 0 | 5 | 82 | 66 | 59 | 7 | null | null |
Cahu/krpc-hs | src/KRPCHS/SpaceCenter.hs | gpl-3.0 | {-
- The seed of the icon color. See <see cref="M:SpaceCenter.WaypointManager.Colors" /> for example colors.
-}
getWaypointColor :: KRPCHS.SpaceCenter.Waypoint -> RPCContext (Data.Int.Int32)
getWaypointColor thisArg = do
let r = makeRequest "SpaceCenter" "Waypoint_get_Color" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 355 | getWaypointColor :: KRPCHS.SpaceCenter.Waypoint -> RPCContext (Data.Int.Int32)
getWaypointColor thisArg = do
let r = makeRequest "SpaceCenter" "Waypoint_get_Color" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 241 | getWaypointColor thisArg = do
let r = makeRequest "SpaceCenter" "Waypoint_get_Color" [makeArgument 0 thisArg]
res <- sendRequest r
processResponse res | 162 | true | true | 0 | 13 | 54 | 76 | 35 | 41 | null | null |
eriksvedang/Pearls | src/Pearl2.hs | bsd-3-clause | cclique2 :: Integer -> [Integer]
cclique2 n = (head . ccliques) [1..n] | 70 | cclique2 :: Integer -> [Integer]
cclique2 n = (head . ccliques) [1..n] | 70 | cclique2 n = (head . ccliques) [1..n] | 37 | false | true | 0 | 7 | 11 | 36 | 19 | 17 | null | null |
sfultong/stand-in-language | src/SIL/Parser.hs | apache-2.0 | addBound :: String -> Term1 -> ParserState -> Maybe ParserState
addBound name expr (ParserState bound) = if Map.member name bound
then Nothing
else pure $ ParserState (Map.insert name expr bound) | 199 | addBound :: String -> Term1 -> ParserState -> Maybe ParserState
addBound name expr (ParserState bound) = if Map.member name bound
then Nothing
else pure $ ParserState (Map.insert name expr bound) | 199 | addBound name expr (ParserState bound) = if Map.member name bound
then Nothing
else pure $ ParserState (Map.insert name expr bound) | 135 | false | true | 0 | 10 | 33 | 73 | 36 | 37 | null | null |
supki/libjenkins | src/Jenkins/Rest/Method/Internal.hs | bsd-2-clause | renderQ' Empty = renderT "" | 36 | renderQ' Empty = renderT "" | 36 | renderQ' Empty = renderT "" | 36 | false | false | 0 | 5 | 13 | 12 | 5 | 7 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 82365 = 4843 | 32 | getValueFromProduct 82365 = 4843 | 32 | getValueFromProduct 82365 = 4843 | 32 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
phischu/fragnix | builtins/ghc-prim/GHC.Prim.hs | bsd-3-clause | -- | Read a vector from specified index of immutable array.
indexFloatX8Array# :: ByteArray# -> Int# -> FloatX8#
indexFloatX8Array# = indexFloatX8Array# | 154 | indexFloatX8Array# :: ByteArray# -> Int# -> FloatX8#
indexFloatX8Array# = indexFloatX8Array# | 92 | indexFloatX8Array# = indexFloatX8Array# | 39 | true | true | 0 | 6 | 22 | 20 | 11 | 9 | null | null |
rodrigo-machado/verigraph | src/library/Util/Map.hs | gpl-3.0 | -- | Given a list of key-value pairs, create a map from each value to its keys. /O(n*log(n))/
inverse :: Ord v => [(k, v)] -> Map v [k]
inverse = foldl' addInverse Map.empty
where addInverse m (k, v) = Map.insertWith (++) v [k] m
-- | @lookupMaybe x m@ is shorthand for @x >>= (`lookup` m)@ | 293 | inverse :: Ord v => [(k, v)] -> Map v [k]
inverse = foldl' addInverse Map.empty
where addInverse m (k, v) = Map.insertWith (++) v [k] m
-- | @lookupMaybe x m@ is shorthand for @x >>= (`lookup` m)@ | 199 | inverse = foldl' addInverse Map.empty
where addInverse m (k, v) = Map.insertWith (++) v [k] m
-- | @lookupMaybe x m@ is shorthand for @x >>= (`lookup` m)@ | 157 | true | true | 0 | 8 | 59 | 82 | 45 | 37 | null | null |
aelve/guide | back/src/Guide/ServerStuff.hs | bsd-3-clause | dbQuery :: (MonadIO m, HasSpock m, SpockState m ~ ServerState,
EventState event ~ GlobalState, QueryEvent event)
=> event -> m (EventResult event)
dbQuery x = do
db <- _db <$> Spock.getState
liftIO $ Acid.query db x
----------------------------------------------------------------------------
-- Edits
----------------------------------------------------------------------------
-- | Remember an edit.
--
-- Call this whenever any user-made change is applied to the database. | 501 | dbQuery :: (MonadIO m, HasSpock m, SpockState m ~ ServerState,
EventState event ~ GlobalState, QueryEvent event)
=> event -> m (EventResult event)
dbQuery x = do
db <- _db <$> Spock.getState
liftIO $ Acid.query db x
----------------------------------------------------------------------------
-- Edits
----------------------------------------------------------------------------
-- | Remember an edit.
--
-- Call this whenever any user-made change is applied to the database. | 501 | dbQuery x = do
db <- _db <$> Spock.getState
liftIO $ Acid.query db x
----------------------------------------------------------------------------
-- Edits
----------------------------------------------------------------------------
-- | Remember an edit.
--
-- Call this whenever any user-made change is applied to the database. | 334 | false | true | 0 | 9 | 83 | 103 | 52 | 51 | null | null |
sapek/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | macron 'a' = "ā" | 16 | macron 'a' = "ā" | 16 | macron 'a' = "ā" | 16 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
nushio3/ghc | compiler/main/TidyPgm.hs | bsd-3-clause | cafRefsE p (Lit lit) = cafRefsL p lit | 47 | cafRefsE p (Lit lit) = cafRefsL p lit | 47 | cafRefsE p (Lit lit) = cafRefsL p lit | 47 | false | false | 0 | 6 | 17 | 24 | 10 | 14 | null | null |
kawu/dawg | src/Data/DAWG/Static.hs | bsd-2-clause | -- | Follow the path from the given identifier.
follow :: Unbox b => [Sym] -> ID -> DAWG a b c -> Maybe ID
follow (x:xs) i d = do
j <- N.onSym x (nodeBy i d)
follow xs j d | 179 | follow :: Unbox b => [Sym] -> ID -> DAWG a b c -> Maybe ID
follow (x:xs) i d = do
j <- N.onSym x (nodeBy i d)
follow xs j d | 131 | follow (x:xs) i d = do
j <- N.onSym x (nodeBy i d)
follow xs j d | 72 | true | true | 0 | 10 | 49 | 90 | 43 | 47 | null | null |
formrre/yi | yi-core/src/Yi/Buffer/TextUnit.hs | gpl-2.0 | numberOfB :: TextUnit -> TextUnit -> BufferM Int
numberOfB unit containingUnit = savingPointB $ do
maybeMoveB containingUnit Backward
start <- pointB
moveB containingUnit Forward
end <- pointB
moveTo start
length <$> untilB ((>= end) <$> pointB) (moveB unit Forward) | 380 | numberOfB :: TextUnit -> TextUnit -> BufferM Int
numberOfB unit containingUnit = savingPointB $ do
maybeMoveB containingUnit Backward
start <- pointB
moveB containingUnit Forward
end <- pointB
moveTo start
length <$> untilB ((>= end) <$> pointB) (moveB unit Forward) | 380 | numberOfB unit containingUnit = savingPointB $ do
maybeMoveB containingUnit Backward
start <- pointB
moveB containingUnit Forward
end <- pointB
moveTo start
length <$> untilB ((>= end) <$> pointB) (moveB unit Forward) | 331 | false | true | 0 | 12 | 152 | 98 | 45 | 53 | null | null |
markwright/antlrc-examples | src/tapl/arith/Semantic.hs | bsd-3-clause | isval _ = False | 15 | isval _ = False | 15 | isval _ = False | 15 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
zepto-lang/zepto-js | src/Zepto/Primitives/LogMathPrimitives.hs | gpl-2.0 | numPow badArgList = throwError $ NumArgs 2 badArgList | 53 | numPow badArgList = throwError $ NumArgs 2 badArgList | 53 | numPow badArgList = throwError $ NumArgs 2 badArgList | 53 | false | false | 1 | 6 | 7 | 21 | 8 | 13 | null | null |
rueshyna/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The dimension from which deleted cells will be replaced with. If ROWS,
-- existing cells will be shifted upward to replace the deleted cells. If
-- COLUMNS, existing cells will be shifted left to replace the deleted
-- cells.
drrShiftDimension :: Lens' DeleteRangeRequest (Maybe DeleteRangeRequestShiftDimension)
drrShiftDimension
= lens _drrShiftDimension
(\ s a -> s{_drrShiftDimension = a}) | 406 | drrShiftDimension :: Lens' DeleteRangeRequest (Maybe DeleteRangeRequestShiftDimension)
drrShiftDimension
= lens _drrShiftDimension
(\ s a -> s{_drrShiftDimension = a}) | 175 | drrShiftDimension
= lens _drrShiftDimension
(\ s a -> s{_drrShiftDimension = a}) | 88 | true | true | 0 | 8 | 65 | 52 | 28 | 24 | null | null |
urbanslug/ghc | libraries/template-haskell/Language/Haskell/TH/Lib.hs | bsd-3-clause | stdCall = StdCall | 20 | stdCall = StdCall | 20 | stdCall = StdCall | 20 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.