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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Tarrasch/Hong | Fal/Draw.hs | bsd-3-clause | -- [1.6,1.4 .. 0.2]
coloredCircles =
zip [Black, Blue, Green, Cyan, Red, Magenta, Yellow, White]
conCircles | 116 | coloredCircles =
zip [Black, Blue, Green, Cyan, Red, Magenta, Yellow, White]
conCircles | 95 | coloredCircles =
zip [Black, Blue, Green, Cyan, Red, Magenta, Yellow, White]
conCircles | 95 | true | false | 1 | 5 | 24 | 41 | 22 | 19 | null | null |
randen/haddock | haddock-api/src/Haddock/Utils.hs | bsd-2-clause | jsFile, framesFile :: String
jsFile = "haddock-util.js" | 58 | jsFile, framesFile :: String
jsFile = "haddock-util.js" | 58 | jsFile = "haddock-util.js" | 29 | false | true | 2 | 6 | 9 | 24 | 9 | 15 | null | null |
mrehayden1/lji | src/LJI/Args.hs | bsd-3-clause | notes :: String
notes = "Notes:\n"
++ " If OUTPUT already exists the target file is overwritten. "
++ "If OUTPUT is missing, output is sent to the standard output" | 186 | notes :: String
notes = "Notes:\n"
++ " If OUTPUT already exists the target file is overwritten. "
++ "If OUTPUT is missing, output is sent to the standard output" | 186 | notes = "Notes:\n"
++ " If OUTPUT already exists the target file is overwritten. "
++ "If OUTPUT is missing, output is sent to the standard output" | 170 | false | true | 4 | 6 | 52 | 28 | 11 | 17 | null | null |
jhedev/hs-mesos | test/TestFramework.hs | mit | executorSettings fid = e & name ?~ "Test Executor (Haskell)"
where e = executorInfo (ExecutorID "default") fid (T.commandInfo $ ShellCommand "/Users/ian/Code/personal/hs-mesos/dist/build/test-executor/test-executor") requiredResources | 236 | executorSettings fid = e & name ?~ "Test Executor (Haskell)"
where e = executorInfo (ExecutorID "default") fid (T.commandInfo $ ShellCommand "/Users/ian/Code/personal/hs-mesos/dist/build/test-executor/test-executor") requiredResources | 236 | executorSettings fid = e & name ?~ "Test Executor (Haskell)"
where e = executorInfo (ExecutorID "default") fid (T.commandInfo $ ShellCommand "/Users/ian/Code/personal/hs-mesos/dist/build/test-executor/test-executor") requiredResources | 236 | false | false | 0 | 8 | 23 | 52 | 25 | 27 | null | null |
brendanhay/apteryx | apteryx-server/Main.hs | mpl-2.0 | runApp :: Env -> App a -> IO a
runApp e = (`runReaderT` e) . unApp | 66 | runApp :: Env -> App a -> IO a
runApp e = (`runReaderT` e) . unApp | 66 | runApp e = (`runReaderT` e) . unApp | 35 | false | true | 0 | 7 | 15 | 38 | 20 | 18 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/ValidityState.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/ValidityState.valueMissing Mozilla ValidityState.valueMissing documentation>
getValueMissing :: (MonadDOM m) => ValidityState -> m Bool
getValueMissing self
= liftDOM ((self ^. js "valueMissing") >>= valToBool) | 268 | getValueMissing :: (MonadDOM m) => ValidityState -> m Bool
getValueMissing self
= liftDOM ((self ^. js "valueMissing") >>= valToBool) | 135 | getValueMissing self
= liftDOM ((self ^. js "valueMissing") >>= valToBool) | 76 | true | true | 0 | 10 | 27 | 51 | 26 | 25 | null | null |
romanb/amazonka | amazonka-emr/gen/Network/AWS/EMR/Types.hs | mpl-2.0 | -- | The status change reason description.
igscrMessage :: Lens' InstanceGroupStateChangeReason (Maybe Text)
igscrMessage = lens _igscrMessage (\s a -> s { _igscrMessage = a }) | 176 | igscrMessage :: Lens' InstanceGroupStateChangeReason (Maybe Text)
igscrMessage = lens _igscrMessage (\s a -> s { _igscrMessage = a }) | 133 | igscrMessage = lens _igscrMessage (\s a -> s { _igscrMessage = a }) | 67 | true | true | 0 | 9 | 25 | 46 | 25 | 21 | null | null |
liamoc/tea-hs | Tea/Input.hs | bsd-3-clause | sdlKey SDL.SDLK_v = KeyV | 35 | sdlKey SDL.SDLK_v = KeyV | 35 | sdlKey SDL.SDLK_v = KeyV | 35 | false | false | 0 | 6 | 14 | 11 | 5 | 6 | null | null |
duplode/threepenny-gui | src/Graphics/UI/Threepenny/DragNDrop.hs | bsd-3-clause | {-----------------------------------------------------------------------------
Attributes
------------------------------------------------------------------------------}
-- | Enable or disable whether the element can be dragged by the user.
--
-- An element with draggable set to 'True' will receive
-- 'drag', 'dragStart' and 'dragEnd' events.
draggable :: WriteAttr Element Bool
draggable = mkWriteAttr set
where
set v = set' (attr "draggable") $ if v then "true" else "false"
-- | Set the data that is transferred when dragging this element. | 557 | draggable :: WriteAttr Element Bool
draggable = mkWriteAttr set
where
set v = set' (attr "draggable") $ if v then "true" else "false"
-- | Set the data that is transferred when dragging this element. | 208 | draggable = mkWriteAttr set
where
set v = set' (attr "draggable") $ if v then "true" else "false"
-- | Set the data that is transferred when dragging this element. | 172 | true | true | 0 | 8 | 81 | 57 | 31 | 26 | null | null |
rueshyna/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/FloodlightActivities/List.hs | mpl-2.0 | -- | Maximum number of results to return.
falMaxResults :: Lens' FloodlightActivitiesList (Maybe Int32)
falMaxResults
= lens _falMaxResults
(\ s a -> s{_falMaxResults = a})
. mapping _Coerce | 204 | falMaxResults :: Lens' FloodlightActivitiesList (Maybe Int32)
falMaxResults
= lens _falMaxResults
(\ s a -> s{_falMaxResults = a})
. mapping _Coerce | 162 | falMaxResults
= lens _falMaxResults
(\ s a -> s{_falMaxResults = a})
. mapping _Coerce | 100 | true | true | 0 | 10 | 41 | 55 | 28 | 27 | null | null |
KommuSoft/vty-ui | src/Graphics/Vty/Widgets/Limits.hs | bsd-3-clause | addToHLimit :: Widget (HLimit a) -> Int -> IO ()
addToHLimit wRef delta = do
lim <- getHLimit wRef
setHLimit wRef $ lim + delta
-- |Get the vertical limit of a child widget's size. | 185 | addToHLimit :: Widget (HLimit a) -> Int -> IO ()
addToHLimit wRef delta = do
lim <- getHLimit wRef
setHLimit wRef $ lim + delta
-- |Get the vertical limit of a child widget's size. | 185 | addToHLimit wRef delta = do
lim <- getHLimit wRef
setHLimit wRef $ lim + delta
-- |Get the vertical limit of a child widget's size. | 136 | false | true | 0 | 9 | 39 | 63 | 29 | 34 | null | null |
Pnom/haskell-ast-pretty | Test/examples/Attributes.hs | mit | usedByGraphs FontPath{} = True | 40 | usedByGraphs FontPath{} = True | 40 | usedByGraphs FontPath{} = True | 40 | false | false | 0 | 6 | 13 | 13 | 6 | 7 | null | null |
mcschroeder/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | mkParPat :: LPat name -> LPat name
mkParPat lp@(L loc p) | hsPatNeedsParens p = L loc (ParPat lp)
| otherwise = lp | 145 | mkParPat :: LPat name -> LPat name
mkParPat lp@(L loc p) | hsPatNeedsParens p = L loc (ParPat lp)
| otherwise = lp | 145 | mkParPat lp@(L loc p) | hsPatNeedsParens p = L loc (ParPat lp)
| otherwise = lp | 110 | false | true | 0 | 8 | 53 | 64 | 29 | 35 | null | null |
erikd/hs-tls | core/Network/TLS/Handshake/Common.hs | bsd-3-clause | runRecvState :: Context -> RecvState IO -> IO ()
runRecvState _ (RecvStateDone) = return () | 95 | runRecvState :: Context -> RecvState IO -> IO ()
runRecvState _ (RecvStateDone) = return () | 95 | runRecvState _ (RecvStateDone) = return () | 46 | false | true | 0 | 9 | 18 | 44 | 20 | 24 | null | null |
olsner/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | pprPat :: Precedence -> Pat -> Doc
pprPat i (LitP l) = pprLit i l | 69 | pprPat :: Precedence -> Pat -> Doc
pprPat i (LitP l) = pprLit i l | 69 | pprPat i (LitP l) = pprLit i l | 34 | false | true | 0 | 7 | 18 | 35 | 17 | 18 | null | null |
osa1/toylisp | src/Prim.hs | bsd-3-clause | stringp args = errorOrFalse 1 args | 34 | stringp args = errorOrFalse 1 args | 34 | stringp args = errorOrFalse 1 args | 34 | false | false | 1 | 5 | 5 | 17 | 6 | 11 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/ASKSkill.hs | mit | askSkill
:: ASKSkillAuthenticationConfiguration -- ^ 'asksAuthenticationConfiguration'
-> ASKSkillSkillPackage -- ^ 'asksSkillPackage'
-> Val Text -- ^ 'asksVendorId'
-> ASKSkill
askSkill authenticationConfigurationarg skillPackagearg vendorIdarg =
ASKSkill
{ _aSKSkillAuthenticationConfiguration = authenticationConfigurationarg
, _aSKSkillSkillPackage = skillPackagearg
, _aSKSkillVendorId = vendorIdarg
} | 425 | askSkill
:: ASKSkillAuthenticationConfiguration -- ^ 'asksAuthenticationConfiguration'
-> ASKSkillSkillPackage -- ^ 'asksSkillPackage'
-> Val Text -- ^ 'asksVendorId'
-> ASKSkill
askSkill authenticationConfigurationarg skillPackagearg vendorIdarg =
ASKSkill
{ _aSKSkillAuthenticationConfiguration = authenticationConfigurationarg
, _aSKSkillSkillPackage = skillPackagearg
, _aSKSkillVendorId = vendorIdarg
} | 425 | askSkill authenticationConfigurationarg skillPackagearg vendorIdarg =
ASKSkill
{ _aSKSkillAuthenticationConfiguration = authenticationConfigurationarg
, _aSKSkillSkillPackage = skillPackagearg
, _aSKSkillVendorId = vendorIdarg
} | 238 | false | true | 0 | 9 | 55 | 65 | 34 | 31 | null | null |
adept/hledger | hledger-lib/Hledger/Utils/String.hs | gpl-3.0 | whitespacechars = " \t\n\r" | 27 | whitespacechars = " \t\n\r" | 27 | whitespacechars = " \t\n\r" | 27 | false | false | 1 | 5 | 3 | 10 | 3 | 7 | null | null |
Tener/HaNS | src/Network/TCP/LTS/InData.hs | bsd-3-clause | di3_ackstuff seg seqnum acknum seg_win h ourfinisacked =
do sock <- get_sock
let scb = cb_snd sock
if acknum > snd_max scb then return False
else if acknum > snd_una scb
then di3_newackstuff sock seg acknum h ourfinisacked
else di3_oldackstuff sock seg seqnum acknum seg_win h
| 306 | di3_ackstuff seg seqnum acknum seg_win h ourfinisacked =
do sock <- get_sock
let scb = cb_snd sock
if acknum > snd_max scb then return False
else if acknum > snd_una scb
then di3_newackstuff sock seg acknum h ourfinisacked
else di3_oldackstuff sock seg seqnum acknum seg_win h
| 306 | di3_ackstuff seg seqnum acknum seg_win h ourfinisacked =
do sock <- get_sock
let scb = cb_snd sock
if acknum > snd_max scb then return False
else if acknum > snd_una scb
then di3_newackstuff sock seg acknum h ourfinisacked
else di3_oldackstuff sock seg seqnum acknum seg_win h
| 306 | false | false | 0 | 10 | 75 | 98 | 46 | 52 | null | null |
mtlstats/mtlstats | test/ActionsSpec.hs | gpl-3.0 | clearRookiesSpec :: Spec
clearRookiesSpec = describe "clearRookies" $ do
let
players =
[ newPlayer 1 "Joe" "centre" & pRookie .~ True
, newPlayer 2 "Bob" "centre" & pRookie .~ False
]
goalies =
[ newGoalie 3 "Bill" & gRookie .~ True
, newGoalie 4 "Doug" & gRookie .~ False
]
ps = newProgState
& database
%~ (dbPlayers .~ players)
. (dbGoalies .~ goalies)
ps' = clearRookies ps
context "Players" $ mapM_
(\p -> let
name = p^.pName
rFlag = p^.pRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbPlayers)
context "Goalies" $ mapM_
(\g -> let
name = g^.gName
rFlag = g^.gRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbGoalies) | 893 | clearRookiesSpec :: Spec
clearRookiesSpec = describe "clearRookies" $ do
let
players =
[ newPlayer 1 "Joe" "centre" & pRookie .~ True
, newPlayer 2 "Bob" "centre" & pRookie .~ False
]
goalies =
[ newGoalie 3 "Bill" & gRookie .~ True
, newGoalie 4 "Doug" & gRookie .~ False
]
ps = newProgState
& database
%~ (dbPlayers .~ players)
. (dbGoalies .~ goalies)
ps' = clearRookies ps
context "Players" $ mapM_
(\p -> let
name = p^.pName
rFlag = p^.pRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbPlayers)
context "Goalies" $ mapM_
(\g -> let
name = g^.gName
rFlag = g^.gRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbGoalies) | 893 | clearRookiesSpec = describe "clearRookies" $ do
let
players =
[ newPlayer 1 "Joe" "centre" & pRookie .~ True
, newPlayer 2 "Bob" "centre" & pRookie .~ False
]
goalies =
[ newGoalie 3 "Bill" & gRookie .~ True
, newGoalie 4 "Doug" & gRookie .~ False
]
ps = newProgState
& database
%~ (dbPlayers .~ players)
. (dbGoalies .~ goalies)
ps' = clearRookies ps
context "Players" $ mapM_
(\p -> let
name = p^.pName
rFlag = p^.pRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbPlayers)
context "Goalies" $ mapM_
(\g -> let
name = g^.gName
rFlag = g^.gRookie
in context name $
it "should not be a rookie" $
rFlag `shouldBe` False)
(ps'^.database.dbGoalies) | 868 | false | true | 0 | 17 | 299 | 291 | 147 | 144 | null | null |
hvr/ghci-ng | ghc/Main.hs | bsd-3-clause | -- ghc --print-foo
showGhcUsageMode, showGhciUsageMode, showInfoMode :: Mode
showGhcUsageMode = mkPreLoadMode ShowGhcUsage | 123 | showGhcUsageMode, showGhciUsageMode, showInfoMode :: Mode
showGhcUsageMode = mkPreLoadMode ShowGhcUsage | 103 | showGhcUsageMode = mkPreLoadMode ShowGhcUsage | 45 | true | true | 0 | 5 | 12 | 19 | 12 | 7 | null | null |
seL4/capDL-tool | CapDL/ParserUtils.hs | bsd-2-clause | tcb_addr :: MapParser TCBExtraParam
tcb_addr = do
reserved "addr"
colon
n <- number
return $ Addr n | 115 | tcb_addr :: MapParser TCBExtraParam
tcb_addr = do
reserved "addr"
colon
n <- number
return $ Addr n | 115 | tcb_addr = do
reserved "addr"
colon
n <- number
return $ Addr n | 79 | false | true | 0 | 8 | 32 | 40 | 17 | 23 | null | null |
joelburget/haste-compiler | src/Haste/Version.hs | bsd-3-clause | -- | Current Haste version as an Int. The format of this version number is
-- MAJOR*10 000 + MINOR*100 + MICRO.
-- Version 1.2.3 would thus be represented as 10203.
intVersion :: Int
intVersion = foldl (\a x -> a*100+x) 0 ver
where Version ver _ = hasteVersion
-- | The version of GHC used to build this binary. | 318 | intVersion :: Int
intVersion = foldl (\a x -> a*100+x) 0 ver
where Version ver _ = hasteVersion
-- | The version of GHC used to build this binary. | 149 | intVersion = foldl (\a x -> a*100+x) 0 ver
where Version ver _ = hasteVersion
-- | The version of GHC used to build this binary. | 131 | true | true | 0 | 9 | 66 | 52 | 29 | 23 | null | null |
GaloisInc/ivory | ivory-eval/src/Ivory/Eval.hs | bsd-3-clause | numBinOp op (Double x) (Double y) = Double (op x y) | 51 | numBinOp op (Double x) (Double y) = Double (op x y) | 51 | numBinOp op (Double x) (Double y) = Double (op x y) | 51 | false | false | 0 | 7 | 10 | 36 | 17 | 19 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT09.hs | gpl-3.0 | sorted _ = True | 15 | sorted _ = True | 15 | sorted _ = True | 15 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
koengit/cyphy | src/Zelus.hs | mit | -- delay the stream by one step, copying the first value.
-- NOTE: this will not terminate in a loop, you MUST also use |> in that case!
pre :: S a -> S a
pre xs = xs |-> xs | 173 | pre :: S a -> S a
pre xs = xs |-> xs | 36 | pre xs = xs |-> xs | 18 | true | true | 0 | 6 | 40 | 34 | 16 | 18 | null | null |
peterokagey/haskellOEIS | test/Staircase/A282574Spec.hs | apache-2.0 | spec :: Spec
spec = describe "A282574" $
it "correctly computes the first 20 elements" $
take 20 (map a282574 [1..]) `shouldBe` expectedValue where
expectedValue = [1,0,1,3,5,2,3,0,1,7,9,2,3,0,1,6,11,17,1,15] | 220 | spec :: Spec
spec = describe "A282574" $
it "correctly computes the first 20 elements" $
take 20 (map a282574 [1..]) `shouldBe` expectedValue where
expectedValue = [1,0,1,3,5,2,3,0,1,7,9,2,3,0,1,6,11,17,1,15] | 220 | spec = describe "A282574" $
it "correctly computes the first 20 elements" $
take 20 (map a282574 [1..]) `shouldBe` expectedValue where
expectedValue = [1,0,1,3,5,2,3,0,1,7,9,2,3,0,1,6,11,17,1,15] | 207 | false | true | 0 | 10 | 38 | 114 | 68 | 46 | null | null |
duplode/stack | src/Stack/Package.hs | bsd-3-clause | -- | Make the component-specific subdirectory of the build directory.
getBuildComponentDir :: Maybe String -> Maybe (Path Rel Dir)
getBuildComponentDir Nothing = Nothing | 169 | getBuildComponentDir :: Maybe String -> Maybe (Path Rel Dir)
getBuildComponentDir Nothing = Nothing | 99 | getBuildComponentDir Nothing = Nothing | 38 | true | true | 0 | 9 | 22 | 38 | 17 | 21 | null | null |
keithduncan/logplex-statsd | src/Main.hs | mit | application :: Environment -> ScottyT T.Text ConfigM ()
application e = do
middleware (logger e)
defaultHandler (defaultH e)
get "/_ping" $ do
sec <- liftIO getPOSIXTime
let ping = M.fromList [("now", show sec), ("status", "ok")] :: M.Map String String
status ok200
json ping
post "/:app_name/logs" $ do
{-
1. check per-app authentication -> 401 unauthorized
2. check content-type -> 406 not acceptable
3. parse body as application/logplex-1 -> 422 unprocessable
4. map log entry messages
5. parse messages as heroku errors
6. map each error to a statsd client increment action
-}
auth <- checkAuthentication
when auth $ do
app <- param "app_name" :: Action T.Text
logs <- parseLogs
case logs of
Nothing -> return ()
Just l -> do
let errors = rights $ parseHerokuError <$> catMaybes (getMessage <$> l)
let statPrefix = T.unpack app ++ ".heroku.errors"
cluster <- lift (asks metrics)
liftIO $ forM_ errors $ \err ->
let stat = statPrefix ++ "." ++ getCode err
in StatsCluster.increment cluster stat
created
notFound (status status404 >> json A.Null)
-- TODO make this 'throw' an error which is handled in the application to mean
-- unauthenticated | 1,358 | application :: Environment -> ScottyT T.Text ConfigM ()
application e = do
middleware (logger e)
defaultHandler (defaultH e)
get "/_ping" $ do
sec <- liftIO getPOSIXTime
let ping = M.fromList [("now", show sec), ("status", "ok")] :: M.Map String String
status ok200
json ping
post "/:app_name/logs" $ do
{-
1. check per-app authentication -> 401 unauthorized
2. check content-type -> 406 not acceptable
3. parse body as application/logplex-1 -> 422 unprocessable
4. map log entry messages
5. parse messages as heroku errors
6. map each error to a statsd client increment action
-}
auth <- checkAuthentication
when auth $ do
app <- param "app_name" :: Action T.Text
logs <- parseLogs
case logs of
Nothing -> return ()
Just l -> do
let errors = rights $ parseHerokuError <$> catMaybes (getMessage <$> l)
let statPrefix = T.unpack app ++ ".heroku.errors"
cluster <- lift (asks metrics)
liftIO $ forM_ errors $ \err ->
let stat = statPrefix ++ "." ++ getCode err
in StatsCluster.increment cluster stat
created
notFound (status status404 >> json A.Null)
-- TODO make this 'throw' an error which is handled in the application to mean
-- unauthenticated | 1,358 | application e = do
middleware (logger e)
defaultHandler (defaultH e)
get "/_ping" $ do
sec <- liftIO getPOSIXTime
let ping = M.fromList [("now", show sec), ("status", "ok")] :: M.Map String String
status ok200
json ping
post "/:app_name/logs" $ do
{-
1. check per-app authentication -> 401 unauthorized
2. check content-type -> 406 not acceptable
3. parse body as application/logplex-1 -> 422 unprocessable
4. map log entry messages
5. parse messages as heroku errors
6. map each error to a statsd client increment action
-}
auth <- checkAuthentication
when auth $ do
app <- param "app_name" :: Action T.Text
logs <- parseLogs
case logs of
Nothing -> return ()
Just l -> do
let errors = rights $ parseHerokuError <$> catMaybes (getMessage <$> l)
let statPrefix = T.unpack app ++ ".heroku.errors"
cluster <- lift (asks metrics)
liftIO $ forM_ errors $ \err ->
let stat = statPrefix ++ "." ++ getCode err
in StatsCluster.increment cluster stat
created
notFound (status status404 >> json A.Null)
-- TODO make this 'throw' an error which is handled in the application to mean
-- unauthenticated | 1,302 | false | true | 0 | 25 | 398 | 344 | 157 | 187 | null | null |
wavewave/gnuplot | src/Graphics/Gnuplot/Private/Graph2DType.hs | bsd-3-clause | listPoints = Cons "points" | 31 | listPoints = Cons "points" | 31 | listPoints = Cons "points" | 31 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
brendanhay/gogol | gogol-servicenetworking/gen/Network/Google/ServiceNetworking/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Route' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'rNextHopGateway'
--
-- * 'rNetwork'
--
-- * 'rDestRange'
--
-- * 'rName'
route
:: Route
route =
Route'
{ _rNextHopGateway = Nothing
, _rNetwork = Nothing
, _rDestRange = Nothing
, _rName = Nothing
} | 390 | route
:: Route
route =
Route'
{ _rNextHopGateway = Nothing
, _rNetwork = Nothing
, _rDestRange = Nothing
, _rName = Nothing
} | 151 | route =
Route'
{ _rNextHopGateway = Nothing
, _rNetwork = Nothing
, _rDestRange = Nothing
, _rName = Nothing
} | 132 | true | true | 1 | 7 | 94 | 55 | 35 | 20 | null | null |
jseaton/ttasm | Instructions.hs | gpl-3.0 | stage2 ((Ref b):bs) m d = stage2 bs m (d+4) | 46 | stage2 ((Ref b):bs) m d = stage2 bs m (d+4) | 46 | stage2 ((Ref b):bs) m d = stage2 bs m (d+4) | 46 | false | false | 0 | 9 | 12 | 40 | 20 | 20 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_316 (176#) = happyShift action_86 | 40 | action_316 (176#) = happyShift action_86 | 40 | action_316 (176#) = happyShift action_86 | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
brendanhay/gogol | gogol-containeranalysis/gen/Network/Google/ContainerAnalysis/Types/Product.hs | mpl-2.0 | -- | Associates a list of \`members\` to a \`role\`. Optionally, may specify
-- a \`condition\` that determines how and when the \`bindings\` are
-- applied. Each of the \`bindings\` must contain at least one member.
pBindings :: Lens' Policy [Binding]
pBindings
= lens _pBindings (\ s a -> s{_pBindings = a}) .
_Default
. _Coerce | 344 | pBindings :: Lens' Policy [Binding]
pBindings
= lens _pBindings (\ s a -> s{_pBindings = a}) .
_Default
. _Coerce | 127 | pBindings
= lens _pBindings (\ s a -> s{_pBindings = a}) .
_Default
. _Coerce | 91 | true | true | 1 | 10 | 69 | 57 | 30 | 27 | null | null |
EliuX/AdHocParser | src/Text/Parsec/String/Combinator.hs | bsd-3-clause | manyTill :: Parser a -> Parser end -> Parser [a]
manyTill = C.manyTill | 70 | manyTill :: Parser a -> Parser end -> Parser [a]
manyTill = C.manyTill | 70 | manyTill = C.manyTill | 21 | false | true | 0 | 8 | 12 | 33 | 16 | 17 | null | null |
mpkh/Idris-dev | src/IRTS/Lang.hs | bsd-3-clause | usedIn env (LOp f args) = concatMap (usedIn env) args | 53 | usedIn env (LOp f args) = concatMap (usedIn env) args | 53 | usedIn env (LOp f args) = concatMap (usedIn env) args | 53 | false | false | 0 | 7 | 9 | 32 | 14 | 18 | null | null |
balez/ag-zipper | Repmin.hs | gpl-2.0 | repmin :: (TreeC t) => t -> T
repmin t = case tree t of
Leaf n -> leaf (gmin t)
Node x y -> node (repmin x) (repmin y)
-- ** Abstractions
{- Each of the functions above can be generalised into a
useful combinator.
-}
{- Paramorphism are especially useful since they can
depend on inherited attributes.
-} | 313 | repmin :: (TreeC t) => t -> T
repmin t = case tree t of
Leaf n -> leaf (gmin t)
Node x y -> node (repmin x) (repmin y)
-- ** Abstractions
{- Each of the functions above can be generalised into a
useful combinator.
-}
{- Paramorphism are especially useful since they can
depend on inherited attributes.
-} | 313 | repmin t = case tree t of
Leaf n -> leaf (gmin t)
Node x y -> node (repmin x) (repmin y)
-- ** Abstractions
{- Each of the functions above can be generalised into a
useful combinator.
-}
{- Paramorphism are especially useful since they can
depend on inherited attributes.
-} | 283 | false | true | 0 | 10 | 68 | 83 | 41 | 42 | null | null |
DanielWaterworth/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | runIdeSlaveCommand id orig fn mods (IdeSlave.CallsWho n) =
case splitName n of
Left err -> iPrintError err
Right n -> do calls <- callsWho n
ist <- getIState
let msg = (IdeSlave.SymbolAtom "ok",
map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls)
runIO . putStrLn $ IdeSlave.convSExp "return" msg id
where pn ist = displaySpans .
renderPretty 0.9 1000 .
fmap (fancifyAnnots ist) .
prettyName True [] | 564 | runIdeSlaveCommand id orig fn mods (IdeSlave.CallsWho n) =
case splitName n of
Left err -> iPrintError err
Right n -> do calls <- callsWho n
ist <- getIState
let msg = (IdeSlave.SymbolAtom "ok",
map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls)
runIO . putStrLn $ IdeSlave.convSExp "return" msg id
where pn ist = displaySpans .
renderPretty 0.9 1000 .
fmap (fancifyAnnots ist) .
prettyName True [] | 564 | runIdeSlaveCommand id orig fn mods (IdeSlave.CallsWho n) =
case splitName n of
Left err -> iPrintError err
Right n -> do calls <- callsWho n
ist <- getIState
let msg = (IdeSlave.SymbolAtom "ok",
map (\ (n,ns) -> (pn ist n, map (pn ist) ns)) calls)
runIO . putStrLn $ IdeSlave.convSExp "return" msg id
where pn ist = displaySpans .
renderPretty 0.9 1000 .
fmap (fancifyAnnots ist) .
prettyName True [] | 564 | false | false | 0 | 20 | 233 | 196 | 92 | 104 | null | null |
WillSewell/ghc-events-analyze | src/GHC/RTS/Events/Analyze/Reports/Timed/SVG.hs | bsd-3-clause | eventColor _ (EventThread _) = D.blue | 37 | eventColor _ (EventThread _) = D.blue | 37 | eventColor _ (EventThread _) = D.blue | 37 | false | false | 0 | 7 | 5 | 19 | 9 | 10 | null | null |
luqui/tigress | Javascript.hs | bsd-3-clause | query (JSMemberDot pre _ _) = Just $ gvars pre | 46 | query (JSMemberDot pre _ _) = Just $ gvars pre | 46 | query (JSMemberDot pre _ _) = Just $ gvars pre | 46 | false | false | 0 | 6 | 9 | 27 | 12 | 15 | null | null |
juhp/stack | test/integration/tests/3229-exe-targets/Main.hs | bsd-3-clause | expectMessage :: String -> String -> IO ()
expectMessage msg stderr =
unless (msg `isInfixOf` stderr)
(error $ "Expected in output: \n" ++ show msg) | 160 | expectMessage :: String -> String -> IO ()
expectMessage msg stderr =
unless (msg `isInfixOf` stderr)
(error $ "Expected in output: \n" ++ show msg) | 160 | expectMessage msg stderr =
unless (msg `isInfixOf` stderr)
(error $ "Expected in output: \n" ++ show msg) | 117 | false | true | 0 | 8 | 36 | 57 | 29 | 28 | null | null |
michaelochurch/jatek | Games/Ambition.hs | mit | winnerOfTrick :: Suit -> Tup4 Card -> Int
winnerOfTrick ledSuit cards =
maxIndex score cards
where honor = any (\(Card r s) -> r >= jack && s == ledSuit) cards
score c = if (suit c) == ledSuit
then if honor && (rank c) == 2 then 100 else unRank (rank c)
else -100 | 311 | winnerOfTrick :: Suit -> Tup4 Card -> Int
winnerOfTrick ledSuit cards =
maxIndex score cards
where honor = any (\(Card r s) -> r >= jack && s == ledSuit) cards
score c = if (suit c) == ledSuit
then if honor && (rank c) == 2 then 100 else unRank (rank c)
else -100 | 311 | winnerOfTrick ledSuit cards =
maxIndex score cards
where honor = any (\(Card r s) -> r >= jack && s == ledSuit) cards
score c = if (suit c) == ledSuit
then if honor && (rank c) == 2 then 100 else unRank (rank c)
else -100 | 269 | false | true | 2 | 10 | 102 | 145 | 68 | 77 | null | null |
brendanhay/ede | src/Text/EDE/Internal/Filters.hs | mpl-2.0 | lastT = text (Text.singleton . Text.last) | 41 | lastT = text (Text.singleton . Text.last) | 41 | lastT = text (Text.singleton . Text.last) | 41 | false | false | 0 | 8 | 5 | 20 | 10 | 10 | null | null |
diegueins680/myExpertAdvisor | ExpertAdvisor.hs | gpl-2.0 | radToDeg :: Float -> Float
radToDeg rads = rads * 360 / (2 * pi) | 64 | radToDeg :: Float -> Float
radToDeg rads = rads * 360 / (2 * pi) | 64 | radToDeg rads = rads * 360 / (2 * pi) | 37 | false | true | 1 | 8 | 14 | 40 | 18 | 22 | null | null |
ChrisLane/leksah | src/IDE/Workspaces/Writer.hs | gpl-2.0 | workspaceVersion :: Int
workspaceVersion = 2 | 44 | workspaceVersion :: Int
workspaceVersion = 2 | 44 | workspaceVersion = 2 | 20 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
pxqr/regex-fuzzy | src/Text/Regex/Fuzzy/Gen.hs | mit | limitDist :: Dist -> DistFront Char -> Matcher
limitDist maxDist df
| editDist df > maxDist = fail ""
| otherwise = return df | 141 | limitDist :: Dist -> DistFront Char -> Matcher
limitDist maxDist df
| editDist df > maxDist = fail ""
| otherwise = return df | 141 | limitDist maxDist df
| editDist df > maxDist = fail ""
| otherwise = return df | 94 | false | true | 0 | 9 | 39 | 63 | 26 | 37 | null | null |
MaxwellBo/Advent_Of_Code_2016 | Day_15.hs | bsd-3-clause | parseDisc :: String -> Disc
parseDisc xs = (read $ tok !! 11, read $ tok !! 3)
where
tok = splitOn " " . init $ xs | 120 | parseDisc :: String -> Disc
parseDisc xs = (read $ tok !! 11, read $ tok !! 3)
where
tok = splitOn " " . init $ xs | 120 | parseDisc xs = (read $ tok !! 11, read $ tok !! 3)
where
tok = splitOn " " . init $ xs | 92 | false | true | 0 | 7 | 33 | 59 | 30 | 29 | null | null |
batterseapower/chsc | Evaluator/Syntax.hs | bsd-3-clause | annedAltsFreeVars = taggedSizedFVedAltsFreeVars | 47 | annedAltsFreeVars = taggedSizedFVedAltsFreeVars | 47 | annedAltsFreeVars = taggedSizedFVedAltsFreeVars | 47 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
dagit/zenc | Text/Encoding/Z.hs | bsd-3-clause | encode_ch '=' = "ze" | 21 | encode_ch '=' = "ze" | 21 | encode_ch '=' = "ze" | 21 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
holoed/Junior | src/Expr.hs | apache-2.0 | isIfThenElse :: Expr -> Bool
isIfThenElse EIfThenElse {} = True | 63 | isIfThenElse :: Expr -> Bool
isIfThenElse EIfThenElse {} = True | 63 | isIfThenElse EIfThenElse {} = True | 34 | false | true | 0 | 6 | 9 | 22 | 11 | 11 | null | null |
bitemyapp/lets-lens | src/Lets/OpticPolyLens.hs | bsd-3-clause | set ::
Lens s t a b
-> s
-> b
-> t
set (Lens r) a b =
getIdentity (r (const (Identity b)) a) | 102 | set ::
Lens s t a b
-> s
-> b
-> t
set (Lens r) a b =
getIdentity (r (const (Identity b)) a) | 102 | set (Lens r) a b =
getIdentity (r (const (Identity b)) a) | 59 | false | true | 0 | 11 | 34 | 70 | 33 | 37 | null | null |
s9gf4ult/yesod | yesod-core/Yesod/Core/Handler.hs | mit | getMessages :: MonadHandler m => m [(Text, Html)]
getMessages = do
bs <- lookupSessionBS msgKey
let ms = maybe [] enlist bs
deleteSession msgKey
return ms
where
enlist = pairup . S.split W8._nul
pairup [] = []
pairup [_] = []
pairup (s:v:xs) = (decode s, preEscapedToHtml (decode v)) : pairup xs
decode = decodeUtf8With lenientDecode
-- | Calls 'addMessage' with an empty status | 417 | getMessages :: MonadHandler m => m [(Text, Html)]
getMessages = do
bs <- lookupSessionBS msgKey
let ms = maybe [] enlist bs
deleteSession msgKey
return ms
where
enlist = pairup . S.split W8._nul
pairup [] = []
pairup [_] = []
pairup (s:v:xs) = (decode s, preEscapedToHtml (decode v)) : pairup xs
decode = decodeUtf8With lenientDecode
-- | Calls 'addMessage' with an empty status | 417 | getMessages = do
bs <- lookupSessionBS msgKey
let ms = maybe [] enlist bs
deleteSession msgKey
return ms
where
enlist = pairup . S.split W8._nul
pairup [] = []
pairup [_] = []
pairup (s:v:xs) = (decode s, preEscapedToHtml (decode v)) : pairup xs
decode = decodeUtf8With lenientDecode
-- | Calls 'addMessage' with an empty status | 367 | false | true | 0 | 11 | 102 | 167 | 81 | 86 | null | null |
GregorySchwartz/find-clumpiness | app/Main.hs | gpl-3.0 | -- | Get the tree from a Haskell format
haskellFormat :: Options -> HaskellFormat -> IO (Tree NodeLabel)
haskellFormat opts format = do
contents <- case input opts of
Nothing -> getContents
(Just x) -> readFile x
return . makeWork format $ contents
where
makeWork BaseFormat x = makeWorkable (read x :: Tree NodeLabel)
makeWork TreeFormat x = makeWorkable (read x :: Tree (Seq.Seq T.Text))
-- | Get the tree from a JSON format | 498 | haskellFormat :: Options -> HaskellFormat -> IO (Tree NodeLabel)
haskellFormat opts format = do
contents <- case input opts of
Nothing -> getContents
(Just x) -> readFile x
return . makeWork format $ contents
where
makeWork BaseFormat x = makeWorkable (read x :: Tree NodeLabel)
makeWork TreeFormat x = makeWorkable (read x :: Tree (Seq.Seq T.Text))
-- | Get the tree from a JSON format | 458 | haskellFormat opts format = do
contents <- case input opts of
Nothing -> getContents
(Just x) -> readFile x
return . makeWork format $ contents
where
makeWork BaseFormat x = makeWorkable (read x :: Tree NodeLabel)
makeWork TreeFormat x = makeWorkable (read x :: Tree (Seq.Seq T.Text))
-- | Get the tree from a JSON format | 393 | true | true | 0 | 12 | 145 | 155 | 71 | 84 | null | null |
ryantrinkle/ghcjs | Setup.hs | mit | main :: IO ()
main = defaultMainWithHooks ghcjsHooks | 52 | main :: IO ()
main = defaultMainWithHooks ghcjsHooks | 52 | main = defaultMainWithHooks ghcjsHooks | 38 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
kmein/yes-we-scan | YesWeScan/DomainName.hs | mit | topLevelDomain :: String -> String
topLevelDomain url =
case splitTld url of
Just (_,_,tld) -> tld
Nothing -> error "Invalid URI provided." | 155 | topLevelDomain :: String -> String
topLevelDomain url =
case splitTld url of
Just (_,_,tld) -> tld
Nothing -> error "Invalid URI provided." | 155 | topLevelDomain url =
case splitTld url of
Just (_,_,tld) -> tld
Nothing -> error "Invalid URI provided." | 120 | false | true | 0 | 9 | 37 | 57 | 27 | 30 | null | null |
martinra/hlinear | src/HLinear/Hook/LeftTransformation/Basic.hs | gpl-3.0 | diagonal :: AdditiveMonoid a => Vector (Unit a) -> LeftTransformation a
diagonal ds =
let nrs = V.length ds
in LeftTransformation nrs $ (`V.imap` ds) $ \ix d ->
LeftTransformationColumn ix d $
V.replicate (nrs-ix-1) zero | 243 | diagonal :: AdditiveMonoid a => Vector (Unit a) -> LeftTransformation a
diagonal ds =
let nrs = V.length ds
in LeftTransformation nrs $ (`V.imap` ds) $ \ix d ->
LeftTransformationColumn ix d $
V.replicate (nrs-ix-1) zero | 243 | diagonal ds =
let nrs = V.length ds
in LeftTransformation nrs $ (`V.imap` ds) $ \ix d ->
LeftTransformationColumn ix d $
V.replicate (nrs-ix-1) zero | 171 | false | true | 0 | 13 | 58 | 106 | 52 | 54 | null | null |
tel/saltine | src/Crypto/Saltine/Core/Password.hs | mit | opslimit :: Algorithm -> Int -> Maybe Opslimit
opslimit alg x
| Opslimit x < minOpslimit alg = Nothing
| Opslimit x > maxOpslimit alg = Nothing
| otherwise = Just (Opslimit x) | 181 | opslimit :: Algorithm -> Int -> Maybe Opslimit
opslimit alg x
| Opslimit x < minOpslimit alg = Nothing
| Opslimit x > maxOpslimit alg = Nothing
| otherwise = Just (Opslimit x) | 181 | opslimit alg x
| Opslimit x < minOpslimit alg = Nothing
| Opslimit x > maxOpslimit alg = Nothing
| otherwise = Just (Opslimit x) | 134 | false | true | 1 | 9 | 38 | 80 | 36 | 44 | null | null |
bitemyapp/formatting | src/Formatting/Time.hs | bsd-3-clause | -- | Last two digits of year, @00@ - @99@.
yy :: FormatTime a => Format r (a -> r)
yy = later (build . fmt "%y") | 112 | yy :: FormatTime a => Format r (a -> r)
yy = later (build . fmt "%y") | 69 | yy = later (build . fmt "%y") | 29 | true | true | 0 | 9 | 26 | 50 | 23 | 27 | null | null |
sordina/wai | wai/Network/Wai.hs | bsd-2-clause | -- | Accessing 'H.ResponseHeaders' in 'Response'.
responseHeaders :: Response -> H.ResponseHeaders
responseHeaders (ResponseFile _ hs _ _) = hs | 146 | responseHeaders :: Response -> H.ResponseHeaders
responseHeaders (ResponseFile _ hs _ _) = hs | 96 | responseHeaders (ResponseFile _ hs _ _) = hs | 47 | true | true | 0 | 6 | 21 | 37 | 18 | 19 | null | null |
mightymoose/liquidhaskell | benchmarks/bytestring-0.9.2.1/Data/ByteString/LazyZip.hs | bsd-3-clause | zipWith _ _ Empty = [] | 27 | zipWith _ _ Empty = [] | 27 | zipWith _ _ Empty = [] | 27 | false | false | 1 | 6 | 10 | 15 | 6 | 9 | null | null |
three/codeworld | codeworld-server/src/Main.hs | apache-2.0 | shareContentHandler :: ClientId -> Snap ()
shareContentHandler clientId = do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <- liftIO $ B.readFile (shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
user <- getUser clientId
Just name <- getParam "name"
let dirPath = dirBase $ nameToDirId $ T.decodeUtf8 name
liftIO $ ensureUserBaseDir mode (userId user) dirPath
liftIO $ copyDirIfExists (BC.unpack sharingFolder) $ userProjectDir mode (userId user) </> dirPath
liftIO $ B.writeFile (userProjectDir mode (userId user) </> dirPath </> "dir.info") name | 618 | shareContentHandler :: ClientId -> Snap ()
shareContentHandler clientId = do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <- liftIO $ B.readFile (shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
user <- getUser clientId
Just name <- getParam "name"
let dirPath = dirBase $ nameToDirId $ T.decodeUtf8 name
liftIO $ ensureUserBaseDir mode (userId user) dirPath
liftIO $ copyDirIfExists (BC.unpack sharingFolder) $ userProjectDir mode (userId user) </> dirPath
liftIO $ B.writeFile (userProjectDir mode (userId user) </> dirPath </> "dir.info") name | 618 | shareContentHandler clientId = do
mode <- getBuildMode
Just shash <- getParam "shash"
sharingFolder <- liftIO $ B.readFile (shareRootDir mode </> shareLink (ShareId $ T.decodeUtf8 shash))
user <- getUser clientId
Just name <- getParam "name"
let dirPath = dirBase $ nameToDirId $ T.decodeUtf8 name
liftIO $ ensureUserBaseDir mode (userId user) dirPath
liftIO $ copyDirIfExists (BC.unpack sharingFolder) $ userProjectDir mode (userId user) </> dirPath
liftIO $ B.writeFile (userProjectDir mode (userId user) </> dirPath </> "dir.info") name | 575 | false | true | 0 | 16 | 115 | 222 | 100 | 122 | null | null |
wavewave/lhc-analysis-collection | heavyhiggs/lhcoparser.hs | gpl-3.0 | printer :: (MonadIO m, Show a) => Pipe a a m r
printer = do x <- await
liftIO $ (print x)
printer | 125 | printer :: (MonadIO m, Show a) => Pipe a a m r
printer = do x <- await
liftIO $ (print x)
printer | 125 | printer = do x <- await
liftIO $ (print x)
printer | 78 | false | true | 0 | 9 | 50 | 58 | 28 | 30 | null | null |
christiaanb/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f } | 66 | ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f } | 66 | ibc i (IBCSyntax n) f = return f { ibc_syntax = n : ibc_syntax f } | 66 | false | false | 1 | 9 | 15 | 46 | 19 | 27 | null | null |
phasedchirp/chirpy-learning | app/Main.hs | bsd-3-clause | isVowel :: Char -> Bool
isVowel x = x `elem` ("aiueo"::[Char]) | 62 | isVowel :: Char -> Bool
isVowel x = x `elem` ("aiueo"::[Char]) | 62 | isVowel x = x `elem` ("aiueo"::[Char]) | 38 | false | true | 0 | 7 | 10 | 33 | 19 | 14 | null | null |
sopvop/cabal | Cabal/Distribution/Simple/PackageIndex.hs | bsd-3-clause | insert :: HasUnitId a => a -> PackageIndex a -> PackageIndex a
insert pkg (PackageIndex pids pnames) =
mkPackageIndex pids' pnames'
where
pids' = Map.insert (installedUnitId pkg) pkg pids
pnames' = insertPackageName pnames
insertPackageName =
Map.insertWith' (\_ -> insertPackageVersion)
(packageName pkg)
(Map.singleton (packageVersion pkg) [pkg])
insertPackageVersion =
Map.insertWith' (\_ -> insertPackageInstance)
(packageVersion pkg) [pkg]
insertPackageInstance pkgs =
pkg : deleteBy (equating installedUnitId) pkg pkgs
-- | Removes a single installed package from the index.
-- | 697 | insert :: HasUnitId a => a -> PackageIndex a -> PackageIndex a
insert pkg (PackageIndex pids pnames) =
mkPackageIndex pids' pnames'
where
pids' = Map.insert (installedUnitId pkg) pkg pids
pnames' = insertPackageName pnames
insertPackageName =
Map.insertWith' (\_ -> insertPackageVersion)
(packageName pkg)
(Map.singleton (packageVersion pkg) [pkg])
insertPackageVersion =
Map.insertWith' (\_ -> insertPackageInstance)
(packageVersion pkg) [pkg]
insertPackageInstance pkgs =
pkg : deleteBy (equating installedUnitId) pkg pkgs
-- | Removes a single installed package from the index.
-- | 697 | insert pkg (PackageIndex pids pnames) =
mkPackageIndex pids' pnames'
where
pids' = Map.insert (installedUnitId pkg) pkg pids
pnames' = insertPackageName pnames
insertPackageName =
Map.insertWith' (\_ -> insertPackageVersion)
(packageName pkg)
(Map.singleton (packageVersion pkg) [pkg])
insertPackageVersion =
Map.insertWith' (\_ -> insertPackageInstance)
(packageVersion pkg) [pkg]
insertPackageInstance pkgs =
pkg : deleteBy (equating installedUnitId) pkg pkgs
-- | Removes a single installed package from the index.
-- | 634 | false | true | 2 | 9 | 188 | 192 | 95 | 97 | null | null |
qrilka/xlsx | src/Codec/Xlsx/Lens.hs | mit | -- | lens to access cell in a worksheet
ixCellRC :: (Int, Int) -> Traversal' Worksheet Cell
ixCellRC i = wsCells . ix i | 119 | ixCellRC :: (Int, Int) -> Traversal' Worksheet Cell
ixCellRC i = wsCells . ix i | 79 | ixCellRC i = wsCells . ix i | 27 | true | true | 0 | 6 | 23 | 37 | 19 | 18 | null | null |
ku-fpg/kansas-amber | legacy/Parts/LCD.hs | bsd-3-clause | -- | Convert a command to a data-word
getCmdVal :: LCDController -> Cmd -> Word8
getCmdVal c cmd = get cmd
where multiLine -- bit 3
| (lcdRows c) > 1 = 0x08 :: Word8
| True = 0x00 :: Word8
dotMode -- bit 2
| (dotMode5x10 c) = 0x04 :: Word8
| True = 0x00 :: Word8
displayFunction = multiLine .|. dotMode
get LCD_NOOP = 0x00
get LCD_INITIALIZE = 0x33
get LCD_INITIALIZE_END = 0x32
get LCD_FUNCTIONSET = 0x20 .|. displayFunction
get (LCD_DISPLAYCONTROL w) = 0x08 .|. w
get LCD_CLEARDISPLAY = 0x01
get (LCD_ENTRYMODESET w) = 0x04 .|. w
get LCD_RETURNHOME = 0x02
get (LCD_SETDDRAMADDR w) = 0x80 .|. w
get (LCD_CURSORSHIFT w) = 0x10 .|. 0x08 .|. w -- NB. LCD_DISPLAYMOVE (0x08) hard coded here
get (LCD_SETCGRAMADDR w) = 0x40 .|. w `shiftL` 3
-- | Initialize the LCD. Follows the data sheet <http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf>,
-- page 46; figure 24. | 1,084 | getCmdVal :: LCDController -> Cmd -> Word8
getCmdVal c cmd = get cmd
where multiLine -- bit 3
| (lcdRows c) > 1 = 0x08 :: Word8
| True = 0x00 :: Word8
dotMode -- bit 2
| (dotMode5x10 c) = 0x04 :: Word8
| True = 0x00 :: Word8
displayFunction = multiLine .|. dotMode
get LCD_NOOP = 0x00
get LCD_INITIALIZE = 0x33
get LCD_INITIALIZE_END = 0x32
get LCD_FUNCTIONSET = 0x20 .|. displayFunction
get (LCD_DISPLAYCONTROL w) = 0x08 .|. w
get LCD_CLEARDISPLAY = 0x01
get (LCD_ENTRYMODESET w) = 0x04 .|. w
get LCD_RETURNHOME = 0x02
get (LCD_SETDDRAMADDR w) = 0x80 .|. w
get (LCD_CURSORSHIFT w) = 0x10 .|. 0x08 .|. w -- NB. LCD_DISPLAYMOVE (0x08) hard coded here
get (LCD_SETCGRAMADDR w) = 0x40 .|. w `shiftL` 3
-- | Initialize the LCD. Follows the data sheet <http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf>,
-- page 46; figure 24. | 1,046 | getCmdVal c cmd = get cmd
where multiLine -- bit 3
| (lcdRows c) > 1 = 0x08 :: Word8
| True = 0x00 :: Word8
dotMode -- bit 2
| (dotMode5x10 c) = 0x04 :: Word8
| True = 0x00 :: Word8
displayFunction = multiLine .|. dotMode
get LCD_NOOP = 0x00
get LCD_INITIALIZE = 0x33
get LCD_INITIALIZE_END = 0x32
get LCD_FUNCTIONSET = 0x20 .|. displayFunction
get (LCD_DISPLAYCONTROL w) = 0x08 .|. w
get LCD_CLEARDISPLAY = 0x01
get (LCD_ENTRYMODESET w) = 0x04 .|. w
get LCD_RETURNHOME = 0x02
get (LCD_SETDDRAMADDR w) = 0x80 .|. w
get (LCD_CURSORSHIFT w) = 0x10 .|. 0x08 .|. w -- NB. LCD_DISPLAYMOVE (0x08) hard coded here
get (LCD_SETCGRAMADDR w) = 0x40 .|. w `shiftL` 3
-- | Initialize the LCD. Follows the data sheet <http://lcd-linux.sourceforge.net/pdfdocs/hd44780.pdf>,
-- page 46; figure 24. | 1,003 | true | true | 2 | 10 | 370 | 285 | 139 | 146 | null | null |
shayan-najd/MiniLava | Lava/Library/Operators.hs | bsd-3-clause | nor2 :: Signal Bool -> Signal Bool -> Signal Bool
nor2 x y = inv (or2 x y) | 74 | nor2 :: Signal Bool -> Signal Bool -> Signal Bool
nor2 x y = inv (or2 x y) | 74 | nor2 x y = inv (or2 x y) | 24 | false | true | 0 | 7 | 17 | 44 | 20 | 24 | null | null |
d0kt0r0/Tidal | src/Sound/Tidal/old/Stream.hs | gpl-3.0 | logicalOnset' change tick o offset = logicalNow + (logicalPeriod * o) + offset
where
tpc = fromIntegral ticksPerCycle
cycleD = ((fromIntegral tick) / tpc) :: Double
logicalNow = logicalTime change cycleD
logicalPeriod = (logicalTime change (cycleD + (1/tpc))) - logicalNow | 290 | logicalOnset' change tick o offset = logicalNow + (logicalPeriod * o) + offset
where
tpc = fromIntegral ticksPerCycle
cycleD = ((fromIntegral tick) / tpc) :: Double
logicalNow = logicalTime change cycleD
logicalPeriod = (logicalTime change (cycleD + (1/tpc))) - logicalNow | 290 | logicalOnset' change tick o offset = logicalNow + (logicalPeriod * o) + offset
where
tpc = fromIntegral ticksPerCycle
cycleD = ((fromIntegral tick) / tpc) :: Double
logicalNow = logicalTime change cycleD
logicalPeriod = (logicalTime change (cycleD + (1/tpc))) - logicalNow | 290 | false | false | 0 | 11 | 57 | 103 | 54 | 49 | null | null |
mightymoose/liquidhaskell | tests/todo/ptr.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
{-@ foldl :: (a -> Word8 -> a) -> a -> ByteString -> a @-}
foldl :: (a -> Word8 -> a) -> a -> ByteString -> a
foldl f v (PS x s l) = inlinePerformIO $ withForeignPtr x $ \ptr ->
lgo v (ptr `plusPtr` s) (ptr `plusPtr` (s+l))
where
STRICT3(lgo)
lgo z p q | eqPtr p q = return z
| otherwise = do c <- peek p
lgo (f z c) (p `plusPtr` 1) q
| 501 | foldl :: (a -> Word8 -> a) -> a -> ByteString -> a
foldl f v (PS x s l) = inlinePerformIO $ withForeignPtr x $ \ptr ->
lgo v (ptr `plusPtr` s) (ptr `plusPtr` (s+l))
where
STRICT3(lgo)
lgo z p q | eqPtr p q = return z
| otherwise = do c <- peek p
lgo (f z c) (p `plusPtr` 1) q
| 360 | foldl f v (PS x s l) = inlinePerformIO $ withForeignPtr x $ \ptr ->
lgo v (ptr `plusPtr` s) (ptr `plusPtr` (s+l))
where
STRICT3(lgo)
lgo z p q | eqPtr p q = return z
| otherwise = do c <- peek p
lgo (f z c) (p `plusPtr` 1) q
| 309 | true | true | 0 | 11 | 167 | 186 | 94 | 92 | null | null |
vincenthz/hs-xyz-test | Core/Vector/Boxed.hs | bsd-3-clause | freezeUntilIndex :: PrimMonad prim => MVector ty (PrimState prim) -> Int -> prim (Vector ty)
freezeUntilIndex mvec d = do
m <- new d
copyAt m 0 mvec 0 d
unsafeFreeze m | 179 | freezeUntilIndex :: PrimMonad prim => MVector ty (PrimState prim) -> Int -> prim (Vector ty)
freezeUntilIndex mvec d = do
m <- new d
copyAt m 0 mvec 0 d
unsafeFreeze m | 179 | freezeUntilIndex mvec d = do
m <- new d
copyAt m 0 mvec 0 d
unsafeFreeze m | 86 | false | true | 0 | 10 | 43 | 81 | 36 | 45 | null | null |
jepst/CloudHaskell | examples/kmeans/KMeans3.hs | bsd-3-clause | mrMapper :: (Promise [Promise Vector], [Cluster]) -> TaskM [(ClusterId, Promise Vector)]
mrMapper (ppoints,clusters) =
do points <- readPromise ppoints
tsay $ "mapping "++show (length points)++" points and "++show (length clusters)++" clusters"
mapM (assign (map (\c -> (clId c,clusterCenter c)) clusters)) points
where assign clusters point =
let distances point = map (\(clid,center) -> (clid,sqDistance center point)) clusters
assignment point = fst $ minimumBy (\(_,a) (_,b) -> compare a b) (distances point)
in do vp <- readPromise point
vp `seq` return (assignment vp,point) | 653 | mrMapper :: (Promise [Promise Vector], [Cluster]) -> TaskM [(ClusterId, Promise Vector)]
mrMapper (ppoints,clusters) =
do points <- readPromise ppoints
tsay $ "mapping "++show (length points)++" points and "++show (length clusters)++" clusters"
mapM (assign (map (\c -> (clId c,clusterCenter c)) clusters)) points
where assign clusters point =
let distances point = map (\(clid,center) -> (clid,sqDistance center point)) clusters
assignment point = fst $ minimumBy (\(_,a) (_,b) -> compare a b) (distances point)
in do vp <- readPromise point
vp `seq` return (assignment vp,point) | 653 | mrMapper (ppoints,clusters) =
do points <- readPromise ppoints
tsay $ "mapping "++show (length points)++" points and "++show (length clusters)++" clusters"
mapM (assign (map (\c -> (clId c,clusterCenter c)) clusters)) points
where assign clusters point =
let distances point = map (\(clid,center) -> (clid,sqDistance center point)) clusters
assignment point = fst $ minimumBy (\(_,a) (_,b) -> compare a b) (distances point)
in do vp <- readPromise point
vp `seq` return (assignment vp,point) | 564 | false | true | 0 | 15 | 154 | 287 | 146 | 141 | null | null |
atupal/xmonad-mirror | xmonad/src/XMonad/Core.hs | mit | -- | True if the given window is the root window
isRoot :: Window -> X Bool
isRoot w = (w==) <$> asks theRoot | 109 | isRoot :: Window -> X Bool
isRoot w = (w==) <$> asks theRoot | 60 | isRoot w = (w==) <$> asks theRoot | 33 | true | true | 0 | 6 | 23 | 33 | 17 | 16 | null | null |
ankhers/haskell-ide-engine | src/Haskell/Ide/Engine/Dispatcher.hs | bsd-3-clause | checkParams :: (ValidResponse a) => [ParamDescription] -> ParamMap -> Either (IdeResponse a) [()]
checkParams pds params = mapEithers checkOne pds
where
checkOne :: (ValidResponse a)
=> ParamDescription -> Either (IdeResponse a) ()
checkOne (ParamDesc pn _ph pt Optional) = checkParamOP pn pt
checkOne (ParamDesc pn _ph pt Required) = checkParamRP pn pt
checkParamOP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamOP pn pt =
case Map.lookup pn params of
Nothing -> Right ()
Just p -> checkParamMatch pn pt p
checkParamRP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamRP pn pt =
case Map.lookup pn params of
Nothing -> Left $ missingParameter pn
Just p -> checkParamMatch pn pt p
checkParamMatch :: (ValidResponse a)
=> T.Text -> ParamType -> ParamValP -> Either (IdeResponse a) ()
checkParamMatch pn' pt' p' =
if paramMatches pt' p'
then Right ()
else Left $ incorrectParameter pn' pt' p'
paramMatches :: ParamType -> ParamValP -> Bool
paramMatches PtText (ParamTextP _) = True
paramMatches PtFile (ParamFileP _) = True
paramMatches PtPos (ParamPosP _) = True
paramMatches _ _ = False | 1,376 | checkParams :: (ValidResponse a) => [ParamDescription] -> ParamMap -> Either (IdeResponse a) [()]
checkParams pds params = mapEithers checkOne pds
where
checkOne :: (ValidResponse a)
=> ParamDescription -> Either (IdeResponse a) ()
checkOne (ParamDesc pn _ph pt Optional) = checkParamOP pn pt
checkOne (ParamDesc pn _ph pt Required) = checkParamRP pn pt
checkParamOP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamOP pn pt =
case Map.lookup pn params of
Nothing -> Right ()
Just p -> checkParamMatch pn pt p
checkParamRP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamRP pn pt =
case Map.lookup pn params of
Nothing -> Left $ missingParameter pn
Just p -> checkParamMatch pn pt p
checkParamMatch :: (ValidResponse a)
=> T.Text -> ParamType -> ParamValP -> Either (IdeResponse a) ()
checkParamMatch pn' pt' p' =
if paramMatches pt' p'
then Right ()
else Left $ incorrectParameter pn' pt' p'
paramMatches :: ParamType -> ParamValP -> Bool
paramMatches PtText (ParamTextP _) = True
paramMatches PtFile (ParamFileP _) = True
paramMatches PtPos (ParamPosP _) = True
paramMatches _ _ = False | 1,376 | checkParams pds params = mapEithers checkOne pds
where
checkOne :: (ValidResponse a)
=> ParamDescription -> Either (IdeResponse a) ()
checkOne (ParamDesc pn _ph pt Optional) = checkParamOP pn pt
checkOne (ParamDesc pn _ph pt Required) = checkParamRP pn pt
checkParamOP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamOP pn pt =
case Map.lookup pn params of
Nothing -> Right ()
Just p -> checkParamMatch pn pt p
checkParamRP :: (ValidResponse a)
=> ParamId -> ParamType -> Either (IdeResponse a) ()
checkParamRP pn pt =
case Map.lookup pn params of
Nothing -> Left $ missingParameter pn
Just p -> checkParamMatch pn pt p
checkParamMatch :: (ValidResponse a)
=> T.Text -> ParamType -> ParamValP -> Either (IdeResponse a) ()
checkParamMatch pn' pt' p' =
if paramMatches pt' p'
then Right ()
else Left $ incorrectParameter pn' pt' p'
paramMatches :: ParamType -> ParamValP -> Bool
paramMatches PtText (ParamTextP _) = True
paramMatches PtFile (ParamFileP _) = True
paramMatches PtPos (ParamPosP _) = True
paramMatches _ _ = False | 1,278 | false | true | 0 | 11 | 400 | 462 | 228 | 234 | null | null |
xnil/ply | src/Interpreter.hs | mit | eval f (AST.Cons car cdr) = apply fn args
where fn :: AST.Function
fn = case eval f car of
(_, (AST.Atom (AST.Function fn))) -> fn
_ -> error "Arguments cannot be applied to non-function expression."
args :: AST.Expr
args = case eval f cdr of
(_, expr) -> expr | 331 | eval f (AST.Cons car cdr) = apply fn args
where fn :: AST.Function
fn = case eval f car of
(_, (AST.Atom (AST.Function fn))) -> fn
_ -> error "Arguments cannot be applied to non-function expression."
args :: AST.Expr
args = case eval f cdr of
(_, expr) -> expr | 331 | eval f (AST.Cons car cdr) = apply fn args
where fn :: AST.Function
fn = case eval f car of
(_, (AST.Atom (AST.Function fn))) -> fn
_ -> error "Arguments cannot be applied to non-function expression."
args :: AST.Expr
args = case eval f cdr of
(_, expr) -> expr | 331 | false | false | 5 | 13 | 120 | 120 | 61 | 59 | null | null |
mettekou/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | ltDataCon, eqDataCon, gtDataCon :: DataCon
ltDataCon = pcDataCon ltDataConName [] [] orderingTyCon | 99 | ltDataCon, eqDataCon, gtDataCon :: DataCon
ltDataCon = pcDataCon ltDataConName [] [] orderingTyCon | 99 | ltDataCon = pcDataCon ltDataConName [] [] orderingTyCon | 56 | false | true | 0 | 6 | 12 | 28 | 16 | 12 | null | null |
michaelgwelch/bacnet | src/BACnet/Reader.hs | mit | readNullAP :: Reader ()
readNullAP = void readNullAPTag | 55 | readNullAP :: Reader ()
readNullAP = void readNullAPTag | 55 | readNullAP = void readNullAPTag | 31 | false | true | 0 | 7 | 7 | 25 | 10 | 15 | null | null |
Peaker/lamdu | src/Lamdu/GUI/Annotation.hs | gpl-3.0 | getAnnotationMode ::
Monad i =>
EvalAnnotationOptions -> Sugar.EvaluationScopes name i ->
GuiM env i o (Maybe (EvalResDisplay name, Maybe (NeighborVals (Maybe (EvalResDisplay name)))))
getAnnotationMode opt ann =
do
neighbourVals <-
case opt of
NormalEvalAnnotation -> pure Nothing
WithNeighbouringEvalAnnotations neighbors ->
-- neighbors <&> (>>= valOfScopePreferCur ann . (^. Sugar.bParamScopeId))
-- & Just
neighbors & traverse . Lens._Just %%~
GuiM.im . valOfScopePreferCur ann . (^. Sugar.bParamScopeId)
<&> traverse %~ join
<&> Just
GuiM.readMScopeId
>>= GuiM.im . valOfScope ann
<&> Lens.mapped %~ (, neighbourVals) | 815 | getAnnotationMode ::
Monad i =>
EvalAnnotationOptions -> Sugar.EvaluationScopes name i ->
GuiM env i o (Maybe (EvalResDisplay name, Maybe (NeighborVals (Maybe (EvalResDisplay name)))))
getAnnotationMode opt ann =
do
neighbourVals <-
case opt of
NormalEvalAnnotation -> pure Nothing
WithNeighbouringEvalAnnotations neighbors ->
-- neighbors <&> (>>= valOfScopePreferCur ann . (^. Sugar.bParamScopeId))
-- & Just
neighbors & traverse . Lens._Just %%~
GuiM.im . valOfScopePreferCur ann . (^. Sugar.bParamScopeId)
<&> traverse %~ join
<&> Just
GuiM.readMScopeId
>>= GuiM.im . valOfScope ann
<&> Lens.mapped %~ (, neighbourVals) | 815 | getAnnotationMode opt ann =
do
neighbourVals <-
case opt of
NormalEvalAnnotation -> pure Nothing
WithNeighbouringEvalAnnotations neighbors ->
-- neighbors <&> (>>= valOfScopePreferCur ann . (^. Sugar.bParamScopeId))
-- & Just
neighbors & traverse . Lens._Just %%~
GuiM.im . valOfScopePreferCur ann . (^. Sugar.bParamScopeId)
<&> traverse %~ join
<&> Just
GuiM.readMScopeId
>>= GuiM.im . valOfScope ann
<&> Lens.mapped %~ (, neighbourVals) | 618 | false | true | 0 | 18 | 273 | 191 | 94 | 97 | null | null |
tjakway/ghcjvm | compiler/prelude/PrelNames.hs | bsd-3-clause | fingerprintDataConName :: Name
fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 131 | fingerprintDataConName :: Name
fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 131 | fingerprintDataConName =
dcQual gHC_FINGERPRINT_TYPE (fsLit "Fingerprint") fingerprintDataConKey | 100 | false | true | 0 | 7 | 13 | 24 | 12 | 12 | null | null |
christiaanb/clash-tryout | src/CLaSH/Util/Core/Tools.hs | bsd-3-clause | isPoly expr = (Maybe.isJust . Type.splitForAllTy_maybe . getTypeFail) expr | 86 | isPoly expr = (Maybe.isJust . Type.splitForAllTy_maybe . getTypeFail) expr | 86 | isPoly expr = (Maybe.isJust . Type.splitForAllTy_maybe . getTypeFail) expr | 86 | false | false | 0 | 9 | 20 | 27 | 13 | 14 | null | null |
urbanslug/ghc | compiler/nativeGen/Dwarf/Types.hs | bsd-3-clause | -- | Generate code for setting the unwind information for a register,
-- optimized using its known old value in the table. Note that "Sp" is
-- special: We see it as synonym for the CFA.
pprSetUnwind :: Platform -> GlobalReg -> (Maybe UnwindExpr, UnwindExpr) -> SDoc
pprSetUnwind _ Sp (Just (UwReg s _), UwReg s' o') | s == s'
= if o' >= 0
then pprByte dW_CFA_def_cfa_offset $$ pprLEBWord (fromIntegral o')
else pprByte dW_CFA_def_cfa_offset_sf $$ pprLEBInt o' | 473 | pprSetUnwind :: Platform -> GlobalReg -> (Maybe UnwindExpr, UnwindExpr) -> SDoc
pprSetUnwind _ Sp (Just (UwReg s _), UwReg s' o') | s == s'
= if o' >= 0
then pprByte dW_CFA_def_cfa_offset $$ pprLEBWord (fromIntegral o')
else pprByte dW_CFA_def_cfa_offset_sf $$ pprLEBInt o' | 286 | pprSetUnwind _ Sp (Just (UwReg s _), UwReg s' o') | s == s'
= if o' >= 0
then pprByte dW_CFA_def_cfa_offset $$ pprLEBWord (fromIntegral o')
else pprByte dW_CFA_def_cfa_offset_sf $$ pprLEBInt o' | 206 | true | true | 0 | 10 | 91 | 112 | 56 | 56 | null | null |
forste/haReFork | tools/base/lib/AccList.hs | bsd-3-clause | accList acc (x:xs) ans = accList acc xs (acc x ans) | 51 | accList acc (x:xs) ans = accList acc xs (acc x ans) | 51 | accList acc (x:xs) ans = accList acc xs (acc x ans) | 51 | false | false | 0 | 7 | 10 | 35 | 17 | 18 | null | null |
sandrolovnicki/lambda-calculus-interpreter | src/Helper.hs | mit | isDefined ((v, e) : rest) s
| v == s = True
| otherwise = isDefined rest s | 78 | isDefined ((v, e) : rest) s
| v == s = True
| otherwise = isDefined rest s | 78 | isDefined ((v, e) : rest) s
| v == s = True
| otherwise = isDefined rest s | 78 | false | false | 0 | 8 | 21 | 55 | 25 | 30 | null | null |
DougBurke/swish | tests/RDFProofTest.hs | lgpl-2.1 | query22str :: B.Builder
query22str =
mconcat
[ prefix2
, "?a rel:son ?b . \n"
, "?b rel:son ?c . \n"
] | 113 | query22str :: B.Builder
query22str =
mconcat
[ prefix2
, "?a rel:son ?b . \n"
, "?b rel:son ?c . \n"
] | 113 | query22str =
mconcat
[ prefix2
, "?a rel:son ?b . \n"
, "?b rel:son ?c . \n"
] | 89 | false | true | 0 | 5 | 31 | 25 | 14 | 11 | null | null |
typelead/epm | epm/Distribution/Client/IndexUtils.hs | bsd-3-clause | readRepoIndex :: Verbosity -> Repo -> ReadPackageIndexMode
-> IO (PackageIndex SourcePackage, [Dependency])
readRepoIndex verbosity repo mode =
let indexFile = repoIndexFile repo
cacheFile = repoCacheFile repo
in handleNotFound $ do
warnIfIndexIsOld =<< getIndexFileAge repo
whenCacheOutOfDate indexFile cacheFile $ do
updatePackageIndexCacheFile verbosity indexFile cacheFile
readPackageIndexCacheFile mkAvailablePackage indexFile cacheFile mode
where
mkAvailablePackage pkgEntry =
SourcePackage {
packageInfoId = pkgid,
packageDescription = genPkgDesc,
packageSource = case pkgEntry of
NormalPackage _ _ _ descLoc
| Left _ <- descLoc -> ScmPackage (Just repo) srcRepos pkgid Nothing
| otherwise -> RepoTarballPackage repo pkgid Nothing
BuildTreeRef _ _ _ path _ -> LocalUnpackedPackage path,
packageDescrOverride = case pkgEntry of
NormalPackage _ _ pkgtxt _ -> Just pkgtxt
_ -> Nothing
}
where
pkgid = packageId pkgEntry
genPkgDesc = packageDesc pkgEntry
pkgDesc = PD.packageDescription genPkgDesc
srcRepos = sourceRepos pkgDesc
handleNotFound action = catchIO action $ \e -> if isDoesNotExistError e
then do
case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' does not exist. Run 'epm update' to download it."
Right _localRepo -> warn verbosity $
"The package list for the local repo '" ++ repoLocalDir repo
++ "' is missing. The repo is invalid."
return mempty
else ioError e
isOldThreshold = 15 --days
warnIfIndexIsOld dt = do
when (dt >= isOldThreshold) $ case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' is " ++ showFFloat (Just 1) dt " days old.\nRun "
++ "'epm update' to get the latest list of available packages."
Right _localRepo -> return ()
-- | Return the age of the index file in days (as a Double). | 2,274 | readRepoIndex :: Verbosity -> Repo -> ReadPackageIndexMode
-> IO (PackageIndex SourcePackage, [Dependency])
readRepoIndex verbosity repo mode =
let indexFile = repoIndexFile repo
cacheFile = repoCacheFile repo
in handleNotFound $ do
warnIfIndexIsOld =<< getIndexFileAge repo
whenCacheOutOfDate indexFile cacheFile $ do
updatePackageIndexCacheFile verbosity indexFile cacheFile
readPackageIndexCacheFile mkAvailablePackage indexFile cacheFile mode
where
mkAvailablePackage pkgEntry =
SourcePackage {
packageInfoId = pkgid,
packageDescription = genPkgDesc,
packageSource = case pkgEntry of
NormalPackage _ _ _ descLoc
| Left _ <- descLoc -> ScmPackage (Just repo) srcRepos pkgid Nothing
| otherwise -> RepoTarballPackage repo pkgid Nothing
BuildTreeRef _ _ _ path _ -> LocalUnpackedPackage path,
packageDescrOverride = case pkgEntry of
NormalPackage _ _ pkgtxt _ -> Just pkgtxt
_ -> Nothing
}
where
pkgid = packageId pkgEntry
genPkgDesc = packageDesc pkgEntry
pkgDesc = PD.packageDescription genPkgDesc
srcRepos = sourceRepos pkgDesc
handleNotFound action = catchIO action $ \e -> if isDoesNotExistError e
then do
case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' does not exist. Run 'epm update' to download it."
Right _localRepo -> warn verbosity $
"The package list for the local repo '" ++ repoLocalDir repo
++ "' is missing. The repo is invalid."
return mempty
else ioError e
isOldThreshold = 15 --days
warnIfIndexIsOld dt = do
when (dt >= isOldThreshold) $ case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' is " ++ showFFloat (Just 1) dt " days old.\nRun "
++ "'epm update' to get the latest list of available packages."
Right _localRepo -> return ()
-- | Return the age of the index file in days (as a Double). | 2,274 | readRepoIndex verbosity repo mode =
let indexFile = repoIndexFile repo
cacheFile = repoCacheFile repo
in handleNotFound $ do
warnIfIndexIsOld =<< getIndexFileAge repo
whenCacheOutOfDate indexFile cacheFile $ do
updatePackageIndexCacheFile verbosity indexFile cacheFile
readPackageIndexCacheFile mkAvailablePackage indexFile cacheFile mode
where
mkAvailablePackage pkgEntry =
SourcePackage {
packageInfoId = pkgid,
packageDescription = genPkgDesc,
packageSource = case pkgEntry of
NormalPackage _ _ _ descLoc
| Left _ <- descLoc -> ScmPackage (Just repo) srcRepos pkgid Nothing
| otherwise -> RepoTarballPackage repo pkgid Nothing
BuildTreeRef _ _ _ path _ -> LocalUnpackedPackage path,
packageDescrOverride = case pkgEntry of
NormalPackage _ _ pkgtxt _ -> Just pkgtxt
_ -> Nothing
}
where
pkgid = packageId pkgEntry
genPkgDesc = packageDesc pkgEntry
pkgDesc = PD.packageDescription genPkgDesc
srcRepos = sourceRepos pkgDesc
handleNotFound action = catchIO action $ \e -> if isDoesNotExistError e
then do
case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' does not exist. Run 'epm update' to download it."
Right _localRepo -> warn verbosity $
"The package list for the local repo '" ++ repoLocalDir repo
++ "' is missing. The repo is invalid."
return mempty
else ioError e
isOldThreshold = 15 --days
warnIfIndexIsOld dt = do
when (dt >= isOldThreshold) $ case repoKind repo of
Left remoteRepo -> warn verbosity $
"The package list for '" ++ remoteRepoName remoteRepo
++ "' is " ++ showFFloat (Just 1) dt " days old.\nRun "
++ "'epm update' to get the latest list of available packages."
Right _localRepo -> return ()
-- | Return the age of the index file in days (as a Double). | 2,152 | false | true | 3 | 20 | 700 | 506 | 238 | 268 | null | null |
seL4/capDL-tool | CapDL/State.hs | bsd-2-clause | validIRQ :: Model Word -> ObjID -> Bool
validIRQ m irq = isIRQ $ object irq m | 77 | validIRQ :: Model Word -> ObjID -> Bool
validIRQ m irq = isIRQ $ object irq m | 77 | validIRQ m irq = isIRQ $ object irq m | 37 | false | true | 0 | 6 | 16 | 36 | 17 | 19 | null | null |
gcampax/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey | 91 | orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey | 91 | orIntegerName = varQual gHC_INTEGER_TYPE (fsLit "orInteger") orIntegerIdKey | 91 | false | false | 0 | 7 | 22 | 19 | 9 | 10 | null | null |
ben-schulz/Idris-dev | src/Idris/Core/Evaluate.hs | bsd-3-clause | isUniverse (UType _) = True | 27 | isUniverse (UType _) = True | 27 | isUniverse (UType _) = True | 27 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
wangbj/haskell | gergovia.hs | bsd-2-clause | process (_:ints:rest) = ger (map readint (C.words ints)) : process rest | 71 | process (_:ints:rest) = ger (map readint (C.words ints)) : process rest | 71 | process (_:ints:rest) = ger (map readint (C.words ints)) : process rest | 71 | false | false | 0 | 11 | 10 | 47 | 22 | 25 | null | null |
3noch/slack-google-bot | src/AppLib/SlackBot.hs | bsd-3-clause | -- | The official responder which looks for search requests and posts search results.
botResponder :: SearchEngine -> Responder
botResponder searchEngine msg = case T.stripPrefix "google" msg of
Just query -> Just <$> searchEngine (T.strip query)
Nothing -> return Nothing
-- | The Slack bot engine for our app. | 324 | botResponder :: SearchEngine -> Responder
botResponder searchEngine msg = case T.stripPrefix "google" msg of
Just query -> Just <$> searchEngine (T.strip query)
Nothing -> return Nothing
-- | The Slack bot engine for our app. | 238 | botResponder searchEngine msg = case T.stripPrefix "google" msg of
Just query -> Just <$> searchEngine (T.strip query)
Nothing -> return Nothing
-- | The Slack bot engine for our app. | 196 | true | true | 0 | 12 | 61 | 71 | 33 | 38 | null | null |
beni55/binary | tests/QuickCheckUtils.hs | bsd-3-clause | mytests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> Double -> IO Double
mytests config gen rnd0 ntest nfail stamps t0
| ntest == configMaxTest config = do done "OK," ntest stamps
return t0
| nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
return t0
| otherwise = do
(result,t1) <- time (generate (configSize config ntest) rnd2 gen)
putStr (configEvery config ntest (arguments result)) >> hFlush stdout
case ok result of
Nothing ->
mytests config gen rnd1 ntest (nfail+1) stamps (t0 + t1)
Just True ->
mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps) (t0 + t1)
Just False -> do
putStr ( "Falsifiable after "
++ show ntest
++ " tests:\n"
++ unlines (arguments result)
) >> hFlush stdout
return t0
where
(rnd1,rnd2) = split rnd0 | 1,029 | mytests :: Config -> Gen Result -> StdGen -> Int -> Int -> [[String]] -> Double -> IO Double
mytests config gen rnd0 ntest nfail stamps t0
| ntest == configMaxTest config = do done "OK," ntest stamps
return t0
| nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
return t0
| otherwise = do
(result,t1) <- time (generate (configSize config ntest) rnd2 gen)
putStr (configEvery config ntest (arguments result)) >> hFlush stdout
case ok result of
Nothing ->
mytests config gen rnd1 ntest (nfail+1) stamps (t0 + t1)
Just True ->
mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps) (t0 + t1)
Just False -> do
putStr ( "Falsifiable after "
++ show ntest
++ " tests:\n"
++ unlines (arguments result)
) >> hFlush stdout
return t0
where
(rnd1,rnd2) = split rnd0 | 1,029 | mytests config gen rnd0 ntest nfail stamps t0
| ntest == configMaxTest config = do done "OK," ntest stamps
return t0
| nfail == configMaxFail config = do done "Arguments exhausted after" ntest stamps
return t0
| otherwise = do
(result,t1) <- time (generate (configSize config ntest) rnd2 gen)
putStr (configEvery config ntest (arguments result)) >> hFlush stdout
case ok result of
Nothing ->
mytests config gen rnd1 ntest (nfail+1) stamps (t0 + t1)
Just True ->
mytests config gen rnd1 (ntest+1) nfail (stamp result:stamps) (t0 + t1)
Just False -> do
putStr ( "Falsifiable after "
++ show ntest
++ " tests:\n"
++ unlines (arguments result)
) >> hFlush stdout
return t0
where
(rnd1,rnd2) = split rnd0 | 935 | false | true | 1 | 18 | 373 | 371 | 172 | 199 | null | null |
intolerable/GroupProject | src/Emulator/Interpreter.hs | bsd-2-clause | _debugRegisters :: MonadIO m => SystemT m ()
_debugRegisters = do
rs <- mapM use $ map (registers.) [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15]
debug Warning $ format "{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}" (map (showHexPadded 8) rs) | 274 | _debugRegisters :: MonadIO m => SystemT m ()
_debugRegisters = do
rs <- mapM use $ map (registers.) [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15]
debug Warning $ format "{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}" (map (showHexPadded 8) rs) | 274 | _debugRegisters = do
rs <- mapM use $ map (registers.) [r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15]
debug Warning $ format "{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}" (map (showHexPadded 8) rs) | 229 | false | true | 0 | 12 | 61 | 125 | 68 | 57 | null | null |
kojiromike/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | p_strLen _ = Nothing | 20 | p_strLen _ = Nothing | 20 | p_strLen _ = Nothing | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
dservgun/erp | src/common/Company.hs | gpl-3.0 | setPrimaryCurrency aCurrency aCompany =
if currencyExists aCurrency aCompany then
aCompany
else
aCompany {currency = aCurrency} | 167 | setPrimaryCurrency aCurrency aCompany =
if currencyExists aCurrency aCompany then
aCompany
else
aCompany {currency = aCurrency} | 167 | setPrimaryCurrency aCurrency aCompany =
if currencyExists aCurrency aCompany then
aCompany
else
aCompany {currency = aCurrency} | 167 | false | false | 0 | 7 | 54 | 37 | 18 | 19 | null | null |
keithodulaigh/Hets | Temporal/NuSmv.hs | gpl-2.0 | showElement (Invar expr) = concat [ "INVAR ", showBasicExpr expr True, ";\n" ] | 78 | showElement (Invar expr) = concat [ "INVAR ", showBasicExpr expr True, ";\n" ] | 78 | showElement (Invar expr) = concat [ "INVAR ", showBasicExpr expr True, ";\n" ] | 78 | false | false | 0 | 6 | 12 | 33 | 16 | 17 | null | null |
nushio3/ghc | testsuite/tests/typecheck/should_compile/PolyRec.hs | bsd-3-clause | -- With RelaxedPolyRec we can infer this type
-- g :: Functor f => (f Int -> b) -> f (Y Maybe) -> b
g h x = h $ fmap f x | 122 | g h x = h $ fmap f x | 20 | g h x = h $ fmap f x | 20 | true | false | 3 | 5 | 34 | 29 | 11 | 18 | null | null |
lennart/Tidal | Sound/Tidal/Strategies.hs | gpl-3.0 | samples :: Applicative f => f String -> f Int -> f String
samples p p' = pick <$> p <*> p' | 90 | samples :: Applicative f => f String -> f Int -> f String
samples p p' = pick <$> p <*> p' | 90 | samples p p' = pick <$> p <*> p' | 32 | false | true | 0 | 8 | 21 | 48 | 22 | 26 | null | null |
alphaHeavy/hlint | src/HSE/Match.hs | gpl-2.0 | isCon (x:_) = isUpper x || x == ':' | 35 | isCon (x:_) = isUpper x || x == ':' | 35 | isCon (x:_) = isUpper x || x == ':' | 35 | false | false | 1 | 6 | 8 | 34 | 15 | 19 | null | null |
YoEight/deiko-feed | Text/RSS1/Export.hs | bsd-3-clause | xmlImage :: Image -> XML.Element
xmlImage i =
(qualNode (rss10NS,Nothing) "image" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (imageTitle i)
, xmlLeaf (rss10NS,Nothing) "url" (imageURL i)
, xmlLeaf (rss10NS,Nothing) "link" (imageLink i)
] ++ map xmlDC (imageDC i) ++
imageOther i))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (imageURI i) :
imageAttrs i)} | 432 | xmlImage :: Image -> XML.Element
xmlImage i =
(qualNode (rss10NS,Nothing) "image" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (imageTitle i)
, xmlLeaf (rss10NS,Nothing) "url" (imageURL i)
, xmlLeaf (rss10NS,Nothing) "link" (imageLink i)
] ++ map xmlDC (imageDC i) ++
imageOther i))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (imageURI i) :
imageAttrs i)} | 432 | xmlImage i =
(qualNode (rss10NS,Nothing) "image" $ map Elem $
([ xmlLeaf (rss10NS,Nothing) "title" (imageTitle i)
, xmlLeaf (rss10NS,Nothing) "url" (imageURL i)
, xmlLeaf (rss10NS,Nothing) "link" (imageLink i)
] ++ map xmlDC (imageDC i) ++
imageOther i))
{ elAttribs = ( Attr (qualName (rdfNS,rdfPrefix) "about") (imageURI i) :
imageAttrs i)} | 399 | false | true | 0 | 13 | 111 | 183 | 95 | 88 | null | null |
muhbaasu/haskell-db-fahrplan-api | src/Web/DeutscheBahn/API/Schedule/API.hs | mit | apiFormat :: Maybe ApiFormat
apiFormat = Just FormatJSON | 56 | apiFormat :: Maybe ApiFormat
apiFormat = Just FormatJSON | 56 | apiFormat = Just FormatJSON | 27 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.