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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dsalisbury/xmobar
|
src/Window.hs
|
bsd-3-clause
|
drawBorder :: Border -> Int -> Display -> Drawable -> GC -> Pixel
-> Dimension -> Dimension -> IO ()
drawBorder b lw d p gc c wi ht = case b of
NoBorder -> return ()
TopB -> drawBorder (TopBM 0) lw d p gc c wi ht
BottomB -> drawBorder (BottomBM 0) lw d p gc c wi ht
FullB -> drawBorder (FullBM 0) lw d p gc c wi ht
TopBM m -> sf >> sla >>
drawLine d p gc 0 (fi m + boff) (fi wi) (fi m + boff)
BottomBM m -> let rw = fi ht - fi m + boff in
sf >> sla >> drawLine d p gc 0 rw (fi wi) rw
FullBM m -> let mp = fi m
pad = 2 * fi mp + fi lw
in sf >> sla >>
drawRectangle d p gc mp mp (wi - pad + 1) (ht - pad)
where sf = setForeground d gc c
sla = setLineAttributes d gc (fi lw) lineSolid capNotLast joinMiter
boff = borderOffset b lw
-- boff' = calcBorderOffset lw :: Int
| 936
|
drawBorder :: Border -> Int -> Display -> Drawable -> GC -> Pixel
-> Dimension -> Dimension -> IO ()
drawBorder b lw d p gc c wi ht = case b of
NoBorder -> return ()
TopB -> drawBorder (TopBM 0) lw d p gc c wi ht
BottomB -> drawBorder (BottomBM 0) lw d p gc c wi ht
FullB -> drawBorder (FullBM 0) lw d p gc c wi ht
TopBM m -> sf >> sla >>
drawLine d p gc 0 (fi m + boff) (fi wi) (fi m + boff)
BottomBM m -> let rw = fi ht - fi m + boff in
sf >> sla >> drawLine d p gc 0 rw (fi wi) rw
FullBM m -> let mp = fi m
pad = 2 * fi mp + fi lw
in sf >> sla >>
drawRectangle d p gc mp mp (wi - pad + 1) (ht - pad)
where sf = setForeground d gc c
sla = setLineAttributes d gc (fi lw) lineSolid capNotLast joinMiter
boff = borderOffset b lw
-- boff' = calcBorderOffset lw :: Int
| 936
|
drawBorder b lw d p gc c wi ht = case b of
NoBorder -> return ()
TopB -> drawBorder (TopBM 0) lw d p gc c wi ht
BottomB -> drawBorder (BottomBM 0) lw d p gc c wi ht
FullB -> drawBorder (FullBM 0) lw d p gc c wi ht
TopBM m -> sf >> sla >>
drawLine d p gc 0 (fi m + boff) (fi wi) (fi m + boff)
BottomBM m -> let rw = fi ht - fi m + boff in
sf >> sla >> drawLine d p gc 0 rw (fi wi) rw
FullBM m -> let mp = fi m
pad = 2 * fi mp + fi lw
in sf >> sla >>
drawRectangle d p gc mp mp (wi - pad + 1) (ht - pad)
where sf = setForeground d gc c
sla = setLineAttributes d gc (fi lw) lineSolid capNotLast joinMiter
boff = borderOffset b lw
-- boff' = calcBorderOffset lw :: Int
| 821
| false
| true
| 2
| 15
| 357
| 430
| 204
| 226
| null | null |
urbanslug/ghc
|
testsuite/tests/typecheck/should_compile/tc089.hs
|
bsd-3-clause
|
g_rec5 x y z p = (g_rec g_rec4 g_rec4 x y z p)
| 47
|
g_rec5 x y z p = (g_rec g_rec4 g_rec4 x y z p)
| 47
|
g_rec5 x y z p = (g_rec g_rec4 g_rec4 x y z p)
| 47
| false
| false
| 0
| 6
| 13
| 31
| 15
| 16
| null | null |
anton-k/language-css
|
src/Language/Css/Build/Tags.hs
|
bsd-3-clause
|
-- | @sup@ tag
sup :: Sel'
sup = ident "sup"
| 44
|
sup :: Sel'
sup = ident "sup"
| 29
|
sup = ident "sup"
| 17
| true
| true
| 0
| 6
| 10
| 22
| 9
| 13
| null | null |
ancientlanguage/haskell-analysis
|
grammar/src/Grammar/Common/Pretty.hs
|
mit
|
prettyMilestoned :: Show a => Milestone :* a -> Text
prettyMilestoned (m, x) = Text.intercalate " " $
[ prettyMilestone m
, "--"
, textShow $ x
]
| 153
|
prettyMilestoned :: Show a => Milestone :* a -> Text
prettyMilestoned (m, x) = Text.intercalate " " $
[ prettyMilestone m
, "--"
, textShow $ x
]
| 153
|
prettyMilestoned (m, x) = Text.intercalate " " $
[ prettyMilestone m
, "--"
, textShow $ x
]
| 100
| false
| true
| 0
| 7
| 35
| 60
| 31
| 29
| null | null |
simonmichael/fungen
|
Graphics/UI/Fungen/Game.hs
|
bsd-3-clause
|
pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v Bool
pointsObjectCollision p1X p1Y s1X s1Y o2 = do
asleep <- getObjectAsleep o2
if asleep
then (return False)
else do (p2X,p2Y) <- getObjectPosition o2
(s2X,s2Y) <- getObjectSize o2
let aX1 = p1X - (s1X/2)
aX2 = p1X + (s1X/2)
aY1 = p1Y - (s1Y/2)
aY2 = p1Y + (s1Y/2)
bX1 = p2X - (s2X/2)
bX2 = p2X + (s2X/2)
bY1 = p2Y - (s2Y/2)
bY2 = p2Y + (s2Y/2)
return ((bX1 < aX2) && (aX1 < bX2) && (bY1 < aY2) && (aY1 < bY2))
| 858
|
pointsObjectCollision :: GLdouble -> GLdouble -> GLdouble -> GLdouble -> GameObject s -> IOGame t s u v Bool
pointsObjectCollision p1X p1Y s1X s1Y o2 = do
asleep <- getObjectAsleep o2
if asleep
then (return False)
else do (p2X,p2Y) <- getObjectPosition o2
(s2X,s2Y) <- getObjectSize o2
let aX1 = p1X - (s1X/2)
aX2 = p1X + (s1X/2)
aY1 = p1Y - (s1Y/2)
aY2 = p1Y + (s1Y/2)
bX1 = p2X - (s2X/2)
bX2 = p2X + (s2X/2)
bY1 = p2Y - (s2Y/2)
bY2 = p2Y + (s2Y/2)
return ((bX1 < aX2) && (aX1 < bX2) && (bY1 < aY2) && (aY1 < bY2))
| 857
|
pointsObjectCollision p1X p1Y s1X s1Y o2 = do
asleep <- getObjectAsleep o2
if asleep
then (return False)
else do (p2X,p2Y) <- getObjectPosition o2
(s2X,s2Y) <- getObjectSize o2
let aX1 = p1X - (s1X/2)
aX2 = p1X + (s1X/2)
aY1 = p1Y - (s1Y/2)
aY2 = p1Y + (s1Y/2)
bX1 = p2X - (s2X/2)
bX2 = p2X + (s2X/2)
bY1 = p2Y - (s2Y/2)
bY2 = p2Y + (s2Y/2)
return ((bX1 < aX2) && (aX1 < bX2) && (bY1 < aY2) && (aY1 < bY2))
| 748
| false
| true
| 0
| 16
| 445
| 296
| 155
| 141
| null | null |
tkonolige/vector-clock
|
src/Data/VectorClock/Simple.hs
|
gpl-3.0
|
combine :: (Ord a, Ord b)
=> (a -> Maybe b -> Maybe b -> Maybe b)
-- ^ a function that takes the /key/, the value of the entry in
-- the left hand vector clock, if it exists, the value in the
-- right hand vector clock, if it exists, and, if it wishes to
-- keep a value for this /key/ in the resulting vector clock,
-- returns it.
-> VectorClock a b -- ^ /lhs/: the left hand vector clock
-> VectorClock a b -- ^ /rhs/: the right hand vector clock
-> VectorClock a b
combine f vc1 vc2 =
VectorClock { clock = catMaybes (go (clock vc1) (clock vc2)) }
where
go [] xys = map (\(x, y) -> (x ~^ f x Nothing (Just y))) xys
go xys [] = map (\(x, y) -> (x ~^ f x (Just y) Nothing)) xys
go (xy@(x, y) : xys) (xy'@(x', y') : xys')
| x < x' = (x ~^ f x (Just y) Nothing) : go xys (xy' : xys')
| x == x' = (x ~^ f x (Just y) (Just y')) : go xys xys'
| otherwise = (x' ~^ f x' Nothing (Just y')) : go (xy : xys) xys'
(~^) x v = v >>= return . (x,)
-- | /O(max(N, M))/. The maximum of the two vector clocks.
| 1,113
|
combine :: (Ord a, Ord b)
=> (a -> Maybe b -> Maybe b -> Maybe b)
-- ^ a function that takes the /key/, the value of the entry in
-- the left hand vector clock, if it exists, the value in the
-- right hand vector clock, if it exists, and, if it wishes to
-- keep a value for this /key/ in the resulting vector clock,
-- returns it.
-> VectorClock a b -- ^ /lhs/: the left hand vector clock
-> VectorClock a b -- ^ /rhs/: the right hand vector clock
-> VectorClock a b
combine f vc1 vc2 =
VectorClock { clock = catMaybes (go (clock vc1) (clock vc2)) }
where
go [] xys = map (\(x, y) -> (x ~^ f x Nothing (Just y))) xys
go xys [] = map (\(x, y) -> (x ~^ f x (Just y) Nothing)) xys
go (xy@(x, y) : xys) (xy'@(x', y') : xys')
| x < x' = (x ~^ f x (Just y) Nothing) : go xys (xy' : xys')
| x == x' = (x ~^ f x (Just y) (Just y')) : go xys xys'
| otherwise = (x' ~^ f x' Nothing (Just y')) : go (xy : xys) xys'
(~^) x v = v >>= return . (x,)
-- | /O(max(N, M))/. The maximum of the two vector clocks.
| 1,113
|
combine f vc1 vc2 =
VectorClock { clock = catMaybes (go (clock vc1) (clock vc2)) }
where
go [] xys = map (\(x, y) -> (x ~^ f x Nothing (Just y))) xys
go xys [] = map (\(x, y) -> (x ~^ f x (Just y) Nothing)) xys
go (xy@(x, y) : xys) (xy'@(x', y') : xys')
| x < x' = (x ~^ f x (Just y) Nothing) : go xys (xy' : xys')
| x == x' = (x ~^ f x (Just y) (Just y')) : go xys xys'
| otherwise = (x' ~^ f x' Nothing (Just y')) : go (xy : xys) xys'
(~^) x v = v >>= return . (x,)
-- | /O(max(N, M))/. The maximum of the two vector clocks.
| 583
| false
| true
| 7
| 17
| 347
| 435
| 225
| 210
| null | null |
brendanhay/gogol
|
gogol-monitoring/gen/Network/Google/Resource/Monitoring/Projects/UptimeCheckConfigs/Create.hs
|
mpl-2.0
|
-- | Creates a value of 'ProjectsUptimeCheckConfigsCreate' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'pucccParent'
--
-- * 'pucccXgafv'
--
-- * 'pucccUploadProtocol'
--
-- * 'pucccAccessToken'
--
-- * 'pucccUploadType'
--
-- * 'pucccPayload'
--
-- * 'pucccCallback'
projectsUptimeCheckConfigsCreate
:: Text -- ^ 'pucccParent'
-> UptimeCheckConfig -- ^ 'pucccPayload'
-> ProjectsUptimeCheckConfigsCreate
projectsUptimeCheckConfigsCreate pPucccParent_ pPucccPayload_ =
ProjectsUptimeCheckConfigsCreate'
{ _pucccParent = pPucccParent_
, _pucccXgafv = Nothing
, _pucccUploadProtocol = Nothing
, _pucccAccessToken = Nothing
, _pucccUploadType = Nothing
, _pucccPayload = pPucccPayload_
, _pucccCallback = Nothing
}
| 846
|
projectsUptimeCheckConfigsCreate
:: Text -- ^ 'pucccParent'
-> UptimeCheckConfig -- ^ 'pucccPayload'
-> ProjectsUptimeCheckConfigsCreate
projectsUptimeCheckConfigsCreate pPucccParent_ pPucccPayload_ =
ProjectsUptimeCheckConfigsCreate'
{ _pucccParent = pPucccParent_
, _pucccXgafv = Nothing
, _pucccUploadProtocol = Nothing
, _pucccAccessToken = Nothing
, _pucccUploadType = Nothing
, _pucccPayload = pPucccPayload_
, _pucccCallback = Nothing
}
| 489
|
projectsUptimeCheckConfigsCreate pPucccParent_ pPucccPayload_ =
ProjectsUptimeCheckConfigsCreate'
{ _pucccParent = pPucccParent_
, _pucccXgafv = Nothing
, _pucccUploadProtocol = Nothing
, _pucccAccessToken = Nothing
, _pucccUploadType = Nothing
, _pucccPayload = pPucccPayload_
, _pucccCallback = Nothing
}
| 340
| true
| true
| 0
| 8
| 150
| 96
| 62
| 34
| null | null |
da-x/lamdu
|
test/InferTests.hs
|
gpl-3.0
|
mapIdTest =
testInfer "map id (5:_)" $
glob [intType, intType] "map" $$:
[ glob [intType] ":" $$:
[ literalInteger 5
, holeWithInferredType $ listOf intType
]
, glob [intType] "id"
]
| 226
|
mapIdTest =
testInfer "map id (5:_)" $
glob [intType, intType] "map" $$:
[ glob [intType] ":" $$:
[ literalInteger 5
, holeWithInferredType $ listOf intType
]
, glob [intType] "id"
]
| 226
|
mapIdTest =
testInfer "map id (5:_)" $
glob [intType, intType] "map" $$:
[ glob [intType] ":" $$:
[ literalInteger 5
, holeWithInferredType $ listOf intType
]
, glob [intType] "id"
]
| 226
| false
| false
| 0
| 10
| 74
| 70
| 36
| 34
| null | null |
green-haskell/ghc
|
compiler/coreSyn/CoreUnfold.hs
|
bsd-3-clause
|
mkWorkerUnfolding _ _ _ = noUnfolding
| 37
|
mkWorkerUnfolding _ _ _ = noUnfolding
| 37
|
mkWorkerUnfolding _ _ _ = noUnfolding
| 37
| false
| false
| 1
| 5
| 5
| 14
| 5
| 9
| null | null |
cryptica/slapnet
|
src/Printer/SPEC.hs
|
gpl-3.0
|
renderConjunction (p :&: q) = renderConjunction p <> ", " <> renderConjunction q
| 80
|
renderConjunction (p :&: q) = renderConjunction p <> ", " <> renderConjunction q
| 80
|
renderConjunction (p :&: q) = renderConjunction p <> ", " <> renderConjunction q
| 80
| false
| false
| 0
| 7
| 12
| 30
| 14
| 16
| null | null |
ezyang/ghc
|
compiler/hsSyn/HsExpr.hs
|
bsd-3-clause
|
pprGRHS ctxt (GRHS guards body)
= sep [vbar <+> interpp'SP guards, pp_rhs ctxt body]
| 85
|
pprGRHS ctxt (GRHS guards body)
= sep [vbar <+> interpp'SP guards, pp_rhs ctxt body]
| 85
|
pprGRHS ctxt (GRHS guards body)
= sep [vbar <+> interpp'SP guards, pp_rhs ctxt body]
| 85
| false
| false
| 0
| 7
| 14
| 41
| 19
| 22
| null | null |
nevrenato/HetsAlloy
|
OMDoc/XmlInterface.hs
|
gpl-2.0
|
at_role = toQN "role"
| 21
|
at_role = toQN "role"
| 21
|
at_role = toQN "role"
| 21
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
dsorokin/aivika-lattice
|
tests/TraversingLattice4.hs
|
bsd-3-clause
|
main :: IO ()
main =
do lat <- newRandomLattice 4
runLIO lat $
runSimulation model specs
| 102
|
main :: IO ()
main =
do lat <- newRandomLattice 4
runLIO lat $
runSimulation model specs
| 102
|
main =
do lat <- newRandomLattice 4
runLIO lat $
runSimulation model specs
| 88
| false
| true
| 0
| 9
| 30
| 47
| 19
| 28
| null | null |
haskell-distributed/distributed-process-platform
|
tests/TestAsync.hs
|
bsd-3-clause
|
testAsyncLinked :: TestResult Bool -> Process ()
testAsyncLinked result = do
mv :: MVar (Async ()) <- liftIO $ newEmptyMVar
pid <- spawnLocal $ do
-- NB: async == asyncLinked for AsyncChan
h <- asyncLinked $ do
"waiting" <- expect
return ()
stash mv h
"sleeping" <- expect
return ()
hAsync <- liftIO $ takeMVar mv
mref <- monitor $ asyncWorker hAsync
exit pid "stop"
_ <- receiveTimeout (after 5 Seconds) [
matchIf (\(ProcessMonitorNotification mref' _ _) -> mref == mref')
(\_ -> return ())
]
-- since the initial caller died and we used 'asyncLinked', the async should
-- pick up on the exit signal and set the result accordingly. trying to match
-- on 'DiedException String' is pointless though, as the *string* is highly
-- context dependent.
r <- waitTimeout (within 3 Seconds) hAsync
case r of
Nothing -> stash result True
Just _ -> stash result False
| 1,038
|
testAsyncLinked :: TestResult Bool -> Process ()
testAsyncLinked result = do
mv :: MVar (Async ()) <- liftIO $ newEmptyMVar
pid <- spawnLocal $ do
-- NB: async == asyncLinked for AsyncChan
h <- asyncLinked $ do
"waiting" <- expect
return ()
stash mv h
"sleeping" <- expect
return ()
hAsync <- liftIO $ takeMVar mv
mref <- monitor $ asyncWorker hAsync
exit pid "stop"
_ <- receiveTimeout (after 5 Seconds) [
matchIf (\(ProcessMonitorNotification mref' _ _) -> mref == mref')
(\_ -> return ())
]
-- since the initial caller died and we used 'asyncLinked', the async should
-- pick up on the exit signal and set the result accordingly. trying to match
-- on 'DiedException String' is pointless though, as the *string* is highly
-- context dependent.
r <- waitTimeout (within 3 Seconds) hAsync
case r of
Nothing -> stash result True
Just _ -> stash result False
| 1,038
|
testAsyncLinked result = do
mv :: MVar (Async ()) <- liftIO $ newEmptyMVar
pid <- spawnLocal $ do
-- NB: async == asyncLinked for AsyncChan
h <- asyncLinked $ do
"waiting" <- expect
return ()
stash mv h
"sleeping" <- expect
return ()
hAsync <- liftIO $ takeMVar mv
mref <- monitor $ asyncWorker hAsync
exit pid "stop"
_ <- receiveTimeout (after 5 Seconds) [
matchIf (\(ProcessMonitorNotification mref' _ _) -> mref == mref')
(\_ -> return ())
]
-- since the initial caller died and we used 'asyncLinked', the async should
-- pick up on the exit signal and set the result accordingly. trying to match
-- on 'DiedException String' is pointless though, as the *string* is highly
-- context dependent.
r <- waitTimeout (within 3 Seconds) hAsync
case r of
Nothing -> stash result True
Just _ -> stash result False
| 989
| false
| true
| 0
| 16
| 330
| 268
| 124
| 144
| null | null |
spl/dlist
|
tests/DListProperties.hs
|
bsd-3-clause
|
prop_tail :: [Int] -> Property
prop_tail = eqOn (not . null) List.tail (tail . fromList)
| 88
|
prop_tail :: [Int] -> Property
prop_tail = eqOn (not . null) List.tail (tail . fromList)
| 88
|
prop_tail = eqOn (not . null) List.tail (tail . fromList)
| 57
| false
| true
| 0
| 7
| 14
| 41
| 22
| 19
| null | null |
supki/envparse
|
test/EnvSpec.hs
|
bsd-2-clause
|
spec :: Spec
spec =
describe "parsing" $ do
it "parsing the environment with the noop parser always succeeds" $
p (pure ()) `shouldBe` Just ()
it "parsing the environment with the failing parser always fails" $
p Control.Applicative.empty `shouldBe` Nothing
it "looking for the non-existing env var fails" $
p (var str "xyzzy" mempty) `shouldBe` Nothing
it "looking for the existing env var is a success" $
p (var str "foo" mempty) `shouldBe` Just "bar"
it "looking for many existing env vars is a success" $ do
let x = (,) <$> var str "foo" mempty <*> var str "qux" mempty
p x `shouldBe` Just ("bar", "quux")
it "looking for the existing env var selects the active flag value" $
p (flag 4 7 "foo" mempty) `shouldBe` Just 7
it "looking for the existing but empty env var selects the default flag value" $
p (flag 4 7 "empty" mempty) `shouldBe` Just 4
it "looking for the non-existing env var selects the default flag value" $
p (flag 4 7 "xyzzy" mempty) `shouldBe` Just 4
context "readers" $ do
it "can use a reader to parse the env var value" $
p (var auto "num" mempty) `shouldBe` Just 4
it "can use a custom reader" $ do
p (var greaterThan5 "num" mempty) `shouldBe` Nothing
p (var greaterThan5 "num2" mempty) `shouldBe` Just 7
it "'nonempty' weeds out variables set to the empty string" $
p (var (str <=< nonempty) "empty" mempty) `shouldBe` Nothing
context "var has a default value" $
context "malformed value is passed by the user" $
it "fails to parse" $
p (var auto "foo" (def 4)) `shouldBe` (Nothing :: Maybe Int)
context "alternatives" $ do
it "can look through a list of alternatives" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" mempty
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 3
it "variables can have default values" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" (def 4)
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 4
context "modifiers" $ do
it "the latter modifier overwrites the former" $
p (var (\_ -> Left (unread "nope")) "never" (def 4 <> def 7)) `shouldBe` Just 7
it "‘prefixed’ modifier changes the names of the variables" $
p (prefixed "spec_" (var str "foo" mempty)) `shouldBe` Just "totally-not-bar"
it "‘prefixed’ modifier can be nested" $
p (prefixed "pre" (prefixed "pro" (var str "morphism" mempty)))
`shouldBe`
Just "zygohistomorphic"
#if __GLASGOW_HASKELL__ >= 708
it "does not unset parsed variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b"))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "7"
context "some variables are marked as sensitive" $ do
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Nothing
context "parsing fails" $
it "does not unset any variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "bar"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldThrow` anyException
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "bar"
context "unsetting multiple variables" $
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (sensitive (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Nothing
lookupEnv "BAR" `shouldReturn` Nothing
#endif
context "#18" $
it "behaves reasonably" $ do
let parser = var (fmap Just . auto) "FOO" (def Nothing) :: Parser Error (Maybe Int)
parsePure parser [("FOO", "4")] `shouldBe` Right (Just 4)
parsePure parser [("FOO", "str")] `shouldBe` Left [("FOO", UnreadError "\"str\"")]
parsePure parser [] `shouldBe` Right Nothing
| 4,559
|
spec :: Spec
spec =
describe "parsing" $ do
it "parsing the environment with the noop parser always succeeds" $
p (pure ()) `shouldBe` Just ()
it "parsing the environment with the failing parser always fails" $
p Control.Applicative.empty `shouldBe` Nothing
it "looking for the non-existing env var fails" $
p (var str "xyzzy" mempty) `shouldBe` Nothing
it "looking for the existing env var is a success" $
p (var str "foo" mempty) `shouldBe` Just "bar"
it "looking for many existing env vars is a success" $ do
let x = (,) <$> var str "foo" mempty <*> var str "qux" mempty
p x `shouldBe` Just ("bar", "quux")
it "looking for the existing env var selects the active flag value" $
p (flag 4 7 "foo" mempty) `shouldBe` Just 7
it "looking for the existing but empty env var selects the default flag value" $
p (flag 4 7 "empty" mempty) `shouldBe` Just 4
it "looking for the non-existing env var selects the default flag value" $
p (flag 4 7 "xyzzy" mempty) `shouldBe` Just 4
context "readers" $ do
it "can use a reader to parse the env var value" $
p (var auto "num" mempty) `shouldBe` Just 4
it "can use a custom reader" $ do
p (var greaterThan5 "num" mempty) `shouldBe` Nothing
p (var greaterThan5 "num2" mempty) `shouldBe` Just 7
it "'nonempty' weeds out variables set to the empty string" $
p (var (str <=< nonempty) "empty" mempty) `shouldBe` Nothing
context "var has a default value" $
context "malformed value is passed by the user" $
it "fails to parse" $
p (var auto "foo" (def 4)) `shouldBe` (Nothing :: Maybe Int)
context "alternatives" $ do
it "can look through a list of alternatives" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" mempty
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 3
it "variables can have default values" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" (def 4)
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 4
context "modifiers" $ do
it "the latter modifier overwrites the former" $
p (var (\_ -> Left (unread "nope")) "never" (def 4 <> def 7)) `shouldBe` Just 7
it "‘prefixed’ modifier changes the names of the variables" $
p (prefixed "spec_" (var str "foo" mempty)) `shouldBe` Just "totally-not-bar"
it "‘prefixed’ modifier can be nested" $
p (prefixed "pre" (prefixed "pro" (var str "morphism" mempty)))
`shouldBe`
Just "zygohistomorphic"
#if __GLASGOW_HASKELL__ >= 708
it "does not unset parsed variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b"))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "7"
context "some variables are marked as sensitive" $ do
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Nothing
context "parsing fails" $
it "does not unset any variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "bar"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldThrow` anyException
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "bar"
context "unsetting multiple variables" $
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (sensitive (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Nothing
lookupEnv "BAR" `shouldReturn` Nothing
#endif
context "#18" $
it "behaves reasonably" $ do
let parser = var (fmap Just . auto) "FOO" (def Nothing) :: Parser Error (Maybe Int)
parsePure parser [("FOO", "4")] `shouldBe` Right (Just 4)
parsePure parser [("FOO", "str")] `shouldBe` Left [("FOO", UnreadError "\"str\"")]
parsePure parser [] `shouldBe` Right Nothing
| 4,559
|
spec =
describe "parsing" $ do
it "parsing the environment with the noop parser always succeeds" $
p (pure ()) `shouldBe` Just ()
it "parsing the environment with the failing parser always fails" $
p Control.Applicative.empty `shouldBe` Nothing
it "looking for the non-existing env var fails" $
p (var str "xyzzy" mempty) `shouldBe` Nothing
it "looking for the existing env var is a success" $
p (var str "foo" mempty) `shouldBe` Just "bar"
it "looking for many existing env vars is a success" $ do
let x = (,) <$> var str "foo" mempty <*> var str "qux" mempty
p x `shouldBe` Just ("bar", "quux")
it "looking for the existing env var selects the active flag value" $
p (flag 4 7 "foo" mempty) `shouldBe` Just 7
it "looking for the existing but empty env var selects the default flag value" $
p (flag 4 7 "empty" mempty) `shouldBe` Just 4
it "looking for the non-existing env var selects the default flag value" $
p (flag 4 7 "xyzzy" mempty) `shouldBe` Just 4
context "readers" $ do
it "can use a reader to parse the env var value" $
p (var auto "num" mempty) `shouldBe` Just 4
it "can use a custom reader" $ do
p (var greaterThan5 "num" mempty) `shouldBe` Nothing
p (var greaterThan5 "num2" mempty) `shouldBe` Just 7
it "'nonempty' weeds out variables set to the empty string" $
p (var (str <=< nonempty) "empty" mempty) `shouldBe` Nothing
context "var has a default value" $
context "malformed value is passed by the user" $
it "fails to parse" $
p (var auto "foo" (def 4)) `shouldBe` (Nothing :: Maybe Int)
context "alternatives" $ do
it "can look through a list of alternatives" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" mempty
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 3
it "variables can have default values" $
p (asum
[ var (\_ -> pure 1) "nope" mempty
, var (\_ -> pure 2) "still-nope" (def 4)
, var (\_ -> pure 3) "yep" mempty
]) `shouldBe` Just 4
context "modifiers" $ do
it "the latter modifier overwrites the former" $
p (var (\_ -> Left (unread "nope")) "never" (def 4 <> def 7)) `shouldBe` Just 7
it "‘prefixed’ modifier changes the names of the variables" $
p (prefixed "spec_" (var str "foo" mempty)) `shouldBe` Just "totally-not-bar"
it "‘prefixed’ modifier can be nested" $
p (prefixed "pre" (prefixed "pro" (var str "morphism" mempty)))
`shouldBe`
Just "zygohistomorphic"
#if __GLASGOW_HASKELL__ >= 708
it "does not unset parsed variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b"))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "7"
context "some variables are marked as sensitive" $ do
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Nothing
context "parsing fails" $
it "does not unset any variables" $ do
setEnv "FOO" "4"
setEnv "BAR" "bar"
parse (header "hi") (liftA2 (+) (var auto "FOO" (help "a")) (sensitive (var auto "BAR" (help "b")))) `shouldThrow` anyException
lookupEnv "FOO" `shouldReturn` Just "4"
lookupEnv "BAR" `shouldReturn` Just "bar"
context "unsetting multiple variables" $
it "unsets them" $ do
setEnv "FOO" "4"
setEnv "BAR" "7"
parse (header "hi") (sensitive (liftA2 (+) (var auto "FOO" (help "a")) (var auto "BAR" (help "b")))) `shouldReturn` (11 :: Int)
lookupEnv "FOO" `shouldReturn` Nothing
lookupEnv "BAR" `shouldReturn` Nothing
#endif
context "#18" $
it "behaves reasonably" $ do
let parser = var (fmap Just . auto) "FOO" (def Nothing) :: Parser Error (Maybe Int)
parsePure parser [("FOO", "4")] `shouldBe` Right (Just 4)
parsePure parser [("FOO", "str")] `shouldBe` Left [("FOO", UnreadError "\"str\"")]
parsePure parser [] `shouldBe` Right Nothing
| 4,546
| false
| true
| 2
| 22
| 1,309
| 1,544
| 745
| 799
| null | null |
jbracker/supermonad-plugin
|
examples/monad/hmtc/original/PPTAMCode.hs
|
bsd-3-clause
|
ppTAMInst (LOADLB m n) = ppOA "LOADLB" (show m ++ " " ++ show n)
| 66
|
ppTAMInst (LOADLB m n) = ppOA "LOADLB" (show m ++ " " ++ show n)
| 66
|
ppTAMInst (LOADLB m n) = ppOA "LOADLB" (show m ++ " " ++ show n)
| 66
| false
| false
| 0
| 9
| 16
| 39
| 18
| 21
| null | null |
hjwylde/omnifmt
|
src/Omnifmt/Pipes.hs
|
bsd-3-clause
|
ommit :: MonadIO m => Pipe (Status, FilePath, FilePath) (Status, FilePath, FilePath) m ()
commit = select [Ugly] $ \(_, uglyFilePath, prettyFilePath) -> do
-- Try move the file, but if it's across a filesystem boundary then we may need to copy instead
liftIO $ renameFile prettyFilePath uglyFilePath `catchIOError` \e ->
if ioeGetErrorType e == UnsupportedOperation
then copyFile prettyFilePath uglyFilePath >> removeFile prettyFilePath
else ioError e
return (Prettified, uglyFilePath, prettyFilePath)
-- | Prints out the diff of all ugly files to standard output.
| 611
|
commit :: MonadIO m => Pipe (Status, FilePath, FilePath) (Status, FilePath, FilePath) m ()
commit = select [Ugly] $ \(_, uglyFilePath, prettyFilePath) -> do
-- Try move the file, but if it's across a filesystem boundary then we may need to copy instead
liftIO $ renameFile prettyFilePath uglyFilePath `catchIOError` \e ->
if ioeGetErrorType e == UnsupportedOperation
then copyFile prettyFilePath uglyFilePath >> removeFile prettyFilePath
else ioError e
return (Prettified, uglyFilePath, prettyFilePath)
-- | Prints out the diff of all ugly files to standard output.
| 611
|
commit = select [Ugly] $ \(_, uglyFilePath, prettyFilePath) -> do
-- Try move the file, but if it's across a filesystem boundary then we may need to copy instead
liftIO $ renameFile prettyFilePath uglyFilePath `catchIOError` \e ->
if ioeGetErrorType e == UnsupportedOperation
then copyFile prettyFilePath uglyFilePath >> removeFile prettyFilePath
else ioError e
return (Prettified, uglyFilePath, prettyFilePath)
-- | Prints out the diff of all ugly files to standard output.
| 520
| false
| true
| 2
| 11
| 129
| 148
| 77
| 71
| null | null |
CindyLinz/Haskell-HVG
|
src/HVG/Context2D.hs
|
bsd-3-clause
|
beginPath :: IO ()
beginPath = putStrLn "ctx.beginPath();"
| 58
|
beginPath :: IO ()
beginPath = putStrLn "ctx.beginPath();"
| 58
|
beginPath = putStrLn "ctx.beginPath();"
| 39
| false
| true
| 0
| 7
| 7
| 25
| 10
| 15
| null | null |
fmapfmapfmap/amazonka
|
amazonka-iam/gen/Network/AWS/IAM/ListAttachedRolePolicies.hs
|
mpl-2.0
|
-- | The name (friendly name, not ARN) of the role to list attached policies
-- for.
larpRoleName :: Lens' ListAttachedRolePolicies Text
larpRoleName = lens _larpRoleName (\ s a -> s{_larpRoleName = a})
| 202
|
larpRoleName :: Lens' ListAttachedRolePolicies Text
larpRoleName = lens _larpRoleName (\ s a -> s{_larpRoleName = a})
| 117
|
larpRoleName = lens _larpRoleName (\ s a -> s{_larpRoleName = a})
| 65
| true
| true
| 0
| 9
| 32
| 41
| 23
| 18
| null | null |
fmapfmapfmap/amazonka
|
amazonka-datapipeline/gen/Network/AWS/DataPipeline/ReportTaskProgress.hs
|
mpl-2.0
|
-- | The response status code.
rtprsResponseStatus :: Lens' ReportTaskProgressResponse Int
rtprsResponseStatus = lens _rtprsResponseStatus (\ s a -> s{_rtprsResponseStatus = a})
| 177
|
rtprsResponseStatus :: Lens' ReportTaskProgressResponse Int
rtprsResponseStatus = lens _rtprsResponseStatus (\ s a -> s{_rtprsResponseStatus = a})
| 146
|
rtprsResponseStatus = lens _rtprsResponseStatus (\ s a -> s{_rtprsResponseStatus = a})
| 86
| true
| true
| 0
| 9
| 21
| 40
| 22
| 18
| null | null |
uuhan/Idris-dev
|
src/IRTS/CodegenC.hs
|
bsd-3-clause
|
hasCallback :: BC -> [(FDesc, Reg)]
hasCallback (FOREIGNCALL l rty (FStr fn) args) = filter isFn args
where
isFn (desc,_) = case toFType desc of
FFunction -> True
FFunctionIO -> True
_ -> False
| 289
|
hasCallback :: BC -> [(FDesc, Reg)]
hasCallback (FOREIGNCALL l rty (FStr fn) args) = filter isFn args
where
isFn (desc,_) = case toFType desc of
FFunction -> True
FFunctionIO -> True
_ -> False
| 289
|
hasCallback (FOREIGNCALL l rty (FStr fn) args) = filter isFn args
where
isFn (desc,_) = case toFType desc of
FFunction -> True
FFunctionIO -> True
_ -> False
| 253
| false
| true
| 0
| 9
| 129
| 92
| 47
| 45
| null | null |
nevrenato/Hets_Fork
|
Common/Lib/Pretty.hs
|
gpl-2.0
|
nonEmptySet :: Doc -> Bool
nonEmptySet NoDoc = False
| 62
|
nonEmptySet :: Doc -> Bool
nonEmptySet NoDoc = False
| 62
|
nonEmptySet NoDoc = False
| 35
| false
| true
| 0
| 5
| 18
| 18
| 9
| 9
| null | null |
damianfral/clay
|
src/Clay/Text.hs
|
bsd-3-clause
|
fullWidth = TextTransform "full-width"
| 39
|
fullWidth = TextTransform "full-width"
| 39
|
fullWidth = TextTransform "full-width"
| 39
| false
| false
| 0
| 5
| 4
| 9
| 4
| 5
| null | null |
mikeplus64/Level-0
|
src/Logic.hs
|
gpl-3.0
|
getFileName :: Surface -> Font -> World -> IO (Maybe String)
getFileName surface font world = getStringAndDo $ \s -> do
drawWorld surface font world
drawText surface font "Filename: " (-h2 + 8) (-110)
unless (null s) $ void $ drawText surface font s (-h2 + 8) 30
SDL.flip surface
| 297
|
getFileName :: Surface -> Font -> World -> IO (Maybe String)
getFileName surface font world = getStringAndDo $ \s -> do
drawWorld surface font world
drawText surface font "Filename: " (-h2 + 8) (-110)
unless (null s) $ void $ drawText surface font s (-h2 + 8) 30
SDL.flip surface
| 297
|
getFileName surface font world = getStringAndDo $ \s -> do
drawWorld surface font world
drawText surface font "Filename: " (-h2 + 8) (-110)
unless (null s) $ void $ drawText surface font s (-h2 + 8) 30
SDL.flip surface
| 236
| false
| true
| 0
| 13
| 67
| 134
| 64
| 70
| null | null |
olsner/ghc
|
compiler/nativeGen/SPARC/CodeGen/Gen32.hs
|
bsd-3-clause
|
condIntReg EQQ x y = do
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
let
code__2 dst = code1 `appOL` code2 `appOL` toOL [
XOR False src1 (RIReg src2) dst,
SUB False True g0 (RIReg dst) g0,
SUB True False g0 (RIImm (ImmInt (-1))) dst]
return (Any II32 code__2)
| 334
|
condIntReg EQQ x y = do
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
let
code__2 dst = code1 `appOL` code2 `appOL` toOL [
XOR False src1 (RIReg src2) dst,
SUB False True g0 (RIReg dst) g0,
SUB True False g0 (RIImm (ImmInt (-1))) dst]
return (Any II32 code__2)
| 334
|
condIntReg EQQ x y = do
(src1, code1) <- getSomeReg x
(src2, code2) <- getSomeReg y
let
code__2 dst = code1 `appOL` code2 `appOL` toOL [
XOR False src1 (RIReg src2) dst,
SUB False True g0 (RIReg dst) g0,
SUB True False g0 (RIImm (ImmInt (-1))) dst]
return (Any II32 code__2)
| 334
| false
| false
| 0
| 19
| 110
| 155
| 77
| 78
| null | null |
mbelicki/valdemar
|
src/CodeGenerator.hs
|
gpl-3.0
|
fmul :: LLVM.Operand -> LLVM.Operand -> CodeGenerator LLVM.Operand
fmul a b = instruction $ LLVM.FMul LLVM.NoFastMathFlags a b []
| 129
|
fmul :: LLVM.Operand -> LLVM.Operand -> CodeGenerator LLVM.Operand
fmul a b = instruction $ LLVM.FMul LLVM.NoFastMathFlags a b []
| 129
|
fmul a b = instruction $ LLVM.FMul LLVM.NoFastMathFlags a b []
| 62
| false
| true
| 2
| 9
| 18
| 57
| 26
| 31
| null | null |
QuickChick/Luck
|
luck/src/Core/Optimizations.hs
|
mit
|
removeExtra (Fresh x en e) p = Fresh x (removeExtra en p) (removeExtra e p)
| 75
|
removeExtra (Fresh x en e) p = Fresh x (removeExtra en p) (removeExtra e p)
| 75
|
removeExtra (Fresh x en e) p = Fresh x (removeExtra en p) (removeExtra e p)
| 75
| false
| false
| 0
| 7
| 14
| 44
| 21
| 23
| null | null |
kadena-io/pact
|
src/Pact/Types/Pretty.hs
|
bsd-3-clause
|
commaBraces, commaBrackets, bracketsSep, parensSep, bracesSep :: [Doc] -> Doc
commaBraces = encloseSep "{" "}" ","
| 116
|
commaBraces, commaBrackets, bracketsSep, parensSep, bracesSep :: [Doc] -> Doc
commaBraces = encloseSep "{" "}" ","
| 116
|
commaBraces = encloseSep "{" "}" ","
| 38
| false
| true
| 3
| 6
| 16
| 40
| 21
| 19
| null | null |
tych0/hquery
|
tests/UtilsTests.hs
|
mit
|
mkDiv :: [Node] -> Node
mkDiv = elt "div" []
| 44
|
mkDiv :: [Node] -> Node
mkDiv = elt "div" []
| 44
|
mkDiv = elt "div" []
| 20
| false
| true
| 0
| 7
| 9
| 33
| 14
| 19
| null | null |
imh/plover
|
src/Language/Plover/Reduce.hs
|
mit
|
joinNum t1 t2 = error $ "joinNum: can't join non numeric types: " ++ sep t1 t2
| 78
|
joinNum t1 t2 = error $ "joinNum: can't join non numeric types: " ++ sep t1 t2
| 78
|
joinNum t1 t2 = error $ "joinNum: can't join non numeric types: " ++ sep t1 t2
| 78
| false
| false
| 3
| 6
| 16
| 29
| 11
| 18
| null | null |
fmapfmapfmap/amazonka
|
amazonka-sns/gen/Network/AWS/SNS/ListSubscriptionsByTopic.hs
|
mpl-2.0
|
-- | The response status code.
lsbtrsResponseStatus :: Lens' ListSubscriptionsByTopicResponse Int
lsbtrsResponseStatus = lens _lsbtrsResponseStatus (\ s a -> s{_lsbtrsResponseStatus = a})
| 187
|
lsbtrsResponseStatus :: Lens' ListSubscriptionsByTopicResponse Int
lsbtrsResponseStatus = lens _lsbtrsResponseStatus (\ s a -> s{_lsbtrsResponseStatus = a})
| 156
|
lsbtrsResponseStatus = lens _lsbtrsResponseStatus (\ s a -> s{_lsbtrsResponseStatus = a})
| 89
| true
| true
| 0
| 9
| 21
| 40
| 22
| 18
| null | null |
leepike/SmartCheck
|
examples/RedBlackTrees/RedBlackSetTest.hs
|
bsd-3-clause
|
-- Check for the validity of a red-black tree:
prop_RBValid :: RBSet Int -> Bool
prop_RBValid t = prop_NoRedRed t && prop_BlackBalanced t && prop_Ordered t
| 155
|
prop_RBValid :: RBSet Int -> Bool
prop_RBValid t = prop_NoRedRed t && prop_BlackBalanced t && prop_Ordered t
| 108
|
prop_RBValid t = prop_NoRedRed t && prop_BlackBalanced t && prop_Ordered t
| 74
| true
| true
| 2
| 7
| 25
| 45
| 19
| 26
| null | null |
olsner/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
mkCastTy :: Type -> Coercion -> Type
-- Running example:
-- T :: forall k1. k1 -> forall k2. k2 -> Bool -> Maybe k1 -> *
-- co :: * ~R X (maybe X is a newtype around *)
-- ty = T Nat 3 Symbol "foo" True (Just 2)
--
-- We wish to "push" the cast down as far as possible. See also
-- Note [Pushing down casts] in TyCoRep. Here is where we end
-- up:
--
-- (T Nat 3 Symbol |> <Symbol> -> <Bool> -> <Maybe Nat> -> co)
-- "foo" True (Just 2)
--
mkCastTy ty co | isReflexiveCo co = ty
| 494
|
mkCastTy :: Type -> Coercion -> Type
mkCastTy ty co | isReflexiveCo co = ty
| 75
|
mkCastTy ty co | isReflexiveCo co = ty
| 38
| true
| true
| 0
| 8
| 124
| 45
| 27
| 18
| null | null |
coreyoconnor/bind-marshal
|
test/verify_seraction_storable.hs
|
bsd-3-clause
|
main = run_test $ do
returnM () :: Test ()
| 46
|
main = run_test $ do
returnM () :: Test ()
| 46
|
main = run_test $ do
returnM () :: Test ()
| 46
| false
| false
| 0
| 9
| 13
| 26
| 12
| 14
| null | null |
haslab/SecreC
|
src/Language/SecreC/Prover/Base.hs
|
gpl-3.0
|
iLitTy (IBool _) = BaseT $ TyPrim $ DatatypeBool ()
| 51
|
iLitTy (IBool _) = BaseT $ TyPrim $ DatatypeBool ()
| 51
|
iLitTy (IBool _) = BaseT $ TyPrim $ DatatypeBool ()
| 51
| false
| false
| 0
| 7
| 9
| 29
| 13
| 16
| null | null |
eklavya/Idris-dev
|
src/Idris/Core/ProofTerm.hs
|
bsd-3-clause
|
updsubst :: Eq n => n {-^ The id to replace -} ->
TT n {-^ The replacement term -} ->
TT n {-^ The term to replace in -} ->
TT n
-- subst n v tm = instantiate v (pToV n tm)
updsubst n v tm = fst $ subst' 0 tm
where
-- keep track of updates to save allocations - this is a big win on
-- large terms in particular
-- ('Maybe' would be neater here, but >>= is not the right combinator.
-- Feel free to tidy up, as long as it still saves allocating when no
-- substitution happens...)
subst' i (V x) | i == x = (v, True)
subst' i (P _ x _) | n == x = (v, True)
subst' i t@(P nt x ty)
= let (ty', ut) = subst' i ty in
if ut then (P nt x ty', True) else (t, False)
subst' i t@(Bind x b sc) | x /= n
= let (b', ub) = substB' i b
(sc', usc) = subst' (i+1) sc in
if ub || usc then (Bind x b' sc', True) else (t, False)
subst' i t@(App Complete f a) = (t, False)
subst' i t@(App s f a) = let (f', uf) = subst' i f
(a', ua) = subst' i a in
if uf || ua then (App s f' a', True) else (t, False)
subst' i t@(Proj x idx) = let (x', u) = subst' i x in
if u then (Proj x' idx, u) else (t, False)
subst' i t = (t, False)
substB' i b@(Let t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Let t' v', True)
else (b, False)
substB' i b@(Guess t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Guess t' v', True)
else (b, False)
substB' i b = let (ty', u) = subst' i (binderTy b) in
if u then (b { binderTy = ty' }, u) else (b, False)
-- | Apply solutions to an environment.
| 2,016
|
updsubst :: Eq n => n {-^ The id to replace -} ->
TT n {-^ The replacement term -} ->
TT n {-^ The term to replace in -} ->
TT n
updsubst n v tm = fst $ subst' 0 tm
where
-- keep track of updates to save allocations - this is a big win on
-- large terms in particular
-- ('Maybe' would be neater here, but >>= is not the right combinator.
-- Feel free to tidy up, as long as it still saves allocating when no
-- substitution happens...)
subst' i (V x) | i == x = (v, True)
subst' i (P _ x _) | n == x = (v, True)
subst' i t@(P nt x ty)
= let (ty', ut) = subst' i ty in
if ut then (P nt x ty', True) else (t, False)
subst' i t@(Bind x b sc) | x /= n
= let (b', ub) = substB' i b
(sc', usc) = subst' (i+1) sc in
if ub || usc then (Bind x b' sc', True) else (t, False)
subst' i t@(App Complete f a) = (t, False)
subst' i t@(App s f a) = let (f', uf) = subst' i f
(a', ua) = subst' i a in
if uf || ua then (App s f' a', True) else (t, False)
subst' i t@(Proj x idx) = let (x', u) = subst' i x in
if u then (Proj x' idx, u) else (t, False)
subst' i t = (t, False)
substB' i b@(Let t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Let t' v', True)
else (b, False)
substB' i b@(Guess t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Guess t' v', True)
else (b, False)
substB' i b = let (ty', u) = subst' i (binderTy b) in
if u then (b { binderTy = ty' }, u) else (b, False)
-- | Apply solutions to an environment.
| 1,972
|
updsubst n v tm = fst $ subst' 0 tm
where
-- keep track of updates to save allocations - this is a big win on
-- large terms in particular
-- ('Maybe' would be neater here, but >>= is not the right combinator.
-- Feel free to tidy up, as long as it still saves allocating when no
-- substitution happens...)
subst' i (V x) | i == x = (v, True)
subst' i (P _ x _) | n == x = (v, True)
subst' i t@(P nt x ty)
= let (ty', ut) = subst' i ty in
if ut then (P nt x ty', True) else (t, False)
subst' i t@(Bind x b sc) | x /= n
= let (b', ub) = substB' i b
(sc', usc) = subst' (i+1) sc in
if ub || usc then (Bind x b' sc', True) else (t, False)
subst' i t@(App Complete f a) = (t, False)
subst' i t@(App s f a) = let (f', uf) = subst' i f
(a', ua) = subst' i a in
if uf || ua then (App s f' a', True) else (t, False)
subst' i t@(Proj x idx) = let (x', u) = subst' i x in
if u then (Proj x' idx, u) else (t, False)
subst' i t = (t, False)
substB' i b@(Let t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Let t' v', True)
else (b, False)
substB' i b@(Guess t v) = let (t', ut) = subst' i t
(v', uv) = subst' i v in
if ut || uv then (Guess t' v', True)
else (b, False)
substB' i b = let (ty', u) = subst' i (binderTy b) in
if u then (b { binderTy = ty' }, u) else (b, False)
-- | Apply solutions to an environment.
| 1,807
| true
| true
| 0
| 12
| 875
| 775
| 412
| 363
| null | null |
nevrenato/Hets_Fork
|
Isabelle/IsaConsts.hs
|
gpl-2.0
|
compS :: String
compS = "comp"
| 30
|
compS :: String
compS = "comp"
| 30
|
compS = "comp"
| 14
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
tjakway/ghcjvm
|
compiler/nativeGen/X86/CodeGen.hs
|
bsd-3-clause
|
trivialCode' :: Bool -> Width -> (Operand -> Operand -> Instr)
-> Maybe (Operand -> Operand -> Instr)
-> CmmExpr -> CmmExpr -> NatM Register
trivialCode' is32Bit width _ (Just revinstr) (CmmLit lit_a) b
| is32BitLit is32Bit lit_a = do
b_code <- getAnyReg b
let
code dst
= b_code dst `snocOL`
revinstr (OpImm (litToImm lit_a)) (OpReg dst)
return (Any (intFormat width) code)
| 434
|
trivialCode' :: Bool -> Width -> (Operand -> Operand -> Instr)
-> Maybe (Operand -> Operand -> Instr)
-> CmmExpr -> CmmExpr -> NatM Register
trivialCode' is32Bit width _ (Just revinstr) (CmmLit lit_a) b
| is32BitLit is32Bit lit_a = do
b_code <- getAnyReg b
let
code dst
= b_code dst `snocOL`
revinstr (OpImm (litToImm lit_a)) (OpReg dst)
return (Any (intFormat width) code)
| 434
|
trivialCode' is32Bit width _ (Just revinstr) (CmmLit lit_a) b
| is32BitLit is32Bit lit_a = do
b_code <- getAnyReg b
let
code dst
= b_code dst `snocOL`
revinstr (OpImm (litToImm lit_a)) (OpReg dst)
return (Any (intFormat width) code)
| 267
| false
| true
| 0
| 17
| 122
| 178
| 83
| 95
| null | null |
kawu/ltag
|
src/NLP/LTAG/Early4.hs
|
bsd-2-clause
|
-- | Save the rule in the writer component of the monad.
keepRule :: Rule n t -> RM n t ()
keepRule = RWS.tell . (:[])
| 118
|
keepRule :: Rule n t -> RM n t ()
keepRule = RWS.tell . (:[])
| 61
|
keepRule = RWS.tell . (:[])
| 27
| true
| true
| 0
| 8
| 26
| 48
| 23
| 25
| null | null |
TC1211/TCP
|
src/3a/tester-src/Data/IterIO/Parse.hs
|
apache-2.0
|
- | An infix synonym for 'ifNoParse' that allows LL(*) parsing of
-- alternatives by keeping a copy of input data consumed by the first
-- Iteratee so as to backtrack and execute the second Iteratee if the
-- first one fails. Returns a function that takes a continuation for
-- the first 'Iter', should it succeed. The code:
--
-- > iter1 \/ iter2 $ \iter1Result -> doSomethingWith iter1Result
--
-- Executes @iter1@ (saving a copy of the input for backtracking). If
-- @iter1@ fails with an exception of class 'IterNoParse', then the
-- input is re-wound and fed to @iter2@. On the other hand, if
-- @iter1@ succeeds and returns @iter1Result@, then the saved input is
-- discarded (as @iter2@ will not need to be run) and the result of
-- @iter1@ is fed to function @doSomethingWith@.
--
-- For example, to build up a list of results of executing @iter@, one
-- could implement a type-restricted version of 'many' as follows:
--
-- @
-- myMany :: (ChunkData t, Monad m) => Iter t m a -> Iter t m [a]
-- myMany iter = iter \\/ return [] '$' \\r -> 'fmap' ((:) r) (myMany iter)
-- @
--
-- In other words, @myMany@ tries running @iter@. If @iter@ fails,
-- then @myMany@ returns the empty list. If @iter@ succeeds, its
-- result @r@ is added to the head of the list returned by calling
-- @myMany@ recursively. This idiom of partially applying a binary
-- funciton to a result and then applying the resulting function to an
-- iter via 'fmap' is so common that there is an infix operator for
-- it, @'>$>'@. Thus, the above code can be written:
--
-- @
-- myMany iter = iter \\/ return [] '$' (:) '>$>' myMany iter
-- @
--
-- @\\/@ has fixity:
--
-- > infix 2 \/
--
(\/) :: (ChunkData t, Monad m) =>
Iter t m a -> Iter t m b -> (a -> Iter t m b) -> Iter t m b
(\/) = ifNoParse
| 1,802
|
(\/) :: (ChunkData t, Monad m) =>
Iter t m a -> Iter t m b -> (a -> Iter t m b) -> Iter t m b
(\/) = ifNoParse
| 119
|
(\/) = ifNoParse
| 16
| true
| true
| 4
| 8
| 374
| 101
| 78
| 23
| null | null |
bitemyapp/ghc
|
compiler/basicTypes/RdrName.hs
|
bsd-3-clause
|
qualSpecOK :: ModuleName -> ImportSpec -> Bool
-- ^ Is in scope qualified with the given module?
qualSpecOK mod is = mod == is_as (is_decl is)
| 142
|
qualSpecOK :: ModuleName -> ImportSpec -> Bool
qualSpecOK mod is = mod == is_as (is_decl is)
| 92
|
qualSpecOK mod is = mod == is_as (is_decl is)
| 45
| true
| true
| 2
| 8
| 25
| 44
| 21
| 23
| null | null |
linusyang/barrelfish
|
tools/flounder/UMPCommon.hs
|
mit
|
-- Name of the transmit handler
tx_handler_name p ifn = ump_ifscope p ifn "send_handler"
| 88
|
tx_handler_name p ifn = ump_ifscope p ifn "send_handler"
| 56
|
tx_handler_name p ifn = ump_ifscope p ifn "send_handler"
| 56
| true
| false
| 0
| 5
| 13
| 19
| 9
| 10
| null | null |
pjones/xmonad-test
|
vendor/xmonad-contrib/XMonad/Layout/BinarySpacePartition.hs
|
bsd-2-clause
|
rotateTreeNth D b = b
| 21
|
rotateTreeNth D b = b
| 21
|
rotateTreeNth D b = b
| 21
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
coursestitch/coursestitch-api
|
src/Templates/Resource.hs
|
apache-2.0
|
resourcePage :: Entity Resource -> [(RelationshipType, [Entity Concept])] -> Html()
resourcePage r rels = page $ resourceDetailed r rels
| 136
|
resourcePage :: Entity Resource -> [(RelationshipType, [Entity Concept])] -> Html()
resourcePage r rels = page $ resourceDetailed r rels
| 136
|
resourcePage r rels = page $ resourceDetailed r rels
| 52
| false
| true
| 0
| 10
| 18
| 56
| 28
| 28
| null | null |
RyanGlScott/nfa2dfa
|
Main.hs
|
gpl-3.0
|
-- | Checks if a marked state's sets are in a marked state set.
inDStates :: MarkedAStateSet -> Set MarkedAStateSet -> Bool
inDStates (MarkedAStateSet _ _ set) dstates = any ((==set) . markedSet) $ S.toList dstates
| 214
|
inDStates :: MarkedAStateSet -> Set MarkedAStateSet -> Bool
inDStates (MarkedAStateSet _ _ set) dstates = any ((==set) . markedSet) $ S.toList dstates
| 150
|
inDStates (MarkedAStateSet _ _ set) dstates = any ((==set) . markedSet) $ S.toList dstates
| 90
| true
| true
| 0
| 9
| 35
| 61
| 31
| 30
| null | null |
fryguybob/LaTeXGrapher
|
src/LaTeXGrapher/Data/Markup.hs
|
bsd-3-clause
|
isLabel :: Markup -> Bool
isLabel (Label _ _) = True
| 52
|
isLabel :: Markup -> Bool
isLabel (Label _ _) = True
| 52
|
isLabel (Label _ _) = True
| 26
| false
| true
| 0
| 6
| 10
| 30
| 14
| 16
| null | null |
literate-unitb/literate-unitb
|
src/Document/Scope.hs
|
mit
|
setToList :: Ord a => NonEmptyListSet a -> [a]
setToList = Ord.nubSort . D.toList . unNonEmptyListSet
| 101
|
setToList :: Ord a => NonEmptyListSet a -> [a]
setToList = Ord.nubSort . D.toList . unNonEmptyListSet
| 101
|
setToList = Ord.nubSort . D.toList . unNonEmptyListSet
| 54
| false
| true
| 0
| 7
| 15
| 40
| 20
| 20
| null | null |
markflorisson/hpack
|
testrepo/bytestring-0.10.2.0/Data/ByteString/Builder/Prim/Binary.hs
|
bsd-3-clause
|
word32BE = word32Host
| 21
|
word32BE = word32Host
| 21
|
word32BE = word32Host
| 21
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
kishoredbn/barrelfish
|
tools/skate/SkateBackendWiki.hs
|
mit
|
wikiPrintFactAttrib :: FactAttrib -> [String]
wikiPrintFactAttrib fa@(FactAttrib n d t _) = [n, (show t), d]
| 108
|
wikiPrintFactAttrib :: FactAttrib -> [String]
wikiPrintFactAttrib fa@(FactAttrib n d t _) = [n, (show t), d]
| 108
|
wikiPrintFactAttrib fa@(FactAttrib n d t _) = [n, (show t), d]
| 62
| false
| true
| 0
| 8
| 15
| 51
| 28
| 23
| null | null |
thoughtpolice/hs-nacl
|
src/Crypto/Encrypt/Stream.hs
|
bsd-3-clause
|
-- $example
-- >>> nonce <- randomNonce :: IO (Nonce Stream)
-- >>> key <- randomKey
-- >>> let cipherText = encrypt nonce "Hello" key
-- >>> let recoveredText = decrypt nonce cipherText key
-- >>> recoveredText == "Hello"
-- True
xsalsa20KEYBYTES :: Int
xsalsa20KEYBYTES = 32
| 279
|
xsalsa20KEYBYTES :: Int
xsalsa20KEYBYTES = 32
| 47
|
xsalsa20KEYBYTES = 32
| 23
| true
| true
| 0
| 4
| 49
| 18
| 13
| 5
| null | null |
DNNX/shkoliner
|
src/Lib.hs
|
bsd-3-clause
|
extractLink :: [Tag T.Text] -> T.Text
extractLink = fromAttrib "href" . head . takeBetween "<a>" "</a>" . takeBetween "<h3 class=\"b-posts-1-item__title\">" "</h3>"
| 164
|
extractLink :: [Tag T.Text] -> T.Text
extractLink = fromAttrib "href" . head . takeBetween "<a>" "</a>" . takeBetween "<h3 class=\"b-posts-1-item__title\">" "</h3>"
| 164
|
extractLink = fromAttrib "href" . head . takeBetween "<a>" "</a>" . takeBetween "<h3 class=\"b-posts-1-item__title\">" "</h3>"
| 126
| false
| true
| 0
| 8
| 20
| 50
| 24
| 26
| null | null |
fffej/HS-Poker
|
LookupPatternMatch.hs
|
bsd-3-clause
|
getValueFromProduct 543286 = 4155
| 33
|
getValueFromProduct 543286 = 4155
| 33
|
getValueFromProduct 543286 = 4155
| 33
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
zhiyuanshi/fcore
|
examples/case_studies/FeatherWeightJava.hs
|
bsd-2-clause
|
eval1 :: Term -> Term
-- E-PROJNEW
eval1 (FieAcc c@(New cn ts) fn) = if isValue c
then if elem fn (fnsFromFs $ fields cn)
then ts !! (seeOrder fn (fields cn))
else error "There is no such field"
else FieAcc (eval1 c) fn
| 365
|
eval1 :: Term -> Term
eval1 (FieAcc c@(New cn ts) fn) = if isValue c
then if elem fn (fnsFromFs $ fields cn)
then ts !! (seeOrder fn (fields cn))
else error "There is no such field"
else FieAcc (eval1 c) fn
| 352
|
eval1 (FieAcc c@(New cn ts) fn) = if isValue c
then if elem fn (fnsFromFs $ fields cn)
then ts !! (seeOrder fn (fields cn))
else error "There is no such field"
else FieAcc (eval1 c) fn
| 330
| true
| true
| 0
| 11
| 189
| 108
| 54
| 54
| null | null |
toddmohney/NinetyNineProbs
|
src/BTree.hs
|
mit
|
balBTree 1 = insertBalanced Empty (leaf 'x')
| 44
|
balBTree 1 = insertBalanced Empty (leaf 'x')
| 44
|
balBTree 1 = insertBalanced Empty (leaf 'x')
| 44
| false
| false
| 1
| 7
| 6
| 23
| 9
| 14
| null | null |
rrnewton/accelerate
|
Data/Array/Accelerate/Trafo/Algebra.hs
|
bsd-3-clause
|
evalBRotateR ty arg env
| IntegralDict <- integralDict ty = eval2 rotateR arg env
| 83
|
evalBRotateR ty arg env
| IntegralDict <- integralDict ty = eval2 rotateR arg env
| 83
|
evalBRotateR ty arg env
| IntegralDict <- integralDict ty = eval2 rotateR arg env
| 83
| false
| false
| 0
| 9
| 15
| 35
| 14
| 21
| null | null |
roberth/uu-helium
|
test/staticerrors/CapitalFunctionErrors.hs
|
gpl-3.0
|
X = 3
| 5
|
X = 3
| 5
|
X = 3
| 5
| false
| false
| 1
| 5
| 2
| 10
| 3
| 7
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2017/M01/D18/Solution.hs
|
mit
|
pets :: Bag Pet
pets = fromList [Cat, Cat, Dog, Dog, Fish, Fish, Fish]
| 70
|
pets :: Bag Pet
pets = fromList [Cat, Cat, Dog, Dog, Fish, Fish, Fish]
| 70
|
pets = fromList [Cat, Cat, Dog, Dog, Fish, Fish, Fish]
| 54
| false
| true
| 1
| 6
| 13
| 41
| 22
| 19
| null | null |
Peaker/GLFW-b
|
Test.hs
|
bsd-2-clause
|
test_getWindowContextRobustness :: GLFW.Window -> IO ()
test_getWindowContextRobustness win = do
_ <- GLFW.getWindowContextRobustness win
return ()
| 155
|
test_getWindowContextRobustness :: GLFW.Window -> IO ()
test_getWindowContextRobustness win = do
_ <- GLFW.getWindowContextRobustness win
return ()
| 155
|
test_getWindowContextRobustness win = do
_ <- GLFW.getWindowContextRobustness win
return ()
| 99
| false
| true
| 0
| 9
| 23
| 45
| 20
| 25
| null | null |
romanb/amazonka
|
amazonka-redshift/gen/Network/AWS/Redshift/Types.hs
|
mpl-2.0
|
-- | The snapshot status. The value of the status depends on the API operation
-- used. 'CreateClusterSnapshot' and 'CopyClusterSnapshot' returns status as
-- "creating". 'DescribeClusterSnapshots' returns status as "creating",
-- "available", "final snapshot", or "failed". 'DeleteClusterSnapshot' returns
-- status as "deleted".
sStatus :: Lens' Snapshot (Maybe Text)
sStatus = lens _sStatus (\s a -> s { _sStatus = a })
| 427
|
sStatus :: Lens' Snapshot (Maybe Text)
sStatus = lens _sStatus (\s a -> s { _sStatus = a })
| 91
|
sStatus = lens _sStatus (\s a -> s { _sStatus = a })
| 52
| true
| true
| 0
| 9
| 65
| 50
| 29
| 21
| null | null |
fmthoma/ghc
|
compiler/types/Type.hs
|
bsd-3-clause
|
unionTvSubst :: TvSubst -> TvSubst -> TvSubst
-- Works when the ranges are disjoint
unionTvSubst (TvSubst in_scope1 tenv1) (TvSubst in_scope2 tenv2)
= ASSERT( not (tenv1 `intersectsVarEnv` tenv2) )
TvSubst (in_scope1 `unionInScope` in_scope2)
(tenv1 `plusVarEnv` tenv2)
| 293
|
unionTvSubst :: TvSubst -> TvSubst -> TvSubst
unionTvSubst (TvSubst in_scope1 tenv1) (TvSubst in_scope2 tenv2)
= ASSERT( not (tenv1 `intersectsVarEnv` tenv2) )
TvSubst (in_scope1 `unionInScope` in_scope2)
(tenv1 `plusVarEnv` tenv2)
| 255
|
unionTvSubst (TvSubst in_scope1 tenv1) (TvSubst in_scope2 tenv2)
= ASSERT( not (tenv1 `intersectsVarEnv` tenv2) )
TvSubst (in_scope1 `unionInScope` in_scope2)
(tenv1 `plusVarEnv` tenv2)
| 209
| true
| true
| 0
| 9
| 58
| 85
| 46
| 39
| null | null |
michalkonecny/aern2
|
aern2-fun-univariate/src/AERN2/Frac/Maximum.hs
|
bsd-3-clause
|
maximumOptimisedWithAccuracy :: Accuracy -> Frac MPBall -> MPBall -> MPBall -> Integer -> Integer -> MPBall
maximumOptimisedWithAccuracy acc f@(Frac p q _) l r iDeg steps =
--trace("dfs size: "++(show $ length dfs)) $
--trace("dfs: "++(show dfs)) $
PM.genericMaximum evalf dfsWithEval (min (getFiniteAccuracy f) acc) lI rI
where
evalf = evalDf f (reduceToEvalDirectAccuracy p (bits 0))
(reduceToEvalDirectAccuracy q (bits 1))
dom = chPoly_dom p
unit = Interval (dyadic $ -1) (dyadic 1)
pI = makeExactCentre $ p { chPoly_dom = unit }
qI = makeExactCentre $ q { chPoly_dom = unit }
lI = fromDomToUnitInterval dom l
rI = fromDomToUnitInterval dom r -- TODO: set precision
pc = centre pI
qc = centre qI
df = (derivativeExact pc) * qc - pc * (derivativeExact qc)
maxKey = max 0 (ceiling ((Cheb.degree df - iDeg) /! steps))
dfs = [(k, reduceDegree (iDeg + steps*k) df) | k <- [0..maxKey + 1]]
dfsWithEval =
Map.fromList
[(k,(Cheb.evalDirect dfk :: MPBall -> MPBall, (ch2Power . intify) dfk)) | (k, dfk) <- dfs]
| 1,065
|
maximumOptimisedWithAccuracy :: Accuracy -> Frac MPBall -> MPBall -> MPBall -> Integer -> Integer -> MPBall
maximumOptimisedWithAccuracy acc f@(Frac p q _) l r iDeg steps =
--trace("dfs size: "++(show $ length dfs)) $
--trace("dfs: "++(show dfs)) $
PM.genericMaximum evalf dfsWithEval (min (getFiniteAccuracy f) acc) lI rI
where
evalf = evalDf f (reduceToEvalDirectAccuracy p (bits 0))
(reduceToEvalDirectAccuracy q (bits 1))
dom = chPoly_dom p
unit = Interval (dyadic $ -1) (dyadic 1)
pI = makeExactCentre $ p { chPoly_dom = unit }
qI = makeExactCentre $ q { chPoly_dom = unit }
lI = fromDomToUnitInterval dom l
rI = fromDomToUnitInterval dom r -- TODO: set precision
pc = centre pI
qc = centre qI
df = (derivativeExact pc) * qc - pc * (derivativeExact qc)
maxKey = max 0 (ceiling ((Cheb.degree df - iDeg) /! steps))
dfs = [(k, reduceDegree (iDeg + steps*k) df) | k <- [0..maxKey + 1]]
dfsWithEval =
Map.fromList
[(k,(Cheb.evalDirect dfk :: MPBall -> MPBall, (ch2Power . intify) dfk)) | (k, dfk) <- dfs]
| 1,065
|
maximumOptimisedWithAccuracy acc f@(Frac p q _) l r iDeg steps =
--trace("dfs size: "++(show $ length dfs)) $
--trace("dfs: "++(show dfs)) $
PM.genericMaximum evalf dfsWithEval (min (getFiniteAccuracy f) acc) lI rI
where
evalf = evalDf f (reduceToEvalDirectAccuracy p (bits 0))
(reduceToEvalDirectAccuracy q (bits 1))
dom = chPoly_dom p
unit = Interval (dyadic $ -1) (dyadic 1)
pI = makeExactCentre $ p { chPoly_dom = unit }
qI = makeExactCentre $ q { chPoly_dom = unit }
lI = fromDomToUnitInterval dom l
rI = fromDomToUnitInterval dom r -- TODO: set precision
pc = centre pI
qc = centre qI
df = (derivativeExact pc) * qc - pc * (derivativeExact qc)
maxKey = max 0 (ceiling ((Cheb.degree df - iDeg) /! steps))
dfs = [(k, reduceDegree (iDeg + steps*k) df) | k <- [0..maxKey + 1]]
dfsWithEval =
Map.fromList
[(k,(Cheb.evalDirect dfk :: MPBall -> MPBall, (ch2Power . intify) dfk)) | (k, dfk) <- dfs]
| 957
| false
| true
| 7
| 13
| 228
| 432
| 217
| 215
| null | null |
katydid/haslapse
|
src/Data/Katydid/Relapse/Ast.hs
|
bsd-3-clause
|
nullable g (Reference refName) = lookupRef g refName >>= nullable g
| 68
|
nullable g (Reference refName) = lookupRef g refName >>= nullable g
| 68
|
nullable g (Reference refName) = lookupRef g refName >>= nullable g
| 68
| false
| false
| 0
| 7
| 11
| 29
| 13
| 16
| null | null |
mfpi/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs
|
bsd-3-clause
|
gl_STENCIL_BACK_WRITEMASK :: GLenum
gl_STENCIL_BACK_WRITEMASK = 0x8CA5
| 70
|
gl_STENCIL_BACK_WRITEMASK :: GLenum
gl_STENCIL_BACK_WRITEMASK = 0x8CA5
| 70
|
gl_STENCIL_BACK_WRITEMASK = 0x8CA5
| 34
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
ezyang/ghc
|
compiler/prelude/THNames.hs
|
bsd-3-clause
|
viewPName = libFun (fsLit "viewP") viewPIdKey
| 47
|
viewPName = libFun (fsLit "viewP") viewPIdKey
| 47
|
viewPName = libFun (fsLit "viewP") viewPIdKey
| 47
| false
| false
| 0
| 7
| 7
| 17
| 8
| 9
| null | null |
onponomarev/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
-- | The version of the backup/export instance description file format we are
-- producing when exporting and accepting when importing. The two are currently
-- tightly intertwined.
exportVersion :: Int
exportVersion = 0
| 220
|
exportVersion :: Int
exportVersion = 0
| 38
|
exportVersion = 0
| 17
| true
| true
| 0
| 6
| 33
| 21
| 10
| 11
| null | null |
denibertovic/haskell
|
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
|
bsd-3-clause
|
-- * V1Service
-- | 'v1ServiceApiVersion' Lens
v1ServiceApiVersionL :: Lens_' V1Service (Maybe Text)
v1ServiceApiVersionL f V1Service{..} = (\v1ServiceApiVersion -> V1Service { v1ServiceApiVersion, ..} ) <$> f v1ServiceApiVersion
| 230
|
v1ServiceApiVersionL :: Lens_' V1Service (Maybe Text)
v1ServiceApiVersionL f V1Service{..} = (\v1ServiceApiVersion -> V1Service { v1ServiceApiVersion, ..} ) <$> f v1ServiceApiVersion
| 182
|
v1ServiceApiVersionL f V1Service{..} = (\v1ServiceApiVersion -> V1Service { v1ServiceApiVersion, ..} ) <$> f v1ServiceApiVersion
| 128
| true
| true
| 1
| 8
| 27
| 63
| 31
| 32
| null | null |
shlevy/ghc
|
compiler/basicTypes/RdrName.hs
|
bsd-3-clause
|
plusParent p1 p2@(FldParent _ _) = hasParent p2 p1
| 50
|
plusParent p1 p2@(FldParent _ _) = hasParent p2 p1
| 50
|
plusParent p1 p2@(FldParent _ _) = hasParent p2 p1
| 50
| false
| false
| 1
| 8
| 8
| 32
| 13
| 19
| null | null |
cfredric/NumberTheory
|
NumberTheory.hs
|
gpl-3.0
|
enumerate (c:cs) = [ a : as
| a <- c
, as <- enumerate cs
]
| 116
|
enumerate (c:cs) = [ a : as
| a <- c
, as <- enumerate cs
]
| 116
|
enumerate (c:cs) = [ a : as
| a <- c
, as <- enumerate cs
]
| 116
| false
| false
| 0
| 8
| 73
| 43
| 21
| 22
| null | null |
pgj/bead
|
src/Bead/Domain/Entities.hs
|
bsd-3-clause
|
showDate :: LocalTime -> String
showDate = formatTime defaultTimeLocale "%F, %T"
| 80
|
showDate :: LocalTime -> String
showDate = formatTime defaultTimeLocale "%F, %T"
| 80
|
showDate = formatTime defaultTimeLocale "%F, %T"
| 48
| false
| true
| 0
| 7
| 10
| 26
| 11
| 15
| null | null |
GaloisInc/halvm-ghc
|
compiler/utils/OrdList.hs
|
bsd-3-clause
|
lastOL (Cons _ as) = lastOL as
| 30
|
lastOL (Cons _ as) = lastOL as
| 30
|
lastOL (Cons _ as) = lastOL as
| 30
| false
| false
| 0
| 7
| 6
| 20
| 9
| 11
| null | null |
heyduck/pfds
|
src/Pfds/Ch02/notes.hs
|
gpl-3.0
|
member' x Empty = False
| 23
|
member' x Empty = False
| 23
|
member' x Empty = False
| 23
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
dmp1ce/Haskell-Programming-Exercises
|
Chapter 24/src/ChapterExercises_1.hs
|
unlicense
|
verifyGreaterThan :: SemVer -> SemVer -> IO ()
verifyGreaterThan v1 v2 = do
putStr $ (show v1) ++ " > " ++ (show v2) ++ ": "
if v1 > v2
then putStr "\x1b[32mTrue"
else putStr "\x1b[31mFalse"
putStrLn "\x1b[0m"
| 220
|
verifyGreaterThan :: SemVer -> SemVer -> IO ()
verifyGreaterThan v1 v2 = do
putStr $ (show v1) ++ " > " ++ (show v2) ++ ": "
if v1 > v2
then putStr "\x1b[32mTrue"
else putStr "\x1b[31mFalse"
putStrLn "\x1b[0m"
| 220
|
verifyGreaterThan v1 v2 = do
putStr $ (show v1) ++ " > " ++ (show v2) ++ ": "
if v1 > v2
then putStr "\x1b[32mTrue"
else putStr "\x1b[31mFalse"
putStrLn "\x1b[0m"
| 173
| false
| true
| 0
| 12
| 49
| 87
| 41
| 46
| null | null |
antalsz/hs-to-coq
|
src/lib/HsToCoq/ConvertHaskell/Parameters/Edits.hs
|
mit
|
definitionSentence (CoqInductiveDef ind) = InductiveSentence ind
| 78
|
definitionSentence (CoqInductiveDef ind) = InductiveSentence ind
| 78
|
definitionSentence (CoqInductiveDef ind) = InductiveSentence ind
| 78
| false
| false
| 0
| 7
| 19
| 18
| 8
| 10
| null | null |
aslatter/xhb
|
build-utils/src/Generate.hs
|
bsd-3-clause
|
serField name (SField fname _typ Nothing Nothing) -- serialize <field>
= pure $ hsApp (mkVar "serialize") $ hsParen $
accessField name fname
| 158
|
serField name (SField fname _typ Nothing Nothing) -- serialize <field>
= pure $ hsApp (mkVar "serialize") $ hsParen $
accessField name fname
| 158
|
serField name (SField fname _typ Nothing Nothing) -- serialize <field>
= pure $ hsApp (mkVar "serialize") $ hsParen $
accessField name fname
| 158
| false
| false
| 2
| 8
| 39
| 55
| 24
| 31
| null | null |
jethomas/WaveSim
|
src/WaveSim/Input.hs
|
bsd-3-clause
|
worldInput :: IORef WorldState -> Key -> KeyState -> Modifiers -> Position -> IO()
worldInput worldStateRef key state _ pos = do
worldState <- readIORef worldStateRef
let inputState = inputStateRef worldState
let wh = truncate $ winHeight (configData worldState)
writeIORef worldStateRef (worldState {inputStateRef = keyAct key state pos wh inputState})
sequence_ (mouseHandlers worldState)
| 405
|
worldInput :: IORef WorldState -> Key -> KeyState -> Modifiers -> Position -> IO()
worldInput worldStateRef key state _ pos = do
worldState <- readIORef worldStateRef
let inputState = inputStateRef worldState
let wh = truncate $ winHeight (configData worldState)
writeIORef worldStateRef (worldState {inputStateRef = keyAct key state pos wh inputState})
sequence_ (mouseHandlers worldState)
| 405
|
worldInput worldStateRef key state _ pos = do
worldState <- readIORef worldStateRef
let inputState = inputStateRef worldState
let wh = truncate $ winHeight (configData worldState)
writeIORef worldStateRef (worldState {inputStateRef = keyAct key state pos wh inputState})
sequence_ (mouseHandlers worldState)
| 322
| false
| true
| 0
| 14
| 67
| 141
| 64
| 77
| null | null |
haskell-opengl/OpenGLRaw
|
src/Graphics/GL/ExtensionPredicates.hs
|
bsd-3-clause
|
-- | Is the <https://www.opengl.org/registry/specs/ARB/sync.txt ARB_sync> extension supported?
-- Note that in the presence of multiple contexts with different capabilities,
-- this might be wrong. Use 'glGetARBSync' in those cases instead.
gl_ARB_sync :: Bool
gl_ARB_sync = member "GL_ARB_sync" extensions
| 306
|
gl_ARB_sync :: Bool
gl_ARB_sync = member "GL_ARB_sync" extensions
| 65
|
gl_ARB_sync = member "GL_ARB_sync" extensions
| 45
| true
| true
| 0
| 5
| 38
| 19
| 11
| 8
| null | null |
genos/online_problems
|
exercism/haskell/all-your-base/test/Tests.hs
|
mit
|
specs :: Spec
specs = describe "rebase" $ for_ cases test
| 57
|
specs :: Spec
specs = describe "rebase" $ for_ cases test
| 57
|
specs = describe "rebase" $ for_ cases test
| 43
| false
| true
| 2
| 6
| 10
| 30
| 12
| 18
| null | null |
lenary/Idris-dev
|
src/Idris/AbsSyntaxTree.hs
|
bsd-3-clause
|
-- | Pretty printing options with the most verbosity.
verbosePPOption :: PPOption
verbosePPOption = PPOption { ppopt_impl = True,
ppopt_desugarnats = True,
ppopt_pinames = True,
ppopt_depth = Just 200 }
| 289
|
verbosePPOption :: PPOption
verbosePPOption = PPOption { ppopt_impl = True,
ppopt_desugarnats = True,
ppopt_pinames = True,
ppopt_depth = Just 200 }
| 235
|
verbosePPOption = PPOption { ppopt_impl = True,
ppopt_desugarnats = True,
ppopt_pinames = True,
ppopt_depth = Just 200 }
| 207
| true
| true
| 0
| 8
| 116
| 48
| 26
| 22
| null | null |
felixsch/xdg
|
src/System/Environment/XDG/Internal/Ini.hs
|
gpl-3.0
|
getHeader :: IniFile -> [String]
getHeader
(IniFile c _) = c
| 64
|
getHeader :: IniFile -> [String]
getHeader
(IniFile c _) = c
| 64
|
getHeader
(IniFile c _) = c
| 31
| false
| true
| 0
| 6
| 14
| 33
| 16
| 17
| null | null |
cbaatz/hamu8080
|
src/Hamu8080/Compute.hs
|
mit
|
popStack :: Computation Address
popStack = do
addr <- getRegPair SP
setRegPair SP (addr + 2)
liftM2 bytesToAddress (getMem addr) (getMem (addr + 1))
--------------------------------------------------------------------------------
-- Arithmetic helper functions
--------------------------------------------------------------------------------
| 348
|
popStack :: Computation Address
popStack = do
addr <- getRegPair SP
setRegPair SP (addr + 2)
liftM2 bytesToAddress (getMem addr) (getMem (addr + 1))
--------------------------------------------------------------------------------
-- Arithmetic helper functions
--------------------------------------------------------------------------------
| 348
|
popStack = do
addr <- getRegPair SP
setRegPair SP (addr + 2)
liftM2 bytesToAddress (getMem addr) (getMem (addr + 1))
--------------------------------------------------------------------------------
-- Arithmetic helper functions
--------------------------------------------------------------------------------
| 316
| false
| true
| 0
| 11
| 36
| 71
| 35
| 36
| null | null |
michaxm/crawlchain
|
src/Network/Http/ClientFacade.hs
|
bsd-3-clause
|
-- reworked from http-streams due to inappropriate escaping/error handling
getRequest :: BC.ByteString -> IO BC.ByteString
getRequest = doRequest C.concatHandler -- TODO check exceptions with concatHandler
where
doRequest handler url = do
bracket
(openConnection url)
(C.closeConnection)
(process)
where
u = parseURL url
q = C.buildRequest1 $ do
C.http C.GET (path u)
C.setAccept "*/*" where
path :: U.URI -> BC.ByteString
path u' =
case url' of
"" -> "/"
_ -> url'
where
url' = T.encodeUtf8 $! T.pack $! concat [U.uriPath u', U.uriQuery u', U.uriFragment u']
process c = do
C.sendRequest c q C.emptyBody
C.receiveResponse c handler -- wrapRedirect is not exposed: (C.wrapRedirect u 0 handler)
| 898
|
getRequest :: BC.ByteString -> IO BC.ByteString
getRequest = doRequest C.concatHandler -- TODO check exceptions with concatHandler
where
doRequest handler url = do
bracket
(openConnection url)
(C.closeConnection)
(process)
where
u = parseURL url
q = C.buildRequest1 $ do
C.http C.GET (path u)
C.setAccept "*/*" where
path :: U.URI -> BC.ByteString
path u' =
case url' of
"" -> "/"
_ -> url'
where
url' = T.encodeUtf8 $! T.pack $! concat [U.uriPath u', U.uriQuery u', U.uriFragment u']
process c = do
C.sendRequest c q C.emptyBody
C.receiveResponse c handler -- wrapRedirect is not exposed: (C.wrapRedirect u 0 handler)
| 823
|
getRequest = doRequest C.concatHandler -- TODO check exceptions with concatHandler
where
doRequest handler url = do
bracket
(openConnection url)
(C.closeConnection)
(process)
where
u = parseURL url
q = C.buildRequest1 $ do
C.http C.GET (path u)
C.setAccept "*/*" where
path :: U.URI -> BC.ByteString
path u' =
case url' of
"" -> "/"
_ -> url'
where
url' = T.encodeUtf8 $! T.pack $! concat [U.uriPath u', U.uriQuery u', U.uriFragment u']
process c = do
C.sendRequest c q C.emptyBody
C.receiveResponse c handler -- wrapRedirect is not exposed: (C.wrapRedirect u 0 handler)
| 775
| true
| true
| 0
| 15
| 308
| 231
| 113
| 118
| null | null |
stevej/stackist
|
src/Stackist/Parser.hs
|
apache-2.0
|
parseNumber :: Parser Expr
parseNumber = fmap (Numeric . read) $ many1 digit
| 76
|
parseNumber :: Parser Expr
parseNumber = fmap (Numeric . read) $ many1 digit
| 76
|
parseNumber = fmap (Numeric . read) $ many1 digit
| 49
| false
| true
| 0
| 8
| 12
| 31
| 15
| 16
| null | null |
apyrgio/ganeti
|
src/Ganeti/Query/Common.hs
|
bsd-2-clause
|
-- | Builds a param field for a certain getter class
buildParamField :: String -- ^ Prefix
-> String -- ^ Parameter group name
-> Map.Map String String -- ^ Parameter title map
-> Map.Map String FieldType -- ^ Parameter type map
-> (String -> ConfigData -> a -> ResultEntry)
-> String -- ^ The parameter name
-> FieldData a b
buildParamField prefix paramGroupName titleMap typeMap getter field =
let full_name = prefix ++ "/" ++ field
title = fromMaybe full_name $ field `Map.lookup` titleMap
qft = fromMaybe QFTOther $ field `Map.lookup` typeMap
desc = "The \"" ++ field ++ "\" " ++ paramGroupName ++ " parameter"
in ( FieldDefinition full_name title qft desc
, FieldConfig (getter field), QffNormal
)
| 830
|
buildParamField :: String -- ^ Prefix
-> String -- ^ Parameter group name
-> Map.Map String String -- ^ Parameter title map
-> Map.Map String FieldType -- ^ Parameter type map
-> (String -> ConfigData -> a -> ResultEntry)
-> String -- ^ The parameter name
-> FieldData a b
buildParamField prefix paramGroupName titleMap typeMap getter field =
let full_name = prefix ++ "/" ++ field
title = fromMaybe full_name $ field `Map.lookup` titleMap
qft = fromMaybe QFTOther $ field `Map.lookup` typeMap
desc = "The \"" ++ field ++ "\" " ++ paramGroupName ++ " parameter"
in ( FieldDefinition full_name title qft desc
, FieldConfig (getter field), QffNormal
)
| 777
|
buildParamField prefix paramGroupName titleMap typeMap getter field =
let full_name = prefix ++ "/" ++ field
title = fromMaybe full_name $ field `Map.lookup` titleMap
qft = fromMaybe QFTOther $ field `Map.lookup` typeMap
desc = "The \"" ++ field ++ "\" " ++ paramGroupName ++ " parameter"
in ( FieldDefinition full_name title qft desc
, FieldConfig (getter field), QffNormal
)
| 408
| true
| true
| 0
| 13
| 247
| 195
| 102
| 93
| null | null |
tjakway/ghcjvm
|
compiler/basicTypes/BasicTypes.hs
|
bsd-3-clause
|
-- | Turn a positive number into an 'IntWithInf', where 0 represents infinity
treatZeroAsInf :: Int -> IntWithInf
treatZeroAsInf 0 = Infinity
| 141
|
treatZeroAsInf :: Int -> IntWithInf
treatZeroAsInf 0 = Infinity
| 63
|
treatZeroAsInf 0 = Infinity
| 27
| true
| true
| 0
| 7
| 21
| 25
| 11
| 14
| null | null |
sdiehl/ghc
|
compiler/utils/Bag.hs
|
bsd-3-clause
|
mapBagM f (UnitBag x) = do r <- f x
return (UnitBag r)
| 89
|
mapBagM f (UnitBag x) = do r <- f x
return (UnitBag r)
| 89
|
mapBagM f (UnitBag x) = do r <- f x
return (UnitBag r)
| 89
| false
| false
| 0
| 9
| 47
| 41
| 17
| 24
| null | null |
Erdwolf/autotool-bonn
|
src/HeapSort/Tree.hs
|
gpl-2.0
|
depth (Branch _ l r) = 1 + max (depth l) (depth r)
| 50
|
depth (Branch _ l r) = 1 + max (depth l) (depth r)
| 50
|
depth (Branch _ l r) = 1 + max (depth l) (depth r)
| 50
| false
| false
| 0
| 8
| 12
| 40
| 19
| 21
| null | null |
nevrenato/HetsAlloy
|
DFOL/AS_DFOL.hs
|
gpl-2.0
|
printFormula (Equivalence x y) =
printFormulaWithPrec (equivPrec - 1) x
<+> equiv
<+> printFormulaWithPrec (equivPrec - 1) y
| 130
|
printFormula (Equivalence x y) =
printFormulaWithPrec (equivPrec - 1) x
<+> equiv
<+> printFormulaWithPrec (equivPrec - 1) y
| 130
|
printFormula (Equivalence x y) =
printFormulaWithPrec (equivPrec - 1) x
<+> equiv
<+> printFormulaWithPrec (equivPrec - 1) y
| 130
| false
| false
| 4
| 7
| 23
| 53
| 24
| 29
| null | null |
rueshyna/gogol
|
gogol-storage-transfer/gen/Network/Google/Resource/StorageTransfer/GetGoogleServiceAccount.hs
|
mpl-2.0
|
-- | Upload protocol for media (e.g. \"raw\", \"multipart\").
ggsaUploadProtocol :: Lens' GetGoogleServiceAccount (Maybe Text)
ggsaUploadProtocol
= lens _ggsaUploadProtocol
(\ s a -> s{_ggsaUploadProtocol = a})
| 218
|
ggsaUploadProtocol :: Lens' GetGoogleServiceAccount (Maybe Text)
ggsaUploadProtocol
= lens _ggsaUploadProtocol
(\ s a -> s{_ggsaUploadProtocol = a})
| 156
|
ggsaUploadProtocol
= lens _ggsaUploadProtocol
(\ s a -> s{_ggsaUploadProtocol = a})
| 91
| true
| true
| 0
| 9
| 33
| 48
| 25
| 23
| null | null |
green-haskell/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
monadClassKey = mkPreludeClassUnique 8
| 48
|
monadClassKey = mkPreludeClassUnique 8
| 48
|
monadClassKey = mkPreludeClassUnique 8
| 48
| false
| false
| 0
| 5
| 13
| 9
| 4
| 5
| null | null |
ulricha/dsh
|
src/Database/DSH/CL/Primitives.hs
|
bsd-3-clause
|
exp :: Expr -> Expr
exp = scalarUnOp (L.SUNumOp L.Exp)
| 54
|
exp :: Expr -> Expr
exp = scalarUnOp (L.SUNumOp L.Exp)
| 54
|
exp = scalarUnOp (L.SUNumOp L.Exp)
| 34
| false
| true
| 0
| 8
| 9
| 34
| 15
| 19
| null | null |
TOSPIO/yi
|
src/library/Yi/Buffer/HighLevel.hs
|
gpl-2.0
|
lineStreamB :: Direction -> BufferM [YiString]
lineStreamB dir = fmap rev . R.lines <$> (streamB dir =<< pointB)
where
rev = case dir of
Forward -> id
Backward -> R.reverse
-- | Get the next line of text in the given direction. This returns
-- simply 'Nothing' if there no such line.
| 302
|
lineStreamB :: Direction -> BufferM [YiString]
lineStreamB dir = fmap rev . R.lines <$> (streamB dir =<< pointB)
where
rev = case dir of
Forward -> id
Backward -> R.reverse
-- | Get the next line of text in the given direction. This returns
-- simply 'Nothing' if there no such line.
| 302
|
lineStreamB dir = fmap rev . R.lines <$> (streamB dir =<< pointB)
where
rev = case dir of
Forward -> id
Backward -> R.reverse
-- | Get the next line of text in the given direction. This returns
-- simply 'Nothing' if there no such line.
| 255
| false
| true
| 0
| 8
| 70
| 75
| 38
| 37
| null | null |
basile-henry/hs-ipfs-api
|
src/Network/IPFS/API.hs
|
mit
|
callWithContent :: [String] -- ^ command
-> [(String, String)] -- ^ options [(key, value)]
-> [String] -- ^ arguments (an IPFS path for example)
-> Content -- ^ content to send
-> IPFS ByteString -- ^ Return of a successful API request
callWithContent cmd opts args content =
withEndpoint $ \endpoint -> callWithContentIO endpoint cmd opts args content
| 461
|
callWithContent :: [String] -- ^ command
-> [(String, String)] -- ^ options [(key, value)]
-> [String] -- ^ arguments (an IPFS path for example)
-> Content -- ^ content to send
-> IPFS ByteString
callWithContent cmd opts args content =
withEndpoint $ \endpoint -> callWithContentIO endpoint cmd opts args content
| 415
|
callWithContent cmd opts args content =
withEndpoint $ \endpoint -> callWithContentIO endpoint cmd opts args content
| 120
| true
| true
| 0
| 9
| 166
| 79
| 44
| 35
| null | null |
aszlig/language-javascript
|
src/Language/JavaScript/Pretty/Printer.hs
|
bsd-3-clause
|
rJS :: [JSNode] -> Foo -> Foo
rJS xs foo = foldl' (flip rn) foo xs
| 66
|
rJS :: [JSNode] -> Foo -> Foo
rJS xs foo = foldl' (flip rn) foo xs
| 66
|
rJS xs foo = foldl' (flip rn) foo xs
| 36
| false
| true
| 0
| 7
| 15
| 40
| 20
| 20
| null | null |
xmonad/xmonad-contrib
|
XMonad/Actions/TreeSelect.hs
|
bsd-3-clause
|
-- | Quit without returning anything
cancel :: TreeSelect a (Maybe a)
cancel = return Nothing
| 93
|
cancel :: TreeSelect a (Maybe a)
cancel = return Nothing
| 56
|
cancel = return Nothing
| 23
| true
| true
| 0
| 8
| 15
| 32
| 14
| 18
| null | null |
mrjones/workouts
|
src/Workouts.hs
|
mit
|
jsDate :: Day -> String
jsDate d = formatTime defaultTimeLocale "new Date(%Y, (%m - 1), %e)" d
| 94
|
jsDate :: Day -> String
jsDate d = formatTime defaultTimeLocale "new Date(%Y, (%m - 1), %e)" d
| 94
|
jsDate d = formatTime defaultTimeLocale "new Date(%Y, (%m - 1), %e)" d
| 70
| false
| true
| 0
| 5
| 16
| 25
| 12
| 13
| null | null |
haskell/haddock
|
haddock-api/src/Haddock/Convert.hs
|
bsd-2-clause
|
tcSplitPredFunTyPreserveSynonyms_maybe _ = Nothing
| 50
|
tcSplitPredFunTyPreserveSynonyms_maybe _ = Nothing
| 50
|
tcSplitPredFunTyPreserveSynonyms_maybe _ = Nothing
| 50
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
imalsogreg/arte-ephys
|
tetrode-ephys/src/Data/Map/KDMap.hs
|
gpl-3.0
|
insert _ k a (KDLeaf k' a' d')
| k == k' = KDLeaf k a d'
| otherwise = case dimOrder k k' d' of
LT -> KDBranch k' a' d' (KDLeaf k a (dSucc k d')) KDEmpty
_ -> KDBranch k' a' d' KDEmpty (KDLeaf k a (dSucc k d'))
| 223
|
insert _ k a (KDLeaf k' a' d')
| k == k' = KDLeaf k a d'
| otherwise = case dimOrder k k' d' of
LT -> KDBranch k' a' d' (KDLeaf k a (dSucc k d')) KDEmpty
_ -> KDBranch k' a' d' KDEmpty (KDLeaf k a (dSucc k d'))
| 223
|
insert _ k a (KDLeaf k' a' d')
| k == k' = KDLeaf k a d'
| otherwise = case dimOrder k k' d' of
LT -> KDBranch k' a' d' (KDLeaf k a (dSucc k d')) KDEmpty
_ -> KDBranch k' a' d' KDEmpty (KDLeaf k a (dSucc k d'))
| 223
| false
| false
| 1
| 12
| 64
| 130
| 62
| 68
| null | null |
CulpaBS/wbBach
|
src/Futhark/CodeGen/Backends/SimpleRepresentation.hs
|
bsd-3-clause
|
intTypeToCType Int32 = [C.cty|typename int32_t|]
| 48
|
intTypeToCType Int32 = [C.cty|typename int32_t|]
| 48
|
intTypeToCType Int32 = [C.cty|typename int32_t|]
| 48
| false
| false
| 1
| 6
| 4
| 19
| 9
| 10
| null | null |
orezpraw/gitit2
|
Network/Gitit2.hs
|
gpl-2.0
|
postDeleteR :: HasGitit master => Page -> GH master Html
postDeleteR page = do
user <- requireEditor
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR
| 435
|
postDeleteR :: HasGitit master => Page -> GH master Html
postDeleteR page = do
user <- requireEditor
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR
| 435
|
postDeleteR page = do
user <- requireEditor
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR
| 378
| false
| true
| 0
| 13
| 94
| 158
| 71
| 87
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.