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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
kawamuray/ganeti | src/Ganeti/Hs2Py/OpDoc.hs | gpl-2.0 | opNetworkQuery :: String
opNetworkQuery =
"Compute the list of networks." | 75 | opNetworkQuery :: String
opNetworkQuery =
"Compute the list of networks." | 75 | opNetworkQuery =
"Compute the list of networks." | 50 | false | true | 0 | 4 | 11 | 11 | 6 | 5 | null | null |
christiaanb/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | eqResult OrdLT = false_Expr | 32 | eqResult OrdLT = false_Expr | 32 | eqResult OrdLT = false_Expr | 32 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
jspahrsummers/network | Network/URI.hs | bsd-3-clause | -- | Returns a new 'URI' which represents the value of the first 'URI'
-- interpreted as relative to the second 'URI'.
--
-- Algorithm from RFC3986 [3], section 5.2
relativeTo :: URI -> URI -> URI
relativeTo ref base
| isDefined ( uriScheme ref ) =
just_segments ref
| isDefined ( uriAuthority ref ) =
just_segments ref { uriScheme = uriScheme base }
| isDefined ( uriPath ref ) =
if (head (uriPath ref) == '/') then
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
}
else
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = mergePaths base ref
}
| isDefined ( uriQuery ref ) =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
}
| otherwise =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
, uriQuery = uriQuery base
}
where
just_segments u =
u { uriPath = removeDotSegments (uriPath u) }
mergePaths b r
| isDefined (uriAuthority b) && null pb = '/':pr
| otherwise = dropLast pb ++ pr
where
pb = uriPath b
pr = uriPath r
dropLast = fst . splitLast -- reverse . dropWhile (/='/') . reverse
-- Remove dot segments, but protect leading '/' character | 1,720 | relativeTo :: URI -> URI -> URI
relativeTo ref base
| isDefined ( uriScheme ref ) =
just_segments ref
| isDefined ( uriAuthority ref ) =
just_segments ref { uriScheme = uriScheme base }
| isDefined ( uriPath ref ) =
if (head (uriPath ref) == '/') then
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
}
else
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = mergePaths base ref
}
| isDefined ( uriQuery ref ) =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
}
| otherwise =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
, uriQuery = uriQuery base
}
where
just_segments u =
u { uriPath = removeDotSegments (uriPath u) }
mergePaths b r
| isDefined (uriAuthority b) && null pb = '/':pr
| otherwise = dropLast pb ++ pr
where
pb = uriPath b
pr = uriPath r
dropLast = fst . splitLast -- reverse . dropWhile (/='/') . reverse
-- Remove dot segments, but protect leading '/' character | 1,555 | relativeTo ref base
| isDefined ( uriScheme ref ) =
just_segments ref
| isDefined ( uriAuthority ref ) =
just_segments ref { uriScheme = uriScheme base }
| isDefined ( uriPath ref ) =
if (head (uriPath ref) == '/') then
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
}
else
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = mergePaths base ref
}
| isDefined ( uriQuery ref ) =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
}
| otherwise =
just_segments ref
{ uriScheme = uriScheme base
, uriAuthority = uriAuthority base
, uriPath = uriPath base
, uriQuery = uriQuery base
}
where
just_segments u =
u { uriPath = removeDotSegments (uriPath u) }
mergePaths b r
| isDefined (uriAuthority b) && null pb = '/':pr
| otherwise = dropLast pb ++ pr
where
pb = uriPath b
pr = uriPath r
dropLast = fst . splitLast -- reverse . dropWhile (/='/') . reverse
-- Remove dot segments, but protect leading '/' character | 1,523 | true | true | 1 | 11 | 703 | 411 | 202 | 209 | null | null |
abooij/cubicaltt | Eval.hs | mit | transps i ((x,a):as) e (u:us) =
let v = transFill i (eval e a) u
vi1 = trans i (eval e a) u
vs = transps i as (upd (x,v) e) us
in vi1 : vs | 157 | transps i ((x,a):as) e (u:us) =
let v = transFill i (eval e a) u
vi1 = trans i (eval e a) u
vs = transps i as (upd (x,v) e) us
in vi1 : vs | 157 | transps i ((x,a):as) e (u:us) =
let v = transFill i (eval e a) u
vi1 = trans i (eval e a) u
vs = transps i as (upd (x,v) e) us
in vi1 : vs | 157 | false | false | 0 | 12 | 54 | 113 | 58 | 55 | null | null |
wxwxwwxxx/ghc | testsuite/tests/codeGen/should_compile/debug.hs | bsd-3-clause | main = print $ fib 10 | 21 | main = print $ fib 10 | 21 | main = print $ fib 10 | 21 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
brendanhay/gogol | gogol-healthcare/gen/Network/Google/Resource/Healthcare/Projects/Locations/DataSets/ConsentStores/Consents/Patch.hs | mpl-2.0 | -- | V1 error format.
pldscscpXgafv :: Lens' ProjectsLocationsDataSetsConsentStoresConsentsPatch (Maybe Xgafv)
pldscscpXgafv
= lens _pldscscpXgafv
(\ s a -> s{_pldscscpXgafv = a}) | 187 | pldscscpXgafv :: Lens' ProjectsLocationsDataSetsConsentStoresConsentsPatch (Maybe Xgafv)
pldscscpXgafv
= lens _pldscscpXgafv
(\ s a -> s{_pldscscpXgafv = a}) | 165 | pldscscpXgafv
= lens _pldscscpXgafv
(\ s a -> s{_pldscscpXgafv = a}) | 76 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
delta4d/codewars | kata/tiny-three-pass-compiler/TinyThreePassCompiler.hs | mit | pass2 (Sub t1 t2) = pass2' Sub (-) t1 t2 | 40 | pass2 (Sub t1 t2) = pass2' Sub (-) t1 t2 | 40 | pass2 (Sub t1 t2) = pass2' Sub (-) t1 t2 | 40 | false | false | 0 | 6 | 9 | 29 | 14 | 15 | null | null |
roelvandijk/ftdi | System/FTDI/Internal.hs | bsd-3-clause | calcBaudRateDivisors chip baudRate =
minimumBy (compare `on` (\(_,_,x) → x))
[ (d, s, b')
| s ← chipSubDivisors chip
, let s' = fromIntegral s ÷ 8
d = divisor baudRate s'
-- Baud rate calculated from found divisors.
b' = calcBaudRate d s'
]
where
-- |Calculates the divisor from a baud rate and a subdivisor.
divisor ∷ Integral β ⇒ BaudRate α → BRSubDiv α → BRDiv β
divisor br s = clamp $ floor $ (maxBound - br ⋅ s') ÷ br
where s' = BaudRate $ unBRSubDiv s
chipSubDivisors ∷ ChipType → [BRSubDiv Int]
chipSubDivisors ChipType_AM = [0, 1, 2, 4]
chipSubDivisors _ = [0..7]
-- |Calculates the baud rate from a divisor and a subdivisor. | 816 | calcBaudRateDivisors chip baudRate =
minimumBy (compare `on` (\(_,_,x) → x))
[ (d, s, b')
| s ← chipSubDivisors chip
, let s' = fromIntegral s ÷ 8
d = divisor baudRate s'
-- Baud rate calculated from found divisors.
b' = calcBaudRate d s'
]
where
-- |Calculates the divisor from a baud rate and a subdivisor.
divisor ∷ Integral β ⇒ BaudRate α → BRSubDiv α → BRDiv β
divisor br s = clamp $ floor $ (maxBound - br ⋅ s') ÷ br
where s' = BaudRate $ unBRSubDiv s
chipSubDivisors ∷ ChipType → [BRSubDiv Int]
chipSubDivisors ChipType_AM = [0, 1, 2, 4]
chipSubDivisors _ = [0..7]
-- |Calculates the baud rate from a divisor and a subdivisor. | 816 | calcBaudRateDivisors chip baudRate =
minimumBy (compare `on` (\(_,_,x) → x))
[ (d, s, b')
| s ← chipSubDivisors chip
, let s' = fromIntegral s ÷ 8
d = divisor baudRate s'
-- Baud rate calculated from found divisors.
b' = calcBaudRate d s'
]
where
-- |Calculates the divisor from a baud rate and a subdivisor.
divisor ∷ Integral β ⇒ BaudRate α → BRSubDiv α → BRDiv β
divisor br s = clamp $ floor $ (maxBound - br ⋅ s') ÷ br
where s' = BaudRate $ unBRSubDiv s
chipSubDivisors ∷ ChipType → [BRSubDiv Int]
chipSubDivisors ChipType_AM = [0, 1, 2, 4]
chipSubDivisors _ = [0..7]
-- |Calculates the baud rate from a divisor and a subdivisor. | 816 | false | false | 8 | 11 | 302 | 255 | 125 | 130 | null | null |
majecty/SpaceKite | app/SpaceKite.hs | bsd-3-clause | getPlanets :: State DataSet [PlanetPos]
getPlanets = planetPoses `fmap` ask | 75 | getPlanets :: State DataSet [PlanetPos]
getPlanets = planetPoses `fmap` ask | 75 | getPlanets = planetPoses `fmap` ask | 35 | false | true | 0 | 7 | 9 | 33 | 16 | 17 | null | null |
lihlcnkr/codejam | src/QR/BathroomStalls.hs | apache-2.0 | insertBy :: Ord a => (a -> a -> Ordering) -> a -> Seq a -> Seq a
insertBy _ x (S.viewl -> S.EmptyL) = S.singleton x | 117 | insertBy :: Ord a => (a -> a -> Ordering) -> a -> Seq a -> Seq a
insertBy _ x (S.viewl -> S.EmptyL) = S.singleton x | 117 | insertBy _ x (S.viewl -> S.EmptyL) = S.singleton x | 52 | false | true | 0 | 14 | 28 | 77 | 36 | 41 | null | null |
tgdavies/codeworld | codeworld-base/src/Internal/Prelude.hs | apache-2.0 | -- | Gives all members of a list after the given number.
--
-- In general, @xs = first(xs, n) ++ rest(xs, n)@.
rest :: HasCallStack => ([a], Number) -> [a]
rest (xs, n) = withFrozenCallStack (P.drop (toInt n) xs) | 212 | rest :: HasCallStack => ([a], Number) -> [a]
rest (xs, n) = withFrozenCallStack (P.drop (toInt n) xs) | 101 | rest (xs, n) = withFrozenCallStack (P.drop (toInt n) xs) | 56 | true | true | 0 | 9 | 39 | 67 | 36 | 31 | null | null |
olsner/m3 | CppToken.hs | bsd-3-clause | showTok' (IntegerTok i) = show i | 36 | showTok' (IntegerTok i) = show i | 36 | showTok' (IntegerTok i) = show i | 36 | false | false | 0 | 7 | 9 | 18 | 8 | 10 | null | null |
Enamex/Idris-dev | src/Idris/Core/Unify.hs | bsd-3-clause | recoverable (P (TCon _ _) x _) (TType _) = False | 48 | recoverable (P (TCon _ _) x _) (TType _) = False | 48 | recoverable (P (TCon _ _) x _) (TType _) = False | 48 | false | false | 0 | 8 | 10 | 37 | 17 | 20 | null | null |
conal/reification-rules | src/ReificationRules/Exp.hs | bsd-3-clause | extendEnv (VarPat vb) b = (Bind vb b :) | 47 | extendEnv (VarPat vb) b = (Bind vb b :) | 47 | extendEnv (VarPat vb) b = (Bind vb b :) | 47 | false | false | 0 | 7 | 16 | 26 | 13 | 13 | null | null |
alexander-at-github/eta | libraries/base/GHC/Base.hs | bsd-3-clause | -- Inline only in the final stage, after the foldr/cons rule has had a chance
-- Also note that we inline it when it has *two* parameters, which are the
-- ones we are keen about specialising!
foldr k z = go
where
go [] = z
go (y:ys) = y `k` go ys
-- | A list producer that can be fused with 'foldr'.
-- This function is merely
--
-- > build g = g (:) []
--
-- but GHC's simplifier will transform an expression of the form
-- @'foldr' k z ('build' g)@, which may arise after inlining, to @g k z@,
-- which avoids producing an intermediate list. | 586 | foldr k z = go
where
go [] = z
go (y:ys) = y `k` go ys
-- | A list producer that can be fused with 'foldr'.
-- This function is merely
--
-- > build g = g (:) []
--
-- but GHC's simplifier will transform an expression of the form
-- @'foldr' k z ('build' g)@, which may arise after inlining, to @g k z@,
-- which avoids producing an intermediate list. | 393 | foldr k z = go
where
go [] = z
go (y:ys) = y `k` go ys
-- | A list producer that can be fused with 'foldr'.
-- This function is merely
--
-- > build g = g (:) []
--
-- but GHC's simplifier will transform an expression of the form
-- @'foldr' k z ('build' g)@, which may arise after inlining, to @g k z@,
-- which avoids producing an intermediate list. | 393 | true | false | 1 | 7 | 154 | 63 | 35 | 28 | null | null |
sarahn/ganeti | src/Ganeti/OpParams.hs | gpl-2.0 | -- | Optional group name.
pOptGroupName :: Field
pOptGroupName = renameField "OptGroupName" .
optionalField $ simpleField "group_name" [t| NonEmptyString |] | 172 | pOptGroupName :: Field
pOptGroupName = renameField "OptGroupName" .
optionalField $ simpleField "group_name" [t| NonEmptyString |] | 146 | pOptGroupName = renameField "OptGroupName" .
optionalField $ simpleField "group_name" [t| NonEmptyString |] | 123 | true | true | 0 | 7 | 35 | 32 | 18 | 14 | null | null |
bergmark/snaplet-fay | example/src/Site.hs | bsd-3-clause | currentTimeAjax :: AppHandler Time
currentTimeAjax = Time . show <$> liftIO getCurrentTime | 90 | currentTimeAjax :: AppHandler Time
currentTimeAjax = Time . show <$> liftIO getCurrentTime | 90 | currentTimeAjax = Time . show <$> liftIO getCurrentTime | 55 | false | true | 0 | 6 | 11 | 25 | 12 | 13 | null | null |
jchitel/ProjectEuler.hs | Problems/Problem0040.hs | mit | problem40Value :: Int
problem40Value = d1 * d10 * d100 * d1000 * d10000 * d100000 * d1000000
where d1 = digitToInt $ list !! 0
d10 = digitToInt $ list !! 9
d100 = digitToInt $ list !! 99
d1000 = digitToInt $ list !! 999
d10000 = digitToInt $ list !! 9999
d100000 = digitToInt $ list !! 99999
d1000000 = digitToInt $ list !! 999999
list = concat $ map show [1..] | 435 | problem40Value :: Int
problem40Value = d1 * d10 * d100 * d1000 * d10000 * d100000 * d1000000
where d1 = digitToInt $ list !! 0
d10 = digitToInt $ list !! 9
d100 = digitToInt $ list !! 99
d1000 = digitToInt $ list !! 999
d10000 = digitToInt $ list !! 9999
d100000 = digitToInt $ list !! 99999
d1000000 = digitToInt $ list !! 999999
list = concat $ map show [1..] | 435 | problem40Value = d1 * d10 * d100 * d1000 * d10000 * d100000 * d1000000
where d1 = digitToInt $ list !! 0
d10 = digitToInt $ list !! 9
d100 = digitToInt $ list !! 99
d1000 = digitToInt $ list !! 999
d10000 = digitToInt $ list !! 9999
d100000 = digitToInt $ list !! 99999
d1000000 = digitToInt $ list !! 999999
list = concat $ map show [1..] | 413 | false | true | 7 | 10 | 148 | 173 | 78 | 95 | null | null |
ucsd-progsys/nanomaly | src/NanoML/Classify.hs | bsd-3-clause | fold :: Monoid a => (Expr -> a -> a) -> a -> Expr -> a
fold f z = go
where
go e = f e $ case e of
Var {} -> z
Lam _ _ b _ -> go b
App _ f es -> mconcat $ map go (f:es)
Bop _ _ e1 e2 -> mappend (go e1) (go e2)
Uop _ _ e -> go e
Lit {} -> z
Let _ _ pes e -> mconcat (map (go.snd) pes ++ [go e])
Ite _ x y z -> go x <> go y <> go z
Seq _ e1 e2 -> mappend (go e1) (go e2)
Case _ e as -> mconcat (go e : map (go.thd3) as)
Tuple _ es -> mconcat (map go es)
ConApp _ _ me _ -> maybe mempty go me
Record _ fes _ -> mconcat (map (go.snd) fes)
Field _ e _ -> go e
SetField _ e1 _ e2 -> mappend (go e1) (go e2)
List _ es _ -> mconcat (map go es)
Array _ es _ -> mconcat (map go es)
Try _ e as -> mconcat (go e : map (go.thd3) as)
-- the rest of these should not appear in parsed exprs
Prim1 {} -> z
Prim2 {} -> z
With {} -> z
Replace {} -> z
Hole {} -> z
Ref {} -> z | 959 | fold :: Monoid a => (Expr -> a -> a) -> a -> Expr -> a
fold f z = go
where
go e = f e $ case e of
Var {} -> z
Lam _ _ b _ -> go b
App _ f es -> mconcat $ map go (f:es)
Bop _ _ e1 e2 -> mappend (go e1) (go e2)
Uop _ _ e -> go e
Lit {} -> z
Let _ _ pes e -> mconcat (map (go.snd) pes ++ [go e])
Ite _ x y z -> go x <> go y <> go z
Seq _ e1 e2 -> mappend (go e1) (go e2)
Case _ e as -> mconcat (go e : map (go.thd3) as)
Tuple _ es -> mconcat (map go es)
ConApp _ _ me _ -> maybe mempty go me
Record _ fes _ -> mconcat (map (go.snd) fes)
Field _ e _ -> go e
SetField _ e1 _ e2 -> mappend (go e1) (go e2)
List _ es _ -> mconcat (map go es)
Array _ es _ -> mconcat (map go es)
Try _ e as -> mconcat (go e : map (go.thd3) as)
-- the rest of these should not appear in parsed exprs
Prim1 {} -> z
Prim2 {} -> z
With {} -> z
Replace {} -> z
Hole {} -> z
Ref {} -> z | 959 | fold f z = go
where
go e = f e $ case e of
Var {} -> z
Lam _ _ b _ -> go b
App _ f es -> mconcat $ map go (f:es)
Bop _ _ e1 e2 -> mappend (go e1) (go e2)
Uop _ _ e -> go e
Lit {} -> z
Let _ _ pes e -> mconcat (map (go.snd) pes ++ [go e])
Ite _ x y z -> go x <> go y <> go z
Seq _ e1 e2 -> mappend (go e1) (go e2)
Case _ e as -> mconcat (go e : map (go.thd3) as)
Tuple _ es -> mconcat (map go es)
ConApp _ _ me _ -> maybe mempty go me
Record _ fes _ -> mconcat (map (go.snd) fes)
Field _ e _ -> go e
SetField _ e1 _ e2 -> mappend (go e1) (go e2)
List _ es _ -> mconcat (map go es)
Array _ es _ -> mconcat (map go es)
Try _ e as -> mconcat (go e : map (go.thd3) as)
-- the rest of these should not appear in parsed exprs
Prim1 {} -> z
Prim2 {} -> z
With {} -> z
Replace {} -> z
Hole {} -> z
Ref {} -> z | 904 | false | true | 3 | 13 | 337 | 598 | 279 | 319 | null | null |
litherum/http-conduit-browser | Network/HTTP/Conduit/Browser2.hs | bsd-2-clause | withCurrentProxy :: Maybe Proxy -> BrowserAction a -> BrowserAction a
withCurrentProxy a b = do
current <- getCurrentProxy
setCurrentProxy a
out <- b
setCurrentProxy current
return out
-- | An optional SOCKS proxy to send all requests through
-- if Nothing uses Request's 'socksProxy' | 296 | withCurrentProxy :: Maybe Proxy -> BrowserAction a -> BrowserAction a
withCurrentProxy a b = do
current <- getCurrentProxy
setCurrentProxy a
out <- b
setCurrentProxy current
return out
-- | An optional SOCKS proxy to send all requests through
-- if Nothing uses Request's 'socksProxy' | 296 | withCurrentProxy a b = do
current <- getCurrentProxy
setCurrentProxy a
out <- b
setCurrentProxy current
return out
-- | An optional SOCKS proxy to send all requests through
-- if Nothing uses Request's 'socksProxy' | 224 | false | true | 0 | 7 | 55 | 67 | 29 | 38 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/VarEnv.hs | bsd-3-clause | rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2
-- ^ @rnBndr2 env bL bR@ goes under a binder @bL@ in the Left term,
-- and binder @bR@ in the Right term.
-- It finds a new binder, @new_b@,
-- and returns an environment mapping @bL -> new_b@ and @bR -> new_b@
rnBndr2 (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bL bR
= RV2 { envL = extendVarEnv envL bL new_b -- See Note
, envR = extendVarEnv envR bR new_b -- [Rebinding]
, in_scope = extendInScopeSet in_scope new_b }
where
-- Find a new binder not in scope in either term
new_b | not (bL `elemInScopeSet` in_scope) = bL
| not (bR `elemInScopeSet` in_scope) = bR
| otherwise = uniqAway' in_scope bL
-- Note [Rebinding]
-- If the new var is the same as the old one, note that
-- the extendVarEnv *deletes* any current renaming
-- E.g. (\x. \x. ...) ~ (\y. \z. ...)
--
-- Inside \x \y { [x->y], [y->y], {y} }
-- \x \z { [x->x], [y->y, z->x], {y,x} } | 1,105 | rnBndr2 :: RnEnv2 -> Var -> Var -> RnEnv2
rnBndr2 (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bL bR
= RV2 { envL = extendVarEnv envL bL new_b -- See Note
, envR = extendVarEnv envR bR new_b -- [Rebinding]
, in_scope = extendInScopeSet in_scope new_b }
where
-- Find a new binder not in scope in either term
new_b | not (bL `elemInScopeSet` in_scope) = bL
| not (bR `elemInScopeSet` in_scope) = bR
| otherwise = uniqAway' in_scope bL
-- Note [Rebinding]
-- If the new var is the same as the old one, note that
-- the extendVarEnv *deletes* any current renaming
-- E.g. (\x. \x. ...) ~ (\y. \z. ...)
--
-- Inside \x \y { [x->y], [y->y], {y} }
-- \x \z { [x->x], [y->y, z->x], {y,x} } | 872 | rnBndr2 (RV2 { envL = envL, envR = envR, in_scope = in_scope }) bL bR
= RV2 { envL = extendVarEnv envL bL new_b -- See Note
, envR = extendVarEnv envR bR new_b -- [Rebinding]
, in_scope = extendInScopeSet in_scope new_b }
where
-- Find a new binder not in scope in either term
new_b | not (bL `elemInScopeSet` in_scope) = bL
| not (bR `elemInScopeSet` in_scope) = bR
| otherwise = uniqAway' in_scope bL
-- Note [Rebinding]
-- If the new var is the same as the old one, note that
-- the extendVarEnv *deletes* any current renaming
-- E.g. (\x. \x. ...) ~ (\y. \z. ...)
--
-- Inside \x \y { [x->y], [y->y], {y} }
-- \x \z { [x->x], [y->y, z->x], {y,x} } | 830 | true | true | 0 | 10 | 380 | 168 | 95 | 73 | null | null |
bos/critbit | Data/CritBit/Set.hs | bsd-2-clause | -- | /O(n+m)/. Is this a proper subset (ie. a subset but not equal)?
-- @(s1 `isSubsetOf` s2)@ tells whether @s1@ is a proper subset of @s2@.
isProperSubsetOf :: (CritBitKey a) => Set a -> Set a -> Bool
isProperSubsetOf = wrapSS id T.isProperSubmapOf | 250 | isProperSubsetOf :: (CritBitKey a) => Set a -> Set a -> Bool
isProperSubsetOf = wrapSS id T.isProperSubmapOf | 108 | isProperSubsetOf = wrapSS id T.isProperSubmapOf | 47 | true | true | 0 | 8 | 43 | 43 | 22 | 21 | null | null |
sdiehl/ghc | compiler/GHC/StgToCmm/Utils.hs | bsd-3-clause | -- SINGLETON BRANCH, NO DEFAULT: no case analysis to do
mk_discrete_switch _ _tag_expr [(_tag,lbl)] Nothing _
= mkBranch lbl | 126 | mk_discrete_switch _ _tag_expr [(_tag,lbl)] Nothing _
= mkBranch lbl | 70 | mk_discrete_switch _ _tag_expr [(_tag,lbl)] Nothing _
= mkBranch lbl | 70 | true | false | 0 | 7 | 20 | 30 | 16 | 14 | null | null |
dmatveev/oak | Graphics/UI/Oak.hs | bsd-3-clause | runOakT :: MonadFrontend u m
=> OakT i u w m a
-> OakState i m
-> [Handler i u w m]
-> m (OakState i m, Maybe w)
runOakT (OakT oak) s e = do
(st, lw) <- execRWST oak e s
return (st, getLast lw) | 241 | runOakT :: MonadFrontend u m
=> OakT i u w m a
-> OakState i m
-> [Handler i u w m]
-> m (OakState i m, Maybe w)
runOakT (OakT oak) s e = do
(st, lw) <- execRWST oak e s
return (st, getLast lw) | 241 | runOakT (OakT oak) s e = do
(st, lw) <- execRWST oak e s
return (st, getLast lw) | 84 | false | true | 0 | 11 | 94 | 125 | 60 | 65 | null | null |
olsner/ghc | compiler/coreSyn/MkCore.hs | bsd-3-clause | typeErrorName :: Name
recSelErrorName = err_nm "recSelError" recSelErrorIdKey rEC_SEL_ERROR_ID | 107 | typeErrorName :: Name
recSelErrorName = err_nm "recSelError" recSelErrorIdKey rEC_SEL_ERROR_ID | 106 | recSelErrorName = err_nm "recSelError" recSelErrorIdKey rEC_SEL_ERROR_ID | 84 | false | true | 0 | 5 | 21 | 18 | 9 | 9 | null | null |
nh2/shake | Development/Shake/Report.hs | bsd-3-clause | -- | Generates an HTML report given some build system
-- profiling data in JSON format.
buildReport :: String -> FilePath -> IO ()
buildReport json out = do
htmlDir <- getDataFileName "html"
report <- LBS.readFile $ htmlDir </> "report.html"
let f name | name == "data.js" = return $ LBS.pack $ "var shake = \n" ++ json
| otherwise = LBS.readFile $ htmlDir </> name
LBS.writeFile out =<< runTemplate f report
-- | Template Engine. Perform the following replacements on a line basis:
--
-- * <script src="foo"></script> ==> <script>[[foo]]</script>
--
-- * <link href="foo" rel="stylesheet" type="text/css" /> ==> <style type="text/css">[[foo]]</style> | 686 | buildReport :: String -> FilePath -> IO ()
buildReport json out = do
htmlDir <- getDataFileName "html"
report <- LBS.readFile $ htmlDir </> "report.html"
let f name | name == "data.js" = return $ LBS.pack $ "var shake = \n" ++ json
| otherwise = LBS.readFile $ htmlDir </> name
LBS.writeFile out =<< runTemplate f report
-- | Template Engine. Perform the following replacements on a line basis:
--
-- * <script src="foo"></script> ==> <script>[[foo]]</script>
--
-- * <link href="foo" rel="stylesheet" type="text/css" /> ==> <style type="text/css">[[foo]]</style> | 596 | buildReport json out = do
htmlDir <- getDataFileName "html"
report <- LBS.readFile $ htmlDir </> "report.html"
let f name | name == "data.js" = return $ LBS.pack $ "var shake = \n" ++ json
| otherwise = LBS.readFile $ htmlDir </> name
LBS.writeFile out =<< runTemplate f report
-- | Template Engine. Perform the following replacements on a line basis:
--
-- * <script src="foo"></script> ==> <script>[[foo]]</script>
--
-- * <link href="foo" rel="stylesheet" type="text/css" /> ==> <style type="text/css">[[foo]]</style> | 553 | true | true | 0 | 15 | 136 | 140 | 66 | 74 | null | null |
silkapp/haskell-opaleye | src/Opaleye/RunQuery.hs | bsd-3-clause | foldQueryExplicitWithOptions
:: QueryRunner columns haskells
-> PGS.FoldOptions
-> PGS.Connection
-> Query columns
-> a
-> (a -> haskells -> IO a)
-> IO a
foldQueryExplicitWithOptions (QueryRunner u rowParser) opts conn q =
PGS.foldWithOptionsAndParser_ opts (rowParser b) conn sql
where sql :: PGS.Query
sql = String.fromString (S.showSqlForPostgresExplicit u q)
-- FIXME: We're doing work twice here
(b, _, _) = Q.runSimpleQueryArrStart q ()
-- | Use 'queryRunnerColumn' to make an instance to allow you to run queries on
-- your own datatypes. For example:
--
-- @
-- newtype Foo = Foo Int
-- instance Default QueryRunnerColumn Foo Foo where
-- def = queryRunnerColumn ('Opaleye.Column.unsafeCoerce' :: Column Foo -> Column PGInt4) Foo def
-- @ | 796 | foldQueryExplicitWithOptions
:: QueryRunner columns haskells
-> PGS.FoldOptions
-> PGS.Connection
-> Query columns
-> a
-> (a -> haskells -> IO a)
-> IO a
foldQueryExplicitWithOptions (QueryRunner u rowParser) opts conn q =
PGS.foldWithOptionsAndParser_ opts (rowParser b) conn sql
where sql :: PGS.Query
sql = String.fromString (S.showSqlForPostgresExplicit u q)
-- FIXME: We're doing work twice here
(b, _, _) = Q.runSimpleQueryArrStart q ()
-- | Use 'queryRunnerColumn' to make an instance to allow you to run queries on
-- your own datatypes. For example:
--
-- @
-- newtype Foo = Foo Int
-- instance Default QueryRunnerColumn Foo Foo where
-- def = queryRunnerColumn ('Opaleye.Column.unsafeCoerce' :: Column Foo -> Column PGInt4) Foo def
-- @ | 796 | foldQueryExplicitWithOptions (QueryRunner u rowParser) opts conn q =
PGS.foldWithOptionsAndParser_ opts (rowParser b) conn sql
where sql :: PGS.Query
sql = String.fromString (S.showSqlForPostgresExplicit u q)
-- FIXME: We're doing work twice here
(b, _, _) = Q.runSimpleQueryArrStart q ()
-- | Use 'queryRunnerColumn' to make an instance to allow you to run queries on
-- your own datatypes. For example:
--
-- @
-- newtype Foo = Foo Int
-- instance Default QueryRunnerColumn Foo Foo where
-- def = queryRunnerColumn ('Opaleye.Column.unsafeCoerce' :: Column Foo -> Column PGInt4) Foo def
-- @ | 627 | false | true | 2 | 15 | 162 | 165 | 85 | 80 | null | null |
andreagenso/java2scala | src/J2s/Ast/Syntax.hs | apache-2.0 | sem_TypeDeclaration_TypeDeclarationClassDeclarationEnumD = TypeDeclarationClassDeclarationEnumD | 110 | sem_TypeDeclaration_TypeDeclarationClassDeclarationEnumD = TypeDeclarationClassDeclarationEnumD | 110 | sem_TypeDeclaration_TypeDeclarationClassDeclarationEnumD = TypeDeclarationClassDeclarationEnumD | 110 | false | false | 0 | 4 | 17 | 6 | 3 | 3 | null | null |
rvion/stack | src/Stack/Constants.hs | bsd-3-clause | -- | Relative location of build artifacts.
distRelativeDir :: (MonadThrow m, MonadReader env m, HasPlatform env, HasEnvConfig env)
=> m (Path Rel Dir)
distRelativeDir = do
cabalPkgVer <- asks (envConfigCabalVersion . getEnvConfig)
platform <- platformVariantRelDir
wc <- getWhichCompiler
-- Cabal version, suffixed with "_ghcjs" if we're using GHCJS.
envDir <-
parseRelDir $
(if wc == Ghcjs then (++ "_ghcjs") else id) $
packageIdentifierString $
PackageIdentifier cabalPackageName cabalPkgVer
platformAndCabal <- useShaPathOnWindows (platform </> envDir)
return $
workDirRel </>
$(mkRelDir "dist") </>
platformAndCabal
-- | Get a URL for a raw file on Github | 760 | distRelativeDir :: (MonadThrow m, MonadReader env m, HasPlatform env, HasEnvConfig env)
=> m (Path Rel Dir)
distRelativeDir = do
cabalPkgVer <- asks (envConfigCabalVersion . getEnvConfig)
platform <- platformVariantRelDir
wc <- getWhichCompiler
-- Cabal version, suffixed with "_ghcjs" if we're using GHCJS.
envDir <-
parseRelDir $
(if wc == Ghcjs then (++ "_ghcjs") else id) $
packageIdentifierString $
PackageIdentifier cabalPackageName cabalPkgVer
platformAndCabal <- useShaPathOnWindows (platform </> envDir)
return $
workDirRel </>
$(mkRelDir "dist") </>
platformAndCabal
-- | Get a URL for a raw file on Github | 717 | distRelativeDir = do
cabalPkgVer <- asks (envConfigCabalVersion . getEnvConfig)
platform <- platformVariantRelDir
wc <- getWhichCompiler
-- Cabal version, suffixed with "_ghcjs" if we're using GHCJS.
envDir <-
parseRelDir $
(if wc == Ghcjs then (++ "_ghcjs") else id) $
packageIdentifierString $
PackageIdentifier cabalPackageName cabalPkgVer
platformAndCabal <- useShaPathOnWindows (platform </> envDir)
return $
workDirRel </>
$(mkRelDir "dist") </>
platformAndCabal
-- | Get a URL for a raw file on Github | 593 | true | true | 0 | 13 | 192 | 167 | 84 | 83 | null | null |
joelburget/haste-compiler | libraries/base-ghc-7.6/GHC/MVar.hs | bsd-3-clause | addMVarFinalizer :: MVar a -> IO () -> IO ()
addMVarFinalizer (MVar m) finalizer =
IO $ \s -> case mkWeak# m () finalizer s of { (# s1, _ #) -> (# s1, () #) } | 160 | addMVarFinalizer :: MVar a -> IO () -> IO ()
addMVarFinalizer (MVar m) finalizer =
IO $ \s -> case mkWeak# m () finalizer s of { (# s1, _ #) -> (# s1, () #) } | 160 | addMVarFinalizer (MVar m) finalizer =
IO $ \s -> case mkWeak# m () finalizer s of { (# s1, _ #) -> (# s1, () #) } | 115 | false | true | 2 | 10 | 38 | 92 | 45 | 47 | null | null |
shlevy/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | stablePtrTyConKey = mkPreludeTyConUnique 36 | 65 | stablePtrTyConKey = mkPreludeTyConUnique 36 | 65 | stablePtrTyConKey = mkPreludeTyConUnique 36 | 65 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/BackendServices/Patch.hs | mpl-2.0 | -- | Creates a value of 'BackendServicesPatch' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bspRequestId'
--
-- * 'bspProject'
--
-- * 'bspPayload'
--
-- * 'bspBackendService'
backendServicesPatch
:: Text -- ^ 'bspProject'
-> BackendService -- ^ 'bspPayload'
-> Text -- ^ 'bspBackendService'
-> BackendServicesPatch
backendServicesPatch pBspProject_ pBspPayload_ pBspBackendService_ =
BackendServicesPatch'
{ _bspRequestId = Nothing
, _bspProject = pBspProject_
, _bspPayload = pBspPayload_
, _bspBackendService = pBspBackendService_
} | 662 | backendServicesPatch
:: Text -- ^ 'bspProject'
-> BackendService -- ^ 'bspPayload'
-> Text -- ^ 'bspBackendService'
-> BackendServicesPatch
backendServicesPatch pBspProject_ pBspPayload_ pBspBackendService_ =
BackendServicesPatch'
{ _bspRequestId = Nothing
, _bspProject = pBspProject_
, _bspPayload = pBspPayload_
, _bspBackendService = pBspBackendService_
} | 397 | backendServicesPatch pBspProject_ pBspPayload_ pBspBackendService_ =
BackendServicesPatch'
{ _bspRequestId = Nothing
, _bspProject = pBspProject_
, _bspPayload = pBspPayload_
, _bspBackendService = pBspBackendService_
} | 241 | true | true | 0 | 9 | 124 | 79 | 48 | 31 | null | null |
Tener/deeplearning-thesis | src/gg-exp8.hs | bsd-3-clause | playerUseCoinstraints = 100 | 27 | playerUseCoinstraints = 100 | 27 | playerUseCoinstraints = 100 | 27 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
kmilner/tamarin-prover | lib/theory/src/Theory.hs | gpl-3.0 | -- | Convert an incremental proof to a proof skeleton by dropping all
-- annotations.
incrementalToSkeletonDiffProof :: IncrementalDiffProof -> DiffProofSkeleton
incrementalToSkeletonDiffProof = fmap (fmap (const ())) | 217 | incrementalToSkeletonDiffProof :: IncrementalDiffProof -> DiffProofSkeleton
incrementalToSkeletonDiffProof = fmap (fmap (const ())) | 131 | incrementalToSkeletonDiffProof = fmap (fmap (const ())) | 55 | true | true | 0 | 10 | 25 | 34 | 18 | 16 | null | null |
adituv/qbscript | src/Compiler/QbScript/CodeGen.hs | bsd-3-clause | putQbType QbTWString = putWord32BE 0x00840000 | 51 | putQbType QbTWString = putWord32BE 0x00840000 | 51 | putQbType QbTWString = putWord32BE 0x00840000 | 51 | false | false | 0 | 5 | 10 | 12 | 5 | 7 | null | null |
woodsjc/hackerrank-challenges | minimum multiple.hs | gpl-3.0 | solve :: Int -> [Integer] -> [(Char, Int, Int)] -> [Integer]
solve n arr queries = p_queries queries tree []
where
tree = foldl (\root (i,v) -> s_update i v root)
(initSegTree n)
(zip [0..] arr) | 269 | solve :: Int -> [Integer] -> [(Char, Int, Int)] -> [Integer]
solve n arr queries = p_queries queries tree []
where
tree = foldl (\root (i,v) -> s_update i v root)
(initSegTree n)
(zip [0..] arr) | 268 | solve n arr queries = p_queries queries tree []
where
tree = foldl (\root (i,v) -> s_update i v root)
(initSegTree n)
(zip [0..] arr) | 207 | false | true | 0 | 10 | 110 | 115 | 61 | 54 | null | null |
GallagherCommaJack/scheming-machine | ParserEvaluator.hs | gpl-3.0 | unpackStr :: LispVal -> ThrowsError String
unpackStr (String s) = return s | 74 | unpackStr :: LispVal -> ThrowsError String
unpackStr (String s) = return s | 74 | unpackStr (String s) = return s | 31 | false | true | 0 | 9 | 11 | 34 | 15 | 19 | null | null |
aquatir/remember_java_api | code-sample-haskell/hello_world/func_magic/monads.hs | mit | powerset :: [a] -> [[a]]
powerset xs = filterM (\x -> [True, False]) xs | 73 | powerset :: [a] -> [[a]]
powerset xs = filterM (\x -> [True, False]) xs | 71 | powerset xs = filterM (\x -> [True, False]) xs | 46 | false | true | 0 | 9 | 15 | 52 | 27 | 25 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-example/Drasil/GamePhysics/Body.hs | bsd-2-clause | --FIXME: The SRS has been partly switched over to the new docLang, so some of
-- the sections below are now redundant. I have not removed them yet, because
-- it makes it easier to test between the two different versions as changes
-- are introduced. Once the SRS is entirely switched to docLang, the redundant
-- sections should be removed.
-- =================================== --
-- SOFTWARE REQUIREMENTS SPECIFICATION --
-- =================================== --
------------------------------
-- Section : INTRODUCTION --
------------------------------
para1_introduction_intro :: Sentence
para1_introduction_intro = foldlSent
[S "Due to the rising cost of developing", plural videoGame `sC`
S "developers are looking for ways to save time and money for their" +:+.
plural project, S "Using an", phrase openSource,
phrase physLib,
S "that is reliable and free will cut down development costs and lead",
S "to better quality", plural product_] | 965 | para1_introduction_intro :: Sentence
para1_introduction_intro = foldlSent
[S "Due to the rising cost of developing", plural videoGame `sC`
S "developers are looking for ways to save time and money for their" +:+.
plural project, S "Using an", phrase openSource,
phrase physLib,
S "that is reliable and free will cut down development costs and lead",
S "to better quality", plural product_] | 403 | para1_introduction_intro = foldlSent
[S "Due to the rising cost of developing", plural videoGame `sC`
S "developers are looking for ways to save time and money for their" +:+.
plural project, S "Using an", phrase openSource,
phrase physLib,
S "that is reliable and free will cut down development costs and lead",
S "to better quality", plural product_] | 366 | true | true | 0 | 9 | 154 | 96 | 51 | 45 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/Tuple.hs | mit | deTupleDecl (ClosedTypeFamDecl l declHead kind typeEqn) = ClosedTypeFamDecl (id l) (deTupleDeclHead declHead) (fmap (deTupleKind) kind) (fmap (deTupleTypeEqn) typeEqn) | 167 | deTupleDecl (ClosedTypeFamDecl l declHead kind typeEqn) = ClosedTypeFamDecl (id l) (deTupleDeclHead declHead) (fmap (deTupleKind) kind) (fmap (deTupleTypeEqn) typeEqn) | 167 | deTupleDecl (ClosedTypeFamDecl l declHead kind typeEqn) = ClosedTypeFamDecl (id l) (deTupleDeclHead declHead) (fmap (deTupleKind) kind) (fmap (deTupleTypeEqn) typeEqn) | 167 | false | false | 0 | 8 | 17 | 65 | 32 | 33 | null | null |
ckaestne/CIDE | other/CaseStudies/Arith/orig_armin/ite/Arith.hs | gpl-3.0 | --
-- Main evaluation function
--
evalExp :: Exp TypedVal -> Result TypedVal EvalError
evalExp exp = eval exp | 110 | evalExp :: Exp TypedVal -> Result TypedVal EvalError
evalExp exp = eval exp | 75 | evalExp exp = eval exp | 22 | true | true | 0 | 6 | 19 | 32 | 16 | 16 | null | null |
DanielSchuessler/hstri | Tetrahedron/Vertex.hs | gpl-3.0 | vertexNu :: Numbering Vertex
vertexNu = finiteTypeNu | 52 | vertexNu :: Numbering Vertex
vertexNu = finiteTypeNu | 52 | vertexNu = finiteTypeNu | 23 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
gsnewmark/cis194 | src/Cis194/Week3/Lecture.hs | apache-2.0 | filterIntList :: (Int -> Bool) -> IntList -> IntList
filterIntList _ Empty = Empty | 82 | filterIntList :: (Int -> Bool) -> IntList -> IntList
filterIntList _ Empty = Empty | 82 | filterIntList _ Empty = Empty | 29 | false | true | 0 | 7 | 13 | 31 | 16 | 15 | null | null |
gnn/Hets | TPTP/Pretty.hs | gpl-2.0 | printIntro_type :: Intro_type -> Doc
printIntro_type x = case x of
IntroTypeDefinition -> text "definition"
AxiomOfChoice -> text "axiom_of_choice"
Tautology -> text "tautology"
IntroTypeAssumption -> text "assumption"
-- <external_source> :== <file_source> | <theory> | <creator_source> | 301 | printIntro_type :: Intro_type -> Doc
printIntro_type x = case x of
IntroTypeDefinition -> text "definition"
AxiomOfChoice -> text "axiom_of_choice"
Tautology -> text "tautology"
IntroTypeAssumption -> text "assumption"
-- <external_source> :== <file_source> | <theory> | <creator_source> | 301 | printIntro_type x = case x of
IntroTypeDefinition -> text "definition"
AxiomOfChoice -> text "axiom_of_choice"
Tautology -> text "tautology"
IntroTypeAssumption -> text "assumption"
-- <external_source> :== <file_source> | <theory> | <creator_source> | 264 | false | true | 4 | 5 | 48 | 62 | 28 | 34 | null | null |
adnelson/nix-eval | src/Nix/Evaluator/Evaluator.hs | mit | paramList (VariadicParamSet params) = M.toList params | 53 | paramList (VariadicParamSet params) = M.toList params | 53 | paramList (VariadicParamSet params) = M.toList params | 53 | false | false | 0 | 7 | 5 | 20 | 9 | 11 | null | null |
dalaing/type-systems | src/Ast/Term.hs | bsd-3-clause | astToType' :: TmAstTransversable ki ty pt tm
=> (a -> Maybe b)
-> TmAst ki ty pt tm a
-> Maybe (TyAst ki ty b)
astToType' f (TmAstVar x) =
fmap TyAstVar . f $ x | 195 | astToType' :: TmAstTransversable ki ty pt tm
=> (a -> Maybe b)
-> TmAst ki ty pt tm a
-> Maybe (TyAst ki ty b)
astToType' f (TmAstVar x) =
fmap TyAstVar . f $ x | 195 | astToType' f (TmAstVar x) =
fmap TyAstVar . f $ x | 51 | false | true | 3 | 11 | 70 | 95 | 43 | 52 | null | null |
candu/haskellbook | ch14/addition/Addition.hs | mit | runQc :: IO ()
runQc = quickCheck prop_additionGreater | 54 | runQc :: IO ()
runQc = quickCheck prop_additionGreater | 54 | runQc = quickCheck prop_additionGreater | 39 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
zeyuanxy/haskell-playground | write-yourself-a-scheme/chap7/main.hs | mit | liftThrows (Right val) = return val | 35 | liftThrows (Right val) = return val | 35 | liftThrows (Right val) = return val | 35 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
Athas/Sindre | Setup.hs | mit | sindre = "sindre" | 17 | sindre = "sindre" | 17 | sindre = "sindre" | 17 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
vTurbine/ghc | compiler/main/DriverPipeline.hs | bsd-3-clause | runPhase (RealPhase LlvmOpt) input_fn dflags
= do
let opt_lvl = max 0 (min 2 $ optLevel dflags)
-- don't specify anything if user has specified commands. We do this
-- for opt but not llc since opt is very specifically for optimisation
-- passes only, so if the user is passing us extra options we assume
-- they know what they are doing and don't get in the way.
optFlag = if null (getOpts dflags opt_lo)
then map SysTools.Option $ words (llvmOpts !! opt_lvl)
else []
tbaa | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
| otherwise = "--enable-tbaa=false"
output_fn <- phaseOutputFilename LlvmLlc
liftIO $ SysTools.runLlvmOpt dflags
([ SysTools.FileOption "" input_fn,
SysTools.Option "-o",
SysTools.FileOption "" output_fn]
++ optFlag
++ [SysTools.Option tbaa])
return (RealPhase LlvmLlc, output_fn)
where
-- we always (unless -optlo specified) run Opt since we rely on it to
-- fix up some pretty big deficiencies in the code we generate
llvmOpts = [ "-mem2reg -globalopt"
, "-O1 -globalopt"
, "-O2"
]
-----------------------------------------------------------------------------
-- LlvmLlc phase | 1,423 | runPhase (RealPhase LlvmOpt) input_fn dflags
= do
let opt_lvl = max 0 (min 2 $ optLevel dflags)
-- don't specify anything if user has specified commands. We do this
-- for opt but not llc since opt is very specifically for optimisation
-- passes only, so if the user is passing us extra options we assume
-- they know what they are doing and don't get in the way.
optFlag = if null (getOpts dflags opt_lo)
then map SysTools.Option $ words (llvmOpts !! opt_lvl)
else []
tbaa | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
| otherwise = "--enable-tbaa=false"
output_fn <- phaseOutputFilename LlvmLlc
liftIO $ SysTools.runLlvmOpt dflags
([ SysTools.FileOption "" input_fn,
SysTools.Option "-o",
SysTools.FileOption "" output_fn]
++ optFlag
++ [SysTools.Option tbaa])
return (RealPhase LlvmLlc, output_fn)
where
-- we always (unless -optlo specified) run Opt since we rely on it to
-- fix up some pretty big deficiencies in the code we generate
llvmOpts = [ "-mem2reg -globalopt"
, "-O1 -globalopt"
, "-O2"
]
-----------------------------------------------------------------------------
-- LlvmLlc phase | 1,423 | runPhase (RealPhase LlvmOpt) input_fn dflags
= do
let opt_lvl = max 0 (min 2 $ optLevel dflags)
-- don't specify anything if user has specified commands. We do this
-- for opt but not llc since opt is very specifically for optimisation
-- passes only, so if the user is passing us extra options we assume
-- they know what they are doing and don't get in the way.
optFlag = if null (getOpts dflags opt_lo)
then map SysTools.Option $ words (llvmOpts !! opt_lvl)
else []
tbaa | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true"
| otherwise = "--enable-tbaa=false"
output_fn <- phaseOutputFilename LlvmLlc
liftIO $ SysTools.runLlvmOpt dflags
([ SysTools.FileOption "" input_fn,
SysTools.Option "-o",
SysTools.FileOption "" output_fn]
++ optFlag
++ [SysTools.Option tbaa])
return (RealPhase LlvmLlc, output_fn)
where
-- we always (unless -optlo specified) run Opt since we rely on it to
-- fix up some pretty big deficiencies in the code we generate
llvmOpts = [ "-mem2reg -globalopt"
, "-O1 -globalopt"
, "-O2"
]
-----------------------------------------------------------------------------
-- LlvmLlc phase | 1,423 | false | false | 0 | 14 | 485 | 227 | 114 | 113 | null | null |
Numberartificial/workflow | snipets/src/Craft/Set.hs | mit | uni (x:xs) (y:ys)
| x<y = x : uni xs (y:ys)
| x==y = x : uni xs ys
| otherwise = y : uni (x:xs) ys | 114 | uni (x:xs) (y:ys)
| x<y = x : uni xs (y:ys)
| x==y = x : uni xs ys
| otherwise = y : uni (x:xs) ys | 114 | uni (x:xs) (y:ys)
| x<y = x : uni xs (y:ys)
| x==y = x : uni xs ys
| otherwise = y : uni (x:xs) ys | 114 | false | false | 3 | 8 | 42 | 98 | 47 | 51 | null | null |
urbanslug/ghc | compiler/basicTypes/BasicTypes.hs | bsd-3-clause | -- | Inject any integer into an 'IntWithInf'
mkIntWithInf :: Int -> IntWithInf
mkIntWithInf = Int | 97 | mkIntWithInf :: Int -> IntWithInf
mkIntWithInf = Int | 52 | mkIntWithInf = Int | 18 | true | true | 0 | 5 | 15 | 16 | 9 | 7 | null | null |
brendanhay/gogol | gogol-cloudprivatecatalogproducer/gen/Network/Google/Resource/CloudPrivateCatalogProducer/Catalogs/Associations/List.hs | mpl-2.0 | -- | V1 error format.
calXgafv :: Lens' CatalogsAssociationsList (Maybe Xgafv)
calXgafv = lens _calXgafv (\ s a -> s{_calXgafv = a}) | 132 | calXgafv :: Lens' CatalogsAssociationsList (Maybe Xgafv)
calXgafv = lens _calXgafv (\ s a -> s{_calXgafv = a}) | 110 | calXgafv = lens _calXgafv (\ s a -> s{_calXgafv = a}) | 53 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
slpopejoy/fadno-xml | src/Fadno/MusicXml/MusicXml30.hs | bsd-2-clause | parseNoteheadValue :: String -> P.XParse NoteheadValue
parseNoteheadValue s
| s == "slash" = return $ NoteheadValueSlash
| s == "triangle" = return $ NoteheadValueTriangle
| s == "diamond" = return $ NoteheadValueDiamond
| s == "square" = return $ NoteheadValueSquare
| s == "cross" = return $ NoteheadValueCross
| s == "x" = return $ NoteheadValueX
| s == "circle-x" = return $ NoteheadValueCircleX
| s == "inverted triangle" = return $ NoteheadValueInvertedTriangle
| s == "arrow down" = return $ NoteheadValueArrowDown
| s == "arrow up" = return $ NoteheadValueArrowUp
| s == "slashed" = return $ NoteheadValueSlashed
| s == "back slashed" = return $ NoteheadValueBackSlashed
| s == "normal" = return $ NoteheadValueNormal
| s == "cluster" = return $ NoteheadValueCluster
| s == "circle dot" = return $ NoteheadValueCircleDot
| s == "left triangle" = return $ NoteheadValueLeftTriangle
| s == "rectangle" = return $ NoteheadValueRectangle
| s == "none" = return $ NoteheadValueNone
| s == "do" = return $ NoteheadValueDo
| s == "re" = return $ NoteheadValueRe
| s == "mi" = return $ NoteheadValueMi
| s == "fa" = return $ NoteheadValueFa
| s == "fa up" = return $ NoteheadValueFaUp
| s == "so" = return $ NoteheadValueSo
| s == "la" = return $ NoteheadValueLa
| s == "ti" = return $ NoteheadValueTi
| otherwise = P.xfail $ "NoteheadValue: " ++ s | 1,564 | parseNoteheadValue :: String -> P.XParse NoteheadValue
parseNoteheadValue s
| s == "slash" = return $ NoteheadValueSlash
| s == "triangle" = return $ NoteheadValueTriangle
| s == "diamond" = return $ NoteheadValueDiamond
| s == "square" = return $ NoteheadValueSquare
| s == "cross" = return $ NoteheadValueCross
| s == "x" = return $ NoteheadValueX
| s == "circle-x" = return $ NoteheadValueCircleX
| s == "inverted triangle" = return $ NoteheadValueInvertedTriangle
| s == "arrow down" = return $ NoteheadValueArrowDown
| s == "arrow up" = return $ NoteheadValueArrowUp
| s == "slashed" = return $ NoteheadValueSlashed
| s == "back slashed" = return $ NoteheadValueBackSlashed
| s == "normal" = return $ NoteheadValueNormal
| s == "cluster" = return $ NoteheadValueCluster
| s == "circle dot" = return $ NoteheadValueCircleDot
| s == "left triangle" = return $ NoteheadValueLeftTriangle
| s == "rectangle" = return $ NoteheadValueRectangle
| s == "none" = return $ NoteheadValueNone
| s == "do" = return $ NoteheadValueDo
| s == "re" = return $ NoteheadValueRe
| s == "mi" = return $ NoteheadValueMi
| s == "fa" = return $ NoteheadValueFa
| s == "fa up" = return $ NoteheadValueFaUp
| s == "so" = return $ NoteheadValueSo
| s == "la" = return $ NoteheadValueLa
| s == "ti" = return $ NoteheadValueTi
| otherwise = P.xfail $ "NoteheadValue: " ++ s | 1,564 | parseNoteheadValue s
| s == "slash" = return $ NoteheadValueSlash
| s == "triangle" = return $ NoteheadValueTriangle
| s == "diamond" = return $ NoteheadValueDiamond
| s == "square" = return $ NoteheadValueSquare
| s == "cross" = return $ NoteheadValueCross
| s == "x" = return $ NoteheadValueX
| s == "circle-x" = return $ NoteheadValueCircleX
| s == "inverted triangle" = return $ NoteheadValueInvertedTriangle
| s == "arrow down" = return $ NoteheadValueArrowDown
| s == "arrow up" = return $ NoteheadValueArrowUp
| s == "slashed" = return $ NoteheadValueSlashed
| s == "back slashed" = return $ NoteheadValueBackSlashed
| s == "normal" = return $ NoteheadValueNormal
| s == "cluster" = return $ NoteheadValueCluster
| s == "circle dot" = return $ NoteheadValueCircleDot
| s == "left triangle" = return $ NoteheadValueLeftTriangle
| s == "rectangle" = return $ NoteheadValueRectangle
| s == "none" = return $ NoteheadValueNone
| s == "do" = return $ NoteheadValueDo
| s == "re" = return $ NoteheadValueRe
| s == "mi" = return $ NoteheadValueMi
| s == "fa" = return $ NoteheadValueFa
| s == "fa up" = return $ NoteheadValueFaUp
| s == "so" = return $ NoteheadValueSo
| s == "la" = return $ NoteheadValueLa
| s == "ti" = return $ NoteheadValueTi
| otherwise = P.xfail $ "NoteheadValue: " ++ s | 1,509 | false | true | 0 | 8 | 447 | 481 | 226 | 255 | null | null |
oldmanmike/haskellSDL2Examples | src/lesson10.hs | gpl-2.0 | title :: String
title = "lesson10" | 34 | title :: String
title = "lesson10" | 34 | title = "lesson10" | 18 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
swamp-agr/carbuyer-advisor | fay/RegionF.hs | mit | toJSON :: [Request] -> Fay T.Text
toJSON = ffi "JSON.stringify(%1)" | 67 | toJSON :: [Request] -> Fay T.Text
toJSON = ffi "JSON.stringify(%1)" | 67 | toJSON = ffi "JSON.stringify(%1)" | 33 | false | true | 0 | 8 | 9 | 32 | 14 | 18 | null | null |
vdweegen/UvA-Software_Testing | Lab5/Final/Exercises.hs | gpl-3.0 | exercise6 :: IO ()
exercise6 = do
putStrLn "Trying to solve a beginner sudoku: "
solve sudokuBeginner []
putStrLn "Trying to solve a generated minimal sudoku:"
solveMinimal
putStrLn "Simple to solve sudoku:"
simpleSudoku
putStrLn "Some hard to solve sudoku:"
minimalSudoku
print ()
-- | Simple beginner sudoku | 328 | exercise6 :: IO ()
exercise6 = do
putStrLn "Trying to solve a beginner sudoku: "
solve sudokuBeginner []
putStrLn "Trying to solve a generated minimal sudoku:"
solveMinimal
putStrLn "Simple to solve sudoku:"
simpleSudoku
putStrLn "Some hard to solve sudoku:"
minimalSudoku
print ()
-- | Simple beginner sudoku | 328 | exercise6 = do
putStrLn "Trying to solve a beginner sudoku: "
solve sudokuBeginner []
putStrLn "Trying to solve a generated minimal sudoku:"
solveMinimal
putStrLn "Simple to solve sudoku:"
simpleSudoku
putStrLn "Some hard to solve sudoku:"
minimalSudoku
print ()
-- | Simple beginner sudoku | 309 | false | true | 0 | 8 | 65 | 68 | 27 | 41 | null | null |
stirlingpoon/functional-programming-challenges | Challenge2/Game.hs | agpl-3.0 | -- | The height of the board.
boardHeight = snd boardDimensions | 63 | boardHeight = snd boardDimensions | 33 | boardHeight = snd boardDimensions | 33 | true | false | 0 | 5 | 10 | 10 | 5 | 5 | null | null |
markuspf/Idris-dev | src/Idris/Core/TT.hs | bsd-3-clause | -- | Replace references to the given 'Name'-like id with references to
-- de Bruijn index 0.
pToV :: Eq n => n -> TT n -> TT n
pToV n = pToV' n 0 | 145 | pToV :: Eq n => n -> TT n -> TT n
pToV n = pToV' n 0 | 52 | pToV n = pToV' n 0 | 18 | true | true | 0 | 9 | 34 | 48 | 21 | 27 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs | mpl-2.0 | -- | The string value of the EnumValuePair. The maximum length is 32
-- characters.
evpStringValue :: Lens' EnumValuePair (Maybe Text)
evpStringValue
= lens _evpStringValue
(\ s a -> s{_evpStringValue = a}) | 214 | evpStringValue :: Lens' EnumValuePair (Maybe Text)
evpStringValue
= lens _evpStringValue
(\ s a -> s{_evpStringValue = a}) | 130 | evpStringValue
= lens _evpStringValue
(\ s a -> s{_evpStringValue = a}) | 79 | true | true | 1 | 9 | 39 | 53 | 26 | 27 | null | null |
plaprade/haskoin | haskoin-core/src/Network/Haskoin/Crypto/Mnemonic.hs | unlicense | fromMnemonic :: Mnemonic -> Either String Entropy
fromMnemonic ms = do
when (BS.null ms) $
Left $ "fromMnemonic: empty mnemonic"
when (word_count > 48) $
Left $ "fromMnemonic: too many words: " ++ show word_count
when (word_count `mod` 3 /= 0) $
Left $ "fromMnemonic: wrong number of words:" ++ show word_count
ms_bs <- indicesToBS =<< getIndices ms_words
let (ms_ent, ms_cs) = BS.splitAt (ent_len * 4) ms_bs
ms_cs_num = numCS cs_len ms_cs
ent_cs_num = numCS cs_len $ calcCS cs_len ms_ent
when (ent_cs_num /= ms_cs_num) $
Left $ "fromMnemonic: checksum failed: " ++ sh ent_cs_num ms_cs_num
return ms_ent
where
ms_words = C.words ms
word_count = length ms_words
(ent_len, cs_len) = (word_count * 11) `quotRem` 32
sh cs_a cs_b = show cs_a ++ " /= " ++ show cs_b | 853 | fromMnemonic :: Mnemonic -> Either String Entropy
fromMnemonic ms = do
when (BS.null ms) $
Left $ "fromMnemonic: empty mnemonic"
when (word_count > 48) $
Left $ "fromMnemonic: too many words: " ++ show word_count
when (word_count `mod` 3 /= 0) $
Left $ "fromMnemonic: wrong number of words:" ++ show word_count
ms_bs <- indicesToBS =<< getIndices ms_words
let (ms_ent, ms_cs) = BS.splitAt (ent_len * 4) ms_bs
ms_cs_num = numCS cs_len ms_cs
ent_cs_num = numCS cs_len $ calcCS cs_len ms_ent
when (ent_cs_num /= ms_cs_num) $
Left $ "fromMnemonic: checksum failed: " ++ sh ent_cs_num ms_cs_num
return ms_ent
where
ms_words = C.words ms
word_count = length ms_words
(ent_len, cs_len) = (word_count * 11) `quotRem` 32
sh cs_a cs_b = show cs_a ++ " /= " ++ show cs_b | 853 | fromMnemonic ms = do
when (BS.null ms) $
Left $ "fromMnemonic: empty mnemonic"
when (word_count > 48) $
Left $ "fromMnemonic: too many words: " ++ show word_count
when (word_count `mod` 3 /= 0) $
Left $ "fromMnemonic: wrong number of words:" ++ show word_count
ms_bs <- indicesToBS =<< getIndices ms_words
let (ms_ent, ms_cs) = BS.splitAt (ent_len * 4) ms_bs
ms_cs_num = numCS cs_len ms_cs
ent_cs_num = numCS cs_len $ calcCS cs_len ms_ent
when (ent_cs_num /= ms_cs_num) $
Left $ "fromMnemonic: checksum failed: " ++ sh ent_cs_num ms_cs_num
return ms_ent
where
ms_words = C.words ms
word_count = length ms_words
(ent_len, cs_len) = (word_count * 11) `quotRem` 32
sh cs_a cs_b = show cs_a ++ " /= " ++ show cs_b | 803 | false | true | 0 | 13 | 220 | 285 | 137 | 148 | null | null |
green-haskell/ghc | compiler/deSugar/DsBinds.hs | bsd-3-clause | ds_tc_coercion :: CvSubst -> TcCoercion -> Coercion
-- If the incoming TcCoercion if of type (a ~ b) (resp. Coercible a b)
-- the result is of type (a ~# b) (reps. a ~# b)
-- The VarEnv maps EqVars of type (a ~ b) to Coercions of type (a ~# b) (resp. and so on)
-- No need for InScope set etc because the
ds_tc_coercion subst tc_co
= go tc_co
where
go (TcRefl r ty) = Refl r (Coercion.substTy subst ty)
go (TcTyConAppCo r tc cos) = mkTyConAppCo r tc (map go cos)
go (TcAppCo co1 co2) = mkAppCo (go co1) (go co2)
go (TcForAllCo tv co) = mkForAllCo tv' (ds_tc_coercion subst' co)
where
(subst', tv') = Coercion.substTyVarBndr subst tv
go (TcAxiomInstCo ax ind cos)
= AxiomInstCo ax ind (map go cos)
go (TcPhantomCo ty1 ty2) = UnivCo (fsLit "ds_tc_coercion") Phantom ty1 ty2
go (TcSymCo co) = mkSymCo (go co)
go (TcTransCo co1 co2) = mkTransCo (go co1) (go co2)
go (TcNthCo n co) = mkNthCo n (go co)
go (TcLRCo lr co) = mkLRCo lr (go co)
go (TcSubCo co) = mkSubCo (go co)
go (TcLetCo bs co) = ds_tc_coercion (ds_co_binds bs) co
go (TcCastCo co1 co2) = mkCoCast (go co1) (go co2)
go (TcCoVarCo v) = ds_ev_id subst v
go (TcAxiomRuleCo co ts cs) = AxiomRuleCo co (map (Coercion.substTy subst) ts) (map go cs)
go (TcCoercion co) = co
ds_co_binds :: TcEvBinds -> CvSubst
ds_co_binds (EvBinds bs) = foldl ds_scc subst (sccEvBinds bs)
ds_co_binds eb@(TcEvBinds {}) = pprPanic "ds_co_binds" (ppr eb)
ds_scc :: CvSubst -> SCC EvBind -> CvSubst
ds_scc subst (AcyclicSCC (EvBind { eb_lhs = v, eb_rhs = ev_term }))
= extendCvSubstAndInScope subst v (ds_co_term subst ev_term)
ds_scc _ (CyclicSCC other) = pprPanic "ds_scc:cyclic" (ppr other $$ ppr tc_co)
ds_co_term :: CvSubst -> EvTerm -> Coercion
ds_co_term subst (EvCoercion tc_co) = ds_tc_coercion subst tc_co
ds_co_term subst (EvId v) = ds_ev_id subst v
ds_co_term subst (EvCast tm co) = mkCoCast (ds_co_term subst tm) (ds_tc_coercion subst co)
ds_co_term _ other = pprPanic "ds_co_term" (ppr other $$ ppr tc_co)
ds_ev_id :: CvSubst -> EqVar -> Coercion
ds_ev_id subst v
| Just co <- Coercion.lookupCoVar subst v = co
| otherwise = pprPanic "ds_tc_coercion" (ppr v $$ ppr tc_co)
{-
Note [Simple coercions]
~~~~~~~~~~~~~~~~~~~~~~~
We have a special case for coercions that are simple variables.
Suppose cv :: a ~ b is in scope
Lacking the special case, if we see
f a b cv
we'd desguar to
f a b (case cv of EqBox (cv# :: a ~# b) -> EqBox cv#)
which is a bit stupid. The special case does the obvious thing.
This turns out to be important when desugaring the LHS of a RULE
(see Trac #7837). Suppose we have
normalise :: (a ~ Scalar a) => a -> a
normalise_Double :: Double -> Double
{-# RULES "normalise" normalise = normalise_Double #-}
Then the RULE we want looks like
forall a, (cv:a~Scalar a).
normalise a cv = normalise_Double
But without the special case we generate the redundant box/unbox,
which simpleOpt (currently) doesn't remove. So the rule never matches.
Maybe simpleOpt should be smarter. But it seems like a good plan
to simply never generate the redundant box/unbox in the first place.
-} | 3,486 | ds_tc_coercion :: CvSubst -> TcCoercion -> Coercion
ds_tc_coercion subst tc_co
= go tc_co
where
go (TcRefl r ty) = Refl r (Coercion.substTy subst ty)
go (TcTyConAppCo r tc cos) = mkTyConAppCo r tc (map go cos)
go (TcAppCo co1 co2) = mkAppCo (go co1) (go co2)
go (TcForAllCo tv co) = mkForAllCo tv' (ds_tc_coercion subst' co)
where
(subst', tv') = Coercion.substTyVarBndr subst tv
go (TcAxiomInstCo ax ind cos)
= AxiomInstCo ax ind (map go cos)
go (TcPhantomCo ty1 ty2) = UnivCo (fsLit "ds_tc_coercion") Phantom ty1 ty2
go (TcSymCo co) = mkSymCo (go co)
go (TcTransCo co1 co2) = mkTransCo (go co1) (go co2)
go (TcNthCo n co) = mkNthCo n (go co)
go (TcLRCo lr co) = mkLRCo lr (go co)
go (TcSubCo co) = mkSubCo (go co)
go (TcLetCo bs co) = ds_tc_coercion (ds_co_binds bs) co
go (TcCastCo co1 co2) = mkCoCast (go co1) (go co2)
go (TcCoVarCo v) = ds_ev_id subst v
go (TcAxiomRuleCo co ts cs) = AxiomRuleCo co (map (Coercion.substTy subst) ts) (map go cs)
go (TcCoercion co) = co
ds_co_binds :: TcEvBinds -> CvSubst
ds_co_binds (EvBinds bs) = foldl ds_scc subst (sccEvBinds bs)
ds_co_binds eb@(TcEvBinds {}) = pprPanic "ds_co_binds" (ppr eb)
ds_scc :: CvSubst -> SCC EvBind -> CvSubst
ds_scc subst (AcyclicSCC (EvBind { eb_lhs = v, eb_rhs = ev_term }))
= extendCvSubstAndInScope subst v (ds_co_term subst ev_term)
ds_scc _ (CyclicSCC other) = pprPanic "ds_scc:cyclic" (ppr other $$ ppr tc_co)
ds_co_term :: CvSubst -> EvTerm -> Coercion
ds_co_term subst (EvCoercion tc_co) = ds_tc_coercion subst tc_co
ds_co_term subst (EvId v) = ds_ev_id subst v
ds_co_term subst (EvCast tm co) = mkCoCast (ds_co_term subst tm) (ds_tc_coercion subst co)
ds_co_term _ other = pprPanic "ds_co_term" (ppr other $$ ppr tc_co)
ds_ev_id :: CvSubst -> EqVar -> Coercion
ds_ev_id subst v
| Just co <- Coercion.lookupCoVar subst v = co
| otherwise = pprPanic "ds_tc_coercion" (ppr v $$ ppr tc_co)
{-
Note [Simple coercions]
~~~~~~~~~~~~~~~~~~~~~~~
We have a special case for coercions that are simple variables.
Suppose cv :: a ~ b is in scope
Lacking the special case, if we see
f a b cv
we'd desguar to
f a b (case cv of EqBox (cv# :: a ~# b) -> EqBox cv#)
which is a bit stupid. The special case does the obvious thing.
This turns out to be important when desugaring the LHS of a RULE
(see Trac #7837). Suppose we have
normalise :: (a ~ Scalar a) => a -> a
normalise_Double :: Double -> Double
{-# RULES "normalise" normalise = normalise_Double #-}
Then the RULE we want looks like
forall a, (cv:a~Scalar a).
normalise a cv = normalise_Double
But without the special case we generate the redundant box/unbox,
which simpleOpt (currently) doesn't remove. So the rule never matches.
Maybe simpleOpt should be smarter. But it seems like a good plan
to simply never generate the redundant box/unbox in the first place.
-} | 3,212 | ds_tc_coercion subst tc_co
= go tc_co
where
go (TcRefl r ty) = Refl r (Coercion.substTy subst ty)
go (TcTyConAppCo r tc cos) = mkTyConAppCo r tc (map go cos)
go (TcAppCo co1 co2) = mkAppCo (go co1) (go co2)
go (TcForAllCo tv co) = mkForAllCo tv' (ds_tc_coercion subst' co)
where
(subst', tv') = Coercion.substTyVarBndr subst tv
go (TcAxiomInstCo ax ind cos)
= AxiomInstCo ax ind (map go cos)
go (TcPhantomCo ty1 ty2) = UnivCo (fsLit "ds_tc_coercion") Phantom ty1 ty2
go (TcSymCo co) = mkSymCo (go co)
go (TcTransCo co1 co2) = mkTransCo (go co1) (go co2)
go (TcNthCo n co) = mkNthCo n (go co)
go (TcLRCo lr co) = mkLRCo lr (go co)
go (TcSubCo co) = mkSubCo (go co)
go (TcLetCo bs co) = ds_tc_coercion (ds_co_binds bs) co
go (TcCastCo co1 co2) = mkCoCast (go co1) (go co2)
go (TcCoVarCo v) = ds_ev_id subst v
go (TcAxiomRuleCo co ts cs) = AxiomRuleCo co (map (Coercion.substTy subst) ts) (map go cs)
go (TcCoercion co) = co
ds_co_binds :: TcEvBinds -> CvSubst
ds_co_binds (EvBinds bs) = foldl ds_scc subst (sccEvBinds bs)
ds_co_binds eb@(TcEvBinds {}) = pprPanic "ds_co_binds" (ppr eb)
ds_scc :: CvSubst -> SCC EvBind -> CvSubst
ds_scc subst (AcyclicSCC (EvBind { eb_lhs = v, eb_rhs = ev_term }))
= extendCvSubstAndInScope subst v (ds_co_term subst ev_term)
ds_scc _ (CyclicSCC other) = pprPanic "ds_scc:cyclic" (ppr other $$ ppr tc_co)
ds_co_term :: CvSubst -> EvTerm -> Coercion
ds_co_term subst (EvCoercion tc_co) = ds_tc_coercion subst tc_co
ds_co_term subst (EvId v) = ds_ev_id subst v
ds_co_term subst (EvCast tm co) = mkCoCast (ds_co_term subst tm) (ds_tc_coercion subst co)
ds_co_term _ other = pprPanic "ds_co_term" (ppr other $$ ppr tc_co)
ds_ev_id :: CvSubst -> EqVar -> Coercion
ds_ev_id subst v
| Just co <- Coercion.lookupCoVar subst v = co
| otherwise = pprPanic "ds_tc_coercion" (ppr v $$ ppr tc_co)
{-
Note [Simple coercions]
~~~~~~~~~~~~~~~~~~~~~~~
We have a special case for coercions that are simple variables.
Suppose cv :: a ~ b is in scope
Lacking the special case, if we see
f a b cv
we'd desguar to
f a b (case cv of EqBox (cv# :: a ~# b) -> EqBox cv#)
which is a bit stupid. The special case does the obvious thing.
This turns out to be important when desugaring the LHS of a RULE
(see Trac #7837). Suppose we have
normalise :: (a ~ Scalar a) => a -> a
normalise_Double :: Double -> Double
{-# RULES "normalise" normalise = normalise_Double #-}
Then the RULE we want looks like
forall a, (cv:a~Scalar a).
normalise a cv = normalise_Double
But without the special case we generate the redundant box/unbox,
which simpleOpt (currently) doesn't remove. So the rule never matches.
Maybe simpleOpt should be smarter. But it seems like a good plan
to simply never generate the redundant box/unbox in the first place.
-} | 3,160 | true | true | 0 | 11 | 980 | 877 | 429 | 448 | null | null |
scanner-darkly/mod | teletype/euclidean/euclidean.hs | gpl-2.0 | -- | Pad a list of `Bool` with False out to length `n`
pad :: Int -> [Bool] -> [Bool]
pad n xs
| length xs >= n = xs
| otherwise = pad n $ xs ++ [False] | 161 | pad :: Int -> [Bool] -> [Bool]
pad n xs
| length xs >= n = xs
| otherwise = pad n $ xs ++ [False] | 106 | pad n xs
| length xs >= n = xs
| otherwise = pad n $ xs ++ [False] | 75 | true | true | 1 | 9 | 47 | 66 | 33 | 33 | null | null |
jwiegley/ghc-release | libraries/base/GHC/MVar.hs | gpl-3.0 | tryReadMVar :: MVar a -> IO (Maybe a)
tryReadMVar (MVar m) = IO $ \ s ->
case tryReadMVar# m s of
(# s', 0#, _ #) -> (# s', Nothing #) -- MVar is empty
(# s', _, a #) -> (# s', Just a #) -- MVar is full
-- |Check whether a given 'MVar' is empty.
--
-- Notice that the boolean value returned is just a snapshot of
-- the state of the MVar. By the time you get to react on its result,
-- the MVar may have been filled (or emptied) - so be extremely
-- careful when using this operation. Use 'tryTakeMVar' instead if possible. | 559 | tryReadMVar :: MVar a -> IO (Maybe a)
tryReadMVar (MVar m) = IO $ \ s ->
case tryReadMVar# m s of
(# s', 0#, _ #) -> (# s', Nothing #) -- MVar is empty
(# s', _, a #) -> (# s', Just a #) -- MVar is full
-- |Check whether a given 'MVar' is empty.
--
-- Notice that the boolean value returned is just a snapshot of
-- the state of the MVar. By the time you get to react on its result,
-- the MVar may have been filled (or emptied) - so be extremely
-- careful when using this operation. Use 'tryTakeMVar' instead if possible. | 559 | tryReadMVar (MVar m) = IO $ \ s ->
case tryReadMVar# m s of
(# s', 0#, _ #) -> (# s', Nothing #) -- MVar is empty
(# s', _, a #) -> (# s', Just a #) -- MVar is full
-- |Check whether a given 'MVar' is empty.
--
-- Notice that the boolean value returned is just a snapshot of
-- the state of the MVar. By the time you get to react on its result,
-- the MVar may have been filled (or emptied) - so be extremely
-- careful when using this operation. Use 'tryTakeMVar' instead if possible. | 521 | false | true | 2 | 11 | 147 | 109 | 58 | 51 | null | null |
continuouspi/cpiwb | CPi/Signals.hs | gpl-3.0 | -- = HFL
tShift5HFL = ((0, 10), [(0,5)]) :: Signal | 50 | tShift5HFL = ((0, 10), [(0,5)]) :: Signal | 41 | tShift5HFL = ((0, 10), [(0,5)]) :: Signal | 41 | true | false | 0 | 7 | 9 | 31 | 20 | 11 | null | null |
gcampax/ghc | compiler/typecheck/TcRnTypes.hs | bsd-3-clause | pprCtO HoleOrigin = ptext (sLit "a use of") <+> quotes (ptext $ sLit "_") | 84 | pprCtO HoleOrigin = ptext (sLit "a use of") <+> quotes (ptext $ sLit "_") | 84 | pprCtO HoleOrigin = ptext (sLit "a use of") <+> quotes (ptext $ sLit "_") | 84 | false | false | 0 | 9 | 24 | 36 | 16 | 20 | null | null |
martinvlk/cis194-homeworks | src/HW06/Fibonacci.hs | gpl-3.0 | -- ex1
fib :: Integer -> Integer
fib 0 = 0 | 42 | fib :: Integer -> Integer
fib 0 = 0 | 35 | fib 0 = 0 | 9 | true | true | 0 | 7 | 10 | 25 | 11 | 14 | null | null |
jlubi333/Camille | camille/hs/Evaluator.hs | mit | foldInteger :: (Integer -> Integer -> Integer) -> [Expression] -> Expression
foldInteger f = foldl1 $ \(IntegerExpression a) (IntegerExpression n) ->
IntegerExpression (f a n) | 204 | foldInteger :: (Integer -> Integer -> Integer) -> [Expression] -> Expression
foldInteger f = foldl1 $ \(IntegerExpression a) (IntegerExpression n) ->
IntegerExpression (f a n) | 204 | foldInteger f = foldl1 $ \(IntegerExpression a) (IntegerExpression n) ->
IntegerExpression (f a n) | 127 | false | true | 0 | 9 | 53 | 70 | 36 | 34 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter_14_my_note.hs | mit | squashMaybe :: Maybe (Maybe a) -> Maybe a
squashMaybe = maybe Nothing id | 75 | squashMaybe :: Maybe (Maybe a) -> Maybe a
squashMaybe = maybe Nothing id | 75 | squashMaybe = maybe Nothing id | 33 | false | true | 0 | 9 | 15 | 39 | 16 | 23 | null | null |
nevrenato/HetsAlloy | CASL/Freeness.hs | gpl-2.0 | {- | extract the variables from a CASL formula and put them in a map
with keys the sort of the variables and value the set of variables
in this sort -}
getVars :: CASLFORMULA -> Map.Map Id (Set.Set Token)
getVars (Quantification _ _ f _) = getVars f | 249 | getVars :: CASLFORMULA -> Map.Map Id (Set.Set Token)
getVars (Quantification _ _ f _) = getVars f | 97 | getVars (Quantification _ _ f _) = getVars f | 44 | true | true | 0 | 9 | 48 | 53 | 25 | 28 | null | null |
sdiehl/ghc | distrib/compare/compare.hs | bsd-3-clause | nubContents [x] = ([], [x]) | 27 | nubContents [x] = ([], [x]) | 27 | nubContents [x] = ([], [x]) | 27 | false | false | 0 | 6 | 4 | 23 | 13 | 10 | null | null |
brendanhay/gogol | gogol-containerbuilder/gen/Network/Google/Resource/Cloudbuild/Projects/Locations/Builds/Create.hs | mpl-2.0 | -- | Multipart request metadata.
proPayload :: Lens' ProjectsLocationsBuildsCreate Build
proPayload
= lens _proPayload (\ s a -> s{_proPayload = a}) | 150 | proPayload :: Lens' ProjectsLocationsBuildsCreate Build
proPayload
= lens _proPayload (\ s a -> s{_proPayload = a}) | 117 | proPayload
= lens _proPayload (\ s a -> s{_proPayload = a}) | 61 | true | true | 0 | 9 | 22 | 42 | 22 | 20 | null | null |
DavidAlphaFox/darcs | src/Darcs/Patch/Choices.hs | gpl-2.0 | label :: LabelledPatch p wX wY -> Label
label (LP tg _) = tg | 60 | label :: LabelledPatch p wX wY -> Label
label (LP tg _) = tg | 60 | label (LP tg _) = tg | 20 | false | true | 0 | 7 | 13 | 33 | 16 | 17 | null | null |
joelwilliamson/modern-compilers-exercises | Lexer.hs | gpl-3.0 | do' = Do <$ reserved "do" | 25 | do' = Do <$ reserved "do" | 25 | do' = Do <$ reserved "do" | 25 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
intolerable/GroupProject | src/Emulator/Memory.hs | bsd-2-clause | writeAddressHalfWord :: AddressSpace m => Address -> HalfWord -> m ()
writeAddressHalfWord addr hw = do
case addressToRegionType addr of
(_, BIOS) -> return ()
(_, WRAM) -> writeHalfWord (Proxy :: Proxy WRAM) addr hw
(_, GamePakWRAM) -> writeHalfWord (Proxy :: Proxy GamePakWRAM) addr hw
(_, IORegisters) -> writeHalfWord (Proxy :: Proxy IORegisters) addr hw
(_, PaletteRAM) -> writeHalfWord (Proxy :: Proxy PaletteRAM) addr hw
(_, VRAM) -> writeHalfWord (Proxy :: Proxy VRAM) addr hw
(_, ObjAttributes) -> writeHalfWord (Proxy :: Proxy OAM) addr hw
(_, GamePakROM) -> return ()
(_, GamePakSRAM) -> error "Undefined memory proxy location (GamePakSRAM)!"
(_, Unused) -> error $ Text.unpack $ format "Unused memory location (write halfword)! {}" $ Only $ showHex addr | 807 | writeAddressHalfWord :: AddressSpace m => Address -> HalfWord -> m ()
writeAddressHalfWord addr hw = do
case addressToRegionType addr of
(_, BIOS) -> return ()
(_, WRAM) -> writeHalfWord (Proxy :: Proxy WRAM) addr hw
(_, GamePakWRAM) -> writeHalfWord (Proxy :: Proxy GamePakWRAM) addr hw
(_, IORegisters) -> writeHalfWord (Proxy :: Proxy IORegisters) addr hw
(_, PaletteRAM) -> writeHalfWord (Proxy :: Proxy PaletteRAM) addr hw
(_, VRAM) -> writeHalfWord (Proxy :: Proxy VRAM) addr hw
(_, ObjAttributes) -> writeHalfWord (Proxy :: Proxy OAM) addr hw
(_, GamePakROM) -> return ()
(_, GamePakSRAM) -> error "Undefined memory proxy location (GamePakSRAM)!"
(_, Unused) -> error $ Text.unpack $ format "Unused memory location (write halfword)! {}" $ Only $ showHex addr | 807 | writeAddressHalfWord addr hw = do
case addressToRegionType addr of
(_, BIOS) -> return ()
(_, WRAM) -> writeHalfWord (Proxy :: Proxy WRAM) addr hw
(_, GamePakWRAM) -> writeHalfWord (Proxy :: Proxy GamePakWRAM) addr hw
(_, IORegisters) -> writeHalfWord (Proxy :: Proxy IORegisters) addr hw
(_, PaletteRAM) -> writeHalfWord (Proxy :: Proxy PaletteRAM) addr hw
(_, VRAM) -> writeHalfWord (Proxy :: Proxy VRAM) addr hw
(_, ObjAttributes) -> writeHalfWord (Proxy :: Proxy OAM) addr hw
(_, GamePakROM) -> return ()
(_, GamePakSRAM) -> error "Undefined memory proxy location (GamePakSRAM)!"
(_, Unused) -> error $ Text.unpack $ format "Unused memory location (write halfword)! {}" $ Only $ showHex addr | 737 | false | true | 0 | 15 | 159 | 304 | 156 | 148 | null | null |
derekmolloy/exploringBB | chp05/performance/nbodyp.hs | gpl-3.0 | jupiter = Planet
{x = 4.84143144246472090e+00, y = -1.16032004402742839e+00, z= -1.03622044471123109e-01,
vx = 1.66007664274403694e-03*dp, vy = 7.69901118419740425e-03*dp, vz = -6.90460016972063023e-05*dp,
mass = 9.54791938424326609e-04 * solar_mass} | 265 | jupiter = Planet
{x = 4.84143144246472090e+00, y = -1.16032004402742839e+00, z= -1.03622044471123109e-01,
vx = 1.66007664274403694e-03*dp, vy = 7.69901118419740425e-03*dp, vz = -6.90460016972063023e-05*dp,
mass = 9.54791938424326609e-04 * solar_mass} | 265 | jupiter = Planet
{x = 4.84143144246472090e+00, y = -1.16032004402742839e+00, z= -1.03622044471123109e-01,
vx = 1.66007664274403694e-03*dp, vy = 7.69901118419740425e-03*dp, vz = -6.90460016972063023e-05*dp,
mass = 9.54791938424326609e-04 * solar_mass} | 265 | false | false | 0 | 9 | 39 | 76 | 44 | 32 | null | null |
keitax/wikirick | src/Wikirick/Repository.hs | bsd-3-clause | fetchAllArticleTitles :: (MonadState Repository m, MonadCatchIO m) => m [T.Text]
fetchAllArticleTitles = get >>= _fetchAllArticleTitles | 135 | fetchAllArticleTitles :: (MonadState Repository m, MonadCatchIO m) => m [T.Text]
fetchAllArticleTitles = get >>= _fetchAllArticleTitles | 135 | fetchAllArticleTitles = get >>= _fetchAllArticleTitles | 54 | false | true | 2 | 9 | 14 | 48 | 23 | 25 | null | null |
kyren/hsgb | lib/Gameboy/Assembler.hs | unlicense | addressArg :: Parsec String st Argument
addressArg = do
_ <- char '('
r <- hl <|> c <|> bc <|> de <|> try nn <|> n
_ <- char ')'
return r
where
hl = string "HL" >> return (AddressArg AtHL)
c = string "C" >> return (AddressArg AtC)
bc = string "BC" >> return (AddressArg AtBC)
de = string "DE" >> return (AddressArg AtDE)
nn = AddressArg . AtNN <$> immediate16
n = AddressArg . AtN <$> immediate8 | 437 | addressArg :: Parsec String st Argument
addressArg = do
_ <- char '('
r <- hl <|> c <|> bc <|> de <|> try nn <|> n
_ <- char ')'
return r
where
hl = string "HL" >> return (AddressArg AtHL)
c = string "C" >> return (AddressArg AtC)
bc = string "BC" >> return (AddressArg AtBC)
de = string "DE" >> return (AddressArg AtDE)
nn = AddressArg . AtNN <$> immediate16
n = AddressArg . AtN <$> immediate8 | 437 | addressArg = do
_ <- char '('
r <- hl <|> c <|> bc <|> de <|> try nn <|> n
_ <- char ')'
return r
where
hl = string "HL" >> return (AddressArg AtHL)
c = string "C" >> return (AddressArg AtC)
bc = string "BC" >> return (AddressArg AtBC)
de = string "DE" >> return (AddressArg AtDE)
nn = AddressArg . AtNN <$> immediate16
n = AddressArg . AtN <$> immediate8 | 397 | false | true | 5 | 15 | 121 | 190 | 88 | 102 | null | null |
eddywestbrook/hobbits | archival/TermTree.hs | bsd-3-clause | suc = lam $ \n -> lam $ \z -> lam $ \s -> var n `app` (var s `app` var z) `app` var s | 86 | suc = lam $ \n -> lam $ \z -> lam $ \s -> var n `app` (var s `app` var z) `app` var s | 86 | suc = lam $ \n -> lam $ \z -> lam $ \s -> var n `app` (var s `app` var z) `app` var s | 86 | false | false | 0 | 15 | 25 | 66 | 36 | 30 | null | null |
ocean0yohsuke/Scheme | src/Scheme/Evaluator/Micro.hs | bsd-3-clause | evalCons c@(CELL a (CELL x _ _) _) = throwEvalError $ WRONGNumArgs $ show (cell (sym "cons") c) | 95 | evalCons c@(CELL a (CELL x _ _) _) = throwEvalError $ WRONGNumArgs $ show (cell (sym "cons") c) | 95 | evalCons c@(CELL a (CELL x _ _) _) = throwEvalError $ WRONGNumArgs $ show (cell (sym "cons") c) | 95 | false | false | 1 | 12 | 17 | 62 | 28 | 34 | null | null |
pnlbwh/test-tensormasking | pipeline-lib/Pipeline/HCP/Preprocessing.hs | bsd-3-clause | combineB0s :: FilePath -> [(FilePath, [Int])] -> Action ()
combineB0s out path_and_indices =
do fs <- traverse (uncurry extractVols) path_and_indices
mergeVols out fs
trimVol out
--------------------------------------------------------------------------------
-- Rules | 282 | combineB0s :: FilePath -> [(FilePath, [Int])] -> Action ()
combineB0s out path_and_indices =
do fs <- traverse (uncurry extractVols) path_and_indices
mergeVols out fs
trimVol out
--------------------------------------------------------------------------------
-- Rules | 282 | combineB0s out path_and_indices =
do fs <- traverse (uncurry extractVols) path_and_indices
mergeVols out fs
trimVol out
--------------------------------------------------------------------------------
-- Rules | 223 | false | true | 0 | 10 | 41 | 75 | 37 | 38 | null | null |
DougBurke/swish | src/Swish/Datatype.hs | lgpl-2.1 | mergeTupleVals _ _ _ = [Nothing] | 40 | mergeTupleVals _ _ _ = [Nothing] | 40 | mergeTupleVals _ _ _ = [Nothing] | 40 | false | false | 1 | 6 | 13 | 17 | 7 | 10 | null | null |
fmapfmapfmap/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/RemoveTagsFromVault.hs | mpl-2.0 | -- | Creates a value of 'RemoveTagsFromVault' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rtfvTagKeys'
--
-- * 'rtfvAccountId'
--
-- * 'rtfvVaultName'
removeTagsFromVault
:: Text -- ^ 'rtfvAccountId'
-> Text -- ^ 'rtfvVaultName'
-> RemoveTagsFromVault
removeTagsFromVault pAccountId_ pVaultName_ =
RemoveTagsFromVault'
{ _rtfvTagKeys = Nothing
, _rtfvAccountId = pAccountId_
, _rtfvVaultName = pVaultName_
} | 529 | removeTagsFromVault
:: Text -- ^ 'rtfvAccountId'
-> Text -- ^ 'rtfvVaultName'
-> RemoveTagsFromVault
removeTagsFromVault pAccountId_ pVaultName_ =
RemoveTagsFromVault'
{ _rtfvTagKeys = Nothing
, _rtfvAccountId = pAccountId_
, _rtfvVaultName = pVaultName_
} | 288 | removeTagsFromVault pAccountId_ pVaultName_ =
RemoveTagsFromVault'
{ _rtfvTagKeys = Nothing
, _rtfvAccountId = pAccountId_
, _rtfvVaultName = pVaultName_
} | 175 | true | true | 0 | 8 | 104 | 64 | 38 | 26 | null | null |
zepto-lang/zepto | src/Zepto/Types/Export.hs | gpl-2.0 | useAsCStringLenBVec = B.useAsCStringLen | 39 | useAsCStringLenBVec = B.useAsCStringLen | 39 | useAsCStringLenBVec = B.useAsCStringLen | 39 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x2F841' = "\x54F6" | 34 | decomposeChar '\x2F841' = "\x54F6" | 34 | decomposeChar '\x2F841' = "\x54F6" | 34 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
jragonfyre/TRPG | src/English/Words.hs | bsd-3-clause | specifierA :: BaseEntry
specifierA = BaseEntry "a" (AdjectiveT (DeterminerBase General (Singular <$> allGenders))) Nothing | 122 | specifierA :: BaseEntry
specifierA = BaseEntry "a" (AdjectiveT (DeterminerBase General (Singular <$> allGenders))) Nothing | 122 | specifierA = BaseEntry "a" (AdjectiveT (DeterminerBase General (Singular <$> allGenders))) Nothing | 98 | false | true | 0 | 11 | 13 | 46 | 21 | 25 | null | null |
raptros/chatless-hs | model/Chatless/Model/Topic.hs | bsd-3-clause | resolveTopicModeUpdateMay :: TopicMode -> TopicModeUpdate -> Maybe TopicMode
resolveTopicModeUpdateMay = (asMaybe .) . resolveTopicModeUpdate | 141 | resolveTopicModeUpdateMay :: TopicMode -> TopicModeUpdate -> Maybe TopicMode
resolveTopicModeUpdateMay = (asMaybe .) . resolveTopicModeUpdate | 141 | resolveTopicModeUpdateMay = (asMaybe .) . resolveTopicModeUpdate | 64 | false | true | 0 | 7 | 13 | 30 | 16 | 14 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Graphics/Drawable.hs | mit | drawableGetZoneMask :: (Parent Drawable a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Drawable or ascentor
-> m Word
drawableGetZoneMask p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int { $(Drawable* ptr)->GetZoneMask() } |]
-- | Return maximum number of per-pixel lights. | 314 | drawableGetZoneMask :: (Parent Drawable a, Pointer p a, MonadIO m)
=> p -- ^ Pointer to Drawable or ascentor
-> m Word
drawableGetZoneMask p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int { $(Drawable* ptr)->GetZoneMask() } |]
-- | Return maximum number of per-pixel lights. | 314 | drawableGetZoneMask p = liftIO $ do
let ptr = parentPointer p
fromIntegral <$> [C.exp| unsigned int { $(Drawable* ptr)->GetZoneMask() } |]
-- | Return maximum number of per-pixel lights. | 191 | false | true | 0 | 11 | 59 | 78 | 40 | 38 | null | null |
nadavshemer/buildsome | src/Lib/Directory.hs | gpl-2.0 | createDirectories :: FilePath -> IO ()
createDirectories path
| BS8.null path = return ()
| otherwise = do
doesExist <- FilePath.exists path
unless doesExist $ do
createDirectories $ FilePath.takeDirectory path
Posix.createDirectory path 0o777 | 267 | createDirectories :: FilePath -> IO ()
createDirectories path
| BS8.null path = return ()
| otherwise = do
doesExist <- FilePath.exists path
unless doesExist $ do
createDirectories $ FilePath.takeDirectory path
Posix.createDirectory path 0o777 | 267 | createDirectories path
| BS8.null path = return ()
| otherwise = do
doesExist <- FilePath.exists path
unless doesExist $ do
createDirectories $ FilePath.takeDirectory path
Posix.createDirectory path 0o777 | 228 | false | true | 1 | 13 | 56 | 91 | 39 | 52 | null | null |
DanielWaterworth/Idris-dev | src/Idris/IdeSlave.hs | bsd-3-clause | sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name) | 130 | sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name) | 130 | sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name) | 130 | false | false | 0 | 9 | 15 | 50 | 24 | 26 | null | null |
liskin/gooddata-haskell | GoodData/Session.hs | bsd-3-clause | deleteCall ∷ String → GoodDataAction ResponseGDBS
deleteCall uri = http' =<< plainDelete =<< mkUri uri | 102 | deleteCall ∷ String → GoodDataAction ResponseGDBS
deleteCall uri = http' =<< plainDelete =<< mkUri uri | 102 | deleteCall uri = http' =<< plainDelete =<< mkUri uri | 52 | false | true | 0 | 6 | 14 | 32 | 15 | 17 | null | null |
urbanslug/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | i16 = LMInt 16 | 17 | i16 = LMInt 16 | 17 | i16 = LMInt 16 | 17 | false | false | 1 | 5 | 6 | 12 | 4 | 8 | null | null |
acowley/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | idHasRules :: Id -> Bool
idHasRules id = not (isEmptySpecInfo (idSpecialisation id)) | 84 | idHasRules :: Id -> Bool
idHasRules id = not (isEmptySpecInfo (idSpecialisation id)) | 84 | idHasRules id = not (isEmptySpecInfo (idSpecialisation id)) | 59 | false | true | 0 | 9 | 11 | 33 | 16 | 17 | null | null |
sgillespie/ghc | compiler/typecheck/TcBinds.hs | bsd-3-clause | tcHsBootSigs :: [(RecFlag, LHsBinds Name)] -> [LSig Name] -> TcM [Id]
-- A hs-boot file has only one BindGroup, and it only has type
-- signatures in it. The renamer checked all this
tcHsBootSigs binds sigs
= do { checkTc (null binds) badBootDeclErr
; concat <$> mapM (addLocM tc_boot_sig) (filter isTypeLSig sigs) }
where
tc_boot_sig (TypeSig lnames hs_ty) = mapM f lnames
where
f (L _ name)
= do { sigma_ty <- solveEqualities $
tcHsSigWcType (FunSigCtxt name False) hs_ty
; return (mkVanillaGlobal name sigma_ty) }
-- Notice that we make GlobalIds, not LocalIds
tc_boot_sig s = pprPanic "tcHsBootSigs/tc_boot_sig" (ppr s) | 721 | tcHsBootSigs :: [(RecFlag, LHsBinds Name)] -> [LSig Name] -> TcM [Id]
tcHsBootSigs binds sigs
= do { checkTc (null binds) badBootDeclErr
; concat <$> mapM (addLocM tc_boot_sig) (filter isTypeLSig sigs) }
where
tc_boot_sig (TypeSig lnames hs_ty) = mapM f lnames
where
f (L _ name)
= do { sigma_ty <- solveEqualities $
tcHsSigWcType (FunSigCtxt name False) hs_ty
; return (mkVanillaGlobal name sigma_ty) }
-- Notice that we make GlobalIds, not LocalIds
tc_boot_sig s = pprPanic "tcHsBootSigs/tc_boot_sig" (ppr s) | 607 | tcHsBootSigs binds sigs
= do { checkTc (null binds) badBootDeclErr
; concat <$> mapM (addLocM tc_boot_sig) (filter isTypeLSig sigs) }
where
tc_boot_sig (TypeSig lnames hs_ty) = mapM f lnames
where
f (L _ name)
= do { sigma_ty <- solveEqualities $
tcHsSigWcType (FunSigCtxt name False) hs_ty
; return (mkVanillaGlobal name sigma_ty) }
-- Notice that we make GlobalIds, not LocalIds
tc_boot_sig s = pprPanic "tcHsBootSigs/tc_boot_sig" (ppr s) | 537 | true | true | 4 | 11 | 197 | 207 | 98 | 109 | null | null |
JPMoresmau/leksah-server | src/IDE/HeaderParser.hs | gpl-2.0 | transformImport :: DynFlags -> LImportDecl RdrName -> ImportDecl
transformImport dflags (L srcSpan importDecl) =
ImportDecl {
importLoc = srcSpanToLocation srcSpan,
importModule = T.pack modName,
importQualified = ideclQualified importDecl,
importSrc = ideclSource importDecl,
importPkg = T.pack <$> pkgQual,
importAs = T.pack <$> impAs,
importSpecs = specs}
where
modName = moduleNameString $ unLoc $ ideclName importDecl
pkgQual = case ideclPkgQual importDecl of
Nothing -> Nothing
Just fs -> Just (unpackFS fs)
impAs = case ideclAs importDecl of
Nothing -> Nothing
Just mn -> Just (moduleNameString mn)
specs = case ideclHiding importDecl of
Nothing -> Nothing
Just (hide, list) -> Just (ImportSpecList hide (mapMaybe (transformEntity dflags) (unLoc710 list))) | 1,012 | transformImport :: DynFlags -> LImportDecl RdrName -> ImportDecl
transformImport dflags (L srcSpan importDecl) =
ImportDecl {
importLoc = srcSpanToLocation srcSpan,
importModule = T.pack modName,
importQualified = ideclQualified importDecl,
importSrc = ideclSource importDecl,
importPkg = T.pack <$> pkgQual,
importAs = T.pack <$> impAs,
importSpecs = specs}
where
modName = moduleNameString $ unLoc $ ideclName importDecl
pkgQual = case ideclPkgQual importDecl of
Nothing -> Nothing
Just fs -> Just (unpackFS fs)
impAs = case ideclAs importDecl of
Nothing -> Nothing
Just mn -> Just (moduleNameString mn)
specs = case ideclHiding importDecl of
Nothing -> Nothing
Just (hide, list) -> Just (ImportSpecList hide (mapMaybe (transformEntity dflags) (unLoc710 list))) | 1,012 | transformImport dflags (L srcSpan importDecl) =
ImportDecl {
importLoc = srcSpanToLocation srcSpan,
importModule = T.pack modName,
importQualified = ideclQualified importDecl,
importSrc = ideclSource importDecl,
importPkg = T.pack <$> pkgQual,
importAs = T.pack <$> impAs,
importSpecs = specs}
where
modName = moduleNameString $ unLoc $ ideclName importDecl
pkgQual = case ideclPkgQual importDecl of
Nothing -> Nothing
Just fs -> Just (unpackFS fs)
impAs = case ideclAs importDecl of
Nothing -> Nothing
Just mn -> Just (moduleNameString mn)
specs = case ideclHiding importDecl of
Nothing -> Nothing
Just (hide, list) -> Just (ImportSpecList hide (mapMaybe (transformEntity dflags) (unLoc710 list))) | 947 | false | true | 0 | 14 | 353 | 260 | 132 | 128 | null | null |
purcell/adventofcode2016 | src/Day15.hs | bsd-3-clause | partA discs =
take
1
[ t
| t <- [0 ..]
, all
(== 0)
[ pos + (t + t') `mod` size
| (Disc size pos, t') <- zip discs [1 ..] ] ] | 164 | partA discs =
take
1
[ t
| t <- [0 ..]
, all
(== 0)
[ pos + (t + t') `mod` size
| (Disc size pos, t') <- zip discs [1 ..] ] ] | 164 | partA discs =
take
1
[ t
| t <- [0 ..]
, all
(== 0)
[ pos + (t + t') `mod` size
| (Disc size pos, t') <- zip discs [1 ..] ] ] | 164 | false | false | 0 | 13 | 74 | 90 | 49 | 41 | null | null |
mcschroeder/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | parrDataCon :: DataCon
parrDataCon = pcDataCon
parrDataConName
alpha_tyvar -- forall'ed type variables
[intTy, -- 1st argument: Int
mkTyConApp -- 2nd argument: Array# a
arrayPrimTyCon
alpha_ty]
parrTyCon | 367 | parrDataCon :: DataCon
parrDataCon = pcDataCon
parrDataConName
alpha_tyvar -- forall'ed type variables
[intTy, -- 1st argument: Int
mkTyConApp -- 2nd argument: Array# a
arrayPrimTyCon
alpha_ty]
parrTyCon | 367 | parrDataCon = pcDataCon
parrDataConName
alpha_tyvar -- forall'ed type variables
[intTy, -- 1st argument: Int
mkTyConApp -- 2nd argument: Array# a
arrayPrimTyCon
alpha_ty]
parrTyCon | 344 | false | true | 0 | 6 | 189 | 44 | 20 | 24 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Html.hs | gpl-2.0 | startingState = SyntaxState {synStContexts = [("HTML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStContinuation = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} | 242 | startingState = SyntaxState {synStContexts = [("HTML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStContinuation = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} | 242 | startingState = SyntaxState {synStContexts = [("HTML","Start")], synStLineNumber = 0, synStPrevChar = '\n', synStPrevNonspace = False, synStContinuation = False, synStCaseSensitive = True, synStKeywordCaseSensitive = True, synStCaptures = []} | 242 | false | false | 0 | 8 | 26 | 67 | 43 | 24 | null | null |
wayofthepie/scar | src/Analysis/Java.hs | bsd-3-clause | getAnnotation :: Modifier -> Maybe Annotation
getAnnotation (Annotation a) = Just a | 83 | getAnnotation :: Modifier -> Maybe Annotation
getAnnotation (Annotation a) = Just a | 83 | getAnnotation (Annotation a) = Just a | 37 | false | true | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
purebred-mua/purebred | src/Purebred/UI/GatherHeaders/Keybindings.hs | agpl-3.0 | gatherFromKeybindings :: [Keybinding 'Threads 'ComposeFrom]
gatherFromKeybindings =
[ Keybinding (V.EvKey V.KEsc []) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey (V.KChar 'g') [V.MCtrl]) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey V.KEnter []) (noop `focus` continue @'Threads @'ComposeTo)
] | 364 | gatherFromKeybindings :: [Keybinding 'Threads 'ComposeFrom]
gatherFromKeybindings =
[ Keybinding (V.EvKey V.KEsc []) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey (V.KChar 'g') [V.MCtrl]) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey V.KEnter []) (noop `focus` continue @'Threads @'ComposeTo)
] | 364 | gatherFromKeybindings =
[ Keybinding (V.EvKey V.KEsc []) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey (V.KChar 'g') [V.MCtrl]) (abort `focus` continue @'Threads @'ListOfThreads)
, Keybinding (V.EvKey V.KEnter []) (noop `focus` continue @'Threads @'ComposeTo)
] | 304 | false | true | 0 | 11 | 54 | 164 | 86 | 78 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.