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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
music-suite/musicxml2 | src/Data/Music/MusicXml/Score.hs | bsd-3-clause | noTies :: [Tie]
noTies = [] | 27 | noTies :: [Tie]
noTies = [] | 27 | noTies = [] | 11 | false | true | 0 | 5 | 5 | 16 | 9 | 7 | null | null |
gcampax/ghc | compiler/main/HscTypes.hs | bsd-3-clause | getSafeMode :: IfaceTrustInfo -> SafeHaskellMode
getSafeMode (TrustInfo x) = x | 78 | getSafeMode :: IfaceTrustInfo -> SafeHaskellMode
getSafeMode (TrustInfo x) = x | 78 | getSafeMode (TrustInfo x) = x | 29 | false | true | 0 | 7 | 9 | 24 | 12 | 12 | null | null |
ancientlanguage/haskell-analysis | prepare/src/Prepare/Decompose.hs | mit | decomposeChar '\x2F96F' = "\x7E02" | 34 | decomposeChar '\x2F96F' = "\x7E02" | 34 | decomposeChar '\x2F96F' = "\x7E02" | 34 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
RaminHAL9001/rose-trie | src/Data/Tree/RoseTrie.hs | gpl-3.0 | -- | This function merges two trees together, given a leaf-merging function that can optionally
-- create or remove leaves based on whether or not leaves exist on the left and right at any given
-- point in the path @[p]@.
--
-- Also required are two 'RoseTrie' functions: a function that can convert the first (left)
-- 'RoseTrie' parameter to a 'RoseTrie' of the resultant type, and a function that can convert the
-- second (right) 'RoseTrie' parameter to a 'RoseTrie' of the resultant type. These functions are
-- used for when leaves exist only on the left 'RoseTrie', or for when leaves only exist on the
-- right 'RoseTrie'.
--
-- The given leaf-merging function is called for every single sub-'RoseTrie' node where the path
-- @[p]@ exists in both the overlay and target 'RoseTrie's. Each sub-'RoseTrie' node may or may not
-- have a 'Leaf'.
--
-- * If the 'RoseTrie' node for the overlay 'RoseTrie' and the target 'RoseTrie' are both without
-- leaves, the merging function is passed 'Prelude.Nothing' as both arguments to the updating
-- function.
--
-- * If only the target 'RoseTrie' has a 'Leaf', the overlay 'Leaf' as passed with 'Prelude.Just' as
-- the first (left) argument to the updating function, and 'Prelude.Nothing' is passed as the
-- second (right) argument.
--
-- * If only the overlay 'RoseTrie' has a leaf, 'Prelude.Nothing' is passed as the first (left)
-- argument to the merging function, and the overlay 'Leaf' is passed with 'Prelude.Just' as the
-- second (right) argument.
--
-- * If both the target and the overlay 'RoseTrie's have 'Leaf's, both 'Leaf's are passed with
-- 'Prelude.Just' to the merging function.
--
-- Also, it is necessary to specify (as the first parameter to this function) the 'RunRoseTrie'
-- type, which indicates 'DepthFirst' or 'BreadthFirst' evaluation.
mergeWithKeyM
:: forall m p a b c . (Monad m, Ord p)
=> RunRoseTrie
-> ([p] -> Maybe a -> Maybe b -> m (Maybe c))
-> (RoseTrie p a -> m (RoseTrie p c))
-> (RoseTrie p b -> m (RoseTrie p c))
-> RoseTrie p a -> RoseTrie p b -> m (RoseTrie p c)
mergeWithKeyM control = loop [] where
loop px merge left right (RoseTrie (leftLeaf, leftBranches)) (RoseTrie (rightLeaf, rightBranches)) = do
let leaf = merge px leftLeaf rightLeaf
let map = liftM (M.fromList . concat) $
mapM (\ (p, leftIfPaired) -> do
tree <- uncurry (loop (px++[p]) merge left right) ||| id $ leftIfPaired
return $ if Data.Tree.RoseTrie.null tree then [] else [(p, tree)]
)
( let wrap f = fmap (Right . f) in M.assocs $
M.mergeWithKey (\ _ a b -> Just $ Left (a, b))
(wrap left) (wrap right) leftBranches rightBranches
)
if control==BreadthFirst
then ap (ap (return $ curry RoseTrie) leaf) map
else ap (ap (return $ flip $ curry RoseTrie) map) leaf
----------------------------------------------------------------------------------------------------
-- $MapLikeFunctions
-- In this section I have made my best effor to create API functions as similar as possible to that
-- of the "Data.Map" module.
---------------------------------------------------------------------------------------------------- | 3,273 | mergeWithKeyM
:: forall m p a b c . (Monad m, Ord p)
=> RunRoseTrie
-> ([p] -> Maybe a -> Maybe b -> m (Maybe c))
-> (RoseTrie p a -> m (RoseTrie p c))
-> (RoseTrie p b -> m (RoseTrie p c))
-> RoseTrie p a -> RoseTrie p b -> m (RoseTrie p c)
mergeWithKeyM control = loop [] where
loop px merge left right (RoseTrie (leftLeaf, leftBranches)) (RoseTrie (rightLeaf, rightBranches)) = do
let leaf = merge px leftLeaf rightLeaf
let map = liftM (M.fromList . concat) $
mapM (\ (p, leftIfPaired) -> do
tree <- uncurry (loop (px++[p]) merge left right) ||| id $ leftIfPaired
return $ if Data.Tree.RoseTrie.null tree then [] else [(p, tree)]
)
( let wrap f = fmap (Right . f) in M.assocs $
M.mergeWithKey (\ _ a b -> Just $ Left (a, b))
(wrap left) (wrap right) leftBranches rightBranches
)
if control==BreadthFirst
then ap (ap (return $ curry RoseTrie) leaf) map
else ap (ap (return $ flip $ curry RoseTrie) map) leaf
----------------------------------------------------------------------------------------------------
-- $MapLikeFunctions
-- In this section I have made my best effor to create API functions as similar as possible to that
-- of the "Data.Map" module.
---------------------------------------------------------------------------------------------------- | 1,442 | mergeWithKeyM control = loop [] where
loop px merge left right (RoseTrie (leftLeaf, leftBranches)) (RoseTrie (rightLeaf, rightBranches)) = do
let leaf = merge px leftLeaf rightLeaf
let map = liftM (M.fromList . concat) $
mapM (\ (p, leftIfPaired) -> do
tree <- uncurry (loop (px++[p]) merge left right) ||| id $ leftIfPaired
return $ if Data.Tree.RoseTrie.null tree then [] else [(p, tree)]
)
( let wrap f = fmap (Right . f) in M.assocs $
M.mergeWithKey (\ _ a b -> Just $ Left (a, b))
(wrap left) (wrap right) leftBranches rightBranches
)
if control==BreadthFirst
then ap (ap (return $ curry RoseTrie) leaf) map
else ap (ap (return $ flip $ curry RoseTrie) map) leaf
----------------------------------------------------------------------------------------------------
-- $MapLikeFunctions
-- In this section I have made my best effor to create API functions as similar as possible to that
-- of the "Data.Map" module.
---------------------------------------------------------------------------------------------------- | 1,188 | true | true | 0 | 25 | 704 | 532 | 287 | 245 | null | null |
8l/metafun | src/Language/Kiff/Parser.hs | gpl-3.0 | semi = IT.semi lexer | 26 | semi = IT.semi lexer | 26 | semi = IT.semi lexer | 26 | false | false | 0 | 6 | 9 | 11 | 5 | 6 | null | null |
CGenie/platform | shared/src/Unison/ABT.hs | mit | tm :: (Foldable f, Ord v) => f (Term f v ()) -> Term f v ()
tm = tm' () | 71 | tm :: (Foldable f, Ord v) => f (Term f v ()) -> Term f v ()
tm = tm' () | 71 | tm = tm' () | 11 | false | true | 0 | 10 | 20 | 59 | 29 | 30 | null | null |
spechub/Hets | Common/Lib/MapSet.hs | gpl-2.0 | -- | all elementes united
elems :: Ord b => MapSet a b -> Set.Set b
elems = setElems . toMap | 92 | elems :: Ord b => MapSet a b -> Set.Set b
elems = setElems . toMap | 66 | elems = setElems . toMap | 24 | true | true | 0 | 8 | 20 | 37 | 18 | 19 | null | null |
caasi/spj-book-student-1992 | src/PrettyPrint.hs | bsd-3-clause | toPrecedence ">=" = 3 | 21 | toPrecedence ">=" = 3 | 21 | toPrecedence ">=" = 3 | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
xmonad/xmonad-contrib | XMonad/Prompt.hs | bsd-3-clause | handleSubmap :: XP ()
-> M.Map (KeyMask, KeySym) (XP ())
-> KeyStroke
-> Event
-> XP ()
handleSubmap defaultAction keymap stroke KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputSubmap defaultAction keymap keymask stroke | 349 | handleSubmap :: XP ()
-> M.Map (KeyMask, KeySym) (XP ())
-> KeyStroke
-> Event
-> XP ()
handleSubmap defaultAction keymap stroke KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputSubmap defaultAction keymap keymask stroke | 349 | handleSubmap defaultAction keymap stroke KeyEvent{ev_event_type = t, ev_state = m} = do
keymask <- gets cleanMask <*> pure m
when (t == keyPress) $ handleInputSubmap defaultAction keymap keymask stroke | 209 | false | true | 0 | 10 | 105 | 125 | 61 | 64 | null | null |
anton-dessiatov/stack | src/Stack/Types/Resolver.hs | bsd-3-clause | renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d | 58 | renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d | 58 | renderSnapName (Nightly d) = T.pack $ "nightly-" ++ show d | 58 | false | false | 0 | 7 | 9 | 28 | 13 | 15 | null | null |
Pochoir/Pochoir | src/PShow.hs | gpl-3.0 | pShowPointerSet iL@(i:is) l_kernelParams = concat $ map pShowPointerSetTerm iL
where pShowPointerSetTerm (iterName, array, dim) =
let l_arrayName = aName array
l_arrayBaseName = l_arrayName ++ "_base"
l_arrayTotalSize = "l_" ++ l_arrayName ++ "_total_size"
l_arrayStrideList =
pGetArrayStrideList (length l_kernelParams - 1) l_arrayName
l_transDimList = tail $ pShowTransDim dim l_kernelParams
l_arraySpaceOffset =
intercalate " + " $ zipWith pCombineDim l_transDimList l_arrayStrideList
l_arrayTimeOffset = (pGetTimeOffset (aToggle array) (head dim)) ++
" * " ++ l_arrayTotalSize
in breakline ++ iterName ++ " = " ++ l_arrayBaseName ++ " + " ++
l_arrayTimeOffset ++ " + " ++ l_arraySpaceOffset ++ ";" | 924 | pShowPointerSet iL@(i:is) l_kernelParams = concat $ map pShowPointerSetTerm iL
where pShowPointerSetTerm (iterName, array, dim) =
let l_arrayName = aName array
l_arrayBaseName = l_arrayName ++ "_base"
l_arrayTotalSize = "l_" ++ l_arrayName ++ "_total_size"
l_arrayStrideList =
pGetArrayStrideList (length l_kernelParams - 1) l_arrayName
l_transDimList = tail $ pShowTransDim dim l_kernelParams
l_arraySpaceOffset =
intercalate " + " $ zipWith pCombineDim l_transDimList l_arrayStrideList
l_arrayTimeOffset = (pGetTimeOffset (aToggle array) (head dim)) ++
" * " ++ l_arrayTotalSize
in breakline ++ iterName ++ " = " ++ l_arrayBaseName ++ " + " ++
l_arrayTimeOffset ++ " + " ++ l_arraySpaceOffset ++ ";" | 924 | pShowPointerSet iL@(i:is) l_kernelParams = concat $ map pShowPointerSetTerm iL
where pShowPointerSetTerm (iterName, array, dim) =
let l_arrayName = aName array
l_arrayBaseName = l_arrayName ++ "_base"
l_arrayTotalSize = "l_" ++ l_arrayName ++ "_total_size"
l_arrayStrideList =
pGetArrayStrideList (length l_kernelParams - 1) l_arrayName
l_transDimList = tail $ pShowTransDim dim l_kernelParams
l_arraySpaceOffset =
intercalate " + " $ zipWith pCombineDim l_transDimList l_arrayStrideList
l_arrayTimeOffset = (pGetTimeOffset (aToggle array) (head dim)) ++
" * " ++ l_arrayTotalSize
in breakline ++ iterName ++ " = " ++ l_arrayBaseName ++ " + " ++
l_arrayTimeOffset ++ " + " ++ l_arraySpaceOffset ++ ";" | 924 | false | false | 4 | 14 | 317 | 210 | 103 | 107 | null | null |
pgj/bead | src/Bead/Persistence/NoSQLDir.hs | bsd-3-clause | evaluationOfScore :: ScoreKey -> Persist (Maybe EvaluationKey)
evaluationOfScore = objectIn "evaluation" EvaluationKey isEvaluationDir | 134 | evaluationOfScore :: ScoreKey -> Persist (Maybe EvaluationKey)
evaluationOfScore = objectIn "evaluation" EvaluationKey isEvaluationDir | 134 | evaluationOfScore = objectIn "evaluation" EvaluationKey isEvaluationDir | 71 | false | true | 0 | 8 | 12 | 31 | 15 | 16 | null | null |
volhovM/orgstat | src/OrgStat/Ast.hs | gpl-3.0 | atDepth 0 f o = f o | 19 | atDepth 0 f o = f o | 19 | atDepth 0 f o = f o | 19 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
verement/etamoo | src/MOO/Task.hs | bsd-3-clause | handleDebug :: MOO Value -> MOO Value
handleDebug = (`catchException` handler)
where handler Exception {
exceptionDebugBit = False
, exceptionCode = code
} = return code
handler except = passException except
-- | Placeholder for features not yet implemented | 304 | handleDebug :: MOO Value -> MOO Value
handleDebug = (`catchException` handler)
where handler Exception {
exceptionDebugBit = False
, exceptionCode = code
} = return code
handler except = passException except
-- | Placeholder for features not yet implemented | 304 | handleDebug = (`catchException` handler)
where handler Exception {
exceptionDebugBit = False
, exceptionCode = code
} = return code
handler except = passException except
-- | Placeholder for features not yet implemented | 266 | false | true | 1 | 8 | 85 | 66 | 36 | 30 | null | null |
phadej/streaming-commons | Data/Streaming/Network.hs | mit | getReadBufferSize :: HasReadBufferSize a => a -> Int
getReadBufferSize = getConstant . readBufferSizeLens Constant | 114 | getReadBufferSize :: HasReadBufferSize a => a -> Int
getReadBufferSize = getConstant . readBufferSizeLens Constant | 114 | getReadBufferSize = getConstant . readBufferSizeLens Constant | 61 | false | true | 0 | 8 | 13 | 35 | 15 | 20 | null | null |
rueshyna/gogol | gogol-dns/gen/Network/Google/DNS/Types.hs | mpl-2.0 | -- | Default request referring to version 'v2beta1' of the Google Cloud DNS API. This contains the host and root path used as a starting point for constructing service requests.
dNSService :: ServiceConfig
dNSService
= defaultService (ServiceId "dns:v2beta1")
"www.googleapis.com" | 288 | dNSService :: ServiceConfig
dNSService
= defaultService (ServiceId "dns:v2beta1")
"www.googleapis.com" | 110 | dNSService
= defaultService (ServiceId "dns:v2beta1")
"www.googleapis.com" | 82 | true | true | 0 | 7 | 46 | 26 | 12 | 14 | null | null |
mydaum/cabal | Cabal/Distribution/PackageDescription/Parse.hs | bsd-3-clause | deprecatedFieldsBuildInfo :: [(String,String)]
deprecatedFieldsBuildInfo = [ ("hs-source-dir","hs-source-dirs") ] | 113 | deprecatedFieldsBuildInfo :: [(String,String)]
deprecatedFieldsBuildInfo = [ ("hs-source-dir","hs-source-dirs") ] | 113 | deprecatedFieldsBuildInfo = [ ("hs-source-dir","hs-source-dirs") ] | 66 | false | true | 0 | 6 | 7 | 29 | 18 | 11 | null | null |
DanielAtSamraksh/checkReceivedSnapshots | ReceivedSnapshots.hs | mit | -- die err = do putStrLn err
-- exitFailure
printSnapshots :: [Snapshot] -> IO()
printSnapshots ss = mapM_ print ss | 144 | printSnapshots :: [Snapshot] -> IO()
printSnapshots ss = mapM_ print ss | 71 | printSnapshots ss = mapM_ print ss | 34 | true | true | 0 | 8 | 48 | 39 | 18 | 21 | null | null |
literate-unitb/literate-unitb | src/Document/Tests/TrainStationRefinement.hs | mit | result0 :: String
result0 = unlines
[ " o m0/m0:enter/FIS/in@prime"
, " o m0/m0:leave/FIS/in@prime"
, " o m0/m0:prog0/LIVE/discharge/tr/lhs"
, " o m0/m0:prog0/LIVE/discharge/tr/rhs"
, " o m0/m0:tr0/TR/WFIS/t/t@prime"
, " o m0/m0:tr0/TR/m0:leave/EN"
, " o m0/m0:tr0/TR/m0:leave/NEG"
, "passed 7 / 7"
] | 350 | result0 :: String
result0 = unlines
[ " o m0/m0:enter/FIS/in@prime"
, " o m0/m0:leave/FIS/in@prime"
, " o m0/m0:prog0/LIVE/discharge/tr/lhs"
, " o m0/m0:prog0/LIVE/discharge/tr/rhs"
, " o m0/m0:tr0/TR/WFIS/t/t@prime"
, " o m0/m0:tr0/TR/m0:leave/EN"
, " o m0/m0:tr0/TR/m0:leave/NEG"
, "passed 7 / 7"
] | 350 | result0 = unlines
[ " o m0/m0:enter/FIS/in@prime"
, " o m0/m0:leave/FIS/in@prime"
, " o m0/m0:prog0/LIVE/discharge/tr/lhs"
, " o m0/m0:prog0/LIVE/discharge/tr/rhs"
, " o m0/m0:tr0/TR/WFIS/t/t@prime"
, " o m0/m0:tr0/TR/m0:leave/EN"
, " o m0/m0:tr0/TR/m0:leave/NEG"
, "passed 7 / 7"
] | 332 | false | true | 0 | 6 | 89 | 44 | 24 | 20 | null | null |
notae/haskell-exercise | cp/SBVTest3.hs | bsd-3-clause | {-|
Apply as SBV predicate:
>>> allSat p4
Solution #1:
s0 = 1 :: Word8
s1 = 4 :: Word8
Solution #2:
s0 = 2 :: Word8
s1 = 3 :: Word8
Found 2 different solutions.
-}
p4 :: SWord8 -> SWord8 -> Symbolic SBool
p4 x y = do
constrain $ x `inRange` (1, 3)
constrain $ y `inRange` (3, 5)
constrain $ p3 x y
return true
{-|
Encode residue field with type Word8
>>> allSat p0
Solution #1:
s0 = 1 :: Word8
Solution #2:
s0 = 2 :: Word8
Found 2 different solutions.
-} | 475 | p4 :: SWord8 -> SWord8 -> Symbolic SBool
p4 x y = do
constrain $ x `inRange` (1, 3)
constrain $ y `inRange` (3, 5)
constrain $ p3 x y
return true
{-|
Encode residue field with type Word8
>>> allSat p0
Solution #1:
s0 = 1 :: Word8
Solution #2:
s0 = 2 :: Word8
Found 2 different solutions.
-} | 303 | p4 x y = do
constrain $ x `inRange` (1, 3)
constrain $ y `inRange` (3, 5)
constrain $ p3 x y
return true
{-|
Encode residue field with type Word8
>>> allSat p0
Solution #1:
s0 = 1 :: Word8
Solution #2:
s0 = 2 :: Word8
Found 2 different solutions.
-} | 262 | true | true | 0 | 8 | 118 | 85 | 44 | 41 | null | null |
lukexi/ghc-7.8-arm64 | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | ppLit (LMFloatLit r LMFloat ) = ppFloat $ narrowFp r | 53 | ppLit (LMFloatLit r LMFloat ) = ppFloat $ narrowFp r | 53 | ppLit (LMFloatLit r LMFloat ) = ppFloat $ narrowFp r | 53 | false | false | 0 | 6 | 10 | 25 | 11 | 14 | null | null |
abbradar/yaxmpp | src/Network/XMPP/Session.hs | bsd-3-clause | restartOrThrow _ _ _ e = throwM e | 33 | restartOrThrow _ _ _ e = throwM e | 33 | restartOrThrow _ _ _ e = throwM e | 33 | false | false | 0 | 5 | 7 | 18 | 8 | 10 | null | null |
brendanhay/gogol | gogol/src/Network/Google.hs | mpl-2.0 | -- | Run a 'Google' action using the specified environment and
-- credentials annotated with sufficient authorization scopes.
runGoogle :: (MonadResource m, HasEnv s r) => r -> Google s a -> m a
runGoogle e m = liftResourceT $ runReaderT (unGoogle m) (e ^. environment) | 269 | runGoogle :: (MonadResource m, HasEnv s r) => r -> Google s a -> m a
runGoogle e m = liftResourceT $ runReaderT (unGoogle m) (e ^. environment) | 143 | runGoogle e m = liftResourceT $ runReaderT (unGoogle m) (e ^. environment) | 74 | true | true | 0 | 9 | 45 | 77 | 38 | 39 | null | null |
lisperatu/subgetter | Core.hs | gpl-3.0 | main = subsForFile . unwords =<< getArgs | 40 | main = subsForFile . unwords =<< getArgs | 40 | main = subsForFile . unwords =<< getArgs | 40 | false | false | 3 | 5 | 6 | 22 | 8 | 14 | null | null |
brendanhay/gogol | gogol-sheets/gen/Network/Google/Resource/Sheets/Spreadsheets/Values/Get.hs | mpl-2.0 | -- | How dates, times, and durations should be represented in the output.
-- This is ignored if value_render_option is FORMATTED_VALUE. The default
-- dateTime render option is SERIAL_NUMBER.
svgDateTimeRenderOption :: Lens' SpreadsheetsValuesGet (Maybe SpreadsheetsValuesGetDateTimeRenderOption)
svgDateTimeRenderOption
= lens _svgDateTimeRenderOption
(\ s a -> s{_svgDateTimeRenderOption = a}) | 403 | svgDateTimeRenderOption :: Lens' SpreadsheetsValuesGet (Maybe SpreadsheetsValuesGetDateTimeRenderOption)
svgDateTimeRenderOption
= lens _svgDateTimeRenderOption
(\ s a -> s{_svgDateTimeRenderOption = a}) | 211 | svgDateTimeRenderOption
= lens _svgDateTimeRenderOption
(\ s a -> s{_svgDateTimeRenderOption = a}) | 106 | true | true | 0 | 8 | 53 | 51 | 27 | 24 | null | null |
slpopejoy/fadno-xml | src/Fadno/MusicXml/MusicXml30.hs | bsd-2-clause | parseOnOff :: String -> P.XParse OnOff
parseOnOff s
| s == "on" = return $ OnOffOn
| s == "off" = return $ OnOffOff
| otherwise = P.xfail $ "OnOff: " ++ s | 178 | parseOnOff :: String -> P.XParse OnOff
parseOnOff s
| s == "on" = return $ OnOffOn
| s == "off" = return $ OnOffOff
| otherwise = P.xfail $ "OnOff: " ++ s | 178 | parseOnOff s
| s == "on" = return $ OnOffOn
| s == "off" = return $ OnOffOff
| otherwise = P.xfail $ "OnOff: " ++ s | 139 | false | true | 0 | 8 | 56 | 73 | 34 | 39 | null | null |
I3ck/HGE2D | src/examples/Example4.hs | mit | --define our initial state
es4 = EngineState
{ getTitle = myGetTitle
, getTime = myGetTime
, setTime = mySetTime
, moveTime = myMoveTime
, click = myClick
, mUp = myMouseUp
, hover = myHover
, drag = myDrag
, kDown = myKeyDown
, kUp = myKeyUp
, resize = myResize
, getSize = myGetSize
, toGlInstr = myToGlInstr
} :: EngineState GameState
where
myGetTitle _ = "Welcome to Example4" --title of the games window
myGetTime = time -- how to retrieve the games time
mySetTime ms gs = gs { time = ms } -- how to set the games time
myMoveTime _ = id -- our game won't react to time changes
myClick _ _ = id -- nor clicks
myMouseUp _ _ = id --nor mouse up
myHover _ _ = id -- nor hovering
myDrag _ _ = id -- nor draging
myKeyDown _ _ _ = id -- nor key presses
myKeyUp _ _ _ = id --nor key releases
myResize (w, h) gs = gs { gsSize = (realToFrac w, realToFrac h) } -- how to resize our game
myGetSize = gsSize -- and get its size
myToGlInstr gs = withCamera es4 gs $ RenderMany -- render with a camera and while preserving changes
[ circleNextToRectangle -- render our circle next to the rectangle
, whiteRectangle -- as well as the white rectangle
, allMoved -- and the moved group
]
where
-- move them all by 100px in x and y direction
allMoved :: RenderInstruction
allMoved = RenderPreserve $ RenderMany [RenderTranslate 100 100, circleNextToRectangle]
-- group the moved circle and the white rectangle
circleNextToRectangle :: RenderInstruction
circleNextToRectangle = RenderMany [movedCircle, whiteRectangle]
-- the circle moved
movedCircle :: RenderInstruction
movedCircle = RenderPreserve $ RenderMany [RenderTranslate 50 0, redCircle]
-- a white rectangle
whiteRectangle :: RenderInstruction
whiteRectangle = RenderMany [RenderColorize colorWhite, rectangle 30 30]
-- a red circle
redCircle :: RenderInstruction
redCircle = RenderMany [RenderColorize colorRed, circle 30]
-------------------------------------------------------------------------------- | 2,290 | es4 = EngineState
{ getTitle = myGetTitle
, getTime = myGetTime
, setTime = mySetTime
, moveTime = myMoveTime
, click = myClick
, mUp = myMouseUp
, hover = myHover
, drag = myDrag
, kDown = myKeyDown
, kUp = myKeyUp
, resize = myResize
, getSize = myGetSize
, toGlInstr = myToGlInstr
} :: EngineState GameState
where
myGetTitle _ = "Welcome to Example4" --title of the games window
myGetTime = time -- how to retrieve the games time
mySetTime ms gs = gs { time = ms } -- how to set the games time
myMoveTime _ = id -- our game won't react to time changes
myClick _ _ = id -- nor clicks
myMouseUp _ _ = id --nor mouse up
myHover _ _ = id -- nor hovering
myDrag _ _ = id -- nor draging
myKeyDown _ _ _ = id -- nor key presses
myKeyUp _ _ _ = id --nor key releases
myResize (w, h) gs = gs { gsSize = (realToFrac w, realToFrac h) } -- how to resize our game
myGetSize = gsSize -- and get its size
myToGlInstr gs = withCamera es4 gs $ RenderMany -- render with a camera and while preserving changes
[ circleNextToRectangle -- render our circle next to the rectangle
, whiteRectangle -- as well as the white rectangle
, allMoved -- and the moved group
]
where
-- move them all by 100px in x and y direction
allMoved :: RenderInstruction
allMoved = RenderPreserve $ RenderMany [RenderTranslate 100 100, circleNextToRectangle]
-- group the moved circle and the white rectangle
circleNextToRectangle :: RenderInstruction
circleNextToRectangle = RenderMany [movedCircle, whiteRectangle]
-- the circle moved
movedCircle :: RenderInstruction
movedCircle = RenderPreserve $ RenderMany [RenderTranslate 50 0, redCircle]
-- a white rectangle
whiteRectangle :: RenderInstruction
whiteRectangle = RenderMany [RenderColorize colorWhite, rectangle 30 30]
-- a red circle
redCircle :: RenderInstruction
redCircle = RenderMany [RenderColorize colorRed, circle 30]
-------------------------------------------------------------------------------- | 2,263 | es4 = EngineState
{ getTitle = myGetTitle
, getTime = myGetTime
, setTime = mySetTime
, moveTime = myMoveTime
, click = myClick
, mUp = myMouseUp
, hover = myHover
, drag = myDrag
, kDown = myKeyDown
, kUp = myKeyUp
, resize = myResize
, getSize = myGetSize
, toGlInstr = myToGlInstr
} :: EngineState GameState
where
myGetTitle _ = "Welcome to Example4" --title of the games window
myGetTime = time -- how to retrieve the games time
mySetTime ms gs = gs { time = ms } -- how to set the games time
myMoveTime _ = id -- our game won't react to time changes
myClick _ _ = id -- nor clicks
myMouseUp _ _ = id --nor mouse up
myHover _ _ = id -- nor hovering
myDrag _ _ = id -- nor draging
myKeyDown _ _ _ = id -- nor key presses
myKeyUp _ _ _ = id --nor key releases
myResize (w, h) gs = gs { gsSize = (realToFrac w, realToFrac h) } -- how to resize our game
myGetSize = gsSize -- and get its size
myToGlInstr gs = withCamera es4 gs $ RenderMany -- render with a camera and while preserving changes
[ circleNextToRectangle -- render our circle next to the rectangle
, whiteRectangle -- as well as the white rectangle
, allMoved -- and the moved group
]
where
-- move them all by 100px in x and y direction
allMoved :: RenderInstruction
allMoved = RenderPreserve $ RenderMany [RenderTranslate 100 100, circleNextToRectangle]
-- group the moved circle and the white rectangle
circleNextToRectangle :: RenderInstruction
circleNextToRectangle = RenderMany [movedCircle, whiteRectangle]
-- the circle moved
movedCircle :: RenderInstruction
movedCircle = RenderPreserve $ RenderMany [RenderTranslate 50 0, redCircle]
-- a white rectangle
whiteRectangle :: RenderInstruction
whiteRectangle = RenderMany [RenderColorize colorWhite, rectangle 30 30]
-- a red circle
redCircle :: RenderInstruction
redCircle = RenderMany [RenderColorize colorRed, circle 30]
-------------------------------------------------------------------------------- | 2,263 | true | false | 25 | 11 | 663 | 434 | 247 | 187 | null | null |
input-output-hk/cardano-sl-explorer | src/explorer/Main.hs | mit | main :: IO ()
main = do
args <- getExplorerOptions
printFlags
runProduction (action args) | 101 | main :: IO ()
main = do
args <- getExplorerOptions
printFlags
runProduction (action args) | 101 | main = do
args <- getExplorerOptions
printFlags
runProduction (action args) | 87 | false | true | 0 | 9 | 25 | 38 | 17 | 21 | null | null |
kim/amazonka | amazonka-glacier/gen/Network/AWS/Glacier/CompleteMultipartUpload.hs | mpl-2.0 | -- | The total size, in bytes, of the entire archive. This value should be the sum
-- of all the sizes of the individual parts that you uploaded.
cmuArchiveSize :: Lens' CompleteMultipartUpload (Maybe Text)
cmuArchiveSize = lens _cmuArchiveSize (\s a -> s { _cmuArchiveSize = a }) | 280 | cmuArchiveSize :: Lens' CompleteMultipartUpload (Maybe Text)
cmuArchiveSize = lens _cmuArchiveSize (\s a -> s { _cmuArchiveSize = a }) | 134 | cmuArchiveSize = lens _cmuArchiveSize (\s a -> s { _cmuArchiveSize = a }) | 73 | true | true | 1 | 9 | 47 | 52 | 26 | 26 | null | null |
monto-editor/services-haskell | src/Main.hs | bsd-3-clause | main :: IO ()
main =
Z.withContext $ \ctx -> do
_ <- installHandler sigINT (Catch exitSuccess) Nothing
_ <- installHandler sigTERM (Catch exitSuccess) Nothing
cfg <- execParser $ info (helper <*> parseConfig ctx)
( fullDesc <> header "service-haskell - Monto services for Haskell" )
outlineIcons <- getOutlineIcons $ printf "http://localhost:%d/" (resourcePort cfg)
assetDir <- getDataFileName "assets"
_ <- forkIO $ resourceServer cfg assetDir
eitherErrorOrResp <- register cfg RegisterServiceRequest
{ R.serviceID = "ghc"
, R.label = "Glasgow Haskell Compiler"
, R.description = "The GHC compiler does tokenization, parsing and typechecking"
, R.options = Nothing
, R.dependencies = [ SourceDependency "haskell" ]
, R.products = [ PD.ProductDescription "tokens" "haskell"
, PD.ProductDescription "ast" "haskell"
, PD.ProductDescription "errors" "haskell"
, PD.ProductDescription "outline" "haskell"
]
}
case eitherErrorOrResp of
Left errorMessage -> printf "registration failed due to %s\n" (show errorMessage)
Right (Port p) ->
Z.withSocket ctx Z.Pair $ \serviceSocket -> do
--Z.withSocket ctx Z.Sub $ \configSocket -> do
Z.connect serviceSocket $ serviceAddress cfg ++ show p
printf "connected to %s%d\n" (serviceAddress cfg) p
--Z.connect configSocket (configurationAddress cfg)
flip finally (deregister cfg "ghc") $ defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just libdir) $ do
dflags0 <- getSessionDynFlags
let dflags = gopt_set dflags0 Opt_KeepRawTokenStream
_ <- setSessionDynFlags dflags
forever $ do
rawMsg <- liftIO $ Z.receive serviceSocket
case eitherDecodeStrict rawMsg of
Right (Req.Request _ _ (SourceMessage m:_)) -> do
productMessages <- onSourceMessage outlineIcons m
liftIO $ forM_ productMessages $ Z.send serviceSocket [] . BL.toStrict . encode
Right _ ->
liftIO $ printf "Request did not contain a source message: %s\n" (B.unpack rawMsg)
Left err ->
liftIO $ printf "Could not decode request message %s\n%s\n" (B.unpack rawMsg) err | 2,556 | main :: IO ()
main =
Z.withContext $ \ctx -> do
_ <- installHandler sigINT (Catch exitSuccess) Nothing
_ <- installHandler sigTERM (Catch exitSuccess) Nothing
cfg <- execParser $ info (helper <*> parseConfig ctx)
( fullDesc <> header "service-haskell - Monto services for Haskell" )
outlineIcons <- getOutlineIcons $ printf "http://localhost:%d/" (resourcePort cfg)
assetDir <- getDataFileName "assets"
_ <- forkIO $ resourceServer cfg assetDir
eitherErrorOrResp <- register cfg RegisterServiceRequest
{ R.serviceID = "ghc"
, R.label = "Glasgow Haskell Compiler"
, R.description = "The GHC compiler does tokenization, parsing and typechecking"
, R.options = Nothing
, R.dependencies = [ SourceDependency "haskell" ]
, R.products = [ PD.ProductDescription "tokens" "haskell"
, PD.ProductDescription "ast" "haskell"
, PD.ProductDescription "errors" "haskell"
, PD.ProductDescription "outline" "haskell"
]
}
case eitherErrorOrResp of
Left errorMessage -> printf "registration failed due to %s\n" (show errorMessage)
Right (Port p) ->
Z.withSocket ctx Z.Pair $ \serviceSocket -> do
--Z.withSocket ctx Z.Sub $ \configSocket -> do
Z.connect serviceSocket $ serviceAddress cfg ++ show p
printf "connected to %s%d\n" (serviceAddress cfg) p
--Z.connect configSocket (configurationAddress cfg)
flip finally (deregister cfg "ghc") $ defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just libdir) $ do
dflags0 <- getSessionDynFlags
let dflags = gopt_set dflags0 Opt_KeepRawTokenStream
_ <- setSessionDynFlags dflags
forever $ do
rawMsg <- liftIO $ Z.receive serviceSocket
case eitherDecodeStrict rawMsg of
Right (Req.Request _ _ (SourceMessage m:_)) -> do
productMessages <- onSourceMessage outlineIcons m
liftIO $ forM_ productMessages $ Z.send serviceSocket [] . BL.toStrict . encode
Right _ ->
liftIO $ printf "Request did not contain a source message: %s\n" (B.unpack rawMsg)
Left err ->
liftIO $ printf "Could not decode request message %s\n%s\n" (B.unpack rawMsg) err | 2,556 | main =
Z.withContext $ \ctx -> do
_ <- installHandler sigINT (Catch exitSuccess) Nothing
_ <- installHandler sigTERM (Catch exitSuccess) Nothing
cfg <- execParser $ info (helper <*> parseConfig ctx)
( fullDesc <> header "service-haskell - Monto services for Haskell" )
outlineIcons <- getOutlineIcons $ printf "http://localhost:%d/" (resourcePort cfg)
assetDir <- getDataFileName "assets"
_ <- forkIO $ resourceServer cfg assetDir
eitherErrorOrResp <- register cfg RegisterServiceRequest
{ R.serviceID = "ghc"
, R.label = "Glasgow Haskell Compiler"
, R.description = "The GHC compiler does tokenization, parsing and typechecking"
, R.options = Nothing
, R.dependencies = [ SourceDependency "haskell" ]
, R.products = [ PD.ProductDescription "tokens" "haskell"
, PD.ProductDescription "ast" "haskell"
, PD.ProductDescription "errors" "haskell"
, PD.ProductDescription "outline" "haskell"
]
}
case eitherErrorOrResp of
Left errorMessage -> printf "registration failed due to %s\n" (show errorMessage)
Right (Port p) ->
Z.withSocket ctx Z.Pair $ \serviceSocket -> do
--Z.withSocket ctx Z.Sub $ \configSocket -> do
Z.connect serviceSocket $ serviceAddress cfg ++ show p
printf "connected to %s%d\n" (serviceAddress cfg) p
--Z.connect configSocket (configurationAddress cfg)
flip finally (deregister cfg "ghc") $ defaultErrorHandler defaultFatalMessager defaultFlushOut $
runGhc (Just libdir) $ do
dflags0 <- getSessionDynFlags
let dflags = gopt_set dflags0 Opt_KeepRawTokenStream
_ <- setSessionDynFlags dflags
forever $ do
rawMsg <- liftIO $ Z.receive serviceSocket
case eitherDecodeStrict rawMsg of
Right (Req.Request _ _ (SourceMessage m:_)) -> do
productMessages <- onSourceMessage outlineIcons m
liftIO $ forM_ productMessages $ Z.send serviceSocket [] . BL.toStrict . encode
Right _ ->
liftIO $ printf "Request did not contain a source message: %s\n" (B.unpack rawMsg)
Left err ->
liftIO $ printf "Could not decode request message %s\n%s\n" (B.unpack rawMsg) err | 2,542 | false | true | 0 | 31 | 847 | 595 | 281 | 314 | null | null |
fumieval/machines | src/Data/Machine/Mealy.hs | bsd-3-clause | logMealy :: Semigroup a => Mealy a a
logMealy = Mealy $ \a -> (a, h a) where
h a = Mealy $ \b -> let c = a <> b in (c, h c)
| 126 | logMealy :: Semigroup a => Mealy a a
logMealy = Mealy $ \a -> (a, h a) where
h a = Mealy $ \b -> let c = a <> b in (c, h c)
| 126 | logMealy = Mealy $ \a -> (a, h a) where
h a = Mealy $ \b -> let c = a <> b in (c, h c)
| 89 | false | true | 0 | 13 | 37 | 84 | 43 | 41 | null | null |
agocorona/MFlow | tests/workflow1.hs | bsd-3-clause | eserve timereserve keyBook= runFlowOnce f undefined where
f :: FlowM Html (Workflow IO) ()
f= do
let rbook = getDBRef keyBook
lift . logWF $ "You requested the reserve for: "++ keyBook
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 * 60 * 60
r <- compensate (step $ withTimeoutIO t (reserveAndMailIt rbook))
(do
lift $ logWF "Unreserving the book"
step $ liftIO . atomically $ unreserveIt rbook >> fail "")
-- liftIO $ atomically $ (reserveAndMailIt rbook >> return True)
-- `orElse` (waitUntilSTM t >> return False)
if not r
then do
lift $ logWF "reservation period ended, no stock available"
return ()
else do
lift $ logWF "The book entered in stock, reserved "
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 *60 * 60
r <- step . liftIO $ atomically $ (waitUntilSTM t >> return False)
`orElse` (testBought rbook >> return True)
if r
then do
lift $ logWF "Book was bought at this time"
else do
lift $ logWF "Reserved for a time, but reserve period ended"
fail ""
-- now it is compensated above
-- step . liftIO $ atomically $ unreserveIt rbook
u | 1,313 | buyReserve timereserve keyBook= runFlowOnce f undefined where
f :: FlowM Html (Workflow IO) ()
f= do
let rbook = getDBRef keyBook
lift . logWF $ "You requested the reserve for: "++ keyBook
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 * 60 * 60
r <- compensate (step $ withTimeoutIO t (reserveAndMailIt rbook))
(do
lift $ logWF "Unreserving the book"
step $ liftIO . atomically $ unreserveIt rbook >> fail "")
-- liftIO $ atomically $ (reserveAndMailIt rbook >> return True)
-- `orElse` (waitUntilSTM t >> return False)
if not r
then do
lift $ logWF "reservation period ended, no stock available"
return ()
else do
lift $ logWF "The book entered in stock, reserved "
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 *60 * 60
r <- step . liftIO $ atomically $ (waitUntilSTM t >> return False)
`orElse` (testBought rbook >> return True)
if r
then do
lift $ logWF "Book was bought at this time"
else do
lift $ logWF "Reserved for a time, but reserve period ended"
fail ""
-- now it is compensated above
-- step . liftIO $ atomically $ unreserveIt rbook | 1,313 | buyReserve timereserve keyBook= runFlowOnce f undefined where
f :: FlowM Html (Workflow IO) ()
f= do
let rbook = getDBRef keyBook
lift . logWF $ "You requested the reserve for: "++ keyBook
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 * 60 * 60
r <- compensate (step $ withTimeoutIO t (reserveAndMailIt rbook))
(do
lift $ logWF "Unreserving the book"
step $ liftIO . atomically $ unreserveIt rbook >> fail "")
-- liftIO $ atomically $ (reserveAndMailIt rbook >> return True)
-- `orElse` (waitUntilSTM t >> return False)
if not r
then do
lift $ logWF "reservation period ended, no stock available"
return ()
else do
lift $ logWF "The book entered in stock, reserved "
t <- lift $ getTimeoutFlag timereserve -- $ 5 * 24 *60 * 60
r <- step . liftIO $ atomically $ (waitUntilSTM t >> return False)
`orElse` (testBought rbook >> return True)
if r
then do
lift $ logWF "Book was bought at this time"
else do
lift $ logWF "Reserved for a time, but reserve period ended"
fail ""
-- now it is compensated above
-- step . liftIO $ atomically $ unreserveIt rbook | 1,313 | false | false | 0 | 17 | 454 | 305 | 142 | 163 | null | null |
green-haskell/ghc | compiler/codeGen/StgCmmClosure.hs | bsd-3-clause | getTyDescription :: Type -> String
getTyDescription ty
= case (tcSplitSigmaTy ty) of { (_, _, tau_ty) ->
case tau_ty of
TyVarTy _ -> "*"
AppTy fun _ -> getTyDescription fun
FunTy _ res -> '-' : '>' : fun_result res
TyConApp tycon _ -> getOccString tycon
ForAllTy _ ty -> getTyDescription ty
LitTy n -> getTyLitDescription n
}
where
fun_result (FunTy _ res) = '>' : fun_result res
fun_result other = getTyDescription other | 589 | getTyDescription :: Type -> String
getTyDescription ty
= case (tcSplitSigmaTy ty) of { (_, _, tau_ty) ->
case tau_ty of
TyVarTy _ -> "*"
AppTy fun _ -> getTyDescription fun
FunTy _ res -> '-' : '>' : fun_result res
TyConApp tycon _ -> getOccString tycon
ForAllTy _ ty -> getTyDescription ty
LitTy n -> getTyLitDescription n
}
where
fun_result (FunTy _ res) = '>' : fun_result res
fun_result other = getTyDescription other | 589 | getTyDescription ty
= case (tcSplitSigmaTy ty) of { (_, _, tau_ty) ->
case tau_ty of
TyVarTy _ -> "*"
AppTy fun _ -> getTyDescription fun
FunTy _ res -> '-' : '>' : fun_result res
TyConApp tycon _ -> getOccString tycon
ForAllTy _ ty -> getTyDescription ty
LitTy n -> getTyLitDescription n
}
where
fun_result (FunTy _ res) = '>' : fun_result res
fun_result other = getTyDescription other | 554 | false | true | 0 | 12 | 240 | 171 | 81 | 90 | null | null |
AmpersandTarski/ampersand | src/Ampersand/Test/Parser/ArbitraryTree.hs | gpl-3.0 | -- Generates a simple non-empty string of ascii characters
safeStr1 :: Gen String
safeStr1 = listOf1 printable `suchThat` noEsc | 127 | safeStr1 :: Gen String
safeStr1 = listOf1 printable `suchThat` noEsc | 68 | safeStr1 = listOf1 printable `suchThat` noEsc | 45 | true | true | 0 | 6 | 18 | 24 | 13 | 11 | null | null |
bacchanalia/KitchenSink | KitchenSink/Qualified.hs | gpl-3.0 | -- |'IntMapL.insertLookupWithKey'
iml_insertLookupWithKey = IntMapL.insertLookupWithKey | 87 | iml_insertLookupWithKey = IntMapL.insertLookupWithKey | 53 | iml_insertLookupWithKey = IntMapL.insertLookupWithKey | 53 | true | false | 0 | 5 | 4 | 9 | 5 | 4 | null | null |
todays-mitsui/discussion | test/UnitConverter.hs | mit | i = VarT $ Var "I_" | 19 | i = VarT $ Var "I_" | 19 | i = VarT $ Var "I_" | 19 | false | false | 3 | 5 | 5 | 18 | 6 | 12 | null | null |
mietek/stack | src/Stack/Config.hs | bsd-3-clause | -- Interprets ConfigMonoid options.
configFromConfigMonoid
:: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader env m, HasHttpManager env)
=> Path Abs Dir -- ^ stack root, e.g. ~/.stack
-> Maybe Project
-> ConfigMonoid
-> m Config
configFromConfigMonoid configStackRoot mproject ConfigMonoid{..} = do
let configDocker = Docker.dockerOptsFromMonoid mproject configStackRoot configMonoidDockerOpts
configConnectionCount = fromMaybe 8 configMonoidConnectionCount
configHideTHLoading = fromMaybe True configMonoidHideTHLoading
configLatestSnapshotUrl = fromMaybe
"https://www.stackage.org/download/snapshots.json"
configMonoidLatestSnapshotUrl
configPackageIndices = fromMaybe
[PackageIndex
{ indexName = IndexName "hackage.haskell.org"
, indexLocation = ILGitHttp
"https://github.com/commercialhaskell/all-cabal-hashes.git"
"https://s3.amazonaws.com/hackage.fpcomplete.com/00-index.tar.gz"
, indexDownloadPrefix = "https://s3.amazonaws.com/hackage.fpcomplete.com/package/"
, indexGpgVerify = False
, indexRequireHashes = False
}]
configMonoidPackageIndices
-- Only place in the codebase where platform is hard-coded. In theory
-- in the future, allow it to be configured.
configPlatform = buildPlatform
origEnv <- getEnvOverride configPlatform
let configEnvOverride _ = return origEnv
platform <- runReaderT platformRelDir configPlatform
configLocalPrograms <-
case configPlatform of
Platform _ Windows -> do
progsDir <- getWindowsProgsDir configStackRoot origEnv
return $ progsDir </> $(mkRelDir stackProgName) </> platform
_ -> return $ configStackRoot </> $(mkRelDir "programs") </> platform
return Config {..}
-- | Command-line arguments parser for configuration. | 2,042 | configFromConfigMonoid
:: (MonadLogger m, MonadIO m, MonadCatch m, MonadReader env m, HasHttpManager env)
=> Path Abs Dir -- ^ stack root, e.g. ~/.stack
-> Maybe Project
-> ConfigMonoid
-> m Config
configFromConfigMonoid configStackRoot mproject ConfigMonoid{..} = do
let configDocker = Docker.dockerOptsFromMonoid mproject configStackRoot configMonoidDockerOpts
configConnectionCount = fromMaybe 8 configMonoidConnectionCount
configHideTHLoading = fromMaybe True configMonoidHideTHLoading
configLatestSnapshotUrl = fromMaybe
"https://www.stackage.org/download/snapshots.json"
configMonoidLatestSnapshotUrl
configPackageIndices = fromMaybe
[PackageIndex
{ indexName = IndexName "hackage.haskell.org"
, indexLocation = ILGitHttp
"https://github.com/commercialhaskell/all-cabal-hashes.git"
"https://s3.amazonaws.com/hackage.fpcomplete.com/00-index.tar.gz"
, indexDownloadPrefix = "https://s3.amazonaws.com/hackage.fpcomplete.com/package/"
, indexGpgVerify = False
, indexRequireHashes = False
}]
configMonoidPackageIndices
-- Only place in the codebase where platform is hard-coded. In theory
-- in the future, allow it to be configured.
configPlatform = buildPlatform
origEnv <- getEnvOverride configPlatform
let configEnvOverride _ = return origEnv
platform <- runReaderT platformRelDir configPlatform
configLocalPrograms <-
case configPlatform of
Platform _ Windows -> do
progsDir <- getWindowsProgsDir configStackRoot origEnv
return $ progsDir </> $(mkRelDir stackProgName) </> platform
_ -> return $ configStackRoot </> $(mkRelDir "programs") </> platform
return Config {..}
-- | Command-line arguments parser for configuration. | 2,006 | configFromConfigMonoid configStackRoot mproject ConfigMonoid{..} = do
let configDocker = Docker.dockerOptsFromMonoid mproject configStackRoot configMonoidDockerOpts
configConnectionCount = fromMaybe 8 configMonoidConnectionCount
configHideTHLoading = fromMaybe True configMonoidHideTHLoading
configLatestSnapshotUrl = fromMaybe
"https://www.stackage.org/download/snapshots.json"
configMonoidLatestSnapshotUrl
configPackageIndices = fromMaybe
[PackageIndex
{ indexName = IndexName "hackage.haskell.org"
, indexLocation = ILGitHttp
"https://github.com/commercialhaskell/all-cabal-hashes.git"
"https://s3.amazonaws.com/hackage.fpcomplete.com/00-index.tar.gz"
, indexDownloadPrefix = "https://s3.amazonaws.com/hackage.fpcomplete.com/package/"
, indexGpgVerify = False
, indexRequireHashes = False
}]
configMonoidPackageIndices
-- Only place in the codebase where platform is hard-coded. In theory
-- in the future, allow it to be configured.
configPlatform = buildPlatform
origEnv <- getEnvOverride configPlatform
let configEnvOverride _ = return origEnv
platform <- runReaderT platformRelDir configPlatform
configLocalPrograms <-
case configPlatform of
Platform _ Windows -> do
progsDir <- getWindowsProgsDir configStackRoot origEnv
return $ progsDir </> $(mkRelDir stackProgName) </> platform
_ -> return $ configStackRoot </> $(mkRelDir "programs") </> platform
return Config {..}
-- | Command-line arguments parser for configuration. | 1,788 | true | true | 43 | 9 | 548 | 322 | 168 | 154 | null | null |
DavidAlphaFox/ghc | libraries/bytestring/Data/ByteString/Builder/Prim/Binary.hs | bsd-3-clause | doubleHost :: FixedPrim Double
doubleHost = storableToF | 55 | doubleHost :: FixedPrim Double
doubleHost = storableToF | 55 | doubleHost = storableToF | 24 | false | true | 0 | 6 | 6 | 20 | 8 | 12 | null | null |
mjansen/tcp-analyse | TCPOptions.hs | mit | tcpOptionACR = 14 | 20 | tcpOptionACR = 14 | 20 | tcpOptionACR = 14 | 20 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
brendanhay/gogol | gogol-tpu/gen/Network/Google/Resource/TPU/Projects/Locations/Nodes/Stop.hs | mpl-2.0 | -- | Multipart request metadata.
pPayload :: Lens' ProjectsLocationsNodesStop StopNodeRequest
pPayload = lens _pPayload (\ s a -> s{_pPayload = a}) | 147 | pPayload :: Lens' ProjectsLocationsNodesStop StopNodeRequest
pPayload = lens _pPayload (\ s a -> s{_pPayload = a}) | 114 | pPayload = lens _pPayload (\ s a -> s{_pPayload = a}) | 53 | true | true | 0 | 9 | 20 | 40 | 22 | 18 | null | null |
YLiLarry/parser241-production-rule | src/Parser241/Parser/ProductionRule/Internal/Maker.hs | bsd-3-clause | maker :: (Symbol a, [[Symbol a]]) -> Maker a
maker = Maker | 58 | maker :: (Symbol a, [[Symbol a]]) -> Maker a
maker = Maker | 58 | maker = Maker | 13 | false | true | 0 | 9 | 11 | 36 | 19 | 17 | null | null |
danoctavian/tcp-proxy | simple-proxy/Main.hs | mit | runSimpleProxy = do
debugM logger "starting simple proxy"
Proxy.run $ Proxy.Config { Proxy.proxyPort = 1080
, Proxy.initHook = \_ _ -> do
debugM logger "wtf this ran now"
return Proxy.DataHooks {
Proxy.incoming = DC.map P.id
, Proxy.outgoing = DC.map P.id
, Proxy.onDisconnect = do
debugM Proxy.logger "disconnect happened"
}
, Proxy.handshake = Socks4.serverProtocol
, Proxy.makeConn = Proxy.directTCPConn
} | 610 | runSimpleProxy = do
debugM logger "starting simple proxy"
Proxy.run $ Proxy.Config { Proxy.proxyPort = 1080
, Proxy.initHook = \_ _ -> do
debugM logger "wtf this ran now"
return Proxy.DataHooks {
Proxy.incoming = DC.map P.id
, Proxy.outgoing = DC.map P.id
, Proxy.onDisconnect = do
debugM Proxy.logger "disconnect happened"
}
, Proxy.handshake = Socks4.serverProtocol
, Proxy.makeConn = Proxy.directTCPConn
} | 610 | runSimpleProxy = do
debugM logger "starting simple proxy"
Proxy.run $ Proxy.Config { Proxy.proxyPort = 1080
, Proxy.initHook = \_ _ -> do
debugM logger "wtf this ran now"
return Proxy.DataHooks {
Proxy.incoming = DC.map P.id
, Proxy.outgoing = DC.map P.id
, Proxy.onDisconnect = do
debugM Proxy.logger "disconnect happened"
}
, Proxy.handshake = Socks4.serverProtocol
, Proxy.makeConn = Proxy.directTCPConn
} | 610 | false | false | 0 | 19 | 259 | 136 | 70 | 66 | null | null |
GaloisInc/halvm-ghc | compiler/deSugar/Coverage.hs | bsd-3-clause | addTickHsRecordBinds :: HsRecordBinds Id -> TM (HsRecordBinds Id)
addTickHsRecordBinds (HsRecFields fields dd)
= do { fields' <- mapM addTickHsRecField fields
; return (HsRecFields fields' dd) } | 205 | addTickHsRecordBinds :: HsRecordBinds Id -> TM (HsRecordBinds Id)
addTickHsRecordBinds (HsRecFields fields dd)
= do { fields' <- mapM addTickHsRecField fields
; return (HsRecFields fields' dd) } | 205 | addTickHsRecordBinds (HsRecFields fields dd)
= do { fields' <- mapM addTickHsRecField fields
; return (HsRecFields fields' dd) } | 139 | false | true | 0 | 9 | 36 | 67 | 32 | 35 | null | null |
scolobb/fgl | Data/Graph/Inductive/Internal/Thread.hs | bsd-3-clause | -- (3) abstract from split
--
threadList' :: (Collect r c) -> (Split t i r) -> [i] -> t -> (c,t)
threadList' (_,c) _ [] t = (c,t) | 138 | threadList' :: (Collect r c) -> (Split t i r) -> [i] -> t -> (c,t)
threadList' (_,c) _ [] t = (c,t) | 107 | threadList' (_,c) _ [] t = (c,t) | 40 | true | true | 0 | 11 | 37 | 85 | 45 | 40 | null | null |
sdiehl/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | -- See Note [TcLevel and untouchable type variables] for what this Int is
-- See also Note [TcLevel assignment]
{-
Note [TcLevel and untouchable type variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Each unification variable (MetaTv)
and each Implication
has a level number (of type TcLevel)
* INVARIANTS. In a tree of Implications,
(ImplicInv) The level number (ic_tclvl) of an Implication is
STRICTLY GREATER THAN that of its parent
(SkolInv) The level number of the skolems (ic_skols) of an
Implication is equal to the level of the implication
itself (ic_tclvl)
(GivenInv) The level number of a unification variable appearing
in the 'ic_given' of an implication I should be
STRICTLY LESS THAN the ic_tclvl of I
(WantedInv) The level number of a unification variable appearing
in the 'ic_wanted' of an implication I should be
LESS THAN OR EQUAL TO the ic_tclvl of I
See Note [WantedInv]
* A unification variable is *touchable* if its level number
is EQUAL TO that of its immediate parent implication,
and it is a TauTv or TyVarTv (but /not/ FlatMetaTv or FlatSkolTv)
Note [WantedInv]
~~~~~~~~~~~~~~~~
Why is WantedInv important? Consider this implication, where
the constraint (C alpha[3]) disobeys WantedInv:
forall[2] a. blah => (C alpha[3])
(forall[3] b. alpha[3] ~ b)
We can unify alpha:=b in the inner implication, because 'alpha' is
touchable; but then 'b' has excaped its scope into the outer implication.
Note [Skolem escape prevention]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We only unify touchable unification variables. Because of
(WantedInv), there can be no occurrences of the variable further out,
so the unification can't cause the skolems to escape. Example:
data T = forall a. MkT a (a->Int)
f x (MkT v f) = length [v,x]
We decide (x::alpha), and generate an implication like
[1]forall a. (a ~ alpha[0])
But we must not unify alpha:=a, because the skolem would escape.
For the cases where we DO want to unify, we rely on floating the
equality. Example (with same T)
g x (MkT v f) = x && True
We decide (x::alpha), and generate an implication like
[1]forall a. (Bool ~ alpha[0])
We do NOT unify directly, bur rather float out (if the constraint
does not mention 'a') to get
(Bool ~ alpha[0]) /\ [1]forall a.()
and NOW we can unify alpha.
The same idea of only unifying touchables solves another problem.
Suppose we had
(F Int ~ uf[0]) /\ [1](forall a. C a => F Int ~ beta[1])
In this example, beta is touchable inside the implication. The
first solveSimpleWanteds step leaves 'uf' un-unified. Then we move inside
the implication where a new constraint
uf ~ beta
emerges. If we (wrongly) spontaneously solved it to get uf := beta,
the whole implication disappears but when we pop out again we are left with
(F Int ~ uf) which will be unified by our final zonking stage and
uf will get unified *once more* to (F Int).
Note [TcLevel assignment]
~~~~~~~~~~~~~~~~~~~~~~~~~
We arrange the TcLevels like this
0 Top level
1 First-level implication constraints
2 Second-level implication constraints
...etc...
-}
maxTcLevel :: TcLevel -> TcLevel -> TcLevel
maxTcLevel (TcLevel a) (TcLevel b) = TcLevel (a `max` b) | 3,395 | maxTcLevel :: TcLevel -> TcLevel -> TcLevel
maxTcLevel (TcLevel a) (TcLevel b) = TcLevel (a `max` b) | 100 | maxTcLevel (TcLevel a) (TcLevel b) = TcLevel (a `max` b) | 56 | true | true | 0 | 7 | 782 | 51 | 28 | 23 | null | null |
meiersi-11ce/stack | src/Stack/Build/Source.hs | bsd-3-clause | localFlags :: (Map (Maybe PackageName) (Map FlagName Bool))
-> BuildConfig
-> PackageName
-> Map FlagName Bool
localFlags boptsflags bconfig name = Map.unions
[ fromMaybe Map.empty $ Map.lookup (Just name) $ boptsflags
, fromMaybe Map.empty $ Map.lookup Nothing $ boptsflags
, fromMaybe Map.empty $ Map.lookup name $ bcFlags bconfig
] | 383 | localFlags :: (Map (Maybe PackageName) (Map FlagName Bool))
-> BuildConfig
-> PackageName
-> Map FlagName Bool
localFlags boptsflags bconfig name = Map.unions
[ fromMaybe Map.empty $ Map.lookup (Just name) $ boptsflags
, fromMaybe Map.empty $ Map.lookup Nothing $ boptsflags
, fromMaybe Map.empty $ Map.lookup name $ bcFlags bconfig
] | 383 | localFlags boptsflags bconfig name = Map.unions
[ fromMaybe Map.empty $ Map.lookup (Just name) $ boptsflags
, fromMaybe Map.empty $ Map.lookup Nothing $ boptsflags
, fromMaybe Map.empty $ Map.lookup name $ bcFlags bconfig
] | 239 | false | true | 0 | 10 | 97 | 134 | 64 | 70 | null | null |
rueshyna/gogol | gogol-bigquery/gen/Network/Google/Resource/BigQuery/Tables/Insert.hs | mpl-2.0 | -- | Creates a value of 'TablesInsert' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'tiPayload'
--
-- * 'tiDataSetId'
--
-- * 'tiProjectId'
tablesInsert
:: Table -- ^ 'tiPayload'
-> Text -- ^ 'tiDataSetId'
-> Text -- ^ 'tiProjectId'
-> TablesInsert
tablesInsert pTiPayload_ pTiDataSetId_ pTiProjectId_ =
TablesInsert'
{ _tiPayload = pTiPayload_
, _tiDataSetId = pTiDataSetId_
, _tiProjectId = pTiProjectId_
} | 532 | tablesInsert
:: Table -- ^ 'tiPayload'
-> Text -- ^ 'tiDataSetId'
-> Text -- ^ 'tiProjectId'
-> TablesInsert
tablesInsert pTiPayload_ pTiDataSetId_ pTiProjectId_ =
TablesInsert'
{ _tiPayload = pTiPayload_
, _tiDataSetId = pTiDataSetId_
, _tiProjectId = pTiProjectId_
} | 304 | tablesInsert pTiPayload_ pTiDataSetId_ pTiProjectId_ =
TablesInsert'
{ _tiPayload = pTiPayload_
, _tiDataSetId = pTiDataSetId_
, _tiProjectId = pTiProjectId_
} | 179 | true | true | 0 | 7 | 114 | 62 | 40 | 22 | null | null |
fmapfmapfmap/amazonka | amazonka-elasticache/gen/Network/AWS/ElastiCache/CreateCacheSubnetGroup.hs | mpl-2.0 | -- | Undocumented member.
crsCacheSubnetGroup :: Lens' CreateCacheSubnetGroupResponse (Maybe CacheSubnetGroup)
crsCacheSubnetGroup = lens _crsCacheSubnetGroup (\ s a -> s{_crsCacheSubnetGroup = a}) | 197 | crsCacheSubnetGroup :: Lens' CreateCacheSubnetGroupResponse (Maybe CacheSubnetGroup)
crsCacheSubnetGroup = lens _crsCacheSubnetGroup (\ s a -> s{_crsCacheSubnetGroup = a}) | 171 | crsCacheSubnetGroup = lens _crsCacheSubnetGroup (\ s a -> s{_crsCacheSubnetGroup = a}) | 86 | true | true | 0 | 9 | 20 | 46 | 25 | 21 | null | null |
fmapfmapfmap/amazonka | amazonka-cloudtrail/gen/Network/AWS/CloudTrail/Types/Product.hs | mpl-2.0 | -- | Specifies a value for the specified AttributeKey.
laAttributeValue :: Lens' LookupAttribute Text
laAttributeValue = lens _laAttributeValue (\ s a -> s{_laAttributeValue = a}) | 179 | laAttributeValue :: Lens' LookupAttribute Text
laAttributeValue = lens _laAttributeValue (\ s a -> s{_laAttributeValue = a}) | 124 | laAttributeValue = lens _laAttributeValue (\ s a -> s{_laAttributeValue = a}) | 77 | true | true | 0 | 9 | 24 | 40 | 22 | 18 | null | null |
CarstenKoenig/AdventOfCode2016 | Day12/Main.hs | mit | copy :: Target -> Register -> CPU -> CPU
copy (ToValue v) RegA cpu =
moveNext $ cpu { regA = v } | 98 | copy :: Target -> Register -> CPU -> CPU
copy (ToValue v) RegA cpu =
moveNext $ cpu { regA = v } | 98 | copy (ToValue v) RegA cpu =
moveNext $ cpu { regA = v } | 57 | false | true | 0 | 7 | 24 | 48 | 25 | 23 | null | null |
gbataille/pandoc | src/Text/Pandoc/Writers/MediaWiki.hs | gpl-2.0 | blockToMediaWiki (RawBlock f str)
| f == Format "mediawiki" = return str
| f == Format "html" = return str
| otherwise = return "" | 155 | blockToMediaWiki (RawBlock f str)
| f == Format "mediawiki" = return str
| f == Format "html" = return str
| otherwise = return "" | 155 | blockToMediaWiki (RawBlock f str)
| f == Format "mediawiki" = return str
| f == Format "html" = return str
| otherwise = return "" | 155 | false | false | 1 | 9 | 49 | 64 | 28 | 36 | null | null |
zaxtax/hakaru | commands/Hakaru.hs | bsd-3-clause | iterateM_ :: Monad m => (a -> m a) -> a -> m b
iterateM_ f = g
where g x = f x >>= g | 88 | iterateM_ :: Monad m => (a -> m a) -> a -> m b
iterateM_ f = g
where g x = f x >>= g | 88 | iterateM_ f = g
where g x = f x >>= g | 41 | false | true | 0 | 9 | 29 | 59 | 28 | 31 | null | null |
zcesur/h99 | src/Problems01thru10.hs | gpl-3.0 | length'' :: Num b => [a] -> b
length'' [] = 0 | 45 | length'' :: Num b => [a] -> b
length'' [] = 0 | 45 | length'' [] = 0 | 15 | false | true | 0 | 9 | 11 | 36 | 16 | 20 | null | null |
bno1/adventofcode_2016 | d07/main.hs | mit | main :: IO ()
main = do
content <- readFile "input.txt"
let ips = map parseIP $ lines content
let tls_ips = filter checkIPTLS ips
print $ length tls_ips
let ssl_ips = filter checkIPSSL ips
print $ length ssl_ips | 237 | main :: IO ()
main = do
content <- readFile "input.txt"
let ips = map parseIP $ lines content
let tls_ips = filter checkIPTLS ips
print $ length tls_ips
let ssl_ips = filter checkIPSSL ips
print $ length ssl_ips | 237 | main = do
content <- readFile "input.txt"
let ips = map parseIP $ lines content
let tls_ips = filter checkIPTLS ips
print $ length tls_ips
let ssl_ips = filter checkIPSSL ips
print $ length ssl_ips | 223 | false | true | 2 | 7 | 64 | 82 | 37 | 45 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Atomic/MonadStateWrite.hs | bsd-3-clause | deleteItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
deleteItemInv iid kit aid =
updateActor aid $ \b -> b {binv = rmFromBag kit iid (binv b)} | 168 | deleteItemInv :: MonadStateWrite m => ItemId -> ItemQuant -> ActorId -> m ()
deleteItemInv iid kit aid =
updateActor aid $ \b -> b {binv = rmFromBag kit iid (binv b)} | 168 | deleteItemInv iid kit aid =
updateActor aid $ \b -> b {binv = rmFromBag kit iid (binv b)} | 91 | false | true | 0 | 11 | 32 | 75 | 37 | 38 | null | null |
srhb/quickcheck | Test/QuickCheck/Gen.hs | bsd-3-clause | -- | Adjust the size parameter, by transforming it with the given
-- function.
scale :: (Int -> Int) -> Gen a -> Gen a
scale f g = sized (\n -> resize (f n) g) | 159 | scale :: (Int -> Int) -> Gen a -> Gen a
scale f g = sized (\n -> resize (f n) g) | 80 | scale f g = sized (\n -> resize (f n) g) | 40 | true | true | 0 | 10 | 35 | 66 | 32 | 34 | null | null |
sol/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | quoted :: GenParser Char ParserState Inline
quoted = doubleQuoted <|> singleQuoted | 82 | quoted :: GenParser Char ParserState Inline
quoted = doubleQuoted <|> singleQuoted | 82 | quoted = doubleQuoted <|> singleQuoted | 38 | false | true | 0 | 5 | 10 | 22 | 11 | 11 | null | null |
tpsinnem/Idris-dev | src/Idris/IdrisDoc.hs | bsd-3-clause | -- | Gets all namespaces directly referred by a NsItem
referredNss :: NsItem -- ^ The name to get all directly
-- referred namespaces for
-> S.Set NsName
referredNss (_, Nothing, _) = S.empty | 227 | referredNss :: NsItem -- ^ The name to get all directly
-- referred namespaces for
-> S.Set NsName
referredNss (_, Nothing, _) = S.empty | 172 | referredNss (_, Nothing, _) = S.empty | 37 | true | true | 0 | 7 | 69 | 37 | 21 | 16 | null | null |
garetxe/cabal | Cabal/Distribution/Simple.hs | bsd-3-clause | runConfigureScript :: Verbosity -> Bool -> ConfigFlags -> LocalBuildInfo
-> IO ()
runConfigureScript verbosity backwardsCompatHack flags lbi = do
env <- getEnvironment
let programConfig = withPrograms lbi
(ccProg, ccFlags) <- configureCCompiler verbosity programConfig
-- The C compiler's compilation and linker flags (e.g.
-- "C compiler flags" and "Gcc Linker flags" from GHC) have already
-- been merged into ccFlags, so we set both CFLAGS and LDFLAGS
-- to ccFlags
-- We don't try and tell configure which ld to use, as we don't have
-- a way to pass its flags too
let extraPath = fromNubList $ configProgramPathExtra flags
let cflagsEnv = maybe (unwords ccFlags) (++ (" " ++ unwords ccFlags)) $ lookup "CFLAGS" env
spSep = [searchPathSeparator]
pathEnv = maybe (intercalate spSep extraPath) ((intercalate spSep extraPath ++ spSep)++) $ lookup "PATH" env
overEnv = ("CFLAGS", Just cflagsEnv) : [("PATH", Just pathEnv) | not (null extraPath)]
args' = args ++ ["CC=" ++ ccProg]
shProg = simpleProgram "sh"
progDb = modifyProgramSearchPath (\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb
shConfiguredProg <- lookupProgram shProg `fmap` configureProgram verbosity shProg progDb
case shConfiguredProg of
Just sh -> runProgramInvocation verbosity (programInvocation (sh {programOverrideEnv = overEnv}) args')
Nothing -> die notFoundMsg
where
args = "./configure" : configureArgs backwardsCompatHack flags
notFoundMsg = "The package has a './configure' script. If you are on Windows, This requires a "
++ "Unix compatibility toolchain such as MinGW+MSYS or Cygwin. "
++ "If you are not on Windows, ensure that an 'sh' command is discoverable in your path." | 1,804 | runConfigureScript :: Verbosity -> Bool -> ConfigFlags -> LocalBuildInfo
-> IO ()
runConfigureScript verbosity backwardsCompatHack flags lbi = do
env <- getEnvironment
let programConfig = withPrograms lbi
(ccProg, ccFlags) <- configureCCompiler verbosity programConfig
-- The C compiler's compilation and linker flags (e.g.
-- "C compiler flags" and "Gcc Linker flags" from GHC) have already
-- been merged into ccFlags, so we set both CFLAGS and LDFLAGS
-- to ccFlags
-- We don't try and tell configure which ld to use, as we don't have
-- a way to pass its flags too
let extraPath = fromNubList $ configProgramPathExtra flags
let cflagsEnv = maybe (unwords ccFlags) (++ (" " ++ unwords ccFlags)) $ lookup "CFLAGS" env
spSep = [searchPathSeparator]
pathEnv = maybe (intercalate spSep extraPath) ((intercalate spSep extraPath ++ spSep)++) $ lookup "PATH" env
overEnv = ("CFLAGS", Just cflagsEnv) : [("PATH", Just pathEnv) | not (null extraPath)]
args' = args ++ ["CC=" ++ ccProg]
shProg = simpleProgram "sh"
progDb = modifyProgramSearchPath (\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb
shConfiguredProg <- lookupProgram shProg `fmap` configureProgram verbosity shProg progDb
case shConfiguredProg of
Just sh -> runProgramInvocation verbosity (programInvocation (sh {programOverrideEnv = overEnv}) args')
Nothing -> die notFoundMsg
where
args = "./configure" : configureArgs backwardsCompatHack flags
notFoundMsg = "The package has a './configure' script. If you are on Windows, This requires a "
++ "Unix compatibility toolchain such as MinGW+MSYS or Cygwin. "
++ "If you are not on Windows, ensure that an 'sh' command is discoverable in your path." | 1,804 | runConfigureScript verbosity backwardsCompatHack flags lbi = do
env <- getEnvironment
let programConfig = withPrograms lbi
(ccProg, ccFlags) <- configureCCompiler verbosity programConfig
-- The C compiler's compilation and linker flags (e.g.
-- "C compiler flags" and "Gcc Linker flags" from GHC) have already
-- been merged into ccFlags, so we set both CFLAGS and LDFLAGS
-- to ccFlags
-- We don't try and tell configure which ld to use, as we don't have
-- a way to pass its flags too
let extraPath = fromNubList $ configProgramPathExtra flags
let cflagsEnv = maybe (unwords ccFlags) (++ (" " ++ unwords ccFlags)) $ lookup "CFLAGS" env
spSep = [searchPathSeparator]
pathEnv = maybe (intercalate spSep extraPath) ((intercalate spSep extraPath ++ spSep)++) $ lookup "PATH" env
overEnv = ("CFLAGS", Just cflagsEnv) : [("PATH", Just pathEnv) | not (null extraPath)]
args' = args ++ ["CC=" ++ ccProg]
shProg = simpleProgram "sh"
progDb = modifyProgramSearchPath (\p -> map ProgramSearchPathDir extraPath ++ p) emptyProgramDb
shConfiguredProg <- lookupProgram shProg `fmap` configureProgram verbosity shProg progDb
case shConfiguredProg of
Just sh -> runProgramInvocation verbosity (programInvocation (sh {programOverrideEnv = overEnv}) args')
Nothing -> die notFoundMsg
where
args = "./configure" : configureArgs backwardsCompatHack flags
notFoundMsg = "The package has a './configure' script. If you are on Windows, This requires a "
++ "Unix compatibility toolchain such as MinGW+MSYS or Cygwin. "
++ "If you are not on Windows, ensure that an 'sh' command is discoverable in your path." | 1,703 | false | true | 0 | 15 | 382 | 390 | 198 | 192 | null | null |
zaxtax/hakaru | haskell/Language/Hakaru/CodeGen/Types.hs | bsd-3-clause | buildType (SMeasure x) = [callStruct . typeName . SMeasure $ x] | 64 | buildType (SMeasure x) = [callStruct . typeName . SMeasure $ x] | 64 | buildType (SMeasure x) = [callStruct . typeName . SMeasure $ x] | 64 | false | false | 0 | 8 | 11 | 30 | 15 | 15 | null | null |
diagrams/diagrams-input | src/Diagrams/SVG/Arguments.hs | bsd-3-clause | setAttrs =
do ca <- coreAttributes
pa <- presentationAttributes
xlink <- xlinkAttributes
ignoreAttrs
return (ca,pa,xlink) | 143 | setAttrs =
do ca <- coreAttributes
pa <- presentationAttributes
xlink <- xlinkAttributes
ignoreAttrs
return (ca,pa,xlink) | 143 | setAttrs =
do ca <- coreAttributes
pa <- presentationAttributes
xlink <- xlinkAttributes
ignoreAttrs
return (ca,pa,xlink) | 143 | false | false | 0 | 8 | 36 | 45 | 21 | 24 | null | null |
sdiehl/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | -- Overloaded record field selectors
mkRecFldSelOcc :: String -> OccName
mkRecFldSelOcc s = mk_deriv varName "$sel" [fsLit s] | 125 | mkRecFldSelOcc :: String -> OccName
mkRecFldSelOcc s = mk_deriv varName "$sel" [fsLit s] | 88 | mkRecFldSelOcc s = mk_deriv varName "$sel" [fsLit s] | 52 | true | true | 0 | 7 | 17 | 32 | 16 | 16 | null | null |
michalkonecny/aern | aern-mpfr-rounded/src/Numeric/AERN/MPFRBasis/Interval.hs | bsd-3-clause | {-| Convenience Unicode notation for '<\/>?' -}
(<⊔>?) :: MI -> MI -> Maybe MI
(<⊔>?) = (BRO.<⊔>?) | 99 | (<⊔>?) :: MI -> MI -> Maybe MI
(<⊔>?) = (BRO.<⊔>?) | 50 | (<⊔>?) = (BRO.<⊔>?) | 19 | true | true | 0 | 7 | 18 | 31 | 19 | 12 | null | null |
NCrashed/PowerCom | src/powercom/Channel/Miscs.hs | gpl-3.0 | sendDisconnectUser :: ProcessId -> String -> Process ()
sendDisconnectUser = sendTyped1 "disconnect" | 100 | sendDisconnectUser :: ProcessId -> String -> Process ()
sendDisconnectUser = sendTyped1 "disconnect" | 100 | sendDisconnectUser = sendTyped1 "disconnect" | 44 | false | true | 0 | 8 | 11 | 27 | 13 | 14 | null | null |
DavidAlphaFox/darcs | src/Darcs/Patch/Rebase/Fixup.hs | gpl-2.0 | flToNamesPrims (PrimFixup p :>: fs) =
case flToNamesPrims fs of
names :> prims ->
case totalCommuterIdFL commutePrimName (p :> names) of
names' :> p' -> names' :> (p' :>: prims)
-- Note that this produces a list result because of the need to use effect to
-- extract the result.
-- Some general infrastructure for commuting p with PrimOf p would be helpful here, | 403 | flToNamesPrims (PrimFixup p :>: fs) =
case flToNamesPrims fs of
names :> prims ->
case totalCommuterIdFL commutePrimName (p :> names) of
names' :> p' -> names' :> (p' :>: prims)
-- Note that this produces a list result because of the need to use effect to
-- extract the result.
-- Some general infrastructure for commuting p with PrimOf p would be helpful here, | 403 | flToNamesPrims (PrimFixup p :>: fs) =
case flToNamesPrims fs of
names :> prims ->
case totalCommuterIdFL commutePrimName (p :> names) of
names' :> p' -> names' :> (p' :>: prims)
-- Note that this produces a list result because of the need to use effect to
-- extract the result.
-- Some general infrastructure for commuting p with PrimOf p would be helpful here, | 403 | false | false | 0 | 13 | 104 | 76 | 39 | 37 | null | null |
kim/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/CreateLaunchConfiguration.hs | mpl-2.0 | -- | Used for groups that launch instances into a virtual private cloud (VPC).
-- Specifies whether to assign a public IP address to each instance. For more
-- information, see <http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/autoscalingsubnets.html Auto Scaling and Amazon VPC> in the /Auto Scaling DeveloperGuide/.
--
-- If you specify a value for this parameter, be sure to specify at least one
-- subnet using the /VPCZoneIdentifier/ parameter when you create your group.
--
-- Default: If the instance is launched into a default subnet, the default is 'true'. If the instance is launched into a nondefault subnet, the default is 'false'.
-- For more information, see <http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide//as-supported-platforms.html Supported Platforms> in the /Amazon Elastic ComputeCloud User Guide/.
clcAssociatePublicIpAddress :: Lens' CreateLaunchConfiguration (Maybe Bool)
clcAssociatePublicIpAddress =
lens _clcAssociatePublicIpAddress
(\s a -> s { _clcAssociatePublicIpAddress = a }) | 1,046 | clcAssociatePublicIpAddress :: Lens' CreateLaunchConfiguration (Maybe Bool)
clcAssociatePublicIpAddress =
lens _clcAssociatePublicIpAddress
(\s a -> s { _clcAssociatePublicIpAddress = a }) | 200 | clcAssociatePublicIpAddress =
lens _clcAssociatePublicIpAddress
(\s a -> s { _clcAssociatePublicIpAddress = a }) | 124 | true | true | 0 | 9 | 144 | 54 | 33 | 21 | null | null |
fpco/hlint | data/Default.hs | bsd-3-clause | warn = flip (g `on` h) ==> flip g `on` h | 41 | warn = flip (g `on` h) ==> flip g `on` h | 41 | warn = flip (g `on` h) ==> flip g `on` h | 41 | false | false | 0 | 9 | 11 | 31 | 17 | 14 | null | null |
suhailshergill/liboleg | Language/TEval/TInfLetP.hs | bsd-3-clause | teval' env (I n) = return TInt | 30 | teval' env (I n) = return TInt | 30 | teval' env (I n) = return TInt | 30 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
mikehat/blaze-css | src/Text/Blaze/Css21/Style.hs | bsd-3-clause | outlineColor = B.cssStyle "outline-color" "outline-color: " . B.stringValue . toString | 86 | outlineColor = B.cssStyle "outline-color" "outline-color: " . B.stringValue . toString | 86 | outlineColor = B.cssStyle "outline-color" "outline-color: " . B.stringValue . toString | 86 | false | false | 1 | 8 | 9 | 27 | 11 | 16 | null | null |
tjakway/ghcjvm | compiler/ghci/ByteCodeLink.hs | bsd-3-clause | lookupLiteral _ _ (BCONPtrStr _) =
-- should be eliminated during assembleBCOs
panic "lookupLiteral: BCONPtrStr" | 116 | lookupLiteral _ _ (BCONPtrStr _) =
-- should be eliminated during assembleBCOs
panic "lookupLiteral: BCONPtrStr" | 116 | lookupLiteral _ _ (BCONPtrStr _) =
-- should be eliminated during assembleBCOs
panic "lookupLiteral: BCONPtrStr" | 116 | false | false | 0 | 7 | 18 | 23 | 11 | 12 | null | null |
mainland/nikola | src/Data/Vector/CUDA/UnboxedForeign.hs | bsd-3-clause | postscanl = G.postscanl | 23 | postscanl = G.postscanl | 23 | postscanl = G.postscanl | 23 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
AndrewRademacher/stack | src/Stack/Fetch.hs | bsd-3-clause | -- | Figure out where to fetch from.
getToFetch :: (MonadMask m, MonadLogger m, MonadIO m, MonadReader env m, HasConfig env)
=> Maybe (Path Abs Dir) -- ^ directory to unpack into, @Nothing@ means no unpack
-> Map PackageIdentifier ResolvedPackage
-> m ToFetchResult
getToFetch mdest resolvedAll = do
(toFetch0, unpacked) <- liftM partitionEithers $ mapM checkUnpacked $ Map.toList resolvedAll
toFetch1 <- mapM goIndex $ Map.toList $ Map.fromListWith (++) toFetch0
return ToFetchResult
{ tfrToFetch = Map.unions toFetch1
, tfrAlreadyUnpacked = Map.fromList unpacked
}
where
checkUnpacked (ident, resolved) = do
dirRel <- parseRelDir $ packageIdentifierString ident
let mdestDir = (</> dirRel) <$> mdest
mexists <-
case mdestDir of
Nothing -> return Nothing
Just destDir -> do
exists <- doesDirExist destDir
return $ if exists then Just destDir else Nothing
case mexists of
Just destDir -> return $ Right (ident, destDir)
Nothing -> do
let index = rpIndex resolved
d = pcDownload $ rpCache resolved
targz = T.pack $ packageIdentifierString ident ++ ".tar.gz"
tarball <- configPackageTarball (indexName index) ident
return $ Left (indexName index, [(ident, rpCache resolved, rpGitSHA1 resolved, ToFetch
{ tfTarball = tarball
, tfDestDir = mdestDir
, tfUrl = case d of
Just d' -> decodeUtf8 $ pdUrl d'
Nothing -> indexDownloadPrefix index <> targz
, tfSize = fmap pdSize d
, tfSHA512 = fmap pdSHA512 d
, tfCabal = S.empty -- filled in by goIndex
})])
goIndex (name, pkgs) =
liftM Map.fromList $
withCabalFiles name pkgs $ \ident tf cabalBS ->
return (ident, tf { tfCabal = cabalBS })
-- | Download the given name,version pairs into the directory expected by cabal.
--
-- For each package it downloads, it will optionally unpack it to the given
-- @Path@ (if present). Note that unpacking is not simply a matter of
-- untarring, but also of grabbing the cabal file from the package index. The
-- destinations should not include package identifiers.
--
-- Returns the list of paths unpacked, including package identifiers. E.g.:
--
-- @
-- fetchPackages [("foo-1.2.3", Just "/some/dest")] ==> ["/some/dest/foo-1.2.3"]
-- @
--
-- Since 0.1.0.0 | 2,657 | getToFetch :: (MonadMask m, MonadLogger m, MonadIO m, MonadReader env m, HasConfig env)
=> Maybe (Path Abs Dir) -- ^ directory to unpack into, @Nothing@ means no unpack
-> Map PackageIdentifier ResolvedPackage
-> m ToFetchResult
getToFetch mdest resolvedAll = do
(toFetch0, unpacked) <- liftM partitionEithers $ mapM checkUnpacked $ Map.toList resolvedAll
toFetch1 <- mapM goIndex $ Map.toList $ Map.fromListWith (++) toFetch0
return ToFetchResult
{ tfrToFetch = Map.unions toFetch1
, tfrAlreadyUnpacked = Map.fromList unpacked
}
where
checkUnpacked (ident, resolved) = do
dirRel <- parseRelDir $ packageIdentifierString ident
let mdestDir = (</> dirRel) <$> mdest
mexists <-
case mdestDir of
Nothing -> return Nothing
Just destDir -> do
exists <- doesDirExist destDir
return $ if exists then Just destDir else Nothing
case mexists of
Just destDir -> return $ Right (ident, destDir)
Nothing -> do
let index = rpIndex resolved
d = pcDownload $ rpCache resolved
targz = T.pack $ packageIdentifierString ident ++ ".tar.gz"
tarball <- configPackageTarball (indexName index) ident
return $ Left (indexName index, [(ident, rpCache resolved, rpGitSHA1 resolved, ToFetch
{ tfTarball = tarball
, tfDestDir = mdestDir
, tfUrl = case d of
Just d' -> decodeUtf8 $ pdUrl d'
Nothing -> indexDownloadPrefix index <> targz
, tfSize = fmap pdSize d
, tfSHA512 = fmap pdSHA512 d
, tfCabal = S.empty -- filled in by goIndex
})])
goIndex (name, pkgs) =
liftM Map.fromList $
withCabalFiles name pkgs $ \ident tf cabalBS ->
return (ident, tf { tfCabal = cabalBS })
-- | Download the given name,version pairs into the directory expected by cabal.
--
-- For each package it downloads, it will optionally unpack it to the given
-- @Path@ (if present). Note that unpacking is not simply a matter of
-- untarring, but also of grabbing the cabal file from the package index. The
-- destinations should not include package identifiers.
--
-- Returns the list of paths unpacked, including package identifiers. E.g.:
--
-- @
-- fetchPackages [("foo-1.2.3", Just "/some/dest")] ==> ["/some/dest/foo-1.2.3"]
-- @
--
-- Since 0.1.0.0 | 2,620 | getToFetch mdest resolvedAll = do
(toFetch0, unpacked) <- liftM partitionEithers $ mapM checkUnpacked $ Map.toList resolvedAll
toFetch1 <- mapM goIndex $ Map.toList $ Map.fromListWith (++) toFetch0
return ToFetchResult
{ tfrToFetch = Map.unions toFetch1
, tfrAlreadyUnpacked = Map.fromList unpacked
}
where
checkUnpacked (ident, resolved) = do
dirRel <- parseRelDir $ packageIdentifierString ident
let mdestDir = (</> dirRel) <$> mdest
mexists <-
case mdestDir of
Nothing -> return Nothing
Just destDir -> do
exists <- doesDirExist destDir
return $ if exists then Just destDir else Nothing
case mexists of
Just destDir -> return $ Right (ident, destDir)
Nothing -> do
let index = rpIndex resolved
d = pcDownload $ rpCache resolved
targz = T.pack $ packageIdentifierString ident ++ ".tar.gz"
tarball <- configPackageTarball (indexName index) ident
return $ Left (indexName index, [(ident, rpCache resolved, rpGitSHA1 resolved, ToFetch
{ tfTarball = tarball
, tfDestDir = mdestDir
, tfUrl = case d of
Just d' -> decodeUtf8 $ pdUrl d'
Nothing -> indexDownloadPrefix index <> targz
, tfSize = fmap pdSize d
, tfSHA512 = fmap pdSHA512 d
, tfCabal = S.empty -- filled in by goIndex
})])
goIndex (name, pkgs) =
liftM Map.fromList $
withCabalFiles name pkgs $ \ident tf cabalBS ->
return (ident, tf { tfCabal = cabalBS })
-- | Download the given name,version pairs into the directory expected by cabal.
--
-- For each package it downloads, it will optionally unpack it to the given
-- @Path@ (if present). Note that unpacking is not simply a matter of
-- untarring, but also of grabbing the cabal file from the package index. The
-- destinations should not include package identifiers.
--
-- Returns the list of paths unpacked, including package identifiers. E.g.:
--
-- @
-- fetchPackages [("foo-1.2.3", Just "/some/dest")] ==> ["/some/dest/foo-1.2.3"]
-- @
--
-- Since 0.1.0.0 | 2,358 | true | true | 1 | 26 | 859 | 566 | 291 | 275 | null | null |
sdiehl/ghc | compiler/utils/FiniteMap.hs | bsd-3-clause | foldRight :: (elt -> a -> a) -> a -> Map key elt -> a
foldRight = Map.foldr | 89 | foldRight :: (elt -> a -> a) -> a -> Map key elt -> a
foldRight = Map.foldr | 89 | foldRight = Map.foldr | 28 | false | true | 0 | 8 | 31 | 41 | 21 | 20 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | happyReduction_112 _ _ = notHappyAtAll | 39 | happyReduction_112 _ _ = notHappyAtAll | 39 | happyReduction_112 _ _ = notHappyAtAll | 39 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
DaMSL/K3 | src/Language/K3/Parser/SQL.hs | apache-2.0 | keyValueMapping :: TypeMapping -> Bool
keyValueMapping tm = maybe False (either (\pfx -> pfx `elem` ["key", "value"]) keyValuePrefix) tm | 136 | keyValueMapping :: TypeMapping -> Bool
keyValueMapping tm = maybe False (either (\pfx -> pfx `elem` ["key", "value"]) keyValuePrefix) tm | 136 | keyValueMapping tm = maybe False (either (\pfx -> pfx `elem` ["key", "value"]) keyValuePrefix) tm | 97 | false | true | 0 | 11 | 18 | 53 | 29 | 24 | null | null |
Fermat/higher-rank | src/Syntax.hs | bsd-3-clause | norm g (Const a p) =
case lookup a g of
Nothing -> Const a p
Just b -> norm g b | 89 | norm g (Const a p) =
case lookup a g of
Nothing -> Const a p
Just b -> norm g b | 89 | norm g (Const a p) =
case lookup a g of
Nothing -> Const a p
Just b -> norm g b | 89 | false | false | 3 | 7 | 31 | 53 | 24 | 29 | null | null |
sdiehl/ghc | testsuite/tests/programs/andy_cherry/DataTypes.hs | bsd-3-clause | charToMoveTok '0' = Just (PartCastleTok) | 40 | charToMoveTok '0' = Just (PartCastleTok) | 40 | charToMoveTok '0' = Just (PartCastleTok) | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
KommuSoft/dep-software | Dep.Samples.hs | gpl-3.0 | fsm1e "h" = F | 13 | fsm1e "h" = F | 13 | fsm1e "h" = F | 13 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
ezyang/ghc | compiler/prelude/THNames.hs | bsd-3-clause | -- data Phases = ...
allPhasesDataConName, fromPhaseDataConName, beforePhaseDataConName :: Name
allPhasesDataConName = thCon (fsLit "AllPhases") allPhasesDataConKey | 168 | allPhasesDataConName, fromPhaseDataConName, beforePhaseDataConName :: Name
allPhasesDataConName = thCon (fsLit "AllPhases") allPhasesDataConKey | 147 | allPhasesDataConName = thCon (fsLit "AllPhases") allPhasesDataConKey | 72 | true | true | 0 | 7 | 19 | 27 | 16 | 11 | null | null |
alexander-at-github/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo CasSmallArrayOp = mkGenPrimOp (fsLit "casSmallArray#") [deltaTyVar, alphaTyVar] [mkSmallMutableArrayPrimTy deltaTy alphaTy, intPrimTy, alphaTy, alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, intPrimTy, alphaTy])) | 258 | primOpInfo CasSmallArrayOp = mkGenPrimOp (fsLit "casSmallArray#") [deltaTyVar, alphaTyVar] [mkSmallMutableArrayPrimTy deltaTy alphaTy, intPrimTy, alphaTy, alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, intPrimTy, alphaTy])) | 258 | primOpInfo CasSmallArrayOp = mkGenPrimOp (fsLit "casSmallArray#") [deltaTyVar, alphaTyVar] [mkSmallMutableArrayPrimTy deltaTy alphaTy, intPrimTy, alphaTy, alphaTy, mkStatePrimTy deltaTy] ((mkTupleTy UnboxedTuple [mkStatePrimTy deltaTy, intPrimTy, alphaTy])) | 258 | false | false | 0 | 10 | 22 | 76 | 41 | 35 | null | null |
Rathcke/uni | ap/exam/src/subs/SubsInterpreter.hs | gpl-3.0 | getFunction :: FunName -> SubsM Primitive
getFunction name = do
penv <- getPEnv
case Map.lookup name penv of
Just a -> return a
Nothing -> fail "Key does not exist in 'getFunction'"
-- End Utility Functions
-- Expr and Stms Evaluation | 248 | getFunction :: FunName -> SubsM Primitive
getFunction name = do
penv <- getPEnv
case Map.lookup name penv of
Just a -> return a
Nothing -> fail "Key does not exist in 'getFunction'"
-- End Utility Functions
-- Expr and Stms Evaluation | 248 | getFunction name = do
penv <- getPEnv
case Map.lookup name penv of
Just a -> return a
Nothing -> fail "Key does not exist in 'getFunction'"
-- End Utility Functions
-- Expr and Stms Evaluation | 206 | false | true | 0 | 10 | 54 | 65 | 30 | 35 | null | null |
langthom/data-structures | sortingAlgorithms/SelectionSort/Haskell/Main.hs | bsd-3-clause | sample :: [Integer]
sample = [ 5, 9, 24, 72, 0, (-5), 18, 999, 212 ] | 68 | sample :: [Integer]
sample = [ 5, 9, 24, 72, 0, (-5), 18, 999, 212 ] | 68 | sample = [ 5, 9, 24, 72, 0, (-5), 18, 999, 212 ] | 48 | false | true | 0 | 7 | 15 | 46 | 29 | 17 | null | null |
rueshyna/gogol | gogol-doubleclick-search/gen/Network/Google/DoubleClickSearch/Types/Product.hs | mpl-2.0 | -- | The saved columns being requested.
sclItems :: Lens' SavedColumnList [SavedColumn]
sclItems
= lens _sclItems (\ s a -> s{_sclItems = a}) .
_Default
. _Coerce | 176 | sclItems :: Lens' SavedColumnList [SavedColumn]
sclItems
= lens _sclItems (\ s a -> s{_sclItems = a}) .
_Default
. _Coerce | 136 | sclItems
= lens _sclItems (\ s a -> s{_sclItems = a}) .
_Default
. _Coerce | 88 | true | true | 2 | 9 | 40 | 58 | 28 | 30 | null | null |
romanb/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/DescribeNotificationConfigurations.hs | mpl-2.0 | -- | The name of the group.
dncAutoScalingGroupNames :: Lens' DescribeNotificationConfigurations [Text]
dncAutoScalingGroupNames =
lens _dncAutoScalingGroupNames
(\s a -> s { _dncAutoScalingGroupNames = a })
. _List | 239 | dncAutoScalingGroupNames :: Lens' DescribeNotificationConfigurations [Text]
dncAutoScalingGroupNames =
lens _dncAutoScalingGroupNames
(\s a -> s { _dncAutoScalingGroupNames = a })
. _List | 211 | dncAutoScalingGroupNames =
lens _dncAutoScalingGroupNames
(\s a -> s { _dncAutoScalingGroupNames = a })
. _List | 135 | true | true | 0 | 10 | 50 | 47 | 26 | 21 | null | null |
olsner/ghc | testsuite/tests/module/T1148.hs | bsd-3-clause | at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e
at (T a) i = unsafeAt a (index (minBound, maxBound) i) | 126 | at :: (Ix i, Bounded i, Array.IArray Array.UArray e) => T i e -> i -> e
at (T a) i = unsafeAt a (index (minBound, maxBound) i) | 126 | at (T a) i = unsafeAt a (index (minBound, maxBound) i) | 54 | false | true | 0 | 11 | 27 | 86 | 42 | 44 | null | null |
shepheb/go10c | Compiler.hs | bsd-3-clause | -- >= is < with the arguments swapped
compileExpr (BinOp (LOp "<=") left right) = compileComparisonOp IFG IFA "<=" swap left right | 130 | compileExpr (BinOp (LOp "<=") left right) = compileComparisonOp IFG IFA "<=" swap left right | 92 | compileExpr (BinOp (LOp "<=") left right) = compileComparisonOp IFG IFA "<=" swap left right | 92 | true | false | 0 | 9 | 21 | 39 | 19 | 20 | null | null |
dalaing/sdl2 | src/SDL/Raw/Event.hs | bsd-3-clause | joystickGetGUID :: MonadIO m => Joystick -> m JoystickGUID
joystickGetGUID joystick = liftIO . alloca $ \ptr -> do
joystickGetGUIDFFI joystick ptr
peek ptr
| 160 | joystickGetGUID :: MonadIO m => Joystick -> m JoystickGUID
joystickGetGUID joystick = liftIO . alloca $ \ptr -> do
joystickGetGUIDFFI joystick ptr
peek ptr
| 160 | joystickGetGUID joystick = liftIO . alloca $ \ptr -> do
joystickGetGUIDFFI joystick ptr
peek ptr
| 101 | false | true | 0 | 9 | 28 | 55 | 25 | 30 | null | null |
snoyberg/ghc | testsuite/tests/dependent/should_compile/dynamic-paper.hs | bsd-3-clause | fromDynamicMonad :: forall d. Typeable d => Dynamic -> Maybe d
fromDynamicMonad (Dyn ra x)
= do Refl <- eqT ra (typeRep :: TypeRep d)
return x | 154 | fromDynamicMonad :: forall d. Typeable d => Dynamic -> Maybe d
fromDynamicMonad (Dyn ra x)
= do Refl <- eqT ra (typeRep :: TypeRep d)
return x | 153 | fromDynamicMonad (Dyn ra x)
= do Refl <- eqT ra (typeRep :: TypeRep d)
return x | 90 | false | true | 0 | 10 | 38 | 68 | 32 | 36 | null | null |
pellagic-puffbomb/haskpy-dependency-graphs | src/DependencyGraph.hs | gpl-3.0 | sub :: String
sub = "//### EDGES ###//\n" | 41 | sub :: String
sub = "//### EDGES ###//\n" | 41 | sub = "//### EDGES ###//\n" | 27 | false | true | 0 | 6 | 7 | 18 | 7 | 11 | null | null |
ganeti/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | defaultNetCustom :: String
defaultNetCustom = "" | 48 | defaultNetCustom :: String
defaultNetCustom = "" | 48 | defaultNetCustom = "" | 21 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
michelk/bindings-saga-cmd.hs | src/sagaPipe.hs | gpl-3.0 | _PROGRAM_VERSION = "0.2" | 24 | _PROGRAM_VERSION = "0.2" | 24 | _PROGRAM_VERSION = "0.2" | 24 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
brendanhay/gogol | gogol-spanner/gen/Network/Google/Resource/Spanner/Projects/Instances/Backups/Operations/List.hs | mpl-2.0 | -- | V1 error format.
pibolXgafv :: Lens' ProjectsInstancesBackupsOperationsList (Maybe Xgafv)
pibolXgafv
= lens _pibolXgafv (\ s a -> s{_pibolXgafv = a}) | 156 | pibolXgafv :: Lens' ProjectsInstancesBackupsOperationsList (Maybe Xgafv)
pibolXgafv
= lens _pibolXgafv (\ s a -> s{_pibolXgafv = a}) | 134 | pibolXgafv
= lens _pibolXgafv (\ s a -> s{_pibolXgafv = a}) | 61 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
erochest/cabal-new | CabalNew/Opts.hs | apache-2.0 | readBackendOption :: Monad m => String -> m YesodBackend
readBackendOption backend = go $ map toLower backend
where go "s" = return Sqlite
go "p" = return Postgres
go "pf" = return PostFay
go "mongo" = return MongoDB
go "mysql" = return MySQL
go "simple" = return Simple
go _ = fail $ "Invalid backend: " ++ backend | 402 | readBackendOption :: Monad m => String -> m YesodBackend
readBackendOption backend = go $ map toLower backend
where go "s" = return Sqlite
go "p" = return Postgres
go "pf" = return PostFay
go "mongo" = return MongoDB
go "mysql" = return MySQL
go "simple" = return Simple
go _ = fail $ "Invalid backend: " ++ backend | 402 | readBackendOption backend = go $ map toLower backend
where go "s" = return Sqlite
go "p" = return Postgres
go "pf" = return PostFay
go "mongo" = return MongoDB
go "mysql" = return MySQL
go "simple" = return Simple
go _ = fail $ "Invalid backend: " ++ backend | 345 | false | true | 0 | 8 | 144 | 121 | 56 | 65 | null | null |
ddssff/lens | src/Control/Lens/Traversal.hs | bsd-3-clause | --------------------------
-- Traversal Combinators
--------------------------
-- | Map each element of a structure targeted by a 'Lens' or 'Traversal',
-- evaluate these actions from left to right, and collect the results.
--
-- This function is only provided for consistency, 'id' is strictly more general.
--
-- >>> traverseOf each print (1,2,3)
-- 1
-- 2
-- 3
-- ((),(),())
--
-- @
-- 'traverseOf' ≡ 'id'
-- 'itraverseOf' l ≡ 'traverseOf' l '.' 'Indexed'
-- 'itraverseOf' 'itraversed' ≡ 'itraverse'
-- @
--
--
-- This yields the obvious law:
--
-- @
-- 'traverse' ≡ 'traverseOf' 'traverse'
-- @
--
-- @
-- 'traverseOf' :: 'Functor' f => 'Iso' s t a b -> (a -> f b) -> s -> f t
-- 'traverseOf' :: 'Functor' f => 'Lens' s t a b -> (a -> f b) -> s -> f t
-- 'traverseOf' :: 'Apply' f => 'Traversal1' s t a b -> (a -> f b) -> s -> f t
-- 'traverseOf' :: 'Applicative' f => 'Traversal' s t a b -> (a -> f b) -> s -> f t
-- @
traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t
traverseOf = id | 1,027 | traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t
traverseOf = id | 74 | traverseOf = id | 15 | true | true | 0 | 9 | 238 | 80 | 56 | 24 | null | null |
zsol/visual-graphrewrite | GraphRewrite/Internal/Convert.hs | bsd-3-clause | -- | Converts a 'ParseResult' as returned by 'Language.Haskell.Parser' to our internal 'SimpModule' format. Returns an empty 'SimpModule' if the parse failed.
convParse :: ParseResult HsModule -> SimpModule String
convParse (ParseFailed loc err) = error $ "Parse of module failed at " ++ show loc ++ " with message: " ++ err | 324 | convParse :: ParseResult HsModule -> SimpModule String
convParse (ParseFailed loc err) = error $ "Parse of module failed at " ++ show loc ++ " with message: " ++ err | 165 | convParse (ParseFailed loc err) = error $ "Parse of module failed at " ++ show loc ++ " with message: " ++ err | 110 | true | true | 0 | 8 | 51 | 52 | 25 | 27 | null | null |
kejace/ethereum-client-haskell | src/Blockchain/Data/Wire.hs | bsd-3-clause | numberToTerminationReason _ = error "numberToTerminationReasion called with unsupported number" | 95 | numberToTerminationReason _ = error "numberToTerminationReasion called with unsupported number" | 95 | numberToTerminationReason _ = error "numberToTerminationReasion called with unsupported number" | 95 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
MihaiVisu/HaskellStuff | tutorial6 week8/KeymapTree.hs | mit | -- Exercise 15
select :: Ord k => (a -> Bool) -> Keymap k a -> Keymap k a
select = undefined | 93 | select :: Ord k => (a -> Bool) -> Keymap k a -> Keymap k a
select = undefined | 77 | select = undefined | 18 | true | true | 0 | 8 | 22 | 44 | 22 | 22 | null | null |
AccelerateHS/accelerate-c | Data/Array/Accelerate/C/Exp.hs | bsd-3-clause | floorToC :: FloatingType a -> IntegralType b -> C.Exp -> C.Exp
floorToC ta tb x
= ccast (NumScalarType (IntegralNumType tb))
$ ccall (FloatingNumType ta `postfix` "floor") [x] | 179 | floorToC :: FloatingType a -> IntegralType b -> C.Exp -> C.Exp
floorToC ta tb x
= ccast (NumScalarType (IntegralNumType tb))
$ ccall (FloatingNumType ta `postfix` "floor") [x] | 179 | floorToC ta tb x
= ccast (NumScalarType (IntegralNumType tb))
$ ccall (FloatingNumType ta `postfix` "floor") [x] | 116 | false | true | 2 | 9 | 30 | 79 | 39 | 40 | null | null |
yesodweb/yesod | yesod/Yesod/Default/Config.hs | mit | parseArgConfig :: (Show env, Read env, Enum env, Bounded env) => IO (ArgConfig env)
parseArgConfig = do
let envs = [minBound..maxBound]
args <- getArgs
(portS, args') <- getPort id args
portI <-
case reads portS of
(i, _):_ -> return i
[] -> error $ "Invalid port value: " ++ show portS
case args' of
[e] -> do
case reads $ capitalize e of
(e', _):_ -> return $ ArgConfig e' portI
[] -> do
() <- error $ "Invalid environment, valid entries are: " ++ show envs
-- next line just provided to force the type of envs
return $ ArgConfig (head envs) 0
_ -> do
pn <- getProgName
putStrLn $ "Usage: " ++ pn ++ " <environment> [--port <port>]"
putStrLn $ "Valid environments: " ++ show envs
exitFailure
where
getPort front [] = do
env <- getEnvironment
return (fromMaybe "0" $ lookup "PORT" env, front [])
getPort front ("--port":p:rest) = return (p, front rest)
getPort front ("-p":p:rest) = return (p, front rest)
getPort front (arg:rest) = getPort (front . (arg:)) rest
capitalize [] = []
capitalize (x:xs) = toUpper x : xs
-- | Load the app config from command line parameters, using the given
-- @ConfigSettings.
--
-- Since 1.2.2 | 1,390 | parseArgConfig :: (Show env, Read env, Enum env, Bounded env) => IO (ArgConfig env)
parseArgConfig = do
let envs = [minBound..maxBound]
args <- getArgs
(portS, args') <- getPort id args
portI <-
case reads portS of
(i, _):_ -> return i
[] -> error $ "Invalid port value: " ++ show portS
case args' of
[e] -> do
case reads $ capitalize e of
(e', _):_ -> return $ ArgConfig e' portI
[] -> do
() <- error $ "Invalid environment, valid entries are: " ++ show envs
-- next line just provided to force the type of envs
return $ ArgConfig (head envs) 0
_ -> do
pn <- getProgName
putStrLn $ "Usage: " ++ pn ++ " <environment> [--port <port>]"
putStrLn $ "Valid environments: " ++ show envs
exitFailure
where
getPort front [] = do
env <- getEnvironment
return (fromMaybe "0" $ lookup "PORT" env, front [])
getPort front ("--port":p:rest) = return (p, front rest)
getPort front ("-p":p:rest) = return (p, front rest)
getPort front (arg:rest) = getPort (front . (arg:)) rest
capitalize [] = []
capitalize (x:xs) = toUpper x : xs
-- | Load the app config from command line parameters, using the given
-- @ConfigSettings.
--
-- Since 1.2.2 | 1,390 | parseArgConfig = do
let envs = [minBound..maxBound]
args <- getArgs
(portS, args') <- getPort id args
portI <-
case reads portS of
(i, _):_ -> return i
[] -> error $ "Invalid port value: " ++ show portS
case args' of
[e] -> do
case reads $ capitalize e of
(e', _):_ -> return $ ArgConfig e' portI
[] -> do
() <- error $ "Invalid environment, valid entries are: " ++ show envs
-- next line just provided to force the type of envs
return $ ArgConfig (head envs) 0
_ -> do
pn <- getProgName
putStrLn $ "Usage: " ++ pn ++ " <environment> [--port <port>]"
putStrLn $ "Valid environments: " ++ show envs
exitFailure
where
getPort front [] = do
env <- getEnvironment
return (fromMaybe "0" $ lookup "PORT" env, front [])
getPort front ("--port":p:rest) = return (p, front rest)
getPort front ("-p":p:rest) = return (p, front rest)
getPort front (arg:rest) = getPort (front . (arg:)) rest
capitalize [] = []
capitalize (x:xs) = toUpper x : xs
-- | Load the app config from command line parameters, using the given
-- @ConfigSettings.
--
-- Since 1.2.2 | 1,306 | false | true | 2 | 20 | 467 | 493 | 234 | 259 | null | null |
oldmanmike/sdl2 | src/SDL/Raw/Video.hs | bsd-3-clause | saveBMP :: MonadIO m => Ptr Surface -> CString -> m CInt
saveBMP surface file = liftIO $ do
rw <- withCString "wb" $ rwFromFile file
saveBMP_RW surface rw 1
| 161 | saveBMP :: MonadIO m => Ptr Surface -> CString -> m CInt
saveBMP surface file = liftIO $ do
rw <- withCString "wb" $ rwFromFile file
saveBMP_RW surface rw 1
| 161 | saveBMP surface file = liftIO $ do
rw <- withCString "wb" $ rwFromFile file
saveBMP_RW surface rw 1
| 104 | false | true | 0 | 10 | 34 | 72 | 31 | 41 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.