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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
spencerjanssen/cabal2nix | src/Cabal2Nix/Normalize.hs | bsd-3-clause | normalizeList :: [String] -> [String]
normalizeList = nub . sortBy (compare `on` map toLower) . filter (not . null) | 115 | normalizeList :: [String] -> [String]
normalizeList = nub . sortBy (compare `on` map toLower) . filter (not . null) | 115 | normalizeList = nub . sortBy (compare `on` map toLower) . filter (not . null) | 77 | false | true | 0 | 10 | 18 | 54 | 29 | 25 | null | null |
houli/shape-server | src/Colour.hs | mit | yellow = Yellow | 16 | yellow = Yellow | 16 | yellow = Yellow | 16 | false | false | 0 | 4 | 3 | 6 | 3 | 3 | null | null |
tomjefferys/fuligite | test/Test.hs | mit | testScript :: [TestComp]
testScript = [] | 40 | testScript :: [TestComp]
testScript = [] | 40 | testScript = [] | 15 | false | true | 0 | 7 | 5 | 23 | 10 | 13 | null | null |
nbloomf/carl | src/Carl/Algebra/Ring.hs | gpl-3.0 | rEuclidBezoutT :: (Ringoid t, URingoid t, EDoid t) => t -> t -> t -> Either AlgErr (t,t)
rEuclidBezoutT _ = rEuclidBezout | 121 | rEuclidBezoutT :: (Ringoid t, URingoid t, EDoid t) => t -> t -> t -> Either AlgErr (t,t)
rEuclidBezoutT _ = rEuclidBezout | 121 | rEuclidBezoutT _ = rEuclidBezout | 32 | false | true | 0 | 10 | 21 | 58 | 30 | 28 | null | null |
tadeuzagallo/verve-lang | src/Core/Desugar.hs | mit | d_intfMethod (IntfOperator { intfOpName }) next = do
s_name <- var
j <- contVar
let def = CA.FunDef (CA.Var intfOpName) j [CA.Var "#dict", CA.Var "#_"] (CA.LetVal s_name (CA.Lit $ String intfOpName) (CA.App (mk_var "#fieldAccess") j [s_name, mk_var "#dict"]))
return $ CA.LetFun [def] next | 297 | d_intfMethod (IntfOperator { intfOpName }) next = do
s_name <- var
j <- contVar
let def = CA.FunDef (CA.Var intfOpName) j [CA.Var "#dict", CA.Var "#_"] (CA.LetVal s_name (CA.Lit $ String intfOpName) (CA.App (mk_var "#fieldAccess") j [s_name, mk_var "#dict"]))
return $ CA.LetFun [def] next | 297 | d_intfMethod (IntfOperator { intfOpName }) next = do
s_name <- var
j <- contVar
let def = CA.FunDef (CA.Var intfOpName) j [CA.Var "#dict", CA.Var "#_"] (CA.LetVal s_name (CA.Lit $ String intfOpName) (CA.App (mk_var "#fieldAccess") j [s_name, mk_var "#dict"]))
return $ CA.LetFun [def] next | 297 | false | false | 0 | 16 | 50 | 146 | 71 | 75 | null | null |
gspindles/rftg-cards | src/Game/RftG/Cards/RvI.hs | mit | imperiumCloakingTechnology :: Card
imperiumCloakingTechnology = Card
Development
"IMPERIUM CLOAKING TECHNOLOGY"
(Cost 1)
(VP 1)
Nothing
[Imperium]
[Settle] | 169 | imperiumCloakingTechnology :: Card
imperiumCloakingTechnology = Card
Development
"IMPERIUM CLOAKING TECHNOLOGY"
(Cost 1)
(VP 1)
Nothing
[Imperium]
[Settle] | 169 | imperiumCloakingTechnology = Card
Development
"IMPERIUM CLOAKING TECHNOLOGY"
(Cost 1)
(VP 1)
Nothing
[Imperium]
[Settle] | 134 | false | true | 0 | 6 | 30 | 50 | 23 | 27 | null | null |
ocharles/hackage-server | tests/PackageTestMain.hs | bsd-3-clause | goodTest :: HUnit.Test
goodTest = testPermissions "tests/permissions-tarballs/good-perms.tar.gz" goodMangler | 108 | goodTest :: HUnit.Test
goodTest = testPermissions "tests/permissions-tarballs/good-perms.tar.gz" goodMangler | 108 | goodTest = testPermissions "tests/permissions-tarballs/good-perms.tar.gz" goodMangler | 85 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
wavewave/HROOT | HROOT-generate/lib/HROOT/Data/IO/Class.hs | gpl-3.0 | ioclass :: String -> [Class] -> [Function] -> Class
ioclass n ps fs =
Class {
class_cabal = iocabal
, class_name = n
, class_parents = ps
, class_protected = Protected []
, class_alias = Nothing
, class_funcs = fs
, class_vars = []
, class_tmpl_funcs = []
, class_has_proxy = False
} | 359 | ioclass :: String -> [Class] -> [Function] -> Class
ioclass n ps fs =
Class {
class_cabal = iocabal
, class_name = n
, class_parents = ps
, class_protected = Protected []
, class_alias = Nothing
, class_funcs = fs
, class_vars = []
, class_tmpl_funcs = []
, class_has_proxy = False
} | 359 | ioclass n ps fs =
Class {
class_cabal = iocabal
, class_name = n
, class_parents = ps
, class_protected = Protected []
, class_alias = Nothing
, class_funcs = fs
, class_vars = []
, class_tmpl_funcs = []
, class_has_proxy = False
} | 307 | false | true | 0 | 9 | 128 | 109 | 62 | 47 | null | null |
sol/aeson | Data/Aeson/TH.hs | bsd-3-clause | -- | Wrap fields of a constructor.
sumToValue
:: ToJSONFun
-- ^ The method being derived.
-> Options
-- ^ Deriving options.
-> Bool
-- ^ Does this type have multiple constructors.
-> Bool
-- ^ Is this constructor nullary.
-> Name
-- ^ Constructor name.
-> ExpQ
-- ^ Fields of the constructor as a 'Value' or 'Encoding'.
-> (String -> ExpQ)
-- ^ Representation of an 'Object' fragment used for the 'TaggedObject'
-- variant; of type @[(Text,Value)]@ or @[Encoding]@, depending on the method
-- being derived.
--
-- - For non-records, produces a pair @"contentsFieldName":value@,
-- given a @contentsFieldName@ as an argument. See 'opaqueSumToValue'.
-- - For records, produces the list of pairs corresponding to fields of the
-- encoded value (ignores the argument). See 'recordSumToValue'.
-> ExpQ
sumToValue target opts multiCons nullary conName value pairs
| multiCons =
case sumEncoding opts of
TwoElemArray ->
array target [conStr target opts conName, value]
TaggedObject{tagFieldName, contentsFieldName} ->
-- TODO: Maybe throw an error in case
-- tagFieldName overwrites a field in pairs.
let tag = pairE tagFieldName (conStr target opts conName)
content = pairs contentsFieldName
in fromPairsE $
if nullary then tag else infixApp tag [|(Monoid.<>)|] content
ObjectWithSingleField ->
objectE [(conString opts conName, value)]
UntaggedValue | nullary -> conStr target opts conName
UntaggedValue -> value
| otherwise = value | 1,644 | sumToValue
:: ToJSONFun
-- ^ The method being derived.
-> Options
-- ^ Deriving options.
-> Bool
-- ^ Does this type have multiple constructors.
-> Bool
-- ^ Is this constructor nullary.
-> Name
-- ^ Constructor name.
-> ExpQ
-- ^ Fields of the constructor as a 'Value' or 'Encoding'.
-> (String -> ExpQ)
-- ^ Representation of an 'Object' fragment used for the 'TaggedObject'
-- variant; of type @[(Text,Value)]@ or @[Encoding]@, depending on the method
-- being derived.
--
-- - For non-records, produces a pair @"contentsFieldName":value@,
-- given a @contentsFieldName@ as an argument. See 'opaqueSumToValue'.
-- - For records, produces the list of pairs corresponding to fields of the
-- encoded value (ignores the argument). See 'recordSumToValue'.
-> ExpQ
sumToValue target opts multiCons nullary conName value pairs
| multiCons =
case sumEncoding opts of
TwoElemArray ->
array target [conStr target opts conName, value]
TaggedObject{tagFieldName, contentsFieldName} ->
-- TODO: Maybe throw an error in case
-- tagFieldName overwrites a field in pairs.
let tag = pairE tagFieldName (conStr target opts conName)
content = pairs contentsFieldName
in fromPairsE $
if nullary then tag else infixApp tag [|(Monoid.<>)|] content
ObjectWithSingleField ->
objectE [(conString opts conName, value)]
UntaggedValue | nullary -> conStr target opts conName
UntaggedValue -> value
| otherwise = value | 1,609 | sumToValue target opts multiCons nullary conName value pairs
| multiCons =
case sumEncoding opts of
TwoElemArray ->
array target [conStr target opts conName, value]
TaggedObject{tagFieldName, contentsFieldName} ->
-- TODO: Maybe throw an error in case
-- tagFieldName overwrites a field in pairs.
let tag = pairE tagFieldName (conStr target opts conName)
content = pairs contentsFieldName
in fromPairsE $
if nullary then tag else infixApp tag [|(Monoid.<>)|] content
ObjectWithSingleField ->
objectE [(conString opts conName, value)]
UntaggedValue | nullary -> conStr target opts conName
UntaggedValue -> value
| otherwise = value | 798 | true | true | 0 | 15 | 434 | 249 | 130 | 119 | null | null |
dirkz/Thinking_Functionally_With_Haskell | 3/Nat.hs | isc | divModN m n
| m < n = (Zero, m)
| (m == n) = (Succ Zero, Zero)
| otherwise = (Succ q, r)
where
(q, r) = divModN (m - n) n | 137 | divModN m n
| m < n = (Zero, m)
| (m == n) = (Succ Zero, Zero)
| otherwise = (Succ q, r)
where
(q, r) = divModN (m - n) n | 137 | divModN m n
| m < n = (Zero, m)
| (m == n) = (Succ Zero, Zero)
| otherwise = (Succ q, r)
where
(q, r) = divModN (m - n) n | 137 | false | false | 1 | 9 | 48 | 96 | 50 | 46 | null | null |
zeusdeux/mood.mudit.xyz | src/App.hs | isc | ageInsult :: Int -> String
ageInsult age
| age < 10 = "My GOD child!"
| age >= 10 && age <= 28 = "What up son?!"
| otherwise = "With age comes wisdom, I hope.." | 190 | ageInsult :: Int -> String
ageInsult age
| age < 10 = "My GOD child!"
| age >= 10 && age <= 28 = "What up son?!"
| otherwise = "With age comes wisdom, I hope.." | 190 | ageInsult age
| age < 10 = "My GOD child!"
| age >= 10 && age <= 28 = "What up son?!"
| otherwise = "With age comes wisdom, I hope.." | 163 | false | true | 0 | 10 | 65 | 58 | 27 | 31 | null | null |
kadena-io/pact | src/Pact/Types/ExpParser.hs | bsd-3-clause | lit :: ExpParse s (LiteralExp Info)
lit = fst <$> exp "literal" _ELiteral | 73 | lit :: ExpParse s (LiteralExp Info)
lit = fst <$> exp "literal" _ELiteral | 73 | lit = fst <$> exp "literal" _ELiteral | 37 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
jwaldmann/rx | src/Set.hs | gpl-3.0 | elementOf = Data.Set.member | 27 | elementOf = Data.Set.member | 27 | elementOf = Data.Set.member | 27 | false | false | 1 | 6 | 2 | 13 | 5 | 8 | null | null |
LambdaHack/LambdaHack | engine-src/Game/LambdaHack/Common/Item.hs | bsd-3-clause | -- We assume @SkSpeed@ never appears inside @Odds@. If it does,
-- not much harm.
unknownSpeedBonus :: [ItemFull] -> Bool
unknownSpeedBonus =
let p (IK.AddSkill Ability.SkSpeed k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 272 | unknownSpeedBonus :: [ItemFull] -> Bool
unknownSpeedBonus =
let p (IK.AddSkill Ability.SkSpeed k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 190 | unknownSpeedBonus =
let p (IK.AddSkill Ability.SkSpeed k) = [k]
p _ = []
f itemFull b = b || unknownAspect p itemFull
in foldr f False | 150 | true | true | 0 | 12 | 61 | 91 | 43 | 48 | null | null |
foreverbell/obtuse-parakeet | src/Control/Monad/Parakeet.hs | mit | env :: (Options -> a) -> Parakeet a
env = Parakeet . asks | 57 | env :: (Options -> a) -> Parakeet a
env = Parakeet . asks | 57 | env = Parakeet . asks | 21 | false | true | 1 | 8 | 12 | 36 | 16 | 20 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Shared.hs | gpl-2.0 | --
-- Text processing
--
-- | Returns an association list of backslash escapes for the
-- designated characters.
backslashEscapes :: [Char] -- ^ list of special characters to escape
-> [(Char, String)]
backslashEscapes = map (\ch -> (ch, ['\\',ch])) | 270 | backslashEscapes :: [Char] -- ^ list of special characters to escape
-> [(Char, String)]
backslashEscapes = map (\ch -> (ch, ['\\',ch])) | 156 | backslashEscapes = map (\ch -> (ch, ['\\',ch])) | 47 | true | true | 0 | 9 | 60 | 62 | 37 | 25 | null | null |
dkandalov/katas | haskell/p99/src/p9x/p00/P00_.hs | unlicense | pack'4 (x:xs) = if x `elem` (head (pack'4 xs))
then (x:(head (pack'4 xs))):(tail (pack'4 xs))
else [x]:(pack'4 xs) | 146 | pack'4 (x:xs) = if x `elem` (head (pack'4 xs))
then (x:(head (pack'4 xs))):(tail (pack'4 xs))
else [x]:(pack'4 xs) | 146 | pack'4 (x:xs) = if x `elem` (head (pack'4 xs))
then (x:(head (pack'4 xs))):(tail (pack'4 xs))
else [x]:(pack'4 xs) | 146 | false | false | 0 | 12 | 49 | 90 | 48 | 42 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/NameEnv.hs | bsd-3-clause | extendNameEnv x y z = addToUFM x y z | 38 | extendNameEnv x y z = addToUFM x y z | 38 | extendNameEnv x y z = addToUFM x y z | 38 | false | false | 1 | 5 | 10 | 28 | 9 | 19 | null | null |
michalkonecny/aern | aern-poly-plot-gtk/demos/plotPicard.hs | bsd-3-clause | {--- efforts for various AP functions ---}
limitsDefault :: IntPolySizeLimits CF
limitsDefault = limitsD 10 | 108 | limitsDefault :: IntPolySizeLimits CF
limitsDefault = limitsD 10 | 64 | limitsDefault = limitsD 10 | 26 | true | true | 1 | 5 | 15 | 22 | 9 | 13 | null | null |
badp/ganeti | src/Ganeti/Config.hs | gpl-2.0 | getInstance :: ConfigData -> String -> ErrorResult Instance
getInstance cfg name =
let instances = fromContainer (configInstances cfg)
in case getItem "Instance" name instances of
-- if not found by uuid, we need to look it up by name
Ok inst -> Ok inst
Bad _ -> let by_name = M.mapKeys
(instName . (M.!) instances) instances
in getItem "Instance" name by_name
-- | Looks up a node group by name or uuid. | 476 | getInstance :: ConfigData -> String -> ErrorResult Instance
getInstance cfg name =
let instances = fromContainer (configInstances cfg)
in case getItem "Instance" name instances of
-- if not found by uuid, we need to look it up by name
Ok inst -> Ok inst
Bad _ -> let by_name = M.mapKeys
(instName . (M.!) instances) instances
in getItem "Instance" name by_name
-- | Looks up a node group by name or uuid. | 476 | getInstance cfg name =
let instances = fromContainer (configInstances cfg)
in case getItem "Instance" name instances of
-- if not found by uuid, we need to look it up by name
Ok inst -> Ok inst
Bad _ -> let by_name = M.mapKeys
(instName . (M.!) instances) instances
in getItem "Instance" name by_name
-- | Looks up a node group by name or uuid. | 416 | false | true | 0 | 18 | 143 | 120 | 57 | 63 | null | null |
sharkdp/zehntausend | src/Main.hs | mit | main :: IO ()
main = interaktiverModus | 38 | main :: IO ()
main = interaktiverModus | 38 | main = interaktiverModus | 24 | false | true | 0 | 6 | 6 | 16 | 8 | 8 | null | null |
cem3394/haskell | tensorflow/src/TensorFlow/Build.hs | apache-2.0 | initGraphState :: GraphState
initGraphState =
GraphState Map.empty Map.empty [] (Unique 0) Nothing [] Set.empty [] [] | 121 | initGraphState :: GraphState
initGraphState =
GraphState Map.empty Map.empty [] (Unique 0) Nothing [] Set.empty [] [] | 121 | initGraphState =
GraphState Map.empty Map.empty [] (Unique 0) Nothing [] Set.empty [] [] | 92 | false | true | 0 | 7 | 19 | 57 | 26 | 31 | null | null |
haskell/ghc-builder | common/Builder/Files.hs | bsd-3-clause | putMaybeBuildStepMailOutput :: MonadIO m
=> Root -> BuildNum -> BuildStepNum -> Maybe String
-> m ()
putMaybeBuildStepMailOutput root bn bsn m
= maybeWriteBinaryFile (fpBuildStepMailOutput root bn bsn) m | 260 | putMaybeBuildStepMailOutput :: MonadIO m
=> Root -> BuildNum -> BuildStepNum -> Maybe String
-> m ()
putMaybeBuildStepMailOutput root bn bsn m
= maybeWriteBinaryFile (fpBuildStepMailOutput root bn bsn) m | 260 | putMaybeBuildStepMailOutput root bn bsn m
= maybeWriteBinaryFile (fpBuildStepMailOutput root bn bsn) m | 103 | false | true | 0 | 11 | 84 | 66 | 31 | 35 | null | null |
osa1/Idris-dev | src/Idris/IdrisDoc.hs | bsd-3-clause | createOtherDoc ist (ModDoc _ docstring) = do
Docstrings.renderHtml docstring
-- | Generates everything but the actual content of the page | 141 | createOtherDoc ist (ModDoc _ docstring) = do
Docstrings.renderHtml docstring
-- | Generates everything but the actual content of the page | 141 | createOtherDoc ist (ModDoc _ docstring) = do
Docstrings.renderHtml docstring
-- | Generates everything but the actual content of the page | 141 | false | false | 0 | 8 | 23 | 28 | 13 | 15 | null | null |
danr/hipspec | examples/old-examples/quickspec/ProductiveUseOfFailure.hs | gpl-3.0 | intersect,union :: [Nat] -> [Nat] -> [Nat]
(x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys)
| otherwise = xs `intersect` ys | 158 | intersect,union :: [Nat] -> [Nat] -> [Nat]
(x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys)
| otherwise = xs `intersect` ys | 158 | (x:xs) `intersect` ys | x `elem` ys = x:(xs `intersect` ys)
| otherwise = xs `intersect` ys | 115 | false | true | 0 | 8 | 47 | 85 | 48 | 37 | null | null |
rickardlindberg/orgapp | tests/TestSearch.hs | bsd-3-clause | tests = describe "search" $ do
let testItem = setTags ["football", "fun"]
$ setTitle "Different Title"
$ setFileName "foo.png"
$ BucketItem "/path/to/item" createMeta
describe "matches" $ do
it "partial item title" $
matchSearch "Different" testItem
it "partial item title with wrong case" $
matchSearch "title" testItem
it "partial tag" $
matchSearch "foot" testItem
it "when all words match" $
matchSearch "foo fun" testItem
describe "doesn't match" $ do
it "item path" $
not $ matchSearch "item" testItem
it "tag with wrong case" $
not $ matchSearch "FootBall" testItem
it "when all words don't match" $
not $ matchSearch "foo XYZ" testItem | 856 | tests = describe "search" $ do
let testItem = setTags ["football", "fun"]
$ setTitle "Different Title"
$ setFileName "foo.png"
$ BucketItem "/path/to/item" createMeta
describe "matches" $ do
it "partial item title" $
matchSearch "Different" testItem
it "partial item title with wrong case" $
matchSearch "title" testItem
it "partial tag" $
matchSearch "foot" testItem
it "when all words match" $
matchSearch "foo fun" testItem
describe "doesn't match" $ do
it "item path" $
not $ matchSearch "item" testItem
it "tag with wrong case" $
not $ matchSearch "FootBall" testItem
it "when all words don't match" $
not $ matchSearch "foo XYZ" testItem | 856 | tests = describe "search" $ do
let testItem = setTags ["football", "fun"]
$ setTitle "Different Title"
$ setFileName "foo.png"
$ BucketItem "/path/to/item" createMeta
describe "matches" $ do
it "partial item title" $
matchSearch "Different" testItem
it "partial item title with wrong case" $
matchSearch "title" testItem
it "partial tag" $
matchSearch "foot" testItem
it "when all words match" $
matchSearch "foo fun" testItem
describe "doesn't match" $ do
it "item path" $
not $ matchSearch "item" testItem
it "tag with wrong case" $
not $ matchSearch "FootBall" testItem
it "when all words don't match" $
not $ matchSearch "foo XYZ" testItem | 856 | false | false | 0 | 15 | 313 | 191 | 81 | 110 | null | null |
andreasabel/helf | src/HeredNormVal.hs | mit | quote :: (Applicative m, Monad m, MonadEval NVal Env' m) => NVal -> A.SysNameCounter -> m A.Expr
quote v i =
case v of
NVar x _ vs -> foldr (flip A.App) (A.Ident $ A.Var x) <$> mapM (flip quote i) vs
NCon x _ vs -> foldr (flip A.App) (A.Ident $ A.Con x) <$> mapM (flip quote i) vs
NDef x _ _ vs -> foldr (flip A.App) (A.Ident $ A.Def x) <$> mapM (flip quote i) vs
--NLam x w -> see below
--NK _ -> see below
NSort Type -> return A.Typ
NSort Kind -> error "cannot quote sort kind"
NDontCare -> error "cannot quote the dontcare value"
NFun a (NK b) -> A.Pi Nothing <$> quote a i <*> quote b i
NFun a f -> do
u <- quote a i
(x,t) <- quoteFun f i
return $ A.Pi (Just x) u t
f -> do
(x,e) <- quoteFun f i
return $ A.Lam x Nothing e
-- | @quoteFun n v@ expects @v@ to be a function and returns and its
-- body as an expression.
-- quoteFun :: Val -> A.SysNameCounter -> EvalM (A.Name, A.Expr) | 1,191 | quote :: (Applicative m, Monad m, MonadEval NVal Env' m) => NVal -> A.SysNameCounter -> m A.Expr
quote v i =
case v of
NVar x _ vs -> foldr (flip A.App) (A.Ident $ A.Var x) <$> mapM (flip quote i) vs
NCon x _ vs -> foldr (flip A.App) (A.Ident $ A.Con x) <$> mapM (flip quote i) vs
NDef x _ _ vs -> foldr (flip A.App) (A.Ident $ A.Def x) <$> mapM (flip quote i) vs
--NLam x w -> see below
--NK _ -> see below
NSort Type -> return A.Typ
NSort Kind -> error "cannot quote sort kind"
NDontCare -> error "cannot quote the dontcare value"
NFun a (NK b) -> A.Pi Nothing <$> quote a i <*> quote b i
NFun a f -> do
u <- quote a i
(x,t) <- quoteFun f i
return $ A.Pi (Just x) u t
f -> do
(x,e) <- quoteFun f i
return $ A.Lam x Nothing e
-- | @quoteFun n v@ expects @v@ to be a function and returns and its
-- body as an expression.
-- quoteFun :: Val -> A.SysNameCounter -> EvalM (A.Name, A.Expr) | 1,191 | quote v i =
case v of
NVar x _ vs -> foldr (flip A.App) (A.Ident $ A.Var x) <$> mapM (flip quote i) vs
NCon x _ vs -> foldr (flip A.App) (A.Ident $ A.Con x) <$> mapM (flip quote i) vs
NDef x _ _ vs -> foldr (flip A.App) (A.Ident $ A.Def x) <$> mapM (flip quote i) vs
--NLam x w -> see below
--NK _ -> see below
NSort Type -> return A.Typ
NSort Kind -> error "cannot quote sort kind"
NDontCare -> error "cannot quote the dontcare value"
NFun a (NK b) -> A.Pi Nothing <$> quote a i <*> quote b i
NFun a f -> do
u <- quote a i
(x,t) <- quoteFun f i
return $ A.Pi (Just x) u t
f -> do
(x,e) <- quoteFun f i
return $ A.Lam x Nothing e
-- | @quoteFun n v@ expects @v@ to be a function and returns and its
-- body as an expression.
-- quoteFun :: Val -> A.SysNameCounter -> EvalM (A.Name, A.Expr) | 1,094 | false | true | 0 | 13 | 496 | 421 | 199 | 222 | null | null |
egison/egison | hs-src/Language/Egison/Primitives/IO.hs | mit | makeIO :: EvalM EgisonValue -> EgisonValue
makeIO m = IOFunc $ fmap (Value . Tuple . (World :) . (:[])) m | 105 | makeIO :: EvalM EgisonValue -> EgisonValue
makeIO m = IOFunc $ fmap (Value . Tuple . (World :) . (:[])) m | 105 | makeIO m = IOFunc $ fmap (Value . Tuple . (World :) . (:[])) m | 62 | false | true | 0 | 10 | 20 | 55 | 29 | 26 | null | null |
michaelmelanson/cminus-compiler | Compiler/Parser.hs | bsd-2-clause | expression = try (do { ident <- lvalue
; reservedOp "="
; value <- simple_expression
; return $ AssignmentExpr ident value
})
<|> simple_expression
where lvalue = do { ident <- identifier
; x <- maybeindex ident
; return x
}
maybeindex ident = do { index <- squares expression
; return $ ArrayRef ident index
}
<|> do { return $ VariableRef ident } | 678 | expression = try (do { ident <- lvalue
; reservedOp "="
; value <- simple_expression
; return $ AssignmentExpr ident value
})
<|> simple_expression
where lvalue = do { ident <- identifier
; x <- maybeindex ident
; return x
}
maybeindex ident = do { index <- squares expression
; return $ ArrayRef ident index
}
<|> do { return $ VariableRef ident } | 678 | expression = try (do { ident <- lvalue
; reservedOp "="
; value <- simple_expression
; return $ AssignmentExpr ident value
})
<|> simple_expression
where lvalue = do { ident <- identifier
; x <- maybeindex ident
; return x
}
maybeindex ident = do { index <- squares expression
; return $ ArrayRef ident index
}
<|> do { return $ VariableRef ident } | 678 | false | false | 5 | 10 | 394 | 145 | 69 | 76 | null | null |
grammarware/slps | topics/implementation/NielsonN07/Haskell/src/While/DenotationalSemantics/Main0.hs | bsd-3-clause | main =
do
let s x = if x=="x" then 5 else undefined
print $ stm factorial s "y"
{-
> main
120
-} | 109 | main =
do
let s x = if x=="x" then 5 else undefined
print $ stm factorial s "y"
{-
> main
120
-} | 109 | main =
do
let s x = if x=="x" then 5 else undefined
print $ stm factorial s "y"
{-
> main
120
-} | 109 | false | false | 0 | 11 | 36 | 45 | 22 | 23 | null | null |
tamarin-prover/tamarin-prover | lib/theory/src/Theory/Constraint/System.hs | gpl-3.0 | -- | 'True' iff the given node id is guaranteed to be instantiated to the last
-- index of the trace.
isLast :: System -> NodeId -> Bool
isLast sys i = Just i == L.get sLastAtom sys | 181 | isLast :: System -> NodeId -> Bool
isLast sys i = Just i == L.get sLastAtom sys | 79 | isLast sys i = Just i == L.get sLastAtom sys | 44 | true | true | 1 | 8 | 37 | 40 | 19 | 21 | null | null |
bennofs/cabal | cabal-install/tests/UnitTests/Distribution/Solver/Modular/Solver.hs | bsd-3-clause | db13 :: ExampleDb
db13 = [
Right $ exAv "A" 1 []
, Right $ exAv "A" 2 []
, Right $ exAv "A" 3 []
] | 108 | db13 :: ExampleDb
db13 = [
Right $ exAv "A" 1 []
, Right $ exAv "A" 2 []
, Right $ exAv "A" 3 []
] | 108 | db13 = [
Right $ exAv "A" 1 []
, Right $ exAv "A" 2 []
, Right $ exAv "A" 3 []
] | 90 | false | true | 0 | 9 | 36 | 66 | 31 | 35 | null | null |
ml9951/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | mkTcEqPredRole :: Role -> TcType -> TcType -> Type
mkTcEqPredRole Nominal = mkTcEqPred | 95 | mkTcEqPredRole :: Role -> TcType -> TcType -> Type
mkTcEqPredRole Nominal = mkTcEqPred | 95 | mkTcEqPredRole Nominal = mkTcEqPred | 44 | false | true | 0 | 7 | 21 | 26 | 13 | 13 | null | null |
sapek/pandoc | src/Text/Pandoc/Readers/Org.hs | gpl-2.0 | parseInlines :: OrgParser (F Inlines)
parseInlines = trimInlinesF . mconcat <$> many1 inline | 92 | parseInlines :: OrgParser (F Inlines)
parseInlines = trimInlinesF . mconcat <$> many1 inline | 92 | parseInlines = trimInlinesF . mconcat <$> many1 inline | 54 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
ihc/futhark | src/Language/Futhark/TypeChecker/Terms.hs | isc | altOccurences :: Occurences -> Occurences -> Occurences
altOccurences occurs1 occurs2 =
filter (not . nullOccurence) $ map filt1 occurs1 ++ map filt2 occurs2
where filt1 occ =
occ { consumed = consumed occ `S.difference` cons2
, observed = observed occ `S.difference` cons2 }
filt2 occ =
occ { consumed = consumed occ
, observed = observed occ `S.difference` cons1 }
cons1 = allConsumed occurs1
cons2 = allConsumed occurs2
--- Scope management | 520 | altOccurences :: Occurences -> Occurences -> Occurences
altOccurences occurs1 occurs2 =
filter (not . nullOccurence) $ map filt1 occurs1 ++ map filt2 occurs2
where filt1 occ =
occ { consumed = consumed occ `S.difference` cons2
, observed = observed occ `S.difference` cons2 }
filt2 occ =
occ { consumed = consumed occ
, observed = observed occ `S.difference` cons1 }
cons1 = allConsumed occurs1
cons2 = allConsumed occurs2
--- Scope management | 520 | altOccurences occurs1 occurs2 =
filter (not . nullOccurence) $ map filt1 occurs1 ++ map filt2 occurs2
where filt1 occ =
occ { consumed = consumed occ `S.difference` cons2
, observed = observed occ `S.difference` cons2 }
filt2 occ =
occ { consumed = consumed occ
, observed = observed occ `S.difference` cons1 }
cons1 = allConsumed occurs1
cons2 = allConsumed occurs2
--- Scope management | 464 | false | true | 6 | 8 | 147 | 177 | 83 | 94 | null | null |
hspec/hspec | hspec-core/src/Test/Hspec/Core/Formatters/V1/Monad.hs | mit | -- | Return `True` if the user requested time reporting for individual spec
-- items, `False` otherwise.
printTimes :: FormatM Bool
printTimes = liftF (PrintTimes id) | 166 | printTimes :: FormatM Bool
printTimes = liftF (PrintTimes id) | 61 | printTimes = liftF (PrintTimes id) | 34 | true | true | 0 | 7 | 25 | 25 | 13 | 12 | null | null |
brendanhay/apteryx | test/Main.hs | mpl-2.0 | main :: IO ()
main = defaultMain $ testGroup "apteryx"
[ testGroup "parse control fields"
[ testCase "package name" $
parse "Package" "libvarnishapi1"
, testCase "version number" $
parse "Version" "4.0.0~~tp1-1~precise"
, testCase "architecture" $
parse "Architecture" "amd64"
, testCase "unknown field" $
parse "Unknown" "unknown value."
, testCase "singleline description" $
parse "Description" "Expanded synopsis\n"
, testCase "multiline description" $
parse "Description"
"single-line synopsis\n\
\ A more expand description covering\n\
\ Two extra lines.\n"
]
, testGroup "deserialise package description"
[ testCase "package name" $
control entName "libvarnishapi1"
, testCase "version number" $
control entVers (Vers "0.1.0+123~1" [0, 1, 0, 123, 1])
, testCase "amd64 architecture" $
control entArch Amd64
]
, testCase "descending version ordering" $
let mk = Vers ""
a = mk [0]
b = mk [0, 1, 0, 123, 1]
c = mk [1, 2, 3]
d = mk [23, 0, 12, 0]
in [a, b, c, d] @=? sort [b, d, c, a]
] | 1,327 | main :: IO ()
main = defaultMain $ testGroup "apteryx"
[ testGroup "parse control fields"
[ testCase "package name" $
parse "Package" "libvarnishapi1"
, testCase "version number" $
parse "Version" "4.0.0~~tp1-1~precise"
, testCase "architecture" $
parse "Architecture" "amd64"
, testCase "unknown field" $
parse "Unknown" "unknown value."
, testCase "singleline description" $
parse "Description" "Expanded synopsis\n"
, testCase "multiline description" $
parse "Description"
"single-line synopsis\n\
\ A more expand description covering\n\
\ Two extra lines.\n"
]
, testGroup "deserialise package description"
[ testCase "package name" $
control entName "libvarnishapi1"
, testCase "version number" $
control entVers (Vers "0.1.0+123~1" [0, 1, 0, 123, 1])
, testCase "amd64 architecture" $
control entArch Amd64
]
, testCase "descending version ordering" $
let mk = Vers ""
a = mk [0]
b = mk [0, 1, 0, 123, 1]
c = mk [1, 2, 3]
d = mk [23, 0, 12, 0]
in [a, b, c, d] @=? sort [b, d, c, a]
] | 1,327 | main = defaultMain $ testGroup "apteryx"
[ testGroup "parse control fields"
[ testCase "package name" $
parse "Package" "libvarnishapi1"
, testCase "version number" $
parse "Version" "4.0.0~~tp1-1~precise"
, testCase "architecture" $
parse "Architecture" "amd64"
, testCase "unknown field" $
parse "Unknown" "unknown value."
, testCase "singleline description" $
parse "Description" "Expanded synopsis\n"
, testCase "multiline description" $
parse "Description"
"single-line synopsis\n\
\ A more expand description covering\n\
\ Two extra lines.\n"
]
, testGroup "deserialise package description"
[ testCase "package name" $
control entName "libvarnishapi1"
, testCase "version number" $
control entVers (Vers "0.1.0+123~1" [0, 1, 0, 123, 1])
, testCase "amd64 architecture" $
control entArch Amd64
]
, testCase "descending version ordering" $
let mk = Vers ""
a = mk [0]
b = mk [0, 1, 0, 123, 1]
c = mk [1, 2, 3]
d = mk [23, 0, 12, 0]
in [a, b, c, d] @=? sort [b, d, c, a]
] | 1,313 | false | true | 0 | 14 | 497 | 325 | 169 | 156 | null | null |
adnelson/nixfromnpm | src/NixFromNpm/Common.hs | mit | -- | Convert an `Either` to a `Maybe`.
eitherToMaybe :: Either a b -> Maybe b
eitherToMaybe (Left _) = Nothing | 110 | eitherToMaybe :: Either a b -> Maybe b
eitherToMaybe (Left _) = Nothing | 71 | eitherToMaybe (Left _) = Nothing | 32 | true | true | 0 | 7 | 20 | 33 | 16 | 17 | null | null |
IreneKnapp/Faction | libfaction/Distribution/Simple/Utils.hs | bsd-3-clause | xargs :: Int -> ([String] -> IO ())
-> [String] -> [String] -> IO ()
xargs maxSize rawSystemFun fixedArgs bigArgs =
let fixedArgSize = sum (map length fixedArgs) + length fixedArgs
chunkSize = maxSize - fixedArgSize
in mapM_ (rawSystemFun . (fixedArgs ++)) (chunks chunkSize bigArgs)
where chunks len = unfoldr $ \s ->
if null s then Nothing
else Just (chunk [] len s)
chunk acc _ [] = (reverse acc,[])
chunk acc len (s:ss)
| len' < len = chunk (s:acc) (len-len'-1) ss
| otherwise = (reverse acc, s:ss)
where len' = length s
-- ------------------------------------------------------------
-- * File Utilities
-- ------------------------------------------------------------
----------------
-- Finding files
-- | Find a file by looking in a search path. The file path must match exactly.
-- | 896 | xargs :: Int -> ([String] -> IO ())
-> [String] -> [String] -> IO ()
xargs maxSize rawSystemFun fixedArgs bigArgs =
let fixedArgSize = sum (map length fixedArgs) + length fixedArgs
chunkSize = maxSize - fixedArgSize
in mapM_ (rawSystemFun . (fixedArgs ++)) (chunks chunkSize bigArgs)
where chunks len = unfoldr $ \s ->
if null s then Nothing
else Just (chunk [] len s)
chunk acc _ [] = (reverse acc,[])
chunk acc len (s:ss)
| len' < len = chunk (s:acc) (len-len'-1) ss
| otherwise = (reverse acc, s:ss)
where len' = length s
-- ------------------------------------------------------------
-- * File Utilities
-- ------------------------------------------------------------
----------------
-- Finding files
-- | Find a file by looking in a search path. The file path must match exactly.
-- | 896 | xargs maxSize rawSystemFun fixedArgs bigArgs =
let fixedArgSize = sum (map length fixedArgs) + length fixedArgs
chunkSize = maxSize - fixedArgSize
in mapM_ (rawSystemFun . (fixedArgs ++)) (chunks chunkSize bigArgs)
where chunks len = unfoldr $ \s ->
if null s then Nothing
else Just (chunk [] len s)
chunk acc _ [] = (reverse acc,[])
chunk acc len (s:ss)
| len' < len = chunk (s:acc) (len-len'-1) ss
| otherwise = (reverse acc, s:ss)
where len' = length s
-- ------------------------------------------------------------
-- * File Utilities
-- ------------------------------------------------------------
----------------
-- Finding files
-- | Find a file by looking in a search path. The file path must match exactly.
-- | 821 | false | true | 5 | 12 | 231 | 284 | 149 | 135 | null | null |
CulpaBS/wbBach | src/Futhark/Representation/AST/Attributes/Patterns.hs | bsd-3-clause | -- | Return a list of the 'Name's bound by the 'Pattern'.
patternNames :: PatternT attr -> [VName]
patternNames = map patElemName . patternElements | 147 | patternNames :: PatternT attr -> [VName]
patternNames = map patElemName . patternElements | 89 | patternNames = map patElemName . patternElements | 48 | true | true | 0 | 6 | 23 | 29 | 15 | 14 | null | null |
urbanslug/ghc | compiler/prelude/THNames.hs | bsd-3-clause | closedTypeFamilyNoKindDIdKey = mkPreludeMiscIdUnique 351 | 56 | closedTypeFamilyNoKindDIdKey = mkPreludeMiscIdUnique 351 | 56 | closedTypeFamilyNoKindDIdKey = mkPreludeMiscIdUnique 351 | 56 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
michael-j-clark/hjs99 | src/1to10/Six.hs | bsd-3-clause | --Find out whether a list is a palindrome
palindrome :: (Eq a) => [a] -> Bool
palindrome xs
| (xs == reverse' xs) = True
| otherwise = False | 148 | palindrome :: (Eq a) => [a] -> Bool
palindrome xs
| (xs == reverse' xs) = True
| otherwise = False | 104 | palindrome xs
| (xs == reverse' xs) = True
| otherwise = False | 67 | true | true | 0 | 10 | 36 | 64 | 30 | 34 | null | null |
tjakway/ghcjvm | compiler/nativeGen/SPARC/Ppr.hs | bsd-3-clause | pprInstr (JMP addr) = text "\tjmp\t" <> pprAddr addr | 52 | pprInstr (JMP addr) = text "\tjmp\t" <> pprAddr addr | 52 | pprInstr (JMP addr) = text "\tjmp\t" <> pprAddr addr | 52 | false | false | 0 | 7 | 8 | 25 | 11 | 14 | null | null |
fmahnke/dnd-like-game | src/DM.hs | mit | -- Dialog command.
dialogCommand :: Scene -> [String] -> String
dialogCommand scene args
| length args == 0 = unlines $ menu $ map dialogueString (dialogues ((npcs scene) !! 0))
| otherwise = answer ((dialogues ((npcs scene) !! npcIndex)) !! dialogueIndex)
where npcIndex = (read $ args !! 0 :: Int)
dialogueIndex = (read $ args !! 1 :: Int) | 363 | dialogCommand :: Scene -> [String] -> String
dialogCommand scene args
| length args == 0 = unlines $ menu $ map dialogueString (dialogues ((npcs scene) !! 0))
| otherwise = answer ((dialogues ((npcs scene) !! npcIndex)) !! dialogueIndex)
where npcIndex = (read $ args !! 0 :: Int)
dialogueIndex = (read $ args !! 1 :: Int) | 344 | dialogCommand scene args
| length args == 0 = unlines $ menu $ map dialogueString (dialogues ((npcs scene) !! 0))
| otherwise = answer ((dialogues ((npcs scene) !! npcIndex)) !! dialogueIndex)
where npcIndex = (read $ args !! 0 :: Int)
dialogueIndex = (read $ args !! 1 :: Int) | 299 | true | true | 0 | 14 | 81 | 151 | 78 | 73 | null | null |
talanis85/mudblood | src/Mudblood/Screen/Gtk.hs | gpl-3.0 | initUI :: String -> IORef (ScreenState u) -> IO ScreenControls
initUI path stref = do
builder <- GB.builderNew
GB.builderAddFromFile builder path
window <- GB.builderGetObject builder G.castToWindow "mainWindow"
mainView <- GB.builderGetObject builder G.castToTextView "mainView"
mainScroll <- GB.builderGetObject builder G.castToScrolledWindow "mainScroll"
mainBuffer <- G.textViewGetBuffer mainView
mainInput <- GB.builderGetObject builder G.castToEntry "mainInput"
statusKeyseq <- GB.builderGetObject builder G.castToLabel "statusKeyseq"
statusUser <- GB.builderGetObject builder G.castToLabel "statusUser"
statusSystem <- GB.builderGetObject builder G.castToLabel "statusSystem"
promptLabel <- GB.builderGetObject builder G.castToLabel "promptLabel"
treeMenu <- GB.builderGetObject builder G.castToTreeView "treeMenu"
listMenu <- G.listStoreNew []
G.treeViewSetModel treeMenu listMenu
colText <- G.treeViewColumnNew
cellText <- G.cellRendererTextNew
G.treeViewColumnPackStart colText cellText True
G.cellLayoutSetAttributes colText cellText listMenu (\row -> [ G.cellText := row ])
G.treeViewAppendColumn treeMenu colText
let controls = ScreenControls
{ ctlBuilder = builder
, ctlMainView = mainView
, ctlMainScroll = mainScroll
, ctlMainBuffer = mainBuffer
, ctlMainInput = mainInput
, ctlStatusKeyseq = statusKeyseq
, ctlStatusUser = statusUser
, ctlStatusSystem = statusSystem
, ctlPromptLabel = promptLabel
, ctlListMenu = listMenu
, ctlTreeMenu = treeMenu
}
monoFont <- P.fontDescriptionFromString "monospace"
G.widgetModifyFont mainView $ Just monoFont
--G.widgetModifyText mainView G.StateNormal $ P.Color 60000 60000 60000
--G.widgetModifyBase mainView G.StateNormal $ P.Color 0 0 0
G.widgetModifyFont mainInput $ Just monoFont
G.widgetModifyFont statusKeyseq $ Just monoFont
G.widgetModifyFont promptLabel $ Just monoFont
G.widgetModifyFont statusSystem $ Just monoFont
tagTable <- G.textBufferGetTagTable mainBuffer
forM_ ["black", "white", "cyan", "magenta", "blue", "yellow", "green", "red"] $ \x -> do
tag <- G.textTagNew $ Just x
G.set tag [ G.textTagForeground := x ]
G.textTagTableAdd tagTable tag
-- Key press handler
mainInput `on` G.keyPressEvent $ do
keyname <- G.eventKeyName
keychar <- fmap G.keyToChar G.eventKeyVal
case mapKey keychar keyname of
Just k -> do
handled <- liftIO $ runScreen controls stref $ handleKey k
if handled then return True
else return False
Nothing -> return False
-- Always scroll to end when new text arrives
mainView `on` G.sizeAllocate $ \_ -> runScreen controls stref $ do
endIter <- liftIO $ G.textBufferGetEndIter mainBuffer
liftIO $ G.textViewScrollToIter mainView endIter 0 Nothing
return ()
-- Quit when the window is closed
window `on` G.deleteEvent $ liftIO G.mainQuit >> return False
G.set window [ G.windowRole := "mudblood_main" ]
G.widgetShowAll window
return controls | 3,475 | initUI :: String -> IORef (ScreenState u) -> IO ScreenControls
initUI path stref = do
builder <- GB.builderNew
GB.builderAddFromFile builder path
window <- GB.builderGetObject builder G.castToWindow "mainWindow"
mainView <- GB.builderGetObject builder G.castToTextView "mainView"
mainScroll <- GB.builderGetObject builder G.castToScrolledWindow "mainScroll"
mainBuffer <- G.textViewGetBuffer mainView
mainInput <- GB.builderGetObject builder G.castToEntry "mainInput"
statusKeyseq <- GB.builderGetObject builder G.castToLabel "statusKeyseq"
statusUser <- GB.builderGetObject builder G.castToLabel "statusUser"
statusSystem <- GB.builderGetObject builder G.castToLabel "statusSystem"
promptLabel <- GB.builderGetObject builder G.castToLabel "promptLabel"
treeMenu <- GB.builderGetObject builder G.castToTreeView "treeMenu"
listMenu <- G.listStoreNew []
G.treeViewSetModel treeMenu listMenu
colText <- G.treeViewColumnNew
cellText <- G.cellRendererTextNew
G.treeViewColumnPackStart colText cellText True
G.cellLayoutSetAttributes colText cellText listMenu (\row -> [ G.cellText := row ])
G.treeViewAppendColumn treeMenu colText
let controls = ScreenControls
{ ctlBuilder = builder
, ctlMainView = mainView
, ctlMainScroll = mainScroll
, ctlMainBuffer = mainBuffer
, ctlMainInput = mainInput
, ctlStatusKeyseq = statusKeyseq
, ctlStatusUser = statusUser
, ctlStatusSystem = statusSystem
, ctlPromptLabel = promptLabel
, ctlListMenu = listMenu
, ctlTreeMenu = treeMenu
}
monoFont <- P.fontDescriptionFromString "monospace"
G.widgetModifyFont mainView $ Just monoFont
--G.widgetModifyText mainView G.StateNormal $ P.Color 60000 60000 60000
--G.widgetModifyBase mainView G.StateNormal $ P.Color 0 0 0
G.widgetModifyFont mainInput $ Just monoFont
G.widgetModifyFont statusKeyseq $ Just monoFont
G.widgetModifyFont promptLabel $ Just monoFont
G.widgetModifyFont statusSystem $ Just monoFont
tagTable <- G.textBufferGetTagTable mainBuffer
forM_ ["black", "white", "cyan", "magenta", "blue", "yellow", "green", "red"] $ \x -> do
tag <- G.textTagNew $ Just x
G.set tag [ G.textTagForeground := x ]
G.textTagTableAdd tagTable tag
-- Key press handler
mainInput `on` G.keyPressEvent $ do
keyname <- G.eventKeyName
keychar <- fmap G.keyToChar G.eventKeyVal
case mapKey keychar keyname of
Just k -> do
handled <- liftIO $ runScreen controls stref $ handleKey k
if handled then return True
else return False
Nothing -> return False
-- Always scroll to end when new text arrives
mainView `on` G.sizeAllocate $ \_ -> runScreen controls stref $ do
endIter <- liftIO $ G.textBufferGetEndIter mainBuffer
liftIO $ G.textViewScrollToIter mainView endIter 0 Nothing
return ()
-- Quit when the window is closed
window `on` G.deleteEvent $ liftIO G.mainQuit >> return False
G.set window [ G.windowRole := "mudblood_main" ]
G.widgetShowAll window
return controls | 3,475 | initUI path stref = do
builder <- GB.builderNew
GB.builderAddFromFile builder path
window <- GB.builderGetObject builder G.castToWindow "mainWindow"
mainView <- GB.builderGetObject builder G.castToTextView "mainView"
mainScroll <- GB.builderGetObject builder G.castToScrolledWindow "mainScroll"
mainBuffer <- G.textViewGetBuffer mainView
mainInput <- GB.builderGetObject builder G.castToEntry "mainInput"
statusKeyseq <- GB.builderGetObject builder G.castToLabel "statusKeyseq"
statusUser <- GB.builderGetObject builder G.castToLabel "statusUser"
statusSystem <- GB.builderGetObject builder G.castToLabel "statusSystem"
promptLabel <- GB.builderGetObject builder G.castToLabel "promptLabel"
treeMenu <- GB.builderGetObject builder G.castToTreeView "treeMenu"
listMenu <- G.listStoreNew []
G.treeViewSetModel treeMenu listMenu
colText <- G.treeViewColumnNew
cellText <- G.cellRendererTextNew
G.treeViewColumnPackStart colText cellText True
G.cellLayoutSetAttributes colText cellText listMenu (\row -> [ G.cellText := row ])
G.treeViewAppendColumn treeMenu colText
let controls = ScreenControls
{ ctlBuilder = builder
, ctlMainView = mainView
, ctlMainScroll = mainScroll
, ctlMainBuffer = mainBuffer
, ctlMainInput = mainInput
, ctlStatusKeyseq = statusKeyseq
, ctlStatusUser = statusUser
, ctlStatusSystem = statusSystem
, ctlPromptLabel = promptLabel
, ctlListMenu = listMenu
, ctlTreeMenu = treeMenu
}
monoFont <- P.fontDescriptionFromString "monospace"
G.widgetModifyFont mainView $ Just monoFont
--G.widgetModifyText mainView G.StateNormal $ P.Color 60000 60000 60000
--G.widgetModifyBase mainView G.StateNormal $ P.Color 0 0 0
G.widgetModifyFont mainInput $ Just monoFont
G.widgetModifyFont statusKeyseq $ Just monoFont
G.widgetModifyFont promptLabel $ Just monoFont
G.widgetModifyFont statusSystem $ Just monoFont
tagTable <- G.textBufferGetTagTable mainBuffer
forM_ ["black", "white", "cyan", "magenta", "blue", "yellow", "green", "red"] $ \x -> do
tag <- G.textTagNew $ Just x
G.set tag [ G.textTagForeground := x ]
G.textTagTableAdd tagTable tag
-- Key press handler
mainInput `on` G.keyPressEvent $ do
keyname <- G.eventKeyName
keychar <- fmap G.keyToChar G.eventKeyVal
case mapKey keychar keyname of
Just k -> do
handled <- liftIO $ runScreen controls stref $ handleKey k
if handled then return True
else return False
Nothing -> return False
-- Always scroll to end when new text arrives
mainView `on` G.sizeAllocate $ \_ -> runScreen controls stref $ do
endIter <- liftIO $ G.textBufferGetEndIter mainBuffer
liftIO $ G.textViewScrollToIter mainView endIter 0 Nothing
return ()
-- Quit when the window is closed
window `on` G.deleteEvent $ liftIO G.mainQuit >> return False
G.set window [ G.windowRole := "mudblood_main" ]
G.widgetShowAll window
return controls | 3,412 | false | true | 0 | 18 | 986 | 830 | 392 | 438 | null | null |
zmeadows/zwerg | lib/Zwerg/Data/Position.hs | mit | validatePosition :: (Int, Int) -> Maybe Position
validatePosition p = if isValidPosition p then Just $ MkPosition p else Nothing | 128 | validatePosition :: (Int, Int) -> Maybe Position
validatePosition p = if isValidPosition p then Just $ MkPosition p else Nothing | 128 | validatePosition p = if isValidPosition p then Just $ MkPosition p else Nothing | 79 | false | true | 0 | 7 | 19 | 50 | 24 | 26 | null | null |
cwmunn/hrpg | src/Hrpg/Game/Test.hs | bsd-3-clause | meleeTest :: IO ()
meleeTest = do
gen <- newStdGen
print (evalRand (meleeAttack testCombatData testCombatData) gen) | 121 | meleeTest :: IO ()
meleeTest = do
gen <- newStdGen
print (evalRand (meleeAttack testCombatData testCombatData) gen) | 121 | meleeTest = do
gen <- newStdGen
print (evalRand (meleeAttack testCombatData testCombatData) gen) | 102 | false | true | 0 | 12 | 21 | 51 | 22 | 29 | null | null |
Lythimus/lptv | sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Writers/LaTeX.hs | gpl-2.0 | blockToLaTeX HorizontalRule = return $
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline | 102 | blockToLaTeX HorizontalRule = return $
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline | 102 | blockToLaTeX HorizontalRule = return $
"\\begin{center}\\rule{3in}{0.4pt}\\end{center}" $$ blankline | 102 | false | false | 0 | 6 | 9 | 17 | 8 | 9 | null | null |
ekmett/wxHaskell | wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs | lgpl-2.1 | wxDB_WHERE_KEYFIELDS :: Int
wxDB_WHERE_KEYFIELDS = 1 | 52 | wxDB_WHERE_KEYFIELDS :: Int
wxDB_WHERE_KEYFIELDS = 1 | 52 | wxDB_WHERE_KEYFIELDS = 1 | 24 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
michaxm/haskell-hdfs-thrift-client | src-gen-thrift/ThriftHadoopFileSystem.hs | bsd-3-clause | from_Write_result :: Write_result -> T.ThriftVal
from_Write_result record = T.TStruct $ Map.fromList
(let exns = M.catMaybes [ (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record]
in if P.not (P.null exns) then exns else M.catMaybes
[ (\_v143 -> P.Just (0, ("success",T.TBool _v143))) $ write_result_success record
, (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record
]
) | 457 | from_Write_result :: Write_result -> T.ThriftVal
from_Write_result record = T.TStruct $ Map.fromList
(let exns = M.catMaybes [ (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record]
in if P.not (P.null exns) then exns else M.catMaybes
[ (\_v143 -> P.Just (0, ("success",T.TBool _v143))) $ write_result_success record
, (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record
]
) | 457 | from_Write_result record = T.TStruct $ Map.fromList
(let exns = M.catMaybes [ (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record]
in if P.not (P.null exns) then exns else M.catMaybes
[ (\_v143 -> P.Just (0, ("success",T.TBool _v143))) $ write_result_success record
, (\_v143 -> (1, ("ouch",from_ThriftIOException _v143))) <$> write_result_ouch record
]
) | 408 | false | true | 0 | 18 | 74 | 182 | 97 | 85 | null | null |
vito/atomo | src/Atomo/Lexer/Base.hs | bsd-3-clause | natural :: ParsecT String u Identity Integer
natural = zeroNumber <|> decimal | 77 | natural :: ParsecT String u Identity Integer
natural = zeroNumber <|> decimal | 77 | natural = zeroNumber <|> decimal | 32 | false | true | 0 | 5 | 11 | 24 | 12 | 12 | null | null |
suhailshergill/extensible-effects | src/Control/Eff/Logic/Core.hs | mit | (>>-) :: (MonadPlus m, MSplit m) => m a -> (a -> m b) -> m b
sg >>- g =
do r <- msplit sg
case r of
Nothing -> mzero
Just (sg1 ,sg2) -> interleave (g sg1) (sg2 >>- g)
-- | Collect all solutions. This is from Hinze's @Backtr@ monad
-- class. Unsurprisingly, this can be implemented in terms of msplit. | 322 | (>>-) :: (MonadPlus m, MSplit m) => m a -> (a -> m b) -> m b
sg >>- g =
do r <- msplit sg
case r of
Nothing -> mzero
Just (sg1 ,sg2) -> interleave (g sg1) (sg2 >>- g)
-- | Collect all solutions. This is from Hinze's @Backtr@ monad
-- class. Unsurprisingly, this can be implemented in terms of msplit. | 322 | sg >>- g =
do r <- msplit sg
case r of
Nothing -> mzero
Just (sg1 ,sg2) -> interleave (g sg1) (sg2 >>- g)
-- | Collect all solutions. This is from Hinze's @Backtr@ monad
-- class. Unsurprisingly, this can be implemented in terms of msplit. | 261 | false | true | 0 | 12 | 85 | 116 | 58 | 58 | null | null |
anttisalonen/starrover2 | src/SpaceState/City.hs | mit | missionDisplayGeneric f alleg msg =
pressAnyKeyScreen
(liftIO $ makeTextScreen (100, 500)
[(f, Color4 1.0 0.2 0.2 1.0,
intercalate "\n" (["Your current mission for " ++ alleg ++ ":", ""]
++ msg ++ ["", "Press any key to continue"]))]
(return ())) | 312 | missionDisplayGeneric f alleg msg =
pressAnyKeyScreen
(liftIO $ makeTextScreen (100, 500)
[(f, Color4 1.0 0.2 0.2 1.0,
intercalate "\n" (["Your current mission for " ++ alleg ++ ":", ""]
++ msg ++ ["", "Press any key to continue"]))]
(return ())) | 312 | missionDisplayGeneric f alleg msg =
pressAnyKeyScreen
(liftIO $ makeTextScreen (100, 500)
[(f, Color4 1.0 0.2 0.2 1.0,
intercalate "\n" (["Your current mission for " ++ alleg ++ ":", ""]
++ msg ++ ["", "Press any key to continue"]))]
(return ())) | 312 | false | false | 0 | 16 | 105 | 101 | 54 | 47 | null | null |
EPashkin/gamenumber-freegame | src/Middleware/FreeGame/Facade.hs | gpl-3.0 | playerColor' 9 = (36,42,48) | 27 | playerColor' 9 = (36,42,48) | 27 | playerColor' 9 = (36,42,48) | 27 | false | false | 1 | 5 | 3 | 21 | 10 | 11 | null | null |
djudd/blokus | Territory.hs | gpl-3.0 | validOffset player board (Coords x y) (Offsets i j) =
let coords = Coords (x+i) (y+j)
in onBoard coords && legal player board coords | 141 | validOffset player board (Coords x y) (Offsets i j) =
let coords = Coords (x+i) (y+j)
in onBoard coords && legal player board coords | 141 | validOffset player board (Coords x y) (Offsets i j) =
let coords = Coords (x+i) (y+j)
in onBoard coords && legal player board coords | 141 | false | false | 0 | 11 | 32 | 76 | 36 | 40 | null | null |
ksaveljev/hake-2 | src/Game/Monsters/MParasite.hs | bsd-3-clause | frameStand01 :: Int
frameStand01 = 83 | 37 | frameStand01 :: Int
frameStand01 = 83 | 37 | frameStand01 = 83 | 17 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Text/Greek/Source/Sblgnt.hs | mit | wordParser :: EventParser Word
wordParser = do
prefix <- optionMaybe (elementContent "prefix")
(r, content) <- elementContentReference "w"
surface <- embedParser wordContentParser (T.unpack content)
suffix <- elementContent "suffix"
return $ Word (surface, r) prefix suffix | 283 | wordParser :: EventParser Word
wordParser = do
prefix <- optionMaybe (elementContent "prefix")
(r, content) <- elementContentReference "w"
surface <- embedParser wordContentParser (T.unpack content)
suffix <- elementContent "suffix"
return $ Word (surface, r) prefix suffix | 283 | wordParser = do
prefix <- optionMaybe (elementContent "prefix")
(r, content) <- elementContentReference "w"
surface <- embedParser wordContentParser (T.unpack content)
suffix <- elementContent "suffix"
return $ Word (surface, r) prefix suffix | 252 | false | true | 0 | 11 | 43 | 96 | 45 | 51 | null | null |
grumply/mop | bench/Bench/State.hs | bsd-3-clause | state :: Test Sync ()
state = tests
[ addReturn
, fmapChain
] | 67 | state :: Test Sync ()
state = tests
[ addReturn
, fmapChain
] | 67 | state = tests
[ addReturn
, fmapChain
] | 45 | false | true | 1 | 6 | 18 | 31 | 14 | 17 | null | null |
brunjlar/heap | src/Data/Logic.hs | mit | -- | /Modus ponens/ for reified facts: If @a@ is known, and if @a@ implies @b@, then @b@ is known.
--
using :: Dict a -> (a => b) -> b
using d x = case d of Dict -> x
| 167 | using :: Dict a -> (a => b) -> b
using d x = case d of Dict -> x
| 65 | using d x = case d of Dict -> x
| 32 | true | true | 0 | 10 | 41 | 53 | 25 | 28 | null | null |
sjpet/quark | src/Quark/Buffer.hs | mit | ebUnsaved :: ExtendedBuffer -> Bool
ebUnsaved = unsaved . condense | 66 | ebUnsaved :: ExtendedBuffer -> Bool
ebUnsaved = unsaved . condense | 66 | ebUnsaved = unsaved . condense | 30 | false | true | 0 | 7 | 9 | 26 | 11 | 15 | null | null |
vTurbine/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | mk_FunBind :: SrcSpan -> RdrName
-> [([LPat RdrName], LHsExpr RdrName)]
-> LHsBind RdrName
mk_FunBind = mk_HRFunBind 0 | 140 | mk_FunBind :: SrcSpan -> RdrName
-> [([LPat RdrName], LHsExpr RdrName)]
-> LHsBind RdrName
mk_FunBind = mk_HRFunBind 0 | 140 | mk_FunBind = mk_HRFunBind 0 | 27 | false | true | 0 | 12 | 38 | 52 | 25 | 27 | null | null |
vigoos/Farrago-OS | aura-master/aura-master/src/Aura/Core.hs | gpl-2.0 | orphans :: Aura [String]
orphans = lines <$> pacmanOutput ["-Qqdt"] | 67 | orphans :: Aura [String]
orphans = lines <$> pacmanOutput ["-Qqdt"] | 67 | orphans = lines <$> pacmanOutput ["-Qqdt"] | 42 | false | true | 1 | 7 | 9 | 30 | 14 | 16 | null | null |
massysett/penny | penny/lib/Penny/Copper/Copperize.hs | bsd-3-clause | cBG5NovemRadCom
:: D1'9 Char ()
-> Seq (D0'9 Char ())
-> D0'9 Char ()
-> Seq (D0'9 Char ())
-> Seq (D0'9 Char (), Seq (D0'9 Char ()))
-> BG5RadCom Char ()
cBG5NovemRadCom d0 ds1 d2 ds3 gs4
= BG5NovemRadCom d0 (D0'9'Star ds1) cGrpRadCom d2 (D0'9'Star ds3)
(DigitGroupRadCom'Star (fmap (uncurry cDigitGroupRadCom) gs4)) | 335 | cBG5NovemRadCom
:: D1'9 Char ()
-> Seq (D0'9 Char ())
-> D0'9 Char ()
-> Seq (D0'9 Char ())
-> Seq (D0'9 Char (), Seq (D0'9 Char ()))
-> BG5RadCom Char ()
cBG5NovemRadCom d0 ds1 d2 ds3 gs4
= BG5NovemRadCom d0 (D0'9'Star ds1) cGrpRadCom d2 (D0'9'Star ds3)
(DigitGroupRadCom'Star (fmap (uncurry cDigitGroupRadCom) gs4)) | 335 | cBG5NovemRadCom d0 ds1 d2 ds3 gs4
= BG5NovemRadCom d0 (D0'9'Star ds1) cGrpRadCom d2 (D0'9'Star ds3)
(DigitGroupRadCom'Star (fmap (uncurry cDigitGroupRadCom) gs4)) | 168 | false | true | 0 | 16 | 69 | 167 | 79 | 88 | null | null |
elliottt/blank-slate | src/Graphics/BlankSlate/Prim/Shader.hs | bsd-3-clause | -- | Allocate a new vertex shader.
newVertexShader :: IO (Shader SFragment)
newVertexShader = newShader gl_VERTEX_SHADER | 121 | newVertexShader :: IO (Shader SFragment)
newVertexShader = newShader gl_VERTEX_SHADER | 86 | newVertexShader = newShader gl_VERTEX_SHADER | 45 | true | true | 2 | 6 | 16 | 31 | 12 | 19 | null | null |
wavewave/hoodle-core | src/Hoodle/Coroutine/Default.hs | gpl-3.0 | menuEventProcess MenuEmbedImage = updateFlagFromToggleUI "EBDIMGA" (settings.doesEmbedImage) >> return () | 105 | menuEventProcess MenuEmbedImage = updateFlagFromToggleUI "EBDIMGA" (settings.doesEmbedImage) >> return () | 105 | menuEventProcess MenuEmbedImage = updateFlagFromToggleUI "EBDIMGA" (settings.doesEmbedImage) >> return () | 105 | false | false | 0 | 8 | 8 | 28 | 13 | 15 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp Addr2Int64Op = _ILIT(1137) | 39 | tagOf_PrimOp Addr2Int64Op = _ILIT(1137) | 39 | tagOf_PrimOp Addr2Int64Op = _ILIT(1137) | 39 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
nyirog/cis194 | lec03.hs | unlicense | elemList c' (Entry c cs)
| c == c' = True
| otherwise = elemList c' cs | 74 | elemList c' (Entry c cs)
| c == c' = True
| otherwise = elemList c' cs | 74 | elemList c' (Entry c cs)
| c == c' = True
| otherwise = elemList c' cs | 74 | false | false | 1 | 8 | 20 | 41 | 19 | 22 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_2 (157#) = happyShift action_51 | 38 | action_2 (157#) = happyShift action_51 | 38 | action_2 (157#) = happyShift action_51 | 38 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
scsibug/hS3 | Tests.hs | bsd-3-clause | testCopyObjectWithReplace :: AWSConnection -> S3Object -> S3Object -> IO ()
testCopyObjectWithReplace c srco desto =
do r <- copyObjectWithReplace c srco desto
failOnError r ()
(const $ assertBool "object copied" True) | 244 | testCopyObjectWithReplace :: AWSConnection -> S3Object -> S3Object -> IO ()
testCopyObjectWithReplace c srco desto =
do r <- copyObjectWithReplace c srco desto
failOnError r ()
(const $ assertBool "object copied" True) | 244 | testCopyObjectWithReplace c srco desto =
do r <- copyObjectWithReplace c srco desto
failOnError r ()
(const $ assertBool "object copied" True) | 168 | false | true | 0 | 10 | 56 | 73 | 34 | 39 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/CaseReorder.hs | mit | deCaseReorderLiteral a1 (PrimFloat l rational string) = PrimFloat (id l) (id rational) (id string) | 98 | deCaseReorderLiteral a1 (PrimFloat l rational string) = PrimFloat (id l) (id rational) (id string) | 98 | deCaseReorderLiteral a1 (PrimFloat l rational string) = PrimFloat (id l) (id rational) (id string) | 98 | false | false | 0 | 7 | 13 | 46 | 22 | 24 | null | null |
EchoTeam/harlson | Query.hs | bsd-2-clause | writeReply h (ReplyOverLimitUpdate overlimit) = do
B.hPut h $ B8.pack "ROLU"
writeOverLimit h overlimit
hFlush h | 124 | writeReply h (ReplyOverLimitUpdate overlimit) = do
B.hPut h $ B8.pack "ROLU"
writeOverLimit h overlimit
hFlush h | 124 | writeReply h (ReplyOverLimitUpdate overlimit) = do
B.hPut h $ B8.pack "ROLU"
writeOverLimit h overlimit
hFlush h | 124 | false | false | 0 | 9 | 27 | 48 | 20 | 28 | null | null |
ku-fpg/kansas-amber | tests/ExprTests/ExprInt.hs | bsd-3-clause | prop_testBit :: ArduinoConnection -> RemoteRef Bool -> Int -> Int -> Property
prop_testBit c r x y = monadicIO $ do
let local = x `DB.testBit` (fromIntegral y)
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) `testBit` (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 334 | prop_testBit :: ArduinoConnection -> RemoteRef Bool -> Int -> Int -> Property
prop_testBit c r x y = monadicIO $ do
let local = x `DB.testBit` (fromIntegral y)
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) `testBit` (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 334 | prop_testBit c r x y = monadicIO $ do
let local = x `DB.testBit` (fromIntegral y)
remote <- run $ send c $ do
writeRemoteRefE r $ (lit x) `testBit` (lit y)
v <- readRemoteRefE r
return v
assert (local == litEvalB remote) | 256 | false | true | 0 | 15 | 90 | 144 | 68 | 76 | null | null |
NKMR6194/carrot | src/Object.hs | mit | genStringObject :: String -> Object
genStringObject s = Object {klass = "String", value = StringValue s, methods = stringMethod}
where obj = genObject
overrides = Map.fromList [
("to_s", toSString),
("true?", toBString)
]
stringMethod = Map.union overrides $ methods obj | 318 | genStringObject :: String -> Object
genStringObject s = Object {klass = "String", value = StringValue s, methods = stringMethod}
where obj = genObject
overrides = Map.fromList [
("to_s", toSString),
("true?", toBString)
]
stringMethod = Map.union overrides $ methods obj | 318 | genStringObject s = Object {klass = "String", value = StringValue s, methods = stringMethod}
where obj = genObject
overrides = Map.fromList [
("to_s", toSString),
("true?", toBString)
]
stringMethod = Map.union overrides $ methods obj | 282 | false | true | 0 | 7 | 86 | 94 | 52 | 42 | null | null |
exFalso/lambda | src/test/TestRuntimeInterpreter.hs | bsd-3-clause | checkExpression :: [Definition Symbol] -> Primitive -> Text.Text -> Assertion
checkExpression defs expected expr = do
let toplevelDef = "__toplevel__ = " <> expr <> ";"
(_, toplevel) <- case compileString toplevelDef of
Left err -> do
assertFailure $
"ERROR while compiling expression " <> Text.unpack expr <> "\n" <>
err
undefined
Right toplevel -> return toplevel
let
trackStates = True
((result, istates), istate) = runRuntimeInterpreter $ do
load trackStates primitives
load trackStates defs
load trackStates toplevel
evaluate trackStates $ "__toplevel__"
case result of
Left err ->
assertFailure $
"RUNTIME ERROR: " <> err <> "\n" <>
prettyRuntimeState istate
Right value -> Left expected @=? value | 811 | checkExpression :: [Definition Symbol] -> Primitive -> Text.Text -> Assertion
checkExpression defs expected expr = do
let toplevelDef = "__toplevel__ = " <> expr <> ";"
(_, toplevel) <- case compileString toplevelDef of
Left err -> do
assertFailure $
"ERROR while compiling expression " <> Text.unpack expr <> "\n" <>
err
undefined
Right toplevel -> return toplevel
let
trackStates = True
((result, istates), istate) = runRuntimeInterpreter $ do
load trackStates primitives
load trackStates defs
load trackStates toplevel
evaluate trackStates $ "__toplevel__"
case result of
Left err ->
assertFailure $
"RUNTIME ERROR: " <> err <> "\n" <>
prettyRuntimeState istate
Right value -> Left expected @=? value | 811 | checkExpression defs expected expr = do
let toplevelDef = "__toplevel__ = " <> expr <> ";"
(_, toplevel) <- case compileString toplevelDef of
Left err -> do
assertFailure $
"ERROR while compiling expression " <> Text.unpack expr <> "\n" <>
err
undefined
Right toplevel -> return toplevel
let
trackStates = True
((result, istates), istate) = runRuntimeInterpreter $ do
load trackStates primitives
load trackStates defs
load trackStates toplevel
evaluate trackStates $ "__toplevel__"
case result of
Left err ->
assertFailure $
"RUNTIME ERROR: " <> err <> "\n" <>
prettyRuntimeState istate
Right value -> Left expected @=? value | 733 | false | true | 0 | 18 | 213 | 246 | 112 | 134 | null | null |
TomHammersley/HaskellRenderer | app/src/BoundingBox.hs | gpl-2.0 | boundingBoxMinComponent :: (Vector -> Double) -> Vector -> AABB -> Double
boundingBoxMinComponent f norm (boxMin, boxMax) = if f norm > 0 then f boxMin else f boxMax | 165 | boundingBoxMinComponent :: (Vector -> Double) -> Vector -> AABB -> Double
boundingBoxMinComponent f norm (boxMin, boxMax) = if f norm > 0 then f boxMin else f boxMax | 165 | boundingBoxMinComponent f norm (boxMin, boxMax) = if f norm > 0 then f boxMin else f boxMax | 91 | false | true | 0 | 7 | 27 | 64 | 33 | 31 | null | null |
brendanhay/gogol | gogol-serviceusage/gen/Network/Google/ServiceUsage/Types.hs | mpl-2.0 | -- | View your data across Google Cloud Platform services
cloudPlatformReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/cloud-platform.read-only"]
cloudPlatformReadOnlyScope = Proxy | 190 | cloudPlatformReadOnlyScope :: Proxy '["https://www.googleapis.com/auth/cloud-platform.read-only"]
cloudPlatformReadOnlyScope = Proxy | 132 | cloudPlatformReadOnlyScope = Proxy | 34 | true | true | 0 | 7 | 16 | 20 | 11 | 9 | null | null |
sedillard/Vec | Data/Vec/Nat.hs | bsd-2-clause | n9 :: N9 ; n9 = undefined | 28 | n9 :: N9
n9 = undefined | 25 | n9 = undefined | 15 | false | true | 3 | 5 | 9 | 20 | 7 | 13 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2017/M01/D05/Solution.hs | mit | enhancedScoreCard :: ScoreCard USState Axes Float -> EnhancedSC
enhancedScoreCard sc@(SC state arr) =
SC state (listArray (POPULATION, POVERTYRATIO)
([arr ! Population, arr ! Poverty, povertyRatio sc])) | 227 | enhancedScoreCard :: ScoreCard USState Axes Float -> EnhancedSC
enhancedScoreCard sc@(SC state arr) =
SC state (listArray (POPULATION, POVERTYRATIO)
([arr ! Population, arr ! Poverty, povertyRatio sc])) | 227 | enhancedScoreCard sc@(SC state arr) =
SC state (listArray (POPULATION, POVERTYRATIO)
([arr ! Population, arr ! Poverty, povertyRatio sc])) | 163 | false | true | 0 | 10 | 50 | 78 | 41 | 37 | null | null |
miguelpagano/equ | Equ/Proof.hs | gpl-3.0 | validateProof :: [Operator] -> Proof -> PM Proof
validateProof opsac p = validateProof' opsac p goTop' | 103 | validateProof :: [Operator] -> Proof -> PM Proof
validateProof opsac p = validateProof' opsac p goTop' | 103 | validateProof opsac p = validateProof' opsac p goTop' | 54 | false | true | 0 | 7 | 16 | 37 | 18 | 19 | null | null |
enolan/Idris-dev | src/Idris/Output.hs | bsd-3-clause | renderExternal :: OutputFmt -> Int -> Doc OutputAnnotation -> Idris String
renderExternal fmt width doc
| width < 1 = throwError . Msg $ "There must be at least one column for the pretty-printer."
| otherwise =
do ist <- getIState
return . wrap fmt .
displayDecorated (decorate fmt) .
renderPretty 1.0 width .
fmap (fancifyAnnots ist True) $
doc
where
decorate _ (AnnFC _) = id
decorate HTMLOutput (AnnName _ (Just TypeOutput) d _) =
tag "idris-type" d
decorate HTMLOutput (AnnName _ (Just FunOutput) d _) =
tag "idris-function" d
decorate HTMLOutput (AnnName _ (Just DataOutput) d _) =
tag "idris-data" d
decorate HTMLOutput (AnnName _ (Just MetavarOutput) d _) =
tag "idris-metavar" d
decorate HTMLOutput (AnnName _ (Just PostulateOutput) d _) =
tag "idris-postulate" d
decorate HTMLOutput (AnnName _ _ _ _) = id
decorate HTMLOutput (AnnBoundName _ True) = tag "idris-bound idris-implicit" Nothing
decorate HTMLOutput (AnnBoundName _ False) = tag "idris-bound" Nothing
decorate HTMLOutput (AnnConst c) =
tag (if constIsType c then "idris-type" else "idris-data")
(Just $ constDocs c)
decorate HTMLOutput (AnnData _ _) = tag "idris-data" Nothing
decorate HTMLOutput (AnnType _ _) = tag "idris-type" Nothing
decorate HTMLOutput AnnKeyword = tag "idris-keyword" Nothing
decorate HTMLOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> mkTag "strong"
ItalicText -> mkTag "em"
UnderlineText -> tag "idris-underlined" Nothing
where mkTag t x = "<"++t++">"++x++"</"++t++">"
decorate HTMLOutput (AnnTerm _ _) = id
decorate HTMLOutput (AnnSearchResult _) = id
decorate HTMLOutput (AnnErr _) = id
decorate HTMLOutput (AnnNamespace _ _) = id
decorate HTMLOutput (AnnLink url) =
\txt -> "<a href=\"" ++ url ++ "\">" ++ txt ++ "</a>"
decorate HTMLOutput AnnQuasiquote = id
decorate HTMLOutput AnnAntiquote = id
decorate LaTeXOutput (AnnName _ (Just TypeOutput) _ _) =
latex "IdrisType"
decorate LaTeXOutput (AnnName _ (Just FunOutput) _ _) =
latex "IdrisFunction"
decorate LaTeXOutput (AnnName _ (Just DataOutput) _ _) =
latex "IdrisData"
decorate LaTeXOutput (AnnName _ (Just MetavarOutput) _ _) =
latex "IdrisMetavar"
decorate LaTeXOutput (AnnName _ (Just PostulateOutput) _ _) =
latex "IdrisPostulate"
decorate LaTeXOutput (AnnName _ _ _ _) = id
decorate LaTeXOutput (AnnBoundName _ True) = latex "IdrisImplicit"
decorate LaTeXOutput (AnnBoundName _ False) = latex "IdrisBound"
decorate LaTeXOutput (AnnConst c) =
latex $ if constIsType c then "IdrisType" else "IdrisData"
decorate LaTeXOutput (AnnData _ _) = latex "IdrisData"
decorate LaTeXOutput (AnnType _ _) = latex "IdrisType"
decorate LaTeXOutput AnnKeyword = latex "IdrisKeyword"
decorate LaTeXOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> latex "textbf"
ItalicText -> latex "emph"
UnderlineText -> latex "underline"
decorate LaTeXOutput (AnnTerm _ _) = id
decorate LaTeXOutput (AnnSearchResult _) = id
decorate LaTeXOutput (AnnErr _) = id
decorate LaTeXOutput (AnnNamespace _ _) = id
decorate LaTeXOutput (AnnLink url) = (++ "(\\url{" ++ url ++ "})")
decorate LaTeXOutput AnnQuasiquote = id
decorate LaTeXOutput AnnAntiquote = id
tag cls docs str = "<span class=\""++cls++"\""++title++">" ++ str ++ "</span>"
where title = maybe "" (\d->" title=\"" ++ d ++ "\"") docs
latex cmd str = "\\"++cmd++"{"++str++"}"
wrap HTMLOutput str =
"<!doctype html><html><head><style>" ++ css ++ "</style></head>" ++
"<body><!-- START CODE --><pre>" ++ str ++ "</pre><!-- END CODE --></body></html>"
where css = concat . intersperse "\n" $
[".idris-data { color: red; } ",
".idris-type { color: blue; }",
".idris-function {color: green; }",
".idris-keyword { font-weight: bold; }",
".idris-bound { color: purple; }",
".idris-implicit { font-style: italic; }",
".idris-underlined { text-decoration: underline; }"]
wrap LaTeXOutput str =
concat . intersperse "\n" $
["\\documentclass{article}",
"\\usepackage{fancyvrb}",
"\\usepackage[usenames]{xcolor}"] ++
map (\(cmd, color) ->
"\\newcommand{\\"++ cmd ++
"}[1]{\\textcolor{"++ color ++"}{#1}}")
[("IdrisData", "red"), ("IdrisType", "blue"),
("IdrisBound", "magenta"), ("IdrisFunction", "green")] ++
["\\newcommand{\\IdrisKeyword}[1]{{\\underline{#1}}}",
"\\newcommand{\\IdrisImplicit}[1]{{\\itshape \\IdrisBound{#1}}}",
"\n",
"\\begin{document}",
"% START CODE",
"\\begin{Verbatim}[commandchars=\\\\\\{\\}]",
str,
"\\end{Verbatim}",
"% END CODE",
"\\end{document}"] | 5,100 | renderExternal :: OutputFmt -> Int -> Doc OutputAnnotation -> Idris String
renderExternal fmt width doc
| width < 1 = throwError . Msg $ "There must be at least one column for the pretty-printer."
| otherwise =
do ist <- getIState
return . wrap fmt .
displayDecorated (decorate fmt) .
renderPretty 1.0 width .
fmap (fancifyAnnots ist True) $
doc
where
decorate _ (AnnFC _) = id
decorate HTMLOutput (AnnName _ (Just TypeOutput) d _) =
tag "idris-type" d
decorate HTMLOutput (AnnName _ (Just FunOutput) d _) =
tag "idris-function" d
decorate HTMLOutput (AnnName _ (Just DataOutput) d _) =
tag "idris-data" d
decorate HTMLOutput (AnnName _ (Just MetavarOutput) d _) =
tag "idris-metavar" d
decorate HTMLOutput (AnnName _ (Just PostulateOutput) d _) =
tag "idris-postulate" d
decorate HTMLOutput (AnnName _ _ _ _) = id
decorate HTMLOutput (AnnBoundName _ True) = tag "idris-bound idris-implicit" Nothing
decorate HTMLOutput (AnnBoundName _ False) = tag "idris-bound" Nothing
decorate HTMLOutput (AnnConst c) =
tag (if constIsType c then "idris-type" else "idris-data")
(Just $ constDocs c)
decorate HTMLOutput (AnnData _ _) = tag "idris-data" Nothing
decorate HTMLOutput (AnnType _ _) = tag "idris-type" Nothing
decorate HTMLOutput AnnKeyword = tag "idris-keyword" Nothing
decorate HTMLOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> mkTag "strong"
ItalicText -> mkTag "em"
UnderlineText -> tag "idris-underlined" Nothing
where mkTag t x = "<"++t++">"++x++"</"++t++">"
decorate HTMLOutput (AnnTerm _ _) = id
decorate HTMLOutput (AnnSearchResult _) = id
decorate HTMLOutput (AnnErr _) = id
decorate HTMLOutput (AnnNamespace _ _) = id
decorate HTMLOutput (AnnLink url) =
\txt -> "<a href=\"" ++ url ++ "\">" ++ txt ++ "</a>"
decorate HTMLOutput AnnQuasiquote = id
decorate HTMLOutput AnnAntiquote = id
decorate LaTeXOutput (AnnName _ (Just TypeOutput) _ _) =
latex "IdrisType"
decorate LaTeXOutput (AnnName _ (Just FunOutput) _ _) =
latex "IdrisFunction"
decorate LaTeXOutput (AnnName _ (Just DataOutput) _ _) =
latex "IdrisData"
decorate LaTeXOutput (AnnName _ (Just MetavarOutput) _ _) =
latex "IdrisMetavar"
decorate LaTeXOutput (AnnName _ (Just PostulateOutput) _ _) =
latex "IdrisPostulate"
decorate LaTeXOutput (AnnName _ _ _ _) = id
decorate LaTeXOutput (AnnBoundName _ True) = latex "IdrisImplicit"
decorate LaTeXOutput (AnnBoundName _ False) = latex "IdrisBound"
decorate LaTeXOutput (AnnConst c) =
latex $ if constIsType c then "IdrisType" else "IdrisData"
decorate LaTeXOutput (AnnData _ _) = latex "IdrisData"
decorate LaTeXOutput (AnnType _ _) = latex "IdrisType"
decorate LaTeXOutput AnnKeyword = latex "IdrisKeyword"
decorate LaTeXOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> latex "textbf"
ItalicText -> latex "emph"
UnderlineText -> latex "underline"
decorate LaTeXOutput (AnnTerm _ _) = id
decorate LaTeXOutput (AnnSearchResult _) = id
decorate LaTeXOutput (AnnErr _) = id
decorate LaTeXOutput (AnnNamespace _ _) = id
decorate LaTeXOutput (AnnLink url) = (++ "(\\url{" ++ url ++ "})")
decorate LaTeXOutput AnnQuasiquote = id
decorate LaTeXOutput AnnAntiquote = id
tag cls docs str = "<span class=\""++cls++"\""++title++">" ++ str ++ "</span>"
where title = maybe "" (\d->" title=\"" ++ d ++ "\"") docs
latex cmd str = "\\"++cmd++"{"++str++"}"
wrap HTMLOutput str =
"<!doctype html><html><head><style>" ++ css ++ "</style></head>" ++
"<body><!-- START CODE --><pre>" ++ str ++ "</pre><!-- END CODE --></body></html>"
where css = concat . intersperse "\n" $
[".idris-data { color: red; } ",
".idris-type { color: blue; }",
".idris-function {color: green; }",
".idris-keyword { font-weight: bold; }",
".idris-bound { color: purple; }",
".idris-implicit { font-style: italic; }",
".idris-underlined { text-decoration: underline; }"]
wrap LaTeXOutput str =
concat . intersperse "\n" $
["\\documentclass{article}",
"\\usepackage{fancyvrb}",
"\\usepackage[usenames]{xcolor}"] ++
map (\(cmd, color) ->
"\\newcommand{\\"++ cmd ++
"}[1]{\\textcolor{"++ color ++"}{#1}}")
[("IdrisData", "red"), ("IdrisType", "blue"),
("IdrisBound", "magenta"), ("IdrisFunction", "green")] ++
["\\newcommand{\\IdrisKeyword}[1]{{\\underline{#1}}}",
"\\newcommand{\\IdrisImplicit}[1]{{\\itshape \\IdrisBound{#1}}}",
"\n",
"\\begin{document}",
"% START CODE",
"\\begin{Verbatim}[commandchars=\\\\\\{\\}]",
str,
"\\end{Verbatim}",
"% END CODE",
"\\end{document}"] | 5,100 | renderExternal fmt width doc
| width < 1 = throwError . Msg $ "There must be at least one column for the pretty-printer."
| otherwise =
do ist <- getIState
return . wrap fmt .
displayDecorated (decorate fmt) .
renderPretty 1.0 width .
fmap (fancifyAnnots ist True) $
doc
where
decorate _ (AnnFC _) = id
decorate HTMLOutput (AnnName _ (Just TypeOutput) d _) =
tag "idris-type" d
decorate HTMLOutput (AnnName _ (Just FunOutput) d _) =
tag "idris-function" d
decorate HTMLOutput (AnnName _ (Just DataOutput) d _) =
tag "idris-data" d
decorate HTMLOutput (AnnName _ (Just MetavarOutput) d _) =
tag "idris-metavar" d
decorate HTMLOutput (AnnName _ (Just PostulateOutput) d _) =
tag "idris-postulate" d
decorate HTMLOutput (AnnName _ _ _ _) = id
decorate HTMLOutput (AnnBoundName _ True) = tag "idris-bound idris-implicit" Nothing
decorate HTMLOutput (AnnBoundName _ False) = tag "idris-bound" Nothing
decorate HTMLOutput (AnnConst c) =
tag (if constIsType c then "idris-type" else "idris-data")
(Just $ constDocs c)
decorate HTMLOutput (AnnData _ _) = tag "idris-data" Nothing
decorate HTMLOutput (AnnType _ _) = tag "idris-type" Nothing
decorate HTMLOutput AnnKeyword = tag "idris-keyword" Nothing
decorate HTMLOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> mkTag "strong"
ItalicText -> mkTag "em"
UnderlineText -> tag "idris-underlined" Nothing
where mkTag t x = "<"++t++">"++x++"</"++t++">"
decorate HTMLOutput (AnnTerm _ _) = id
decorate HTMLOutput (AnnSearchResult _) = id
decorate HTMLOutput (AnnErr _) = id
decorate HTMLOutput (AnnNamespace _ _) = id
decorate HTMLOutput (AnnLink url) =
\txt -> "<a href=\"" ++ url ++ "\">" ++ txt ++ "</a>"
decorate HTMLOutput AnnQuasiquote = id
decorate HTMLOutput AnnAntiquote = id
decorate LaTeXOutput (AnnName _ (Just TypeOutput) _ _) =
latex "IdrisType"
decorate LaTeXOutput (AnnName _ (Just FunOutput) _ _) =
latex "IdrisFunction"
decorate LaTeXOutput (AnnName _ (Just DataOutput) _ _) =
latex "IdrisData"
decorate LaTeXOutput (AnnName _ (Just MetavarOutput) _ _) =
latex "IdrisMetavar"
decorate LaTeXOutput (AnnName _ (Just PostulateOutput) _ _) =
latex "IdrisPostulate"
decorate LaTeXOutput (AnnName _ _ _ _) = id
decorate LaTeXOutput (AnnBoundName _ True) = latex "IdrisImplicit"
decorate LaTeXOutput (AnnBoundName _ False) = latex "IdrisBound"
decorate LaTeXOutput (AnnConst c) =
latex $ if constIsType c then "IdrisType" else "IdrisData"
decorate LaTeXOutput (AnnData _ _) = latex "IdrisData"
decorate LaTeXOutput (AnnType _ _) = latex "IdrisType"
decorate LaTeXOutput AnnKeyword = latex "IdrisKeyword"
decorate LaTeXOutput (AnnTextFmt fmt) =
case fmt of
BoldText -> latex "textbf"
ItalicText -> latex "emph"
UnderlineText -> latex "underline"
decorate LaTeXOutput (AnnTerm _ _) = id
decorate LaTeXOutput (AnnSearchResult _) = id
decorate LaTeXOutput (AnnErr _) = id
decorate LaTeXOutput (AnnNamespace _ _) = id
decorate LaTeXOutput (AnnLink url) = (++ "(\\url{" ++ url ++ "})")
decorate LaTeXOutput AnnQuasiquote = id
decorate LaTeXOutput AnnAntiquote = id
tag cls docs str = "<span class=\""++cls++"\""++title++">" ++ str ++ "</span>"
where title = maybe "" (\d->" title=\"" ++ d ++ "\"") docs
latex cmd str = "\\"++cmd++"{"++str++"}"
wrap HTMLOutput str =
"<!doctype html><html><head><style>" ++ css ++ "</style></head>" ++
"<body><!-- START CODE --><pre>" ++ str ++ "</pre><!-- END CODE --></body></html>"
where css = concat . intersperse "\n" $
[".idris-data { color: red; } ",
".idris-type { color: blue; }",
".idris-function {color: green; }",
".idris-keyword { font-weight: bold; }",
".idris-bound { color: purple; }",
".idris-implicit { font-style: italic; }",
".idris-underlined { text-decoration: underline; }"]
wrap LaTeXOutput str =
concat . intersperse "\n" $
["\\documentclass{article}",
"\\usepackage{fancyvrb}",
"\\usepackage[usenames]{xcolor}"] ++
map (\(cmd, color) ->
"\\newcommand{\\"++ cmd ++
"}[1]{\\textcolor{"++ color ++"}{#1}}")
[("IdrisData", "red"), ("IdrisType", "blue"),
("IdrisBound", "magenta"), ("IdrisFunction", "green")] ++
["\\newcommand{\\IdrisKeyword}[1]{{\\underline{#1}}}",
"\\newcommand{\\IdrisImplicit}[1]{{\\itshape \\IdrisBound{#1}}}",
"\n",
"\\begin{document}",
"% START CODE",
"\\begin{Verbatim}[commandchars=\\\\\\{\\}]",
str,
"\\end{Verbatim}",
"% END CODE",
"\\end{document}"] | 5,025 | false | true | 7 | 14 | 1,349 | 1,574 | 732 | 842 | null | null |
phadej/range-set-list | src/Data/RangeSet/Map.hs | mit | -- | /O(n)/. Ensure that a set is valid. All functions should return valid sets except those with unchecked preconditions: 'fromAscList', 'fromNormalizedRangeList'
valid :: (Ord a, Enum a, Bounded a) => RSet a -> Bool
valid (RSet xm) = Map.valid xm && validRangeList (Map.toAscList xm) | 285 | valid :: (Ord a, Enum a, Bounded a) => RSet a -> Bool
valid (RSet xm) = Map.valid xm && validRangeList (Map.toAscList xm) | 121 | valid (RSet xm) = Map.valid xm && validRangeList (Map.toAscList xm) | 67 | true | true | 0 | 9 | 44 | 69 | 34 | 35 | null | null |
Yuras/tide | src/HaskellLex.hs | bsd-3-clause | numberLit :: Parser Lit
numberLit = do
pref <- takeWhile1 isDigit
choice
[ floatLit pref
, integralLit pref
]
where
floatLit pref = do
void $ char '.'
rest <- takeWhile isDigit
return . Float $ read $ Text.unpack (Text.concat [pref, ".", rest])
integralLit pref = pure . Integer $ read (Text.unpack pref) | 339 | numberLit :: Parser Lit
numberLit = do
pref <- takeWhile1 isDigit
choice
[ floatLit pref
, integralLit pref
]
where
floatLit pref = do
void $ char '.'
rest <- takeWhile isDigit
return . Float $ read $ Text.unpack (Text.concat [pref, ".", rest])
integralLit pref = pure . Integer $ read (Text.unpack pref) | 339 | numberLit = do
pref <- takeWhile1 isDigit
choice
[ floatLit pref
, integralLit pref
]
where
floatLit pref = do
void $ char '.'
rest <- takeWhile isDigit
return . Float $ read $ Text.unpack (Text.concat [pref, ".", rest])
integralLit pref = pure . Integer $ read (Text.unpack pref) | 315 | false | true | 0 | 11 | 87 | 137 | 64 | 73 | null | null |
jstolarek/ghc | libraries/base/Debug/Trace.hs | bsd-3-clause | -- | The 'traceEvent' function behaves like 'trace' with the difference that
-- the message is emitted to the eventlog, if eventlog profiling is available
-- and enabled at runtime.
--
-- It is suitable for use in pure code. In an IO context use 'traceEventIO'
-- instead.
--
-- Note that when using GHC's SMP runtime, it is possible (but rare) to get
-- duplicate events emitted if two CPUs simultaneously evaluate the same thunk
-- that uses 'traceEvent'.
--
-- /Since: 4.5.0.0/
traceEvent :: String -> a -> a
traceEvent msg expr = unsafeDupablePerformIO $ do
traceEventIO msg
return expr
-- | The 'traceEventIO' function emits a message to the eventlog, if eventlog
-- profiling is available and enabled at runtime.
--
-- Compared to 'traceEvent', 'traceEventIO' sequences the event with respect to
-- other IO actions.
--
-- /Since: 4.5.0.0/ | 854 | traceEvent :: String -> a -> a
traceEvent msg expr = unsafeDupablePerformIO $ do
traceEventIO msg
return expr
-- | The 'traceEventIO' function emits a message to the eventlog, if eventlog
-- profiling is available and enabled at runtime.
--
-- Compared to 'traceEvent', 'traceEventIO' sequences the event with respect to
-- other IO actions.
--
-- /Since: 4.5.0.0/ | 373 | traceEvent msg expr = unsafeDupablePerformIO $ do
traceEventIO msg
return expr
-- | The 'traceEventIO' function emits a message to the eventlog, if eventlog
-- profiling is available and enabled at runtime.
--
-- Compared to 'traceEvent', 'traceEventIO' sequences the event with respect to
-- other IO actions.
--
-- /Since: 4.5.0.0/ | 342 | true | true | 0 | 8 | 151 | 59 | 37 | 22 | null | null |
iamkingmaker/HLearn | src/HLearn/Models/Classifiers/HTree.hs | bsd-3-clause | untupzip = foldr (\(a:::b) ~(as:::bs) -> ((a:as):::(b:bs))) ([]:::[]) | 73 | untupzip = foldr (\(a:::b) ~(as:::bs) -> ((a:as):::(b:bs))) ([]:::[]) | 73 | untupzip = foldr (\(a:::b) ~(as:::bs) -> ((a:as):::(b:bs))) ([]:::[]) | 73 | false | false | 0 | 11 | 11 | 68 | 37 | 31 | null | null |
sdiehl/ghc | compiler/llvmGen/LlvmCodeGen/Base.hs | bsd-3-clause | isFPR (YmmReg _) = True | 26 | isFPR (YmmReg _) = True | 26 | isFPR (YmmReg _) = True | 26 | false | false | 0 | 6 | 7 | 16 | 7 | 9 | null | null |
ihc/futhark | src/Futhark/CodeGen/ImpGen.hs | isc | fparamSizes :: Typed attr => Param attr -> S.Set VName
fparamSizes fparam
| Mem (Var size) _ <- paramType fparam = S.singleton size
| otherwise = S.fromList $ subExpVars $ arrayDims $ paramType fparam | 204 | fparamSizes :: Typed attr => Param attr -> S.Set VName
fparamSizes fparam
| Mem (Var size) _ <- paramType fparam = S.singleton size
| otherwise = S.fromList $ subExpVars $ arrayDims $ paramType fparam | 204 | fparamSizes fparam
| Mem (Var size) _ <- paramType fparam = S.singleton size
| otherwise = S.fromList $ subExpVars $ arrayDims $ paramType fparam | 149 | false | true | 0 | 11 | 37 | 94 | 41 | 53 | null | null |
kenkov/nlp | haskell/langmodel/ngram.hs | mit | ngram2 :: [String] -> [(String, String)]
ngram2 xs = ngram2' (["<s>"] ++ xs ++ ["</s>"]) | 88 | ngram2 :: [String] -> [(String, String)]
ngram2 xs = ngram2' (["<s>"] ++ xs ++ ["</s>"]) | 88 | ngram2 xs = ngram2' (["<s>"] ++ xs ++ ["</s>"]) | 47 | false | true | 0 | 9 | 14 | 50 | 28 | 22 | null | null |
anttisalonen/freekick2 | src/Listings.hs | gpl-3.0 | showPlayerNation 137 = "Pakistan" | 33 | showPlayerNation 137 = "Pakistan" | 33 | showPlayerNation 137 = "Pakistan" | 33 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
muspellsson/hiccup | TclObj.hs | lgpl-2.1 | mkTclDouble :: Double -> TclObj
mkTclDouble !d = TclDouble d bsval
where bsval = pack (show d) | 95 | mkTclDouble :: Double -> TclObj
mkTclDouble !d = TclDouble d bsval
where bsval = pack (show d) | 95 | mkTclDouble !d = TclDouble d bsval
where bsval = pack (show d) | 63 | false | true | 0 | 7 | 17 | 41 | 19 | 22 | null | null |
t4sk/upenn-cis194 | hw-10/AParser.hs | mit | abParser_ :: Parser ()
abParser_ = const () <$> abParser | 56 | abParser_ :: Parser ()
abParser_ = const () <$> abParser | 56 | abParser_ = const () <$> abParser | 33 | false | true | 0 | 7 | 9 | 25 | 12 | 13 | null | null |
mettekou/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | anyTypeOfKind :: Kind -> Type
anyTypeOfKind kind = mkTyConApp anyTyCon [kind] | 77 | anyTypeOfKind :: Kind -> Type
anyTypeOfKind kind = mkTyConApp anyTyCon [kind] | 77 | anyTypeOfKind kind = mkTyConApp anyTyCon [kind] | 47 | false | true | 0 | 6 | 10 | 26 | 13 | 13 | null | null |
jsinglet/Paradox | src/TypeCheck.hs | gpl-3.0 | implicitTypeChecker (ParserState env) (ExpressionNode n@(EqualsExpression expression term)) =
trace ("Checking EqualsExpression: " ++ unparse n 0 "" ++ ". Current Env:\n" ++ (showStack env) ++ "\n\n") $
ParserState $ let (_,s) = runState (checkLastTwoTypesMatch n >> pop >> storeIdent "_infType" BooleanType) env in s | 334 | implicitTypeChecker (ParserState env) (ExpressionNode n@(EqualsExpression expression term)) =
trace ("Checking EqualsExpression: " ++ unparse n 0 "" ++ ". Current Env:\n" ++ (showStack env) ++ "\n\n") $
ParserState $ let (_,s) = runState (checkLastTwoTypesMatch n >> pop >> storeIdent "_infType" BooleanType) env in s | 334 | implicitTypeChecker (ParserState env) (ExpressionNode n@(EqualsExpression expression term)) =
trace ("Checking EqualsExpression: " ++ unparse n 0 "" ++ ". Current Env:\n" ++ (showStack env) ++ "\n\n") $
ParserState $ let (_,s) = runState (checkLastTwoTypesMatch n >> pop >> storeIdent "_infType" BooleanType) env in s | 334 | false | false | 0 | 14 | 60 | 119 | 58 | 61 | null | null |
Teaspot-Studio/Urho3D-Haskell | app/sample03/Main.hs | mit | moveSprites :: SharedPtr Application -> [SharedPtr Sprite] -> Float -> IO ()
moveSprites app sprites t = do
(graphics :: Ptr Graphics) <- fromJustTrace "Graphics" <$> getSubsystem app
gw <- fromIntegral <$> graphicsGetWidth graphics
gh <- fromIntegral <$> graphicsGetHeight graphics
-- Go through all sprites
forM_ sprites $ \sprite -> do
-- Rotate
rot <- spriteGetRotation sprite
spriteSetRotation sprite $ t * 30 + rot
-- Move, wrap around rendering window edges
p <- spriteGetPosition sprite
v <- fromJustTrace "Velocity var" <$> uiElementGetVar sprite varVelocity
let newPos = p + v * realToFrac t
wrapedPos = Vector2
(if newPos^.x < 0 then newPos^.x + gw else
if newPos^.x >= gw then newPos^.x - gw else newPos^.x)
(if newPos^.y < 0 then newPos^.y + gh else
if newPos^.y >= gh then newPos^.y - gh else newPos^.y)
spriteSetPosition sprite wrapedPos
-- | Subscribe to application-wide logic update events. | 1,017 | moveSprites :: SharedPtr Application -> [SharedPtr Sprite] -> Float -> IO ()
moveSprites app sprites t = do
(graphics :: Ptr Graphics) <- fromJustTrace "Graphics" <$> getSubsystem app
gw <- fromIntegral <$> graphicsGetWidth graphics
gh <- fromIntegral <$> graphicsGetHeight graphics
-- Go through all sprites
forM_ sprites $ \sprite -> do
-- Rotate
rot <- spriteGetRotation sprite
spriteSetRotation sprite $ t * 30 + rot
-- Move, wrap around rendering window edges
p <- spriteGetPosition sprite
v <- fromJustTrace "Velocity var" <$> uiElementGetVar sprite varVelocity
let newPos = p + v * realToFrac t
wrapedPos = Vector2
(if newPos^.x < 0 then newPos^.x + gw else
if newPos^.x >= gw then newPos^.x - gw else newPos^.x)
(if newPos^.y < 0 then newPos^.y + gh else
if newPos^.y >= gh then newPos^.y - gh else newPos^.y)
spriteSetPosition sprite wrapedPos
-- | Subscribe to application-wide logic update events. | 1,017 | moveSprites app sprites t = do
(graphics :: Ptr Graphics) <- fromJustTrace "Graphics" <$> getSubsystem app
gw <- fromIntegral <$> graphicsGetWidth graphics
gh <- fromIntegral <$> graphicsGetHeight graphics
-- Go through all sprites
forM_ sprites $ \sprite -> do
-- Rotate
rot <- spriteGetRotation sprite
spriteSetRotation sprite $ t * 30 + rot
-- Move, wrap around rendering window edges
p <- spriteGetPosition sprite
v <- fromJustTrace "Velocity var" <$> uiElementGetVar sprite varVelocity
let newPos = p + v * realToFrac t
wrapedPos = Vector2
(if newPos^.x < 0 then newPos^.x + gw else
if newPos^.x >= gw then newPos^.x - gw else newPos^.x)
(if newPos^.y < 0 then newPos^.y + gh else
if newPos^.y >= gh then newPos^.y - gh else newPos^.y)
spriteSetPosition sprite wrapedPos
-- | Subscribe to application-wide logic update events. | 940 | false | true | 0 | 20 | 254 | 329 | 158 | 171 | null | null |
andreyk0/HSOpenSCAD | Graphics/OpenSCAD.hs | bsd-3-clause | -- | This provides direct access to the OpenScad @polygon@ command for
-- performance reasons. This version uses the OpenSCAD arguments:
-- @polygon /convexity points path/@ to allow client code to save
-- space. However, it bypasses all the checks done by
-- 'polygon', which need the other representation.
unsafePolygon :: Int -> [Vector2d] -> [[Int]] -> Model2d
unsafePolygon convexity points paths = Shape $ Polygon convexity points paths | 443 | unsafePolygon :: Int -> [Vector2d] -> [[Int]] -> Model2d
unsafePolygon convexity points paths = Shape $ Polygon convexity points paths | 134 | unsafePolygon convexity points paths = Shape $ Polygon convexity points paths | 77 | true | true | 0 | 9 | 69 | 55 | 31 | 24 | null | null |
Mokosha/Lambency | lib/Lambency/Texture.hs | mit | loadTexture :: FilePath -> ResourceLoader (Maybe Texture)
loadTexture filename =
let imageType = determineImageType filename
in loadTextureWithType filename imageType | 170 | loadTexture :: FilePath -> ResourceLoader (Maybe Texture)
loadTexture filename =
let imageType = determineImageType filename
in loadTextureWithType filename imageType | 170 | loadTexture filename =
let imageType = determineImageType filename
in loadTextureWithType filename imageType | 112 | false | true | 0 | 9 | 22 | 46 | 21 | 25 | null | null |
aslatter/hmumps | HMumps/Runtime.hs | gpl-3.0 | localCall :: Name -> [FunArg] -> RunMonad (Maybe MValue)
localCall label args = do (r :: Routine) <- (tags . head) `liftM` get
case r label of
Nothing -> fail $ "Noline: " ++ label
Just (argnames, cmds) -> funcall args argnames cmds r | 316 | localCall :: Name -> [FunArg] -> RunMonad (Maybe MValue)
localCall label args = do (r :: Routine) <- (tags . head) `liftM` get
case r label of
Nothing -> fail $ "Noline: " ++ label
Just (argnames, cmds) -> funcall args argnames cmds r | 316 | localCall label args = do (r :: Routine) <- (tags . head) `liftM` get
case r label of
Nothing -> fail $ "Noline: " ++ label
Just (argnames, cmds) -> funcall args argnames cmds r | 259 | false | true | 0 | 12 | 125 | 116 | 57 | 59 | null | null |
gcampax/ghc | compiler/types/Type.hs | bsd-3-clause | tyConAppArgs_maybe _ = Nothing | 45 | tyConAppArgs_maybe _ = Nothing | 45 | tyConAppArgs_maybe _ = Nothing | 45 | false | false | 0 | 5 | 18 | 9 | 4 | 5 | null | null |
DaveCTurner/pool | Data/Pool.hs | bsd-3-clause | modError :: String -> String -> a
modError func msg =
error $ "Data.Pool." ++ func ++ ": " ++ msg | 101 | modError :: String -> String -> a
modError func msg =
error $ "Data.Pool." ++ func ++ ": " ++ msg | 101 | modError func msg =
error $ "Data.Pool." ++ func ++ ": " ++ msg | 67 | false | true | 2 | 8 | 24 | 47 | 21 | 26 | null | null |
MasseR/xmonadcontrib | XMonad/Layout/Mosaic.hs | bsd-3-clause | splitsL rect (Branch l r) = do
let mkSplit f = f ((sumSnd l /) $ sumSnd l + sumSnd r) rect
sumSnd = sum . fmap snd
(rl,rr) <- map mkSplit [splitVerticallyBy,splitHorizontallyBy]
splitsL rl l `interleave` splitsL rr r
-- like zipWith (++), but when one list is shorter, its elements are duplicated
-- so that they match | 339 | splitsL rect (Branch l r) = do
let mkSplit f = f ((sumSnd l /) $ sumSnd l + sumSnd r) rect
sumSnd = sum . fmap snd
(rl,rr) <- map mkSplit [splitVerticallyBy,splitHorizontallyBy]
splitsL rl l `interleave` splitsL rr r
-- like zipWith (++), but when one list is shorter, its elements are duplicated
-- so that they match | 339 | splitsL rect (Branch l r) = do
let mkSplit f = f ((sumSnd l /) $ sumSnd l + sumSnd r) rect
sumSnd = sum . fmap snd
(rl,rr) <- map mkSplit [splitVerticallyBy,splitHorizontallyBy]
splitsL rl l `interleave` splitsL rr r
-- like zipWith (++), but when one list is shorter, its elements are duplicated
-- so that they match | 339 | false | false | 0 | 15 | 79 | 117 | 58 | 59 | null | null |
blippy/sifi | src/Etb.hs | gpl-3.0 | assembleEtb :: [Xacc] -> [[Post]] -> Etb
assembleEtb xaccs ps =
augs
where
--summate (a, n, posts) = (a, countPennies (L.map postPennies posts))
summate ps = (postDr $ head ps, countPennies (L.map postPennies ps))
lup = L.map summate ps
augs = augEtb xaccs lup | 280 | assembleEtb :: [Xacc] -> [[Post]] -> Etb
assembleEtb xaccs ps =
augs
where
--summate (a, n, posts) = (a, countPennies (L.map postPennies posts))
summate ps = (postDr $ head ps, countPennies (L.map postPennies ps))
lup = L.map summate ps
augs = augEtb xaccs lup | 280 | assembleEtb xaccs ps =
augs
where
--summate (a, n, posts) = (a, countPennies (L.map postPennies posts))
summate ps = (postDr $ head ps, countPennies (L.map postPennies ps))
lup = L.map summate ps
augs = augEtb xaccs lup | 239 | false | true | 0 | 9 | 63 | 93 | 48 | 45 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.