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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
acfoltzer/bit-vector | src/Data/Vector/Bit.hs | bsd-3-clause | -- | Equality modulo trailing 'False' bits
(==~) :: BitVector -> BitVector -> Bool
(==~) = (==) `on` trimLeading | 112 | (==~) :: BitVector -> BitVector -> Bool
(==~) = (==) `on` trimLeading | 69 | (==~) = (==) `on` trimLeading | 29 | true | true | 0 | 8 | 18 | 41 | 23 | 18 | null | null |
silky/csound-expression | src/Csound/Air/Misc.hs | bsd-3-clause | nightPad = Patch
{ patchInstr = mul 0.48 . at fromMono . onCps (mul (fadeOut 1) . impNightPad 0.5)
, patchFx = fx1 0.25 largeHall2 } | 143 | nightPad = Patch
{ patchInstr = mul 0.48 . at fromMono . onCps (mul (fadeOut 1) . impNightPad 0.5)
, patchFx = fx1 0.25 largeHall2 } | 143 | nightPad = Patch
{ patchInstr = mul 0.48 . at fromMono . onCps (mul (fadeOut 1) . impNightPad 0.5)
, patchFx = fx1 0.25 largeHall2 } | 143 | false | false | 0 | 14 | 36 | 65 | 31 | 34 | null | null |
kaoskorobase/hsc3-server | Sound/SC3/Server/Notification.hs | gpl-2.0 | n_off_ :: NodeId -> Notification ()
n_off_ = n_notification_ "/n_off" | 69 | n_off_ :: NodeId -> Notification ()
n_off_ = n_notification_ "/n_off" | 69 | n_off_ = n_notification_ "/n_off" | 33 | false | true | 0 | 7 | 9 | 23 | 11 | 12 | null | null |
nau/lasca-compiler | src/lib/Lasca/EmitDynamic.hs | bsd-3-clause | cgenSelect ctx this@(S.Select meta tree expr) = do
tree <- cgen ctx tree
e <- cgen ctx expr
let pos = createPosition $ S.pos meta
callBuiltin "runtimeSelect" [tree, e, constOp pos] | 196 | cgenSelect ctx this@(S.Select meta tree expr) = do
tree <- cgen ctx tree
e <- cgen ctx expr
let pos = createPosition $ S.pos meta
callBuiltin "runtimeSelect" [tree, e, constOp pos] | 196 | cgenSelect ctx this@(S.Select meta tree expr) = do
tree <- cgen ctx tree
e <- cgen ctx expr
let pos = createPosition $ S.pos meta
callBuiltin "runtimeSelect" [tree, e, constOp pos] | 196 | false | false | 1 | 13 | 46 | 94 | 41 | 53 | null | null |
karamellpelle/grid | source/MEnv/Tick/GLFW.hs | gpl-3.0 | -- | set tick for ClockA
tickClockASet :: Tick -> MEnv res ()
tickClockASet t = io $ do
glfw_tickClockASet (realToFrac t) | 125 | tickClockASet :: Tick -> MEnv res ()
tickClockASet t = io $ do
glfw_tickClockASet (realToFrac t) | 100 | tickClockASet t = io $ do
glfw_tickClockASet (realToFrac t) | 63 | true | true | 0 | 10 | 25 | 42 | 20 | 22 | null | null |
bertdouglas/euler-haskell | 001-050/19a.hs | mit | is_leap_year :: Int -> Bool
is_leap_year y
| d 400 = True
| d 100 = False
| d 4 = True
| otherwise = False
where
d n = 0 == (mod y n)
-- test cases for leap years | 195 | is_leap_year :: Int -> Bool
is_leap_year y
| d 400 = True
| d 100 = False
| d 4 = True
| otherwise = False
where
d n = 0 == (mod y n)
-- test cases for leap years | 195 | is_leap_year y
| d 400 = True
| d 100 = False
| d 4 = True
| otherwise = False
where
d n = 0 == (mod y n)
-- test cases for leap years | 167 | false | true | 3 | 10 | 73 | 78 | 38 | 40 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-code/Language/Drasil/Code/ExternalLibrary.hs | bsd-2-clause | callRequires :: [Requires] -> FunctionInterface -> Step
callRequires = Call | 75 | callRequires :: [Requires] -> FunctionInterface -> Step
callRequires = Call | 75 | callRequires = Call | 19 | false | true | 0 | 6 | 9 | 22 | 12 | 10 | null | null |
brendanhay/gogol | gogol-play-moviespartner/gen/Network/Google/PlayMoviesPartner/Types/Product.hs | mpl-2.0 | -- | Countries where the Order is available, using the \"ISO 3166-1 alpha-2\"
-- format (example: \"US\").
oCountries :: Lens' Order [Text]
oCountries
= lens _oCountries (\ s a -> s{_oCountries = a}) .
_Default
. _Coerce | 234 | oCountries :: Lens' Order [Text]
oCountries
= lens _oCountries (\ s a -> s{_oCountries = a}) .
_Default
. _Coerce | 127 | oCountries
= lens _oCountries (\ s a -> s{_oCountries = a}) .
_Default
. _Coerce | 94 | true | true | 0 | 11 | 50 | 54 | 29 | 25 | null | null |
jmgimeno/haskell-playground | src/Zippers/comonadic-life-in-a-torus.hs | unlicense | up :: Z a -> Z a
up (Z z) = Z (loopLeft z) | 43 | up :: Z a -> Z a
up (Z z) = Z (loopLeft z) | 42 | up (Z z) = Z (loopLeft z) | 25 | false | true | 0 | 7 | 14 | 39 | 18 | 21 | null | null |
kowey/GenI | src/NLP/GenI/Configuration.hs | gpl-2.0 | optionsForTesting :: [OptDescr Flag]
optionsForTesting =
[ testSuiteOption
, fromStdinOption
, Option [] ["testcase"]
(reqArg TestCaseFlg T.pack "STRING")
"run test case STRING"
, Option [] ["timeout"] (reqArg TimeoutFlg read "SECONDS")
"time out after SECONDS seconds"
, maxResultsOption
, maxStepsOption
, Option [] ["metrics"] (optArg MetricsFlg ["default"] words "LIST")
"keep track of performance metrics: (default: iterations comparisons chart_size)"
, Option [] ["statsfile"] (reqArg StatsFileFlg id "FILE")
"write performance data to file FILE (stdout if unset)"
, Option [] ["batchdir"] (reqArg BatchDirFlg id "DIR")
"batch process the test suite and save results to DIR"
, Option [] ["earlydeath"] (noArg EarlyDeathFlg)
"exit on first case with no results (batch processing) "
] | 875 | optionsForTesting :: [OptDescr Flag]
optionsForTesting =
[ testSuiteOption
, fromStdinOption
, Option [] ["testcase"]
(reqArg TestCaseFlg T.pack "STRING")
"run test case STRING"
, Option [] ["timeout"] (reqArg TimeoutFlg read "SECONDS")
"time out after SECONDS seconds"
, maxResultsOption
, maxStepsOption
, Option [] ["metrics"] (optArg MetricsFlg ["default"] words "LIST")
"keep track of performance metrics: (default: iterations comparisons chart_size)"
, Option [] ["statsfile"] (reqArg StatsFileFlg id "FILE")
"write performance data to file FILE (stdout if unset)"
, Option [] ["batchdir"] (reqArg BatchDirFlg id "DIR")
"batch process the test suite and save results to DIR"
, Option [] ["earlydeath"] (noArg EarlyDeathFlg)
"exit on first case with no results (batch processing) "
] | 875 | optionsForTesting =
[ testSuiteOption
, fromStdinOption
, Option [] ["testcase"]
(reqArg TestCaseFlg T.pack "STRING")
"run test case STRING"
, Option [] ["timeout"] (reqArg TimeoutFlg read "SECONDS")
"time out after SECONDS seconds"
, maxResultsOption
, maxStepsOption
, Option [] ["metrics"] (optArg MetricsFlg ["default"] words "LIST")
"keep track of performance metrics: (default: iterations comparisons chart_size)"
, Option [] ["statsfile"] (reqArg StatsFileFlg id "FILE")
"write performance data to file FILE (stdout if unset)"
, Option [] ["batchdir"] (reqArg BatchDirFlg id "DIR")
"batch process the test suite and save results to DIR"
, Option [] ["earlydeath"] (noArg EarlyDeathFlg)
"exit on first case with no results (batch processing) "
] | 838 | false | true | 0 | 9 | 195 | 194 | 103 | 91 | null | null |
ezyang/ghc | ghc/Main.hs | bsd-3-clause | doFrontend modname _ = pluginError [modname] | 44 | doFrontend modname _ = pluginError [modname] | 44 | doFrontend modname _ = pluginError [modname] | 44 | false | false | 0 | 6 | 5 | 17 | 8 | 9 | null | null |
geocurnoff/nikki | src/Physics/Chipmunk/ContactRef.hs | lgpl-3.0 | kPreSolve _ (DontWatch _ _) permeability =
return $ isSolidInPresolve permeability
| 87 | mkPreSolve _ (DontWatch _ _) permeability =
return $ isSolidInPresolve permeability | 87 | mkPreSolve _ (DontWatch _ _) permeability =
return $ isSolidInPresolve permeability | 87 | false | false | 0 | 7 | 15 | 28 | 13 | 15 | null | null |
ethercrow/ai-challenger | game-grid/Grid.hs | mit | gridSizeForMap (MapName "40x40") = 40 | 37 | gridSizeForMap (MapName "40x40") = 40 | 37 | gridSizeForMap (MapName "40x40") = 40 | 37 | false | false | 0 | 6 | 4 | 16 | 7 | 9 | null | null |
beni55/haste-compiler | libraries/ghc-7.10/ghc-prim/GHC/Prim.hs | bsd-3-clause | remWord# :: Word# -> Word# -> Word#
remWord# = let x = x in x | 61 | remWord# :: Word# -> Word# -> Word#
remWord# = let x = x in x | 61 | remWord# = let x = x in x | 25 | false | true | 0 | 8 | 14 | 37 | 16 | 21 | null | null |
nevrenato/Hets_Fork | GMP/versioning/gmp-0.0.1/GMP/CoalitionL.hs | gpl-2.0 | allSubsets :: (Ord a) => [Set.Set a] -> Set.Set a -> Bool
allSubsets l s =
case l of
[] -> True
h:t -> if (Set.isSubsetOf h s) then (allSubsets t s)
else False
-- | True if all sets in the 2nd list arg. are equal and supersets of the 1st | 284 | allSubsets :: (Ord a) => [Set.Set a] -> Set.Set a -> Bool
allSubsets l s =
case l of
[] -> True
h:t -> if (Set.isSubsetOf h s) then (allSubsets t s)
else False
-- | True if all sets in the 2nd list arg. are equal and supersets of the 1st | 284 | allSubsets l s =
case l of
[] -> True
h:t -> if (Set.isSubsetOf h s) then (allSubsets t s)
else False
-- | True if all sets in the 2nd list arg. are equal and supersets of the 1st | 226 | false | true | 3 | 9 | 98 | 90 | 47 | 43 | null | null |
charlesrosenbauer/Bzo-Compiler | src/Builtins.hs | gpl-3.0 | isBuiltinFunc "#positcast" = 20019 | 37 | isBuiltinFunc "#positcast" = 20019 | 37 | isBuiltinFunc "#positcast" = 20019 | 37 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
mihaimaruseac/blog-demos | pipes/5.hs | mit | respond :: b -> Pipe a b ()
respond b = Pipe . return $ Respond (return ()) b (return ()) | 89 | respond :: b -> Pipe a b ()
respond b = Pipe . return $ Respond (return ()) b (return ()) | 89 | respond b = Pipe . return $ Respond (return ()) b (return ()) | 61 | false | true | 3 | 8 | 20 | 64 | 29 | 35 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Compiler.hs | bsd-3-clause | compileProcedure (SerialAvailable p) = do
_ <- compileShallowPrimitiveError $ "serialAvailable " ++ show p
return 0 | 123 | compileProcedure (SerialAvailable p) = do
_ <- compileShallowPrimitiveError $ "serialAvailable " ++ show p
return 0 | 123 | compileProcedure (SerialAvailable p) = do
_ <- compileShallowPrimitiveError $ "serialAvailable " ++ show p
return 0 | 123 | false | false | 0 | 9 | 23 | 39 | 17 | 22 | null | null |
mgold/Elm | src/AST/Type.hs | bsd-3-clause | dealias :: [(String, Canonical)] -> Aliased Canonical -> Canonical
dealias args aliasType =
case aliasType of
Holey tipe ->
dealiasHelp (Map.fromList args) tipe
Filled tipe ->
tipe | 203 | dealias :: [(String, Canonical)] -> Aliased Canonical -> Canonical
dealias args aliasType =
case aliasType of
Holey tipe ->
dealiasHelp (Map.fromList args) tipe
Filled tipe ->
tipe | 203 | dealias args aliasType =
case aliasType of
Holey tipe ->
dealiasHelp (Map.fromList args) tipe
Filled tipe ->
tipe | 136 | false | true | 4 | 10 | 49 | 71 | 35 | 36 | null | null |
music-suite/music-pitch | src/Music/Pitch/Common/Interval.hs | bsd-3-clause | - | View an interval as a pair of total number of chromatic and diatonic steps.
interval'' :: Iso' (ChromaticSteps, DiatonicSteps) Interval
interval'' = iso Interval getInterval
| 178 | interval'' :: Iso' (ChromaticSteps, DiatonicSteps) Interval
interval'' = iso Interval getInterval | 97 | interval'' = iso Interval getInterval | 37 | true | true | 2 | 9 | 27 | 60 | 31 | 29 | null | null |
patrickboe/artery | Box.hs | mit | getx (Point x y) = x | 20 | getx (Point x y) = x | 20 | getx (Point x y) = x | 20 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
ocramz/petsc-hs | src/Numerical/PETSc/Internal/PutGet/DM.hs | gpl-3.0 | -- | DMDA brackets
withDmda1d ::
Comm ->
DMBoundaryType_ -> -- b : type of boundary ghost cells
Int -> -- mm : global array dimension
Int -> -- dof : # DOF / node
Int -> -- sw : stencil width
[Int] -> -- # nodes in X dir / processor
(DM -> IO a) ->
IO a
withDmda1d cc b m dof sw lx =
withDm (dmdaCreate1d cc b m dof sw lx) | 375 | withDmda1d ::
Comm ->
DMBoundaryType_ -> -- b : type of boundary ghost cells
Int -> -- mm : global array dimension
Int -> -- dof : # DOF / node
Int -> -- sw : stencil width
[Int] -> -- # nodes in X dir / processor
(DM -> IO a) ->
IO a
withDmda1d cc b m dof sw lx =
withDm (dmdaCreate1d cc b m dof sw lx) | 355 | withDmda1d cc b m dof sw lx =
withDm (dmdaCreate1d cc b m dof sw lx) | 70 | true | true | 0 | 14 | 127 | 93 | 49 | 44 | null | null |
DaMSL/K3 | src/Language/K3/Analysis/HMTypes/Inference.hs | apache-2.0 | liftExceptM :: Except Text a -> TInfM a
liftExceptM = mapExceptT (return . runIdentity) | 87 | liftExceptM :: Except Text a -> TInfM a
liftExceptM = mapExceptT (return . runIdentity) | 87 | liftExceptM = mapExceptT (return . runIdentity) | 47 | false | true | 0 | 7 | 13 | 39 | 17 | 22 | null | null |
aelve/json-x | tests/DataFamilies/Encoders.hs | bsd-3-clause | gApproxToEncodingUnwrap = genericToEncoding optsUnwrapUnaryRecords | 66 | gApproxToEncodingUnwrap = genericToEncoding optsUnwrapUnaryRecords | 66 | gApproxToEncodingUnwrap = genericToEncoding optsUnwrapUnaryRecords | 66 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
CBMM/CBaaS | cbaas-lib/src/Type.hs | bsd-3-clause | -- Int
tyVar :: P.Parser Type
tyVar = do
n <- P.lower
return $ TVar (T.singleton n) | 94 | tyVar :: P.Parser Type
tyVar = do
n <- P.lower
return $ TVar (T.singleton n) | 83 | tyVar = do
n <- P.lower
return $ TVar (T.singleton n) | 60 | true | true | 0 | 11 | 27 | 44 | 21 | 23 | null | null |
grnet/snf-ganeti | src/Ganeti/HTools/Node.hs | bsd-2-clause | -- * Diagnostic functions
-- | For a node diagnose whether it conforms with all policies. The type
-- is chosen to represent that of a no-op node operation.
getPolicyHealth :: Node -> T.OpResult ()
getPolicyHealth n =
case () of
_ | instSpindles n > hiSpindles n -> Bad T.FailDisk
| pCpu n > T.iPolicyVcpuRatio (iPolicy n) -> Bad T.FailCPU
| otherwise -> Ok ()
-- * Update functions
-- | Set the CPU speed | 426 | getPolicyHealth :: Node -> T.OpResult ()
getPolicyHealth n =
case () of
_ | instSpindles n > hiSpindles n -> Bad T.FailDisk
| pCpu n > T.iPolicyVcpuRatio (iPolicy n) -> Bad T.FailCPU
| otherwise -> Ok ()
-- * Update functions
-- | Set the CPU speed | 268 | getPolicyHealth n =
case () of
_ | instSpindles n > hiSpindles n -> Bad T.FailDisk
| pCpu n > T.iPolicyVcpuRatio (iPolicy n) -> Bad T.FailCPU
| otherwise -> Ok ()
-- * Update functions
-- | Set the CPU speed | 227 | true | true | 0 | 14 | 96 | 113 | 52 | 61 | null | null |
sebastiaanvisser/frp-js | src/Core/Raw.hs | bsd-3-clause | from :: Ord k => k -> Map.Map k a -> a
from f = fromMaybe (error "internal error in foldVal") . Map.lookup f | 108 | from :: Ord k => k -> Map.Map k a -> a
from f = fromMaybe (error "internal error in foldVal") . Map.lookup f | 108 | from f = fromMaybe (error "internal error in foldVal") . Map.lookup f | 69 | false | true | 0 | 9 | 23 | 54 | 25 | 29 | null | null |
beni55/ghcjs | test/ghc/rts/t2047.hs | mit | -- 21
largestExplicitlyEnumeratedArea = 5 | 42 | largestExplicitlyEnumeratedArea = 5 | 35 | largestExplicitlyEnumeratedArea = 5 | 35 | true | false | 0 | 4 | 5 | 7 | 4 | 3 | null | null |
JacquesCarette/literate-scientific-software | code/drasil-example/Drasil/Projectile/Unitals.hs | bsd-2-clause | constants :: [QDefinition]
constants = [gravitationalAccelConst, piConst, tol] | 78 | constants :: [QDefinition]
constants = [gravitationalAccelConst, piConst, tol] | 78 | constants = [gravitationalAccelConst, piConst, tol] | 51 | false | true | 0 | 7 | 7 | 30 | 15 | 15 | null | null |
facebookincubator/duckling | Duckling/Rules/TE.hs | bsd-3-clause | langRules (Seal Temperature) = [] | 33 | langRules (Seal Temperature) = [] | 33 | langRules (Seal Temperature) = [] | 33 | false | false | 0 | 7 | 4 | 17 | 8 | 9 | null | null |
DavidAlphaFox/darcs | src/Darcs/Patch/Prim/V1/Coalesce.hs | gpl-2.0 | coalesceFilePrim :: FileName -> (FilePatchType :< FilePatchType) wX wY
-> Maybe (Prim wX wY)
coalesceFilePrim f (Hunk line1 old1 new1 :< Hunk line2 old2 new2)
= coalesceHunk f line1 old1 new1 line2 old2 new2 | 229 | coalesceFilePrim :: FileName -> (FilePatchType :< FilePatchType) wX wY
-> Maybe (Prim wX wY)
coalesceFilePrim f (Hunk line1 old1 new1 :< Hunk line2 old2 new2)
= coalesceHunk f line1 old1 new1 line2 old2 new2 | 229 | coalesceFilePrim f (Hunk line1 old1 new1 :< Hunk line2 old2 new2)
= coalesceHunk f line1 old1 new1 line2 old2 new2 | 118 | false | true | 0 | 11 | 55 | 91 | 41 | 50 | null | null |
raposalorx/leaf | DBHelper.hs | bsd-3-clause | addTags _ [] _ = return () | 26 | addTags _ [] _ = return () | 26 | addTags _ [] _ = return () | 26 | false | false | 0 | 6 | 6 | 20 | 9 | 11 | null | null |
urbanslug/ghc | compiler/cmm/CmmSink.hs | bsd-3-clause | --
-- annotate each node with the set of registers live *after* the node
--
annotate :: DynFlags -> LocalRegSet -> [CmmNode O O] -> [(LocalRegSet, CmmNode O O)]
annotate dflags live nodes = snd $ foldr ann (live,[]) nodes
where ann n (live,nodes) = (gen_kill dflags n live, (live,n) : nodes)
--
-- Find the blocks that have multiple successors (join points)
-- | 363 | annotate :: DynFlags -> LocalRegSet -> [CmmNode O O] -> [(LocalRegSet, CmmNode O O)]
annotate dflags live nodes = snd $ foldr ann (live,[]) nodes
where ann n (live,nodes) = (gen_kill dflags n live, (live,n) : nodes)
--
-- Find the blocks that have multiple successors (join points)
-- | 287 | annotate dflags live nodes = snd $ foldr ann (live,[]) nodes
where ann n (live,nodes) = (gen_kill dflags n live, (live,n) : nodes)
--
-- Find the blocks that have multiple successors (join points)
-- | 202 | true | true | 2 | 12 | 66 | 129 | 67 | 62 | null | null |
alexander-at-github/eta | compiler/ETA/Core/TrieMap.hs | bsd-3-clause | fdT :: (a -> b -> b) -> TypeMap a -> b -> b
fdT _ EmptyTM = \z -> z | 67 | fdT :: (a -> b -> b) -> TypeMap a -> b -> b
fdT _ EmptyTM = \z -> z | 67 | fdT _ EmptyTM = \z -> z | 23 | false | true | 0 | 9 | 20 | 53 | 25 | 28 | null | null |
iand675/metrics | src/Data/Metrics/Timer/Internal.hs | mit | meanRate :: NominalDiffTime -> Timer -> Double
meanRate t = M.meanRate t . timerMeter | 85 | meanRate :: NominalDiffTime -> Timer -> Double
meanRate t = M.meanRate t . timerMeter | 85 | meanRate t = M.meanRate t . timerMeter | 38 | false | true | 0 | 7 | 13 | 31 | 15 | 16 | null | null |
phadej/range-set-list | tests/IntMap.hs | mit | invalidProp :: Property
invalidProp = RSet.valid (RSet.fromNormalizedRangeList [(-10,-1),(1,0),(2,3 :: Int)]) === False | 119 | invalidProp :: Property
invalidProp = RSet.valid (RSet.fromNormalizedRangeList [(-10,-1),(1,0),(2,3 :: Int)]) === False | 119 | invalidProp = RSet.valid (RSet.fromNormalizedRangeList [(-10,-1),(1,0),(2,3 :: Int)]) === False | 95 | false | true | 0 | 11 | 11 | 69 | 37 | 32 | null | null |
plumlife/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | usageFlags :: String -> String -> String
usageFlags name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [FLAGS]\n" | 116 | usageFlags :: String -> String -> String
usageFlags name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [FLAGS]\n" | 116 | usageFlags name pname =
"Usage: " ++ pname ++ " " ++ name ++ " [FLAGS]\n" | 75 | false | true | 4 | 8 | 24 | 48 | 21 | 27 | null | null |
olsner/ghc | libraries/ghci/GHCi/Message.hs | bsd-3-clause | writePipe :: Pipe -> Put -> IO ()
writePipe Pipe{..} put
| LB.null bs = return ()
| otherwise = do
LB.hPut pipeWrite bs
hFlush pipeWrite
where
bs = runPut put | 174 | writePipe :: Pipe -> Put -> IO ()
writePipe Pipe{..} put
| LB.null bs = return ()
| otherwise = do
LB.hPut pipeWrite bs
hFlush pipeWrite
where
bs = runPut put | 174 | writePipe Pipe{..} put
| LB.null bs = return ()
| otherwise = do
LB.hPut pipeWrite bs
hFlush pipeWrite
where
bs = runPut put | 140 | false | true | 8 | 6 | 46 | 71 | 37 | 34 | null | null |
li-zhirui/EoplLangs | src/ImplicitRefs/Evaluator.hs | bsd-3-clause | evalUnaryOpExpr :: UnaryOp -> Expression -> Environment -> Store
-> EvaluateResult
evalUnaryOpExpr op expr env store = do
func <- tryFindOp op unaryOps
v <- valueOf expr env store
func v | 208 | evalUnaryOpExpr :: UnaryOp -> Expression -> Environment -> Store
-> EvaluateResult
evalUnaryOpExpr op expr env store = do
func <- tryFindOp op unaryOps
v <- valueOf expr env store
func v | 208 | evalUnaryOpExpr op expr env store = do
func <- tryFindOp op unaryOps
v <- valueOf expr env store
func v | 109 | false | true | 0 | 10 | 52 | 74 | 32 | 42 | null | null |
forste/haReFork | tools/base/pretty/PrettySymbols.hs | bsd-3-clause | lambda = kwIfUnicode '\x03bb' "\\" | 35 | lambda = kwIfUnicode '\x03bb' "\\" | 35 | lambda = kwIfUnicode '\x03bb' "\\" | 35 | false | false | 1 | 5 | 5 | 15 | 5 | 10 | null | null |
nkaretnikov/titlecase | src/Data/Text/Titlecase/Internal.hs | bsd-3-clause | twoWordPrepositions :: NonEmpty Preposition
twoWordPrepositions = uncurry TwoWordPreposition <$> fromList
[ ("according", "to"), ("ahead", "of"), ("apart", "from"), ("as", "for")
, ("as", "of"), ("as", "per"), ("as", "regards"), ("aside", "from")
, ("astern", "of")
, ("back", "to")
, ("close", "to")
, ("due", "to")
, ("except", "for")
, ("far", "from")
, ("in", "to"), ("inside", "of"), ("instead", "of")
, ("left", "of")
, ("near", "to"), ("next", "to")
, ("on", "to"), ("opposite", "of"), ("opposite", "to"), ("out", "from")
, ("out", "of"), ("outside", "of"), ("owing", "to")
, ("prior", "to"), ("pursuant", "to")
, ("rather", "than"), ("regardless", "of"), ("right", "of")
, ("subsequent", "to"), ("such", "as")
, ("thanks", "to"), ("that", "of")
, ("up", "to")
] | 807 | twoWordPrepositions :: NonEmpty Preposition
twoWordPrepositions = uncurry TwoWordPreposition <$> fromList
[ ("according", "to"), ("ahead", "of"), ("apart", "from"), ("as", "for")
, ("as", "of"), ("as", "per"), ("as", "regards"), ("aside", "from")
, ("astern", "of")
, ("back", "to")
, ("close", "to")
, ("due", "to")
, ("except", "for")
, ("far", "from")
, ("in", "to"), ("inside", "of"), ("instead", "of")
, ("left", "of")
, ("near", "to"), ("next", "to")
, ("on", "to"), ("opposite", "of"), ("opposite", "to"), ("out", "from")
, ("out", "of"), ("outside", "of"), ("owing", "to")
, ("prior", "to"), ("pursuant", "to")
, ("rather", "than"), ("regardless", "of"), ("right", "of")
, ("subsequent", "to"), ("such", "as")
, ("thanks", "to"), ("that", "of")
, ("up", "to")
] | 807 | twoWordPrepositions = uncurry TwoWordPreposition <$> fromList
[ ("according", "to"), ("ahead", "of"), ("apart", "from"), ("as", "for")
, ("as", "of"), ("as", "per"), ("as", "regards"), ("aside", "from")
, ("astern", "of")
, ("back", "to")
, ("close", "to")
, ("due", "to")
, ("except", "for")
, ("far", "from")
, ("in", "to"), ("inside", "of"), ("instead", "of")
, ("left", "of")
, ("near", "to"), ("next", "to")
, ("on", "to"), ("opposite", "of"), ("opposite", "to"), ("out", "from")
, ("out", "of"), ("outside", "of"), ("owing", "to")
, ("prior", "to"), ("pursuant", "to")
, ("rather", "than"), ("regardless", "of"), ("right", "of")
, ("subsequent", "to"), ("such", "as")
, ("thanks", "to"), ("that", "of")
, ("up", "to")
] | 763 | false | true | 0 | 6 | 140 | 357 | 233 | 124 | null | null |
jwaldmann/satchmo-solver | src/Satchmo/Fourier_Motzkin.hs | gpl-3.0 | print_info msg s = when logging $ do
hPutStrLn stderr $ unlines [ msg, show s ] | 81 | print_info msg s = when logging $ do
hPutStrLn stderr $ unlines [ msg, show s ] | 81 | print_info msg s = when logging $ do
hPutStrLn stderr $ unlines [ msg, show s ] | 81 | false | false | 0 | 11 | 18 | 40 | 18 | 22 | null | null |
yu-i9/thih | TypingHaskellInHaskell.hs | bsd-3-clause | matchPred = lift match | 32 | matchPred = lift match | 32 | matchPred = lift match | 32 | false | false | 1 | 5 | 13 | 13 | 4 | 9 | null | null |
elieux/ghc | compiler/utils/Util.hs | bsd-3-clause | all2 _ _ _ = False | 28 | all2 _ _ _ = False | 28 | all2 _ _ _ = False | 28 | false | false | 0 | 5 | 15 | 13 | 6 | 7 | null | null |
ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Decompose.hs | mit | decomposeChar '\x1F13' = "\x03B5\x0314\x0300" | 45 | decomposeChar '\x1F13' = "\x03B5\x0314\x0300" | 45 | decomposeChar '\x1F13' = "\x03B5\x0314\x0300" | 45 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
ian-ross/c2hs-macos-test | c2hs-0.26.1/src/C2HS/C/Trav.hs | mit | -- | read attributed struture tree
--
readAttrCCT :: (AttrC -> a) -> CT s a
readAttrCCT reader = readCST $ \(ac, _) -> reader ac | 136 | readAttrCCT :: (AttrC -> a) -> CT s a
readAttrCCT reader = readCST $ \(ac, _) -> reader ac | 98 | readAttrCCT reader = readCST $ \(ac, _) -> reader ac | 53 | true | true | 0 | 7 | 33 | 50 | 27 | 23 | null | null |
f-me/snap-core | test/suite/Snap/Internal/Routing/Tests.hs | bsd-3-clause | topCapture = do
mp <- getParam "foo"
maybe pass return mp | 65 | topCapture = do
mp <- getParam "foo"
maybe pass return mp | 65 | topCapture = do
mp <- getParam "foo"
maybe pass return mp | 65 | false | false | 0 | 8 | 18 | 26 | 11 | 15 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/Constants.hs | gpl-2.0 | -- | Deprecated and replaced by max and min mem
beMemory :: String
beMemory = "memory" | 86 | beMemory :: String
beMemory = "memory" | 38 | beMemory = "memory" | 19 | true | true | 0 | 6 | 15 | 19 | 8 | 11 | null | null |
AlexanderPankiv/ghc | compiler/nativeGen/X86/Ppr.hs | bsd-3-clause | pprInstr (DIV fmt op) = pprFormatOp (sLit "div") fmt op | 59 | pprInstr (DIV fmt op) = pprFormatOp (sLit "div") fmt op | 59 | pprInstr (DIV fmt op) = pprFormatOp (sLit "div") fmt op | 59 | false | false | 0 | 7 | 13 | 30 | 14 | 16 | null | null |
josuf107/Asteroids | Asteroid.hs | gpl-3.0 | ifapp False _ = id | 18 | ifapp False _ = id | 18 | ifapp False _ = id | 18 | false | false | 0 | 4 | 4 | 13 | 5 | 8 | null | null |
lolepezy/hajs | src/Scanner.hs | unlicense | primitives :: Parser TokenPos
primitives = parsePos $ choice $ map (\(ch, tok) -> char ch >> return tok) [
( ';', Colon ), ( ',', Comma ), ( '.', Dot ),
( '+', Plus ), ( '-', Minus ), ( '*', Star ), ('/', Slash),
( '(', LPar ), ( ')', RPar ),
( '[', LBracket ), ( ']', RBracket ),
( '{', LCurly ), ( '}', RCurly )
] | 339 | primitives :: Parser TokenPos
primitives = parsePos $ choice $ map (\(ch, tok) -> char ch >> return tok) [
( ';', Colon ), ( ',', Comma ), ( '.', Dot ),
( '+', Plus ), ( '-', Minus ), ( '*', Star ), ('/', Slash),
( '(', LPar ), ( ')', RPar ),
( '[', LBracket ), ( ']', RBracket ),
( '{', LCurly ), ( '}', RCurly )
] | 339 | primitives = parsePos $ choice $ map (\(ch, tok) -> char ch >> return tok) [
( ';', Colon ), ( ',', Comma ), ( '.', Dot ),
( '+', Plus ), ( '-', Minus ), ( '*', Star ), ('/', Slash),
( '(', LPar ), ( ')', RPar ),
( '[', LBracket ), ( ']', RBracket ),
( '{', LCurly ), ( '}', RCurly )
] | 309 | false | true | 0 | 10 | 94 | 168 | 104 | 64 | null | null |
simonmar/alex | src/NFA.hs | bsd-3-clause | rctxt_accept :: Accept Code
rctxt_accept = Acc 0 Nothing Nothing NoRightContext | 79 | rctxt_accept :: Accept Code
rctxt_accept = Acc 0 Nothing Nothing NoRightContext | 79 | rctxt_accept = Acc 0 Nothing Nothing NoRightContext | 51 | false | true | 0 | 6 | 10 | 30 | 12 | 18 | null | null |
flocc-net/flocc | v0.1/Compiler/Types2/TypeAssignment.hs | apache-2.0 | intCmpOpNames = ["eqi", "neqi", "gti", "gtei", "lti", "ltei"] | 61 | intCmpOpNames = ["eqi", "neqi", "gti", "gtei", "lti", "ltei"] | 61 | intCmpOpNames = ["eqi", "neqi", "gti", "gtei", "lti", "ltei"] | 61 | false | false | 0 | 5 | 7 | 24 | 15 | 9 | null | null |
printedheart/atomspace | opencog/haskell/OpenCog/AtomSpace/Template.hs | agpl-3.0 | getAbsFromRelPath :: FilePath -> Q FilePath
getAbsFromRelPath relative = do
actual <- runIO getCurrentDirectory
fileName <- loc_filename <$> location
let path = actual </> fileName
dir = takeDirectory path
return $ dir </> relative
-- | 'parseRelativeFile' takes a relative path to a file, and executes the
-- parser over it. | 351 | getAbsFromRelPath :: FilePath -> Q FilePath
getAbsFromRelPath relative = do
actual <- runIO getCurrentDirectory
fileName <- loc_filename <$> location
let path = actual </> fileName
dir = takeDirectory path
return $ dir </> relative
-- | 'parseRelativeFile' takes a relative path to a file, and executes the
-- parser over it. | 351 | getAbsFromRelPath relative = do
actual <- runIO getCurrentDirectory
fileName <- loc_filename <$> location
let path = actual </> fileName
dir = takeDirectory path
return $ dir </> relative
-- | 'parseRelativeFile' takes a relative path to a file, and executes the
-- parser over it. | 307 | false | true | 0 | 10 | 76 | 81 | 37 | 44 | null | null |
martinra/smallcheck | src/Test/SmallCheck/Series.hs | bsd-3-clause | alts1 :: CoSerial m a => Series m b -> Series m (a -> Maybe b)
alts1 rs = do
rs <- fixDepth rs
decDepthChecked (pure $ \_ -> Nothing) (coseriesP rs) | 152 | alts1 :: CoSerial m a => Series m b -> Series m (a -> Maybe b)
alts1 rs = do
rs <- fixDepth rs
decDepthChecked (pure $ \_ -> Nothing) (coseriesP rs) | 152 | alts1 rs = do
rs <- fixDepth rs
decDepthChecked (pure $ \_ -> Nothing) (coseriesP rs) | 89 | false | true | 0 | 10 | 35 | 83 | 39 | 44 | null | null |
adarqui/redprox-core | src/System/RedProx/Core.hs | mit | subber (PSub s) = (psubscribe, punsubscribe, s) | 47 | subber (PSub s) = (psubscribe, punsubscribe, s) | 47 | subber (PSub s) = (psubscribe, punsubscribe, s) | 47 | false | false | 0 | 7 | 6 | 24 | 13 | 11 | null | null |
verement/etamoo | src/MOO/Unparser.hs | bsd-3-clause | keywordsSet :: HashSet Id
keywordsSet = HS.fromList (map toId keywords) | 71 | keywordsSet :: HashSet Id
keywordsSet = HS.fromList (map toId keywords) | 71 | keywordsSet = HS.fromList (map toId keywords) | 45 | false | true | 0 | 7 | 9 | 27 | 13 | 14 | null | null |
balez/lambda-coinduction | Auxiliary/Composition.hs | gpl-3.0 | with5 = res1 . with4 | 20 | with5 = res1 . with4 | 20 | with5 = res1 . with4 | 20 | false | false | 0 | 5 | 4 | 10 | 5 | 5 | null | null |
anton-dessiatov/dbmigrations | test/BackendTest.hs | bsd-3-clause | ignoreSqlExceptions :: IO a -> IO (Maybe a)
ignoreSqlExceptions act = (act >>= return . Just) `catchSql`
(\_ -> return Nothing) | 150 | ignoreSqlExceptions :: IO a -> IO (Maybe a)
ignoreSqlExceptions act = (act >>= return . Just) `catchSql`
(\_ -> return Nothing) | 150 | ignoreSqlExceptions act = (act >>= return . Just) `catchSql`
(\_ -> return Nothing) | 106 | false | true | 0 | 8 | 43 | 58 | 30 | 28 | null | null |
thalerjonathan/phd | public/towards/SugarScape/experimental/concurrent/src/SugarScape/Agent/Interface.hs | gpl-3.0 | agentOutMergeLeft :: AgentOut m e o
-> AgentOut m e o
-> AgentOut m e o
agentOutMergeLeft aoLeft aoRight
= mergeAgentOut
(aoObservable aoLeft)
(pickMaybe (aoInteractCh aoLeft) (aoInteractCh aoRight))
aoLeft
aoRight | 276 | agentOutMergeLeft :: AgentOut m e o
-> AgentOut m e o
-> AgentOut m e o
agentOutMergeLeft aoLeft aoRight
= mergeAgentOut
(aoObservable aoLeft)
(pickMaybe (aoInteractCh aoLeft) (aoInteractCh aoRight))
aoLeft
aoRight | 276 | agentOutMergeLeft aoLeft aoRight
= mergeAgentOut
(aoObservable aoLeft)
(pickMaybe (aoInteractCh aoLeft) (aoInteractCh aoRight))
aoLeft
aoRight | 168 | false | true | 0 | 8 | 91 | 88 | 39 | 49 | null | null |
DougBurke/swish | tests/RDFGraphTest.hs | lgpl-2.1 | tt06 = arc st3 p1 l10 | 21 | tt06 = arc st3 p1 l10 | 21 | tt06 = arc st3 p1 l10 | 21 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
danidiaz/Haskell-Foldl-Library | src/Control/Foldl.hs | bsd-3-clause | {-| @(findIndex predicate)@ returns the index of the first element that
satisfies the predicate, or 'Nothing' if no element satisfies the predicate
-}
findIndex :: (a -> Bool) -> Fold a (Maybe Int)
findIndex predicate = Fold step (Left' 0) hush
where
step x a = case x of
Left' i ->
if predicate a
then Right' i
else Left' (i + 1)
_ -> x
| 406 | findIndex :: (a -> Bool) -> Fold a (Maybe Int)
findIndex predicate = Fold step (Left' 0) hush
where
step x a = case x of
Left' i ->
if predicate a
then Right' i
else Left' (i + 1)
_ -> x
| 251 | findIndex predicate = Fold step (Left' 0) hush
where
step x a = case x of
Left' i ->
if predicate a
then Right' i
else Left' (i + 1)
_ -> x
| 204 | true | true | 0 | 11 | 134 | 106 | 52 | 54 | null | null |
kmilner/tamarin-prover | lib/theory/src/Theory/Model/Fact.hs | gpl-3.0 | factArity :: Fact t -> Int
factArity (Fact tag _ ts)
| length ts == k = k
| otherwise = error $ "factArity: tag of arity " ++ show k ++
" applied to " ++ show (length ts) ++ " terms"
where
k = factTagArity tag
-- | The multiplicity of a 'Fact'. | 289 | factArity :: Fact t -> Int
factArity (Fact tag _ ts)
| length ts == k = k
| otherwise = error $ "factArity: tag of arity " ++ show k ++
" applied to " ++ show (length ts) ++ " terms"
where
k = factTagArity tag
-- | The multiplicity of a 'Fact'. | 289 | factArity (Fact tag _ ts)
| length ts == k = k
| otherwise = error $ "factArity: tag of arity " ++ show k ++
" applied to " ++ show (length ts) ++ " terms"
where
k = factTagArity tag
-- | The multiplicity of a 'Fact'. | 262 | false | true | 2 | 9 | 99 | 98 | 45 | 53 | null | null |
KommuSoft/dep-software | Dep.hs | gpl-3.0 | stripTitle :: String -> String
stripTitle = unpack.strip.pack | 61 | stripTitle :: String -> String
stripTitle = unpack.strip.pack | 61 | stripTitle = unpack.strip.pack | 30 | false | true | 0 | 6 | 7 | 19 | 10 | 9 | null | null |
etrepat/learn-you-a-haskell-exercises | 06-higher-order-functions.hs | gpl-3.0 | -- Define a square function
sq :: Int -> Int
sq x = x * x | 57 | sq :: Int -> Int
sq x = x * x | 29 | sq x = x * x | 12 | true | true | 0 | 6 | 15 | 27 | 13 | 14 | null | null |
xenog/haskoin | test/bitcoin/Network/Haskoin/Script/Tests.hs | unlicense | parseFlags :: String -> [ Flag ]
parseFlags "" = [] | 51 | parseFlags :: String -> [ Flag ]
parseFlags "" = [] | 51 | parseFlags "" = [] | 18 | false | true | 0 | 6 | 10 | 23 | 12 | 11 | null | null |
AlexanderPankiv/ghc | compiler/typecheck/TcClassDcl.hs | bsd-3-clause | lookupHsSig :: HsSigFun -> Name -> Maybe (LHsType Name)
lookupHsSig = lookupNameEnv | 83 | lookupHsSig :: HsSigFun -> Name -> Maybe (LHsType Name)
lookupHsSig = lookupNameEnv | 83 | lookupHsSig = lookupNameEnv | 27 | false | true | 0 | 9 | 11 | 28 | 14 | 14 | null | null |
petabricks/petabricks | scripts/oldtuner2/src/Petabricks.hs | mit | -- SERIALIZATION
serializeTunables :: [Tunable] -> String
serializeTunables = unlines . sort . (map show) | 106 | serializeTunables :: [Tunable] -> String
serializeTunables = unlines . sort . (map show) | 88 | serializeTunables = unlines . sort . (map show) | 47 | true | true | 0 | 7 | 15 | 33 | 18 | 15 | null | null |
facebookincubator/duckling | Duckling/Time/CA/Rules.hs | bsd-3-clause | ruleNthTimeDeTime :: Rule
ruleNthTimeDeTime = Rule
{ name = "nth <time> de <time>"
, pattern =
[ dimension Ordinal
, dimension Time
, regex "de|d'"
, dimension Time
]
, prod = \case
(Token Ordinal OrdinalData{TOrdinal.value = v}:
Token Time td1:
_:
Token Time td2:
_) -> Token Time . predNth (v - 1) False <$> intersect td2 td1
_ -> Nothing
} | 410 | ruleNthTimeDeTime :: Rule
ruleNthTimeDeTime = Rule
{ name = "nth <time> de <time>"
, pattern =
[ dimension Ordinal
, dimension Time
, regex "de|d'"
, dimension Time
]
, prod = \case
(Token Ordinal OrdinalData{TOrdinal.value = v}:
Token Time td1:
_:
Token Time td2:
_) -> Token Time . predNth (v - 1) False <$> intersect td2 td1
_ -> Nothing
} | 410 | ruleNthTimeDeTime = Rule
{ name = "nth <time> de <time>"
, pattern =
[ dimension Ordinal
, dimension Time
, regex "de|d'"
, dimension Time
]
, prod = \case
(Token Ordinal OrdinalData{TOrdinal.value = v}:
Token Time td1:
_:
Token Time td2:
_) -> Token Time . predNth (v - 1) False <$> intersect td2 td1
_ -> Nothing
} | 384 | false | true | 0 | 16 | 130 | 146 | 74 | 72 | null | null |
pparkkin/eta | compiler/ETA/Main/DriverPipeline.hs | bsd-3-clause | doCpp :: DynFlags -> Bool -> FilePath -> FilePath -> IO ()
doCpp dflags _raw input_fn output_fn = do
let hscpp_opts = picPOpts dflags
let cmdline_include_paths = includePaths dflags
pkg_include_dirs <- getPackageIncludePath dflags []
let include_paths = map ("-I" ++) . nub $
cmdline_include_paths ++ pkg_include_dirs
let verbFlags = getVerbFlags dflags
-- let cpp_prog args | raw = SysTools.runCpp dflags args
-- | otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
let cpp_prog_args = prune (getOpts dflags opt_P)
++ (if gopt Opt_WarnIsError dflags
then []
else ["--nowarn"])
prune :: [String] -> [String]
prune ("-include":xs)
= ("--include=" ++ head xs) : tail xs
prune (x:xs) = x : prune xs
prune [] = []
let target_defs = [] -- TODO: Deal with this
-- [ "-D" ++ HOST_OS ++ "_BUILD_OS=1",
-- "-D" ++ HOST_ARCH ++ "_BUILD_ARCH=1",
-- "-D" ++ TARGET_OS ++ "_HOST_OS=1",
-- "-D" ++ TARGET_ARCH ++ "_HOST_ARCH=1" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
let sse_defs =
[ "-D__SSE__=1" | isSseEnabled dflags ] ++
[ "-D__SSE2__=1" | isSse2Enabled dflags ] ++
[ "-D__SSE4_2__=1" | isSse4_2Enabled dflags ]
let avx_defs =
[ "-D__AVX__=1" | isAvxEnabled dflags ] ++
[ "-D__AVX2__=1" | isAvx2Enabled dflags ] ++
[ "-D__AVX512CD__=1" | isAvx512cdEnabled dflags ] ++
[ "-D__AVX512ER__=1" | isAvx512erEnabled dflags ] ++
[ "-D__AVX512F__=1" | isAvx512fEnabled dflags ] ++
[ "-D__AVX512PF__=1" | isAvx512pfEnabled dflags ]
backend_defs <- getBackendDefs dflags
#ifdef GHCI
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=YES" ]
#else
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=NO" ]
#endif
-- Default CPP defines in Haskell source
etaVersionH <- getEtaVersionPathName dflags
let hsSourceCppOpts =
[ "-D__GLASGOW_HASKELL__=" ++ ghcProjectVersionInt
, "-DETA_VERSION=" ++ cProjectVersionInt
, "-DETA_BUILD_NUMBER=" ++ cProjectPatchLevel
, "--include=" ++ etaVersionH
]
flags = verbFlags ++ include_paths ++ hsSourceCppOpts
++ target_defs ++ backend_defs ++ th_defs
++ hscpp_opts ++ sse_defs ++ avx_defs ++ ["--strip"]
++ cpp_prog_args
cppOpts <- either
(\s -> throwGhcExceptionIO $
ProgramError ("Preprocessing phase failed with: " ++ s))
return (parseOptions flags)
liftIO $ do
input <- readFile input_fn
output <- runCpphs cppOpts input_fn input
writeFile output_fn output
-- cpp_prog ( map SysTools.Option verbFlags
-- ++ map SysTools.Option include_paths
-- ++ map SysTools.Option hsSourceCppOpts
-- ++ map SysTools.Option target_defs
-- ++ map SysTools.Option backend_defs
-- ++ map SysTools.Option th_defs
-- ++ map SysTools.Option hscpp_opts
-- ++ map SysTools.Option sse_defs
-- ++ map SysTools.Option avx_defs
-- -- Set the language mode to assembler-with-cpp when preprocessing. This
-- -- alleviates some of the C99 macro rules relating to whitespace and the hash
-- -- operator, which we tend to abuse. Clang in particular is not very happy
-- -- about this.
-- ++ [ SysTools.Option "-x"
-- , SysTools.Option "assembler-with-cpp"
-- , SysTools.Option input_fn
-- -- We hackily use Option instead of FileOption here, so that the file
-- -- name is not back-slashed on Windows. cpp is capable of
-- -- dealing with / in filenames, so it works fine. Furthermore
-- -- if we put in backslashes, cpp outputs #line directives
-- -- with *double* backslashes. And that in turn means that
-- -- our error messages get double backslashes in them.
-- -- In due course we should arrange that the lexer deals
-- -- with these \\ escapes properly.
-- , SysTools.Option "-o"
-- , SysTools.FileOption "" output_fn
-- ]) | 4,587 | doCpp :: DynFlags -> Bool -> FilePath -> FilePath -> IO ()
doCpp dflags _raw input_fn output_fn = do
let hscpp_opts = picPOpts dflags
let cmdline_include_paths = includePaths dflags
pkg_include_dirs <- getPackageIncludePath dflags []
let include_paths = map ("-I" ++) . nub $
cmdline_include_paths ++ pkg_include_dirs
let verbFlags = getVerbFlags dflags
-- let cpp_prog args | raw = SysTools.runCpp dflags args
-- | otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
let cpp_prog_args = prune (getOpts dflags opt_P)
++ (if gopt Opt_WarnIsError dflags
then []
else ["--nowarn"])
prune :: [String] -> [String]
prune ("-include":xs)
= ("--include=" ++ head xs) : tail xs
prune (x:xs) = x : prune xs
prune [] = []
let target_defs = [] -- TODO: Deal with this
-- [ "-D" ++ HOST_OS ++ "_BUILD_OS=1",
-- "-D" ++ HOST_ARCH ++ "_BUILD_ARCH=1",
-- "-D" ++ TARGET_OS ++ "_HOST_OS=1",
-- "-D" ++ TARGET_ARCH ++ "_HOST_ARCH=1" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
let sse_defs =
[ "-D__SSE__=1" | isSseEnabled dflags ] ++
[ "-D__SSE2__=1" | isSse2Enabled dflags ] ++
[ "-D__SSE4_2__=1" | isSse4_2Enabled dflags ]
let avx_defs =
[ "-D__AVX__=1" | isAvxEnabled dflags ] ++
[ "-D__AVX2__=1" | isAvx2Enabled dflags ] ++
[ "-D__AVX512CD__=1" | isAvx512cdEnabled dflags ] ++
[ "-D__AVX512ER__=1" | isAvx512erEnabled dflags ] ++
[ "-D__AVX512F__=1" | isAvx512fEnabled dflags ] ++
[ "-D__AVX512PF__=1" | isAvx512pfEnabled dflags ]
backend_defs <- getBackendDefs dflags
#ifdef GHCI
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=YES" ]
#else
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=NO" ]
#endif
-- Default CPP defines in Haskell source
etaVersionH <- getEtaVersionPathName dflags
let hsSourceCppOpts =
[ "-D__GLASGOW_HASKELL__=" ++ ghcProjectVersionInt
, "-DETA_VERSION=" ++ cProjectVersionInt
, "-DETA_BUILD_NUMBER=" ++ cProjectPatchLevel
, "--include=" ++ etaVersionH
]
flags = verbFlags ++ include_paths ++ hsSourceCppOpts
++ target_defs ++ backend_defs ++ th_defs
++ hscpp_opts ++ sse_defs ++ avx_defs ++ ["--strip"]
++ cpp_prog_args
cppOpts <- either
(\s -> throwGhcExceptionIO $
ProgramError ("Preprocessing phase failed with: " ++ s))
return (parseOptions flags)
liftIO $ do
input <- readFile input_fn
output <- runCpphs cppOpts input_fn input
writeFile output_fn output
-- cpp_prog ( map SysTools.Option verbFlags
-- ++ map SysTools.Option include_paths
-- ++ map SysTools.Option hsSourceCppOpts
-- ++ map SysTools.Option target_defs
-- ++ map SysTools.Option backend_defs
-- ++ map SysTools.Option th_defs
-- ++ map SysTools.Option hscpp_opts
-- ++ map SysTools.Option sse_defs
-- ++ map SysTools.Option avx_defs
-- -- Set the language mode to assembler-with-cpp when preprocessing. This
-- -- alleviates some of the C99 macro rules relating to whitespace and the hash
-- -- operator, which we tend to abuse. Clang in particular is not very happy
-- -- about this.
-- ++ [ SysTools.Option "-x"
-- , SysTools.Option "assembler-with-cpp"
-- , SysTools.Option input_fn
-- -- We hackily use Option instead of FileOption here, so that the file
-- -- name is not back-slashed on Windows. cpp is capable of
-- -- dealing with / in filenames, so it works fine. Furthermore
-- -- if we put in backslashes, cpp outputs #line directives
-- -- with *double* backslashes. And that in turn means that
-- -- our error messages get double backslashes in them.
-- -- In due course we should arrange that the lexer deals
-- -- with these \\ escapes properly.
-- , SysTools.Option "-o"
-- , SysTools.FileOption "" output_fn
-- ]) | 4,587 | doCpp dflags _raw input_fn output_fn = do
let hscpp_opts = picPOpts dflags
let cmdline_include_paths = includePaths dflags
pkg_include_dirs <- getPackageIncludePath dflags []
let include_paths = map ("-I" ++) . nub $
cmdline_include_paths ++ pkg_include_dirs
let verbFlags = getVerbFlags dflags
-- let cpp_prog args | raw = SysTools.runCpp dflags args
-- | otherwise = SysTools.runCc dflags (SysTools.Option "-E" : args)
let cpp_prog_args = prune (getOpts dflags opt_P)
++ (if gopt Opt_WarnIsError dflags
then []
else ["--nowarn"])
prune :: [String] -> [String]
prune ("-include":xs)
= ("--include=" ++ head xs) : tail xs
prune (x:xs) = x : prune xs
prune [] = []
let target_defs = [] -- TODO: Deal with this
-- [ "-D" ++ HOST_OS ++ "_BUILD_OS=1",
-- "-D" ++ HOST_ARCH ++ "_BUILD_ARCH=1",
-- "-D" ++ TARGET_OS ++ "_HOST_OS=1",
-- "-D" ++ TARGET_ARCH ++ "_HOST_ARCH=1" ]
-- remember, in code we *compile*, the HOST is the same our TARGET,
-- and BUILD is the same as our HOST.
let sse_defs =
[ "-D__SSE__=1" | isSseEnabled dflags ] ++
[ "-D__SSE2__=1" | isSse2Enabled dflags ] ++
[ "-D__SSE4_2__=1" | isSse4_2Enabled dflags ]
let avx_defs =
[ "-D__AVX__=1" | isAvxEnabled dflags ] ++
[ "-D__AVX2__=1" | isAvx2Enabled dflags ] ++
[ "-D__AVX512CD__=1" | isAvx512cdEnabled dflags ] ++
[ "-D__AVX512ER__=1" | isAvx512erEnabled dflags ] ++
[ "-D__AVX512F__=1" | isAvx512fEnabled dflags ] ++
[ "-D__AVX512PF__=1" | isAvx512pfEnabled dflags ]
backend_defs <- getBackendDefs dflags
#ifdef GHCI
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=YES" ]
#else
let th_defs = [ "-D__GLASGOW_HASKELL_TH__=NO" ]
#endif
-- Default CPP defines in Haskell source
etaVersionH <- getEtaVersionPathName dflags
let hsSourceCppOpts =
[ "-D__GLASGOW_HASKELL__=" ++ ghcProjectVersionInt
, "-DETA_VERSION=" ++ cProjectVersionInt
, "-DETA_BUILD_NUMBER=" ++ cProjectPatchLevel
, "--include=" ++ etaVersionH
]
flags = verbFlags ++ include_paths ++ hsSourceCppOpts
++ target_defs ++ backend_defs ++ th_defs
++ hscpp_opts ++ sse_defs ++ avx_defs ++ ["--strip"]
++ cpp_prog_args
cppOpts <- either
(\s -> throwGhcExceptionIO $
ProgramError ("Preprocessing phase failed with: " ++ s))
return (parseOptions flags)
liftIO $ do
input <- readFile input_fn
output <- runCpphs cppOpts input_fn input
writeFile output_fn output
-- cpp_prog ( map SysTools.Option verbFlags
-- ++ map SysTools.Option include_paths
-- ++ map SysTools.Option hsSourceCppOpts
-- ++ map SysTools.Option target_defs
-- ++ map SysTools.Option backend_defs
-- ++ map SysTools.Option th_defs
-- ++ map SysTools.Option hscpp_opts
-- ++ map SysTools.Option sse_defs
-- ++ map SysTools.Option avx_defs
-- -- Set the language mode to assembler-with-cpp when preprocessing. This
-- -- alleviates some of the C99 macro rules relating to whitespace and the hash
-- -- operator, which we tend to abuse. Clang in particular is not very happy
-- -- about this.
-- ++ [ SysTools.Option "-x"
-- , SysTools.Option "assembler-with-cpp"
-- , SysTools.Option input_fn
-- -- We hackily use Option instead of FileOption here, so that the file
-- -- name is not back-slashed on Windows. cpp is capable of
-- -- dealing with / in filenames, so it works fine. Furthermore
-- -- if we put in backslashes, cpp outputs #line directives
-- -- with *double* backslashes. And that in turn means that
-- -- our error messages get double backslashes in them.
-- -- In due course we should arrange that the lexer deals
-- -- with these \\ escapes properly.
-- , SysTools.Option "-o"
-- , SysTools.FileOption "" output_fn
-- ]) | 4,528 | false | true | 0 | 19 | 1,557 | 635 | 329 | 306 | null | null |
elieux/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | uWordTyConName = tcQual gHC_GENERICS (fsLit "UWord") uWordTyConKey | 70 | uWordTyConName = tcQual gHC_GENERICS (fsLit "UWord") uWordTyConKey | 70 | uWordTyConName = tcQual gHC_GENERICS (fsLit "UWord") uWordTyConKey | 70 | false | false | 0 | 7 | 10 | 19 | 9 | 10 | null | null |
gnn/Hets | Driver/Options.hs | gpl-2.0 | whitelistS :: String
whitelistS = "whitelist" | 45 | whitelistS :: String
whitelistS = "whitelist" | 45 | whitelistS = "whitelist" | 24 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
bartoszw/haslo | Haslo/Calculator.hs | bsd-3-clause | rawCalcBalBalPlus c n 0 _ i = c - i * fromIntegral n | 52 | rawCalcBalBalPlus c n 0 _ i = c - i * fromIntegral n | 52 | rawCalcBalBalPlus c n 0 _ i = c - i * fromIntegral n | 52 | false | false | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
nh2/quickcheck | examples/Weird.hs | bsd-3-clause | -- note: this example is bad because we construct a rose tree without protecting the result
undef22 (n :: Int) = undefined :: Test.QuickCheck.Property.Result | 157 | undef22 (n :: Int) = undefined :: Test.QuickCheck.Property.Result | 65 | undef22 (n :: Int) = undefined :: Test.QuickCheck.Property.Result | 65 | true | false | 0 | 6 | 23 | 25 | 14 | 11 | null | null |
hguenther/nbis | MemoryModel.hs | agpl-3.0 | memInstrTrg (MICast _ _ _ _) = Nothing | 38 | memInstrTrg (MICast _ _ _ _) = Nothing | 38 | memInstrTrg (MICast _ _ _ _) = Nothing | 38 | false | false | 0 | 6 | 7 | 22 | 10 | 12 | null | null |
stevezhee/ed | app/Main.hs | bsd-3-clause | e = mkLT "you?" [] | 18 | e = mkLT "you?" [] | 18 | e = mkLT "you?" [] | 18 | false | false | 1 | 6 | 4 | 16 | 6 | 10 | null | null |
ekarayel/HTF | tests/TestHTF.hs | lgpl-2.1 | main =
do args <- getArgs
b <- doesDirectoryExist "tests/bbt"
let dirPrefix = if b then "tests" else ""
bbts <- blackBoxTests (dirPrefix </> "bbt") (dirPrefix </> "./run-bbt.sh") ".x"
(defaultBBTArgs { bbtArgs_verbose = False })
let tests = [addToTestSuite htf_thisModulesTests bbts] ++ htf_importedTests
when ("--help" `elem` args || "-h" `elem` args) $
do hPutStrLn stderr ("USAGE: dist/build/test/test [--direct]")
ecode <- runTestWithArgs ["--help"] ([] :: [Test])
exitWith ecode
case args of
"FailFast.hs":rest -> failFastMain rest
"MaxCurTime.hs":rest -> maxCurTimeMain rest
"MaxPrevTime.hs":rest -> maxPrevTimeMain rest
"PrevFactor.hs":rest -> prevFactorMain rest
"SortByPrevTime.hs":rest -> sortByPrevTimeMain rest
"UniqTests1.hs":rest -> uniqTests1Main rest
"UniqTests2.hs":rest -> uniqTests2Main rest
x:_ | ".hs" `List.isSuffixOf` x -> fail ("Unkown real-bbt test: " ++ x)
"--direct":rest ->
do ecode <- runTestWithArgs rest tests
case ecode of
ExitFailure _ -> return ()
_ -> fail ("unexpected exit code: " ++ show ecode)
_ ->
do withSystemTempFile "HTF-out" $ \outFile h ->
do hClose h
ecode <- runTestWithArgs ["-j4", "--deterministic",
"--json", "--output-file=" ++ outFile] tests
case ecode of
ExitFailure _ -> checkOutput outFile
_ -> fail ("unexpected exit code: " ++ show ecode)
`onException` (do s <- readFile outFile
hPutStrLn stderr s)
runRealBlackBoxTests
ecode <- system (dirPrefix </> "compile-errors/run-tests.sh")
exitWith ecode | 1,988 | main =
do args <- getArgs
b <- doesDirectoryExist "tests/bbt"
let dirPrefix = if b then "tests" else ""
bbts <- blackBoxTests (dirPrefix </> "bbt") (dirPrefix </> "./run-bbt.sh") ".x"
(defaultBBTArgs { bbtArgs_verbose = False })
let tests = [addToTestSuite htf_thisModulesTests bbts] ++ htf_importedTests
when ("--help" `elem` args || "-h" `elem` args) $
do hPutStrLn stderr ("USAGE: dist/build/test/test [--direct]")
ecode <- runTestWithArgs ["--help"] ([] :: [Test])
exitWith ecode
case args of
"FailFast.hs":rest -> failFastMain rest
"MaxCurTime.hs":rest -> maxCurTimeMain rest
"MaxPrevTime.hs":rest -> maxPrevTimeMain rest
"PrevFactor.hs":rest -> prevFactorMain rest
"SortByPrevTime.hs":rest -> sortByPrevTimeMain rest
"UniqTests1.hs":rest -> uniqTests1Main rest
"UniqTests2.hs":rest -> uniqTests2Main rest
x:_ | ".hs" `List.isSuffixOf` x -> fail ("Unkown real-bbt test: " ++ x)
"--direct":rest ->
do ecode <- runTestWithArgs rest tests
case ecode of
ExitFailure _ -> return ()
_ -> fail ("unexpected exit code: " ++ show ecode)
_ ->
do withSystemTempFile "HTF-out" $ \outFile h ->
do hClose h
ecode <- runTestWithArgs ["-j4", "--deterministic",
"--json", "--output-file=" ++ outFile] tests
case ecode of
ExitFailure _ -> checkOutput outFile
_ -> fail ("unexpected exit code: " ++ show ecode)
`onException` (do s <- readFile outFile
hPutStrLn stderr s)
runRealBlackBoxTests
ecode <- system (dirPrefix </> "compile-errors/run-tests.sh")
exitWith ecode | 1,988 | main =
do args <- getArgs
b <- doesDirectoryExist "tests/bbt"
let dirPrefix = if b then "tests" else ""
bbts <- blackBoxTests (dirPrefix </> "bbt") (dirPrefix </> "./run-bbt.sh") ".x"
(defaultBBTArgs { bbtArgs_verbose = False })
let tests = [addToTestSuite htf_thisModulesTests bbts] ++ htf_importedTests
when ("--help" `elem` args || "-h" `elem` args) $
do hPutStrLn stderr ("USAGE: dist/build/test/test [--direct]")
ecode <- runTestWithArgs ["--help"] ([] :: [Test])
exitWith ecode
case args of
"FailFast.hs":rest -> failFastMain rest
"MaxCurTime.hs":rest -> maxCurTimeMain rest
"MaxPrevTime.hs":rest -> maxPrevTimeMain rest
"PrevFactor.hs":rest -> prevFactorMain rest
"SortByPrevTime.hs":rest -> sortByPrevTimeMain rest
"UniqTests1.hs":rest -> uniqTests1Main rest
"UniqTests2.hs":rest -> uniqTests2Main rest
x:_ | ".hs" `List.isSuffixOf` x -> fail ("Unkown real-bbt test: " ++ x)
"--direct":rest ->
do ecode <- runTestWithArgs rest tests
case ecode of
ExitFailure _ -> return ()
_ -> fail ("unexpected exit code: " ++ show ecode)
_ ->
do withSystemTempFile "HTF-out" $ \outFile h ->
do hClose h
ecode <- runTestWithArgs ["-j4", "--deterministic",
"--json", "--output-file=" ++ outFile] tests
case ecode of
ExitFailure _ -> checkOutput outFile
_ -> fail ("unexpected exit code: " ++ show ecode)
`onException` (do s <- readFile outFile
hPutStrLn stderr s)
runRealBlackBoxTests
ecode <- system (dirPrefix </> "compile-errors/run-tests.sh")
exitWith ecode | 1,988 | false | false | 0 | 23 | 728 | 516 | 247 | 269 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110315set10.hs | gpl-3.0 | processTTBar0or1jet :: [Char]
processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 130 | processTTBar0or1jet :: [Char]
processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 130 | processTTBar0or1jet =
"\ngenerate P P > t t~ QED=99 @1 \nadd process P P > t t~ J QED=99 @2 \n" | 100 | false | true | 0 | 7 | 28 | 21 | 9 | 12 | null | null |
glutamate/paskell | Paskell/LLVM/LLVMM.hs | bsd-3-clause | ret e1 = withCurrentBuilder $ \bldref -> do
FFI.buildRet bldref e1
return () | 80 | ret e1 = withCurrentBuilder $ \bldref -> do
FFI.buildRet bldref e1
return () | 80 | ret e1 = withCurrentBuilder $ \bldref -> do
FFI.buildRet bldref e1
return () | 80 | false | false | 0 | 10 | 16 | 36 | 16 | 20 | null | null |
corajr/cataskell | src/Cataskell/Game.hs | bsd-3-clause | -- | Check that a response didn't come from the person who made the offer (unless a complete or a cancel)
responseNotFromSamePlayer :: TradeAction -> Precondition Game
responseNotFromSamePlayer trade'
= Precondition (\_ -> Just (trade'^.offer.offeredBy) /= otherParty) "Trade response is from a different player"
where otherParty = (trade' ^? accepter) <|> (trade' ^? rejecter) | 385 | responseNotFromSamePlayer :: TradeAction -> Precondition Game
responseNotFromSamePlayer trade'
= Precondition (\_ -> Just (trade'^.offer.offeredBy) /= otherParty) "Trade response is from a different player"
where otherParty = (trade' ^? accepter) <|> (trade' ^? rejecter) | 279 | responseNotFromSamePlayer trade'
= Precondition (\_ -> Just (trade'^.offer.offeredBy) /= otherParty) "Trade response is from a different player"
where otherParty = (trade' ^? accepter) <|> (trade' ^? rejecter) | 217 | true | true | 0 | 12 | 61 | 76 | 40 | 36 | null | null |
glutamate/probably-baysig | src/Math/Probably/Types.hs | bsd-3-clause | handleGradient :: Maybe t -> t
handleGradient Nothing = error "handleGradient: no gradient provided" | 101 | handleGradient :: Maybe t -> t
handleGradient Nothing = error "handleGradient: no gradient provided" | 101 | handleGradient Nothing = error "handleGradient: no gradient provided" | 70 | false | true | 0 | 7 | 14 | 29 | 12 | 17 | null | null |
vTurbine/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | missingTupArg :: HsTupArg RdrName
missingTupArg = Missing placeHolderType | 73 | missingTupArg :: HsTupArg RdrName
missingTupArg = Missing placeHolderType | 73 | missingTupArg = Missing placeHolderType | 39 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
NCrashed/hjass | src/library/Language/Jass/Parser/AST/TypeDef.hs | mit | -- | Returns type name
getTypeName :: TypeDef -> Name
getTypeName (TypeDef _ n _) = n | 85 | getTypeName :: TypeDef -> Name
getTypeName (TypeDef _ n _) = n | 62 | getTypeName (TypeDef _ n _) = n | 31 | true | true | 0 | 7 | 16 | 29 | 15 | 14 | null | null |
ezyang/ghc | compiler/types/TyCoRep.hs | bsd-3-clause | -- | Substitute within a 'Type' disabling the sanity checks.
-- The problems that the sanity checks in substTy catch are described in
-- Note [The substitution invariant].
-- The goal of #11371 is to migrate all the calls of substTyUnchecked to
-- substTy and remove this function. Please don't use in new code.
substTyUnchecked :: TCvSubst -> Type -> Type
substTyUnchecked subst ty
| isEmptyTCvSubst subst = ty
| otherwise = subst_ty subst ty | 489 | substTyUnchecked :: TCvSubst -> Type -> Type
substTyUnchecked subst ty
| isEmptyTCvSubst subst = ty
| otherwise = subst_ty subst ty | 177 | substTyUnchecked subst ty
| isEmptyTCvSubst subst = ty
| otherwise = subst_ty subst ty | 132 | true | true | 0 | 8 | 120 | 59 | 28 | 31 | null | null |
nilekurt/hs-panelmethod | VectorUtils.hs | gpl-2.0 | getMidpoint :: Line -> FV2
getMidpoint (Line v1 v2) = 0.5 * (v1 + v2) | 70 | getMidpoint :: Line -> FV2
getMidpoint (Line v1 v2) = 0.5 * (v1 + v2) | 70 | getMidpoint (Line v1 v2) = 0.5 * (v1 + v2) | 43 | false | true | 0 | 9 | 15 | 43 | 20 | 23 | null | null |
vladimir-ipatov/ganeti | src/Ganeti/HTools/Node.hs | gpl-2.0 | list :: [String] -> Node -> [String]
list fields t = map (showField t) fields | 77 | list :: [String] -> Node -> [String]
list fields t = map (showField t) fields | 77 | list fields t = map (showField t) fields | 40 | false | true | 0 | 7 | 14 | 45 | 22 | 23 | null | null |
dolio/vector | Data/Vector/Generic.hs | bsd-3-clause | -- NOTE: We *CANNOT* wrap this in New and then fuse because the elements
-- might contain references to the immutable vector!
constructN !n f = runST (
do
v <- M.new n
v' <- unsafeFreeze v
fill v' 0
)
where
fill :: forall s. v a -> Int -> ST s (v a)
fill !v i | i < n = let x = f (unsafeTake i v)
in
elemseq v x $
do
v' <- unsafeThaw v
M.unsafeWrite v' i x
v'' <- unsafeFreeze v'
fill v'' (i+1)
fill v _ = return v
-- | /O(n)/ Construct a vector with @n@ elements from right to left by
-- repeatedly applying the generator function to the already constructed part
-- of the vector.
--
-- > constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>
-- | 871 | constructN !n f = runST (
do
v <- M.new n
v' <- unsafeFreeze v
fill v' 0
)
where
fill :: forall s. v a -> Int -> ST s (v a)
fill !v i | i < n = let x = f (unsafeTake i v)
in
elemseq v x $
do
v' <- unsafeThaw v
M.unsafeWrite v' i x
v'' <- unsafeFreeze v'
fill v'' (i+1)
fill v _ = return v
-- | /O(n)/ Construct a vector with @n@ elements from right to left by
-- repeatedly applying the generator function to the already constructed part
-- of the vector.
--
-- > constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>
-- | 745 | constructN !n f = runST (
do
v <- M.new n
v' <- unsafeFreeze v
fill v' 0
)
where
fill :: forall s. v a -> Int -> ST s (v a)
fill !v i | i < n = let x = f (unsafeTake i v)
in
elemseq v x $
do
v' <- unsafeThaw v
M.unsafeWrite v' i x
v'' <- unsafeFreeze v'
fill v'' (i+1)
fill v _ = return v
-- | /O(n)/ Construct a vector with @n@ elements from right to left by
-- repeatedly applying the generator function to the already constructed part
-- of the vector.
--
-- > constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in f <c,b,a>
-- | 745 | true | false | 0 | 13 | 360 | 203 | 94 | 109 | null | null |
HaskellCNOrg/snap-web | src/Text/Digestive/FormExt.hs | bsd-3-clause | ---------------------------------------------------- Validator
-- | MAYBE: more accurate email addr. validator.
--
emailValidator :: T.Text -> Bool
emailValidator = isJust . T.find (== '@') | 190 | emailValidator :: T.Text -> Bool
emailValidator = isJust . T.find (== '@') | 74 | emailValidator = isJust . T.find (== '@') | 41 | true | true | 0 | 7 | 23 | 33 | 19 | 14 | null | null |
pierzchalski/cs3161a2 | tests/driver/Diff.hs | mit | dstep :: ((Int,Int)->Bool) -> [DL] -> [DL]
dstep cd dls = map maximum $ [hd]:(chunk 2 rst)
where (hd:rst) = concatMap extend dls
extend dl = let pdl = path dl
in [addsnake cd $ dl {poi=poi dl + 1, path=(F : pdl)},
addsnake cd $ dl {poj=poj dl + 1, path=(S : pdl)}] | 327 | dstep :: ((Int,Int)->Bool) -> [DL] -> [DL]
dstep cd dls = map maximum $ [hd]:(chunk 2 rst)
where (hd:rst) = concatMap extend dls
extend dl = let pdl = path dl
in [addsnake cd $ dl {poi=poi dl + 1, path=(F : pdl)},
addsnake cd $ dl {poj=poj dl + 1, path=(S : pdl)}] | 327 | dstep cd dls = map maximum $ [hd]:(chunk 2 rst)
where (hd:rst) = concatMap extend dls
extend dl = let pdl = path dl
in [addsnake cd $ dl {poi=poi dl + 1, path=(F : pdl)},
addsnake cd $ dl {poj=poj dl + 1, path=(S : pdl)}] | 284 | false | true | 1 | 13 | 116 | 193 | 98 | 95 | null | null |
seereason/HJScript | src/HJScript/DOM/ElementNode.hs | bsd-3-clause | lastChild :: IsElementNode n => Exp n -> Exp Node
lastChild = deref "lastChild" | 80 | lastChild :: IsElementNode n => Exp n -> Exp Node
lastChild = deref "lastChild" | 80 | lastChild = deref "lastChild" | 29 | false | true | 0 | 7 | 14 | 31 | 14 | 17 | null | null |
antalsz/hs-to-coq | src/lib/HsToCoq/ConvertHaskell/Expr.hs | mit | convertTypedBinding convHsTy FunBind{..} = do
name <- var ExprNS (unLoc fun_id)
-- Skip it? Axiomatize it?
definitionTask name >>= \case
SkipIt ->
pure . Just $ SkippedBinding name
RedefineIt def ->
pure . Just $ RedefinedBinding name def
AxiomatizeIt axMode ->
let missingType = case axMode of
SpecificAxiomatize -> convUnsupported "axiomatizing definitions without type signatures"
GeneralAxiomatize -> pure bottomType
in Just . ConvertedAxiomBinding name <$> maybe missingType pure convHsTy
TranslateIt -> do
let (tvs, coqTy) =
-- The @forall@ed arguments need to be brought into scope
let peelForall (Forall tvs body) = first (NEL.toList tvs ++) $ peelForall body
peelForall ty = ([], ty)
in maybe ([], Nothing) (second Just . peelForall) convHsTy
-- in maybe ([], Nothing) (second Just . peelForall) (Just $ Qualid $ Bare "test")
let tryCollapseLet defn = do
view (edits.collapsedLets.contains name) >>= \case
True -> collapseLet name defn
& maybe (convUnsupported "collapsing non-`let x=… in x` lets") pure
False -> pure defn
defn <-
tryCollapseLet =<<
if all (null . m_pats . unLoc) . unLoc $ mg_alts fun_matches
then case unLoc $ mg_alts fun_matches of
[L _ (GHC.Match NOEXTP _ [] grhss)] -> convertGRHSs [] grhss patternFailure
_ -> convUnsupported "malformed multi-match variable definitions"
else do
skipEqns <- view $ edits.skippedEquations.at name.non mempty
uncurry Fun <$> convertFunction skipEqns fun_matches
addScope <- maybe id (flip InScope) <$> view (edits.additionalScopes.at (SPValue, name))
pure . Just . ConvertedDefinitionBinding $ ConvertedDefinition name tvs coqTy (addScope defn) | 2,069 | convertTypedBinding convHsTy FunBind{..} = do
name <- var ExprNS (unLoc fun_id)
-- Skip it? Axiomatize it?
definitionTask name >>= \case
SkipIt ->
pure . Just $ SkippedBinding name
RedefineIt def ->
pure . Just $ RedefinedBinding name def
AxiomatizeIt axMode ->
let missingType = case axMode of
SpecificAxiomatize -> convUnsupported "axiomatizing definitions without type signatures"
GeneralAxiomatize -> pure bottomType
in Just . ConvertedAxiomBinding name <$> maybe missingType pure convHsTy
TranslateIt -> do
let (tvs, coqTy) =
-- The @forall@ed arguments need to be brought into scope
let peelForall (Forall tvs body) = first (NEL.toList tvs ++) $ peelForall body
peelForall ty = ([], ty)
in maybe ([], Nothing) (second Just . peelForall) convHsTy
-- in maybe ([], Nothing) (second Just . peelForall) (Just $ Qualid $ Bare "test")
let tryCollapseLet defn = do
view (edits.collapsedLets.contains name) >>= \case
True -> collapseLet name defn
& maybe (convUnsupported "collapsing non-`let x=… in x` lets") pure
False -> pure defn
defn <-
tryCollapseLet =<<
if all (null . m_pats . unLoc) . unLoc $ mg_alts fun_matches
then case unLoc $ mg_alts fun_matches of
[L _ (GHC.Match NOEXTP _ [] grhss)] -> convertGRHSs [] grhss patternFailure
_ -> convUnsupported "malformed multi-match variable definitions"
else do
skipEqns <- view $ edits.skippedEquations.at name.non mempty
uncurry Fun <$> convertFunction skipEqns fun_matches
addScope <- maybe id (flip InScope) <$> view (edits.additionalScopes.at (SPValue, name))
pure . Just . ConvertedDefinitionBinding $ ConvertedDefinition name tvs coqTy (addScope defn) | 2,069 | convertTypedBinding convHsTy FunBind{..} = do
name <- var ExprNS (unLoc fun_id)
-- Skip it? Axiomatize it?
definitionTask name >>= \case
SkipIt ->
pure . Just $ SkippedBinding name
RedefineIt def ->
pure . Just $ RedefinedBinding name def
AxiomatizeIt axMode ->
let missingType = case axMode of
SpecificAxiomatize -> convUnsupported "axiomatizing definitions without type signatures"
GeneralAxiomatize -> pure bottomType
in Just . ConvertedAxiomBinding name <$> maybe missingType pure convHsTy
TranslateIt -> do
let (tvs, coqTy) =
-- The @forall@ed arguments need to be brought into scope
let peelForall (Forall tvs body) = first (NEL.toList tvs ++) $ peelForall body
peelForall ty = ([], ty)
in maybe ([], Nothing) (second Just . peelForall) convHsTy
-- in maybe ([], Nothing) (second Just . peelForall) (Just $ Qualid $ Bare "test")
let tryCollapseLet defn = do
view (edits.collapsedLets.contains name) >>= \case
True -> collapseLet name defn
& maybe (convUnsupported "collapsing non-`let x=… in x` lets") pure
False -> pure defn
defn <-
tryCollapseLet =<<
if all (null . m_pats . unLoc) . unLoc $ mg_alts fun_matches
then case unLoc $ mg_alts fun_matches of
[L _ (GHC.Match NOEXTP _ [] grhss)] -> convertGRHSs [] grhss patternFailure
_ -> convUnsupported "malformed multi-match variable definitions"
else do
skipEqns <- view $ edits.skippedEquations.at name.non mempty
uncurry Fun <$> convertFunction skipEqns fun_matches
addScope <- maybe id (flip InScope) <$> view (edits.additionalScopes.at (SPValue, name))
pure . Just . ConvertedDefinitionBinding $ ConvertedDefinition name tvs coqTy (addScope defn) | 2,069 | false | false | 0 | 25 | 698 | 535 | 252 | 283 | null | null |
lukexi/haskell-opencv | src/OpenCV/Internal/ImgProc/MiscImgTransform/ColorCodes.hs | bsd-3-clause | bgr_NV12 :: Proxy 'BGR_NV12 ; bgr_NV12 = Proxy | 50 | bgr_NV12 :: Proxy 'BGR_NV12
bgr_NV12 = Proxy | 48 | bgr_NV12 = Proxy | 18 | false | true | 0 | 6 | 11 | 17 | 9 | 8 | null | null |
centromere/cacophony | tools/noise-repl/Client.hs | unlicense | printKeys :: DH d
=> KeyPair d
-> KeyPair d
-> IO ()
printKeys (epriv, epub) (spriv, spub) = do
putStrLn "Your keys are as follows:"
putStrLn $ "private ephemeral: " <> (B64.encode . convert . dhSecToBytes) epriv
putStrLn $ "public ephemeral: " <> (B64.encode . convert . dhPubToBytes) epub
putStrLn $ "private static: " <> (B64.encode . convert . dhSecToBytes) spriv
putStrLn $ "public static: " <> (B64.encode . convert . dhPubToBytes) spub | 490 | printKeys :: DH d
=> KeyPair d
-> KeyPair d
-> IO ()
printKeys (epriv, epub) (spriv, spub) = do
putStrLn "Your keys are as follows:"
putStrLn $ "private ephemeral: " <> (B64.encode . convert . dhSecToBytes) epriv
putStrLn $ "public ephemeral: " <> (B64.encode . convert . dhPubToBytes) epub
putStrLn $ "private static: " <> (B64.encode . convert . dhSecToBytes) spriv
putStrLn $ "public static: " <> (B64.encode . convert . dhPubToBytes) spub | 490 | printKeys (epriv, epub) (spriv, spub) = do
putStrLn "Your keys are as follows:"
putStrLn $ "private ephemeral: " <> (B64.encode . convert . dhSecToBytes) epriv
putStrLn $ "public ephemeral: " <> (B64.encode . convert . dhPubToBytes) epub
putStrLn $ "private static: " <> (B64.encode . convert . dhSecToBytes) spriv
putStrLn $ "public static: " <> (B64.encode . convert . dhPubToBytes) spub | 407 | false | true | 0 | 12 | 121 | 168 | 81 | 87 | null | null |
kovach/web2 | src/Reflection.hs | mit | withF = withL (flens) | 21 | withF = withL (flens) | 21 | withF = withL (flens) | 21 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
edsko/cabal | Cabal/src/Distribution/Simple/GHC.hs | bsd-3-clause | -- | Return the 'FilePath' to the global GHC package database.
getGlobalPackageDB :: Verbosity -> ConfiguredProgram -> IO FilePath
getGlobalPackageDB verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-global-package-db"] | 279 | getGlobalPackageDB :: Verbosity -> ConfiguredProgram -> IO FilePath
getGlobalPackageDB verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-global-package-db"] | 216 | getGlobalPackageDB verbosity ghcProg =
dropWhileEndLE isSpace `fmap`
rawSystemProgramStdout verbosity ghcProg ["--print-global-package-db"] | 148 | true | true | 0 | 7 | 38 | 47 | 24 | 23 | null | null |
pparkkin/eta | compiler/ETA/Prelude/PrimOp.hs | bsd-3-clause | primOpCanFail AtomicReadByteArrayOp_Int = True | 46 | primOpCanFail AtomicReadByteArrayOp_Int = True | 46 | primOpCanFail AtomicReadByteArrayOp_Int = True | 46 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
stevana/yeast | tests/UnitTests.hs | isc | test_rss2ConstructiveNews :: IO ()
test_rss2ConstructiveNews =
withFileFeed "tests/files/constructive-news.rss2" assertFailure $ \f -> do
flip assertFeed f $ emptyFeed RSS2Kind
& title ?~ "constructivenews"
& feedHome .~ Nothing
& feedHtml ?~ "https://groups.google.com/d/forum/constructivenews"
& description ?~ T.concat
[ "News on constructive mathematics such as publication of "
, "new papers and discussion including topics: Bishop "
, "constructive mathematics, intuitionism, computability, "
, "realizability, type theory, topos theory, formal "
, "topology, locale theory, applications, and others."
]
& date .~ Nothing
& items .~
[ emptyItem
& title ?~ T.concat
[ "FW: Young Researchers in Mathematics Conference "
, "2015 - Oxford"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "KUvEVQWEKDw/tsnpm_BRbiYJ"
]
& date ?~ "Tue, 02 Jun 2015 15:20:15 UTC"
& author ?~ "Kreinovich, Vladik"
& description ?~ T.concat
[ "FYI -----Original Message----- Young Researchers "
, "in Mathematics Conference 2015 - Oxford "
, "http://yrm2015.co.uk Monday, August 17, 2015 to "
, "Thursday, August 20, 2015 Conference poster: "
, "http://yrm2015.co.uk/poster The YRM2015 conference"
, " is primarily intended for PhD students in "
, "Mathematics an"
]
, emptyItem
& title ?~ T.concat
[ "Continuity, Computability, Constructivity 2015; "
, "second call for submission"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "0U7QOmYQ6FY/ZUefo2WhRmgJ"
]
& date ?~ "Thu, 21 May 2015 12:34:56 UTC"
& author ?~ "spreen"
& description ?~ T.concat
[ "*Continuity, Computability, Constructivity \8211 "
, "From Logic to Algorithms* *(CCC 2015)* * Schloss "
, "Aspenstein, Kochel am See (near Munich)* *14-18 "
, "September 2015* * Second call for papers* "
, "*http://www.cs.swan.ac.uk/ccc2015/* CCC is a "
, "workshop series bringing together researchers "
, "from real analysis, com"
]
] | 2,783 | test_rss2ConstructiveNews :: IO ()
test_rss2ConstructiveNews =
withFileFeed "tests/files/constructive-news.rss2" assertFailure $ \f -> do
flip assertFeed f $ emptyFeed RSS2Kind
& title ?~ "constructivenews"
& feedHome .~ Nothing
& feedHtml ?~ "https://groups.google.com/d/forum/constructivenews"
& description ?~ T.concat
[ "News on constructive mathematics such as publication of "
, "new papers and discussion including topics: Bishop "
, "constructive mathematics, intuitionism, computability, "
, "realizability, type theory, topos theory, formal "
, "topology, locale theory, applications, and others."
]
& date .~ Nothing
& items .~
[ emptyItem
& title ?~ T.concat
[ "FW: Young Researchers in Mathematics Conference "
, "2015 - Oxford"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "KUvEVQWEKDw/tsnpm_BRbiYJ"
]
& date ?~ "Tue, 02 Jun 2015 15:20:15 UTC"
& author ?~ "Kreinovich, Vladik"
& description ?~ T.concat
[ "FYI -----Original Message----- Young Researchers "
, "in Mathematics Conference 2015 - Oxford "
, "http://yrm2015.co.uk Monday, August 17, 2015 to "
, "Thursday, August 20, 2015 Conference poster: "
, "http://yrm2015.co.uk/poster The YRM2015 conference"
, " is primarily intended for PhD students in "
, "Mathematics an"
]
, emptyItem
& title ?~ T.concat
[ "Continuity, Computability, Constructivity 2015; "
, "second call for submission"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "0U7QOmYQ6FY/ZUefo2WhRmgJ"
]
& date ?~ "Thu, 21 May 2015 12:34:56 UTC"
& author ?~ "spreen"
& description ?~ T.concat
[ "*Continuity, Computability, Constructivity \8211 "
, "From Logic to Algorithms* *(CCC 2015)* * Schloss "
, "Aspenstein, Kochel am See (near Munich)* *14-18 "
, "September 2015* * Second call for papers* "
, "*http://www.cs.swan.ac.uk/ccc2015/* CCC is a "
, "workshop series bringing together researchers "
, "from real analysis, com"
]
] | 2,783 | test_rss2ConstructiveNews =
withFileFeed "tests/files/constructive-news.rss2" assertFailure $ \f -> do
flip assertFeed f $ emptyFeed RSS2Kind
& title ?~ "constructivenews"
& feedHome .~ Nothing
& feedHtml ?~ "https://groups.google.com/d/forum/constructivenews"
& description ?~ T.concat
[ "News on constructive mathematics such as publication of "
, "new papers and discussion including topics: Bishop "
, "constructive mathematics, intuitionism, computability, "
, "realizability, type theory, topos theory, formal "
, "topology, locale theory, applications, and others."
]
& date .~ Nothing
& items .~
[ emptyItem
& title ?~ T.concat
[ "FW: Young Researchers in Mathematics Conference "
, "2015 - Oxford"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "KUvEVQWEKDw/tsnpm_BRbiYJ"
]
& date ?~ "Tue, 02 Jun 2015 15:20:15 UTC"
& author ?~ "Kreinovich, Vladik"
& description ?~ T.concat
[ "FYI -----Original Message----- Young Researchers "
, "in Mathematics Conference 2015 - Oxford "
, "http://yrm2015.co.uk Monday, August 17, 2015 to "
, "Thursday, August 20, 2015 Conference poster: "
, "http://yrm2015.co.uk/poster The YRM2015 conference"
, " is primarily intended for PhD students in "
, "Mathematics an"
]
, emptyItem
& title ?~ T.concat
[ "Continuity, Computability, Constructivity 2015; "
, "second call for submission"
]
& link ?~ T.concat
[ "https://groups.google.com/d/msg/constructivenews/"
, "0U7QOmYQ6FY/ZUefo2WhRmgJ"
]
& date ?~ "Thu, 21 May 2015 12:34:56 UTC"
& author ?~ "spreen"
& description ?~ T.concat
[ "*Continuity, Computability, Constructivity \8211 "
, "From Logic to Algorithms* *(CCC 2015)* * Schloss "
, "Aspenstein, Kochel am See (near Munich)* *14-18 "
, "September 2015* * Second call for papers* "
, "*http://www.cs.swan.ac.uk/ccc2015/* CCC is a "
, "workshop series bringing together researchers "
, "from real analysis, com"
]
] | 2,748 | false | true | 0 | 22 | 1,127 | 295 | 157 | 138 | null | null |
Fermat/FCR | src/Fcr/Rewrite.hs | gpl-3.0 | match (Var s) t1 = return [(s, t1)] | 35 | match (Var s) t1 = return [(s, t1)] | 35 | match (Var s) t1 = return [(s, t1)] | 35 | false | false | 1 | 7 | 7 | 33 | 15 | 18 | null | null |
olorin/amazonka | amazonka-iam/test/Test/AWS/Gen/IAM.hs | mpl-2.0 | testRemoveRoleFromInstanceProfile :: RemoveRoleFromInstanceProfile -> TestTree
testRemoveRoleFromInstanceProfile = req
"RemoveRoleFromInstanceProfile"
"fixture/RemoveRoleFromInstanceProfile.yaml" | 203 | testRemoveRoleFromInstanceProfile :: RemoveRoleFromInstanceProfile -> TestTree
testRemoveRoleFromInstanceProfile = req
"RemoveRoleFromInstanceProfile"
"fixture/RemoveRoleFromInstanceProfile.yaml" | 203 | testRemoveRoleFromInstanceProfile = req
"RemoveRoleFromInstanceProfile"
"fixture/RemoveRoleFromInstanceProfile.yaml" | 124 | false | true | 0 | 5 | 17 | 21 | 10 | 11 | null | null |
dalaing/type-systems | src/Fragment/Annotation/Rules/Type/Infer/Common.hs | bsd-3-clause | annotationInferTypeInput :: AnnotationInferTypeConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> InferTypeInput e w s r m (InferTypeMonad m ki ty a i) ki ty pt tm a
annotationInferTypeInput m i =
InferTypeInput [] [InferTypeRecurse $ inferTmAnnotation m i ] [] | 370 | annotationInferTypeInput :: AnnotationInferTypeConstraint e w s r m ki ty pt tm a i
=> Proxy (MonadProxy e w s r m)
-> Proxy i
-> InferTypeInput e w s r m (InferTypeMonad m ki ty a i) ki ty pt tm a
annotationInferTypeInput m i =
InferTypeInput [] [InferTypeRecurse $ inferTmAnnotation m i ] [] | 370 | annotationInferTypeInput m i =
InferTypeInput [] [InferTypeRecurse $ inferTmAnnotation m i ] [] | 97 | false | true | 0 | 10 | 132 | 131 | 63 | 68 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.