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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Frefreak/hearthstone-cardsearch | client/src/JavaScript/JQuery.hs | bsd-3-clause | isElement :: IsElement e => e -> JQuery -> IO Bool
isElement e = jq_is_jq (JQuery . unElement $ toElement e) | 108 | isElement :: IsElement e => e -> JQuery -> IO Bool
isElement e = jq_is_jq (JQuery . unElement $ toElement e) | 108 | isElement e = jq_is_jq (JQuery . unElement $ toElement e) | 57 | false | true | 0 | 9 | 20 | 54 | 24 | 30 | null | null |
sdiehl/ghc | compiler/GHC/Cmm/Pipeline.hs | bsd-3-clause | dumpWith :: DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
dumpWith dflags flag txt fmt sdoc = do
dumpIfSet_dyn dflags flag txt fmt sdoc
when (not (dopt flag dflags)) $
-- If `-ddump-cmm-verbose -ddump-to-file` is specified,
-- dump each Cmm pipeline stage output to a separate file. #16930
when (dopt Opt_D_dump_cmm_verbose dflags)
$ dumpAction dflags (mkDumpStyle dflags alwaysQualify)
(dumpOptionsFromFlag flag) txt fmt sdoc
dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose_by_proc txt fmt sdoc | 551 | dumpWith :: DynFlags -> DumpFlag -> String -> DumpFormat -> SDoc -> IO ()
dumpWith dflags flag txt fmt sdoc = do
dumpIfSet_dyn dflags flag txt fmt sdoc
when (not (dopt flag dflags)) $
-- If `-ddump-cmm-verbose -ddump-to-file` is specified,
-- dump each Cmm pipeline stage output to a separate file. #16930
when (dopt Opt_D_dump_cmm_verbose dflags)
$ dumpAction dflags (mkDumpStyle dflags alwaysQualify)
(dumpOptionsFromFlag flag) txt fmt sdoc
dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose_by_proc txt fmt sdoc | 551 | dumpWith dflags flag txt fmt sdoc = do
dumpIfSet_dyn dflags flag txt fmt sdoc
when (not (dopt flag dflags)) $
-- If `-ddump-cmm-verbose -ddump-to-file` is specified,
-- dump each Cmm pipeline stage output to a separate file. #16930
when (dopt Opt_D_dump_cmm_verbose dflags)
$ dumpAction dflags (mkDumpStyle dflags alwaysQualify)
(dumpOptionsFromFlag flag) txt fmt sdoc
dumpIfSet_dyn dflags Opt_D_dump_cmm_verbose_by_proc txt fmt sdoc | 477 | false | true | 0 | 14 | 116 | 148 | 69 | 79 | null | null |
brendanhay/gogol | gogol-dataproc/gen/Network/Google/Dataproc/Types/Product.hs | mpl-2.0 | -- | Optional. A unique ID used to identify the request. If the server
-- receives two RepairClusterRequests with the same ID, the second request
-- is ignored, and the first google.longrunning.Operation created and
-- stored in the backend is returned.Recommendation: Set this value to a
-- UUID
-- (https:\/\/en.wikipedia.org\/wiki\/Universally_unique_identifier).The ID
-- must contain only letters (a-z, A-Z), numbers (0-9), underscores (_),
-- and hyphens (-). The maximum length is 40 characters.
rcrRequestId :: Lens' RepairClusterRequest (Maybe Text)
rcrRequestId
= lens _rcrRequestId (\ s a -> s{_rcrRequestId = a}) | 626 | rcrRequestId :: Lens' RepairClusterRequest (Maybe Text)
rcrRequestId
= lens _rcrRequestId (\ s a -> s{_rcrRequestId = a}) | 123 | rcrRequestId
= lens _rcrRequestId (\ s a -> s{_rcrRequestId = a}) | 67 | true | true | 0 | 9 | 90 | 55 | 32 | 23 | null | null |
dmcclean/HaTeX | Text/LaTeX/Packages/AMSMath.hs | bsd-3-clause | -- | Dagger symbol, †.
dagger :: LaTeXC l => l
dagger = comm0 "dagger" | 70 | dagger :: LaTeXC l => l
dagger = comm0 "dagger" | 47 | dagger = comm0 "dagger" | 23 | true | true | 0 | 7 | 14 | 29 | 12 | 17 | null | null |
projectorhq/haskell-liquid | src/Text/Liquid/Renderer.hs | bsd-3-clause | applyFilterM _ _ = Nothing | 50 | applyFilterM _ _ = Nothing | 50 | applyFilterM _ _ = Nothing | 50 | false | false | 1 | 5 | 28 | 12 | 5 | 7 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/BasicTypes.hs | bsd-3-clause | notOneBranch = False | 20 | notOneBranch = False | 20 | notOneBranch = False | 20 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
martinvlk/sunrise-equation | src/Main.hs | gpl-3.0 | unrad :: Double -> Double
unrad x = x / pi * halfCircle | 55 | unrad :: Double -> Double
unrad x = x / pi * halfCircle | 55 | unrad x = x / pi * halfCircle | 29 | false | true | 0 | 6 | 12 | 26 | 13 | 13 | null | null |
google/codeworld | codeworld-base/src/Extras/Colors.hs | apache-2.0 | -- | This function allows you to specify the level of transparency of the
-- given color. Transparency must be given in the range 0 (fully transparent)
-- to 1 (fully opaque).
withAlpha :: (Color, Number) -> Color
withAlpha (RGBA (r, g, b, _), a) = RGBA (r, g, b, a) | 266 | withAlpha :: (Color, Number) -> Color
withAlpha (RGBA (r, g, b, _), a) = RGBA (r, g, b, a) | 90 | withAlpha (RGBA (r, g, b, _), a) = RGBA (r, g, b, a) | 52 | true | true | 0 | 8 | 50 | 63 | 38 | 25 | null | null |
urbanslug/ghc | compiler/ghci/ByteCodeInstr.hs | bsd-3-clause | bciStackUse LABEL{} = 0 | 37 | bciStackUse LABEL{} = 0 | 37 | bciStackUse LABEL{} = 0 | 37 | false | false | 1 | 5 | 17 | 16 | 6 | 10 | null | null |
forked-upstream-packages-for-ghcjs/ghcjs | ghcjs/src/Gen2/Prim.hs | mit | genPrim _ _ FloatCosOp [r] [x] = PrimInline [j| `r` = Math.cos(`x`) |] | 79 | genPrim _ _ FloatCosOp [r] [x] = PrimInline [j| `r` = Math.cos(`x`) |] | 79 | genPrim _ _ FloatCosOp [r] [x] = PrimInline [j| `r` = Math.cos(`x`) |] | 79 | false | false | 0 | 6 | 21 | 30 | 17 | 13 | null | null |
vshabanov/fast-tagsoup | Text/HTML/TagSoup/Fast.hs | bsd-3-clause | maxNoSemicolonHtmlEntityLength :: Int -- = 6
maxNoSemicolonHtmlEntityLength =
maximum [length e | (e,_) <- htmlEntities, last e /= ';'] | 139 | maxNoSemicolonHtmlEntityLength :: Int
maxNoSemicolonHtmlEntityLength =
maximum [length e | (e,_) <- htmlEntities, last e /= ';'] | 132 | maxNoSemicolonHtmlEntityLength =
maximum [length e | (e,_) <- htmlEntities, last e /= ';'] | 94 | true | true | 0 | 9 | 22 | 46 | 24 | 22 | null | null |
nickbart1980/pandoc | src/Text/Pandoc/Readers/MediaWiki.hs | gpl-2.0 | math :: MWParser Inlines
math = (B.displayMath . trim <$> try (char ':' >> charsInTags "math"))
<|> (B.math . trim <$> charsInTags "math")
<|> (B.displayMath . trim <$> try (dmStart *> manyTill anyChar dmEnd))
<|> (B.math . trim <$> try (mStart *> manyTill (satisfy (/='\n')) mEnd))
where dmStart = string "\\["
dmEnd = try (string "\\]")
mStart = string "\\("
mEnd = try (string "\\)") | 423 | math :: MWParser Inlines
math = (B.displayMath . trim <$> try (char ':' >> charsInTags "math"))
<|> (B.math . trim <$> charsInTags "math")
<|> (B.displayMath . trim <$> try (dmStart *> manyTill anyChar dmEnd))
<|> (B.math . trim <$> try (mStart *> manyTill (satisfy (/='\n')) mEnd))
where dmStart = string "\\["
dmEnd = try (string "\\]")
mStart = string "\\("
mEnd = try (string "\\)") | 423 | math = (B.displayMath . trim <$> try (char ':' >> charsInTags "math"))
<|> (B.math . trim <$> charsInTags "math")
<|> (B.displayMath . trim <$> try (dmStart *> manyTill anyChar dmEnd))
<|> (B.math . trim <$> try (mStart *> manyTill (satisfy (/='\n')) mEnd))
where dmStart = string "\\["
dmEnd = try (string "\\]")
mStart = string "\\("
mEnd = try (string "\\)") | 398 | false | true | 3 | 14 | 101 | 184 | 92 | 92 | null | null |
pparkkin/eta | compiler/ETA/CodeGen/Prim.hs | bsd-3-clause | simpleOp WordGtOp = Just $ unsignedCmp ifgt | 45 | simpleOp WordGtOp = Just $ unsignedCmp ifgt | 45 | simpleOp WordGtOp = Just $ unsignedCmp ifgt | 45 | false | false | 0 | 6 | 8 | 16 | 7 | 9 | null | null |
haasn/colour | Data/Colour/RGB.hs | mit | hue :: (Fractional a, Ord a) => RGB a -> a
hue rgb = h
where
(h,_,_,_,_) = hslsv rgb | 87 | hue :: (Fractional a, Ord a) => RGB a -> a
hue rgb = h
where
(h,_,_,_,_) = hslsv rgb | 87 | hue rgb = h
where
(h,_,_,_,_) = hslsv rgb | 44 | false | true | 0 | 7 | 22 | 63 | 33 | 30 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/simplCore/SetLevels.hs | bsd-3-clause | destLevel :: LevelEnv -> VarSet
-> Bool -- True <=> is function
-> Bool -- True <=> is bottom
-> Level
destLevel env fvs is_function is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| Just n_args <- floatLams env
, n_args > 0 -- n=0 case handled uniformly by the 'otherwise' case
, is_function
, countFreeIds fvs <= n_args
= tOP_LEVEL -- Send functions to top level; see
-- the comments with isFunction
| otherwise = maxFvLevel isId env fvs | 593 | destLevel :: LevelEnv -> VarSet
-> Bool -- True <=> is function
-> Bool -- True <=> is bottom
-> Level
destLevel env fvs is_function is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| Just n_args <- floatLams env
, n_args > 0 -- n=0 case handled uniformly by the 'otherwise' case
, is_function
, countFreeIds fvs <= n_args
= tOP_LEVEL -- Send functions to top level; see
-- the comments with isFunction
| otherwise = maxFvLevel isId env fvs | 593 | destLevel env fvs is_function is_bot
| is_bot = tOP_LEVEL -- Send bottoming bindings to the top
-- regardless; see Note [Bottoming floats]
| Just n_args <- floatLams env
, n_args > 0 -- n=0 case handled uniformly by the 'otherwise' case
, is_function
, countFreeIds fvs <= n_args
= tOP_LEVEL -- Send functions to top level; see
-- the comments with isFunction
| otherwise = maxFvLevel isId env fvs | 456 | false | true | 1 | 9 | 182 | 107 | 54 | 53 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/VertexArrays.hs | bsd-3-clause | --------------------------------------------------------------------------------
normalPointer :: StateVar (VertexArrayDescriptor a)
normalPointer = makeStateVar getNormalPointer setNormalPointer | 196 | normalPointer :: StateVar (VertexArrayDescriptor a)
normalPointer = makeStateVar getNormalPointer setNormalPointer | 114 | normalPointer = makeStateVar getNormalPointer setNormalPointer | 62 | true | true | 0 | 8 | 11 | 32 | 14 | 18 | null | null |
samidarko/algorithms | main.hs | mit | convert :: [Char] -> [Int]
convert "" = [] | 42 | convert :: [Char] -> [Int]
convert "" = [] | 42 | convert "" = [] | 15 | false | true | 0 | 6 | 8 | 26 | 14 | 12 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | tagOf_PrimOp Ctz32Op = _ILIT(71) | 32 | tagOf_PrimOp Ctz32Op = _ILIT(71) | 32 | tagOf_PrimOp Ctz32Op = _ILIT(71) | 32 | false | false | 0 | 6 | 3 | 15 | 7 | 8 | null | null |
unhammer/bytestring-trie-0.2.4 | src/Data/Trie/Internal.hs | bsd-3-clause | showTrie :: (Show a) => Trie a -> String
showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 775 | showTrie :: (Show a) => Trie a -> String
showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 775 | showTrie t = shows' id t ""
where
spaces f = map (const ' ') (f "")
shows' _ Empty = (".\n"++)
shows' ss (Branch p m l r) =
let s' = ("--"++) . shows p . (","++) . shows m . ("-+"++)
ss' = ss . (tail (spaces s') ++)
in s' . shows' (ss' . ("|"++)) l
. ss' . ("|\n"++)
. ss' . ("`"++) . shows' (ss' . (" "++)) r
shows' ss (Arc k mv t') =
let s' = ("--"++) . shows k
. maybe id (\v -> ("-("++) . shows v . (")"++)) mv
. ("--"++)
in s' . shows' (ss . (spaces s' ++)) t'
-- TODO?? a Read instance? hrm... should I?
-- TODO: consider an instance more like the new one for Data.Map. Better? | 734 | false | true | 0 | 18 | 293 | 344 | 183 | 161 | null | null |
Peaker/keyvaluehash | src/System/IO/MMap/Sync.hs | bsd-3-clause | mkMSyncFlag (Just Sync) = 1 | 27 | mkMSyncFlag (Just Sync) = 1 | 27 | mkMSyncFlag (Just Sync) = 1 | 27 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
travitch/hbgl-experimental | src/Data/Graph/MutableDigraph.hs | bsd-3-clause | toAdj :: IntMap b -> [(Vertex, b)]
toAdj = IM.toList | 52 | toAdj :: IntMap b -> [(Vertex, b)]
toAdj = IM.toList | 52 | toAdj = IM.toList | 17 | false | true | 0 | 9 | 9 | 36 | 17 | 19 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/shows_2.hs | mit | psPs :: (List a) -> (List a) -> (List a);
psPs Nil ys = ys | 62 | psPs :: (List a) -> (List a) -> (List a)
psPs Nil ys = ys | 61 | psPs Nil ys = ys | 16 | false | true | 0 | 8 | 18 | 43 | 22 | 21 | null | null |
brendanhay/gogol | gogol-adexchangebuyer2/gen/Network/Google/AdExchangeBuyer2/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'BidMetricsRow' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'bmrBids'
--
-- * 'bmrBidsInAuction'
--
-- * 'bmrImpressionsWon'
--
-- * 'bmrRowDimensions'
--
-- * 'bmrMeasurableImpressions'
--
-- * 'bmrViewableImpressions'
--
-- * 'bmrBilledImpressions'
--
-- * 'bmrReachedQueries'
bidMetricsRow
:: BidMetricsRow
bidMetricsRow =
BidMetricsRow'
{ _bmrBids = Nothing
, _bmrBidsInAuction = Nothing
, _bmrImpressionsWon = Nothing
, _bmrRowDimensions = Nothing
, _bmrMeasurableImpressions = Nothing
, _bmrViewableImpressions = Nothing
, _bmrBilledImpressions = Nothing
, _bmrReachedQueries = Nothing
} | 748 | bidMetricsRow
:: BidMetricsRow
bidMetricsRow =
BidMetricsRow'
{ _bmrBids = Nothing
, _bmrBidsInAuction = Nothing
, _bmrImpressionsWon = Nothing
, _bmrRowDimensions = Nothing
, _bmrMeasurableImpressions = Nothing
, _bmrViewableImpressions = Nothing
, _bmrBilledImpressions = Nothing
, _bmrReachedQueries = Nothing
} | 356 | bidMetricsRow =
BidMetricsRow'
{ _bmrBids = Nothing
, _bmrBidsInAuction = Nothing
, _bmrImpressionsWon = Nothing
, _bmrRowDimensions = Nothing
, _bmrMeasurableImpressions = Nothing
, _bmrViewableImpressions = Nothing
, _bmrBilledImpressions = Nothing
, _bmrReachedQueries = Nothing
} | 321 | true | true | 0 | 7 | 142 | 90 | 60 | 30 | null | null |
michalkonecny/mixed-types-num | src/Numeric/MixedTypes/MinMaxAbs.hs | bsd-3-clause | {-|
HSpec properties that each implementation of CanMinMax should satisfy.
-}
specCanMinMax ::
_ => T t1 -> T t2 -> T t3 -> Spec
specCanMinMax (T typeName1 :: T t1) (T typeName2 :: T t2) (T typeName3 :: T t3) =
describe (printf "CanMinMax %s %s, CanMinMax %s %s" typeName1 typeName2 typeName2 typeName3) $ do
it "`min` is not larger than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `min` y in (m ?<=?$ y) .&&. (m ?<=?$ x)
it "`max` is not smaller than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `max` y in (m ?>=?$ y) .&&. (m ?>=?$ x)
it "has idempotent `min`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `min` x) ?==?$ x
it "has idempotent `max`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `max` x) ?==?$ x
it "has commutative `min`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `min` y) ?==?$ (y `min` x)
it "has commutative `max`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `max` y) ?==?$ (y `max` x)
it "has associative `min`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `min` (y `min` z)) ?==?$ ((x `min` y) `min` z)
it "has associative `max`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `max` (y `max` z)) ?==?$ ((x `max` y) `max` z)
where
(?==?$) :: (HasEqCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?==?$) = printArgsIfFails2 "?==?" (?==?)
(?>=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?>=?$) = printArgsIfFails2 "?>=?" (?>=?)
(?<=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?<=?$) = printArgsIfFails2 "?<=?" (?<=?)
--
{-|
HSpec properties that each implementation of CanMinMax should satisfy.
-} | 2,584 | specCanMinMax ::
_ => T t1 -> T t2 -> T t3 -> Spec
specCanMinMax (T typeName1 :: T t1) (T typeName2 :: T t2) (T typeName3 :: T t3) =
describe (printf "CanMinMax %s %s, CanMinMax %s %s" typeName1 typeName2 typeName2 typeName3) $ do
it "`min` is not larger than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `min` y in (m ?<=?$ y) .&&. (m ?<=?$ x)
it "`max` is not smaller than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `max` y in (m ?>=?$ y) .&&. (m ?>=?$ x)
it "has idempotent `min`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `min` x) ?==?$ x
it "has idempotent `max`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `max` x) ?==?$ x
it "has commutative `min`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `min` y) ?==?$ (y `min` x)
it "has commutative `max`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `max` y) ?==?$ (y `max` x)
it "has associative `min`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `min` (y `min` z)) ?==?$ ((x `min` y) `min` z)
it "has associative `max`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `max` (y `max` z)) ?==?$ ((x `max` y) `max` z)
where
(?==?$) :: (HasEqCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?==?$) = printArgsIfFails2 "?==?" (?==?)
(?>=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?>=?$) = printArgsIfFails2 "?>=?" (?>=?)
(?<=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?<=?$) = printArgsIfFails2 "?<=?" (?<=?)
--
{-|
HSpec properties that each implementation of CanMinMax should satisfy.
-} | 2,503 | specCanMinMax (T typeName1 :: T t1) (T typeName2 :: T t2) (T typeName3 :: T t3) =
describe (printf "CanMinMax %s %s, CanMinMax %s %s" typeName1 typeName2 typeName2 typeName3) $ do
it "`min` is not larger than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `min` y in (m ?<=?$ y) .&&. (m ?<=?$ x)
it "`max` is not smaller than its arguments" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
let m = x `max` y in (m ?>=?$ y) .&&. (m ?>=?$ x)
it "has idempotent `min`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `min` x) ?==?$ x
it "has idempotent `max`" $ do
property $ \ (x :: t1) ->
-- (x ?==? x) ==> -- avoid NaN
(isFinite x) ==>
(x `max` x) ?==?$ x
it "has commutative `min`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `min` y) ?==?$ (y `min` x)
it "has commutative `max`" $ do
property $ \ (x :: t1) (y :: t2) ->
-- (x ?==? x) && (y ?==? y) ==> -- avoid NaN
(isFinite x) && (isFinite y) ==>
(x `max` y) ?==?$ (y `max` x)
it "has associative `min`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `min` (y `min` z)) ?==?$ ((x `min` y) `min` z)
it "has associative `max`" $ do
property $ \ (x :: t1) (y :: t2) (z :: t3) ->
-- (x ?==? x) && (y ?==? y) && (z ?==? z) ==> -- avoid NaN
(isFinite x) && (isFinite y) && (isFinite z) ==>
(x `max` (y `max` z)) ?==?$ ((x `max` y) `max` z)
where
(?==?$) :: (HasEqCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?==?$) = printArgsIfFails2 "?==?" (?==?)
(?>=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?>=?$) = printArgsIfFails2 "?>=?" (?>=?)
(?<=?$) :: (HasOrderCertainlyAsymmetric a b, Show a, Show b) => a -> b -> Property
(?<=?$) = printArgsIfFails2 "?<=?" (?<=?)
--
{-|
HSpec properties that each implementation of CanMinMax should satisfy.
-} | 2,450 | true | true | 45 | 12 | 798 | 886 | 488 | 398 | null | null |
8084/SimpleTableGenerator | src/Text/SimpleTableGenerator.hs | gpl-3.0 | makeCells :: TextTable -> Table
makeCells textTable =
map (\rowStr -> map
(\cellStr -> splitOn "\n" cellStr) rowStr) textTable
where
splitCell :: String -> Cell
splitCell cellStr = splitOn "\n" cellStr | 238 | makeCells :: TextTable -> Table
makeCells textTable =
map (\rowStr -> map
(\cellStr -> splitOn "\n" cellStr) rowStr) textTable
where
splitCell :: String -> Cell
splitCell cellStr = splitOn "\n" cellStr | 238 | makeCells textTable =
map (\rowStr -> map
(\cellStr -> splitOn "\n" cellStr) rowStr) textTable
where
splitCell :: String -> Cell
splitCell cellStr = splitOn "\n" cellStr | 206 | false | true | 0 | 11 | 67 | 87 | 39 | 48 | null | null |
csabahruska/q3demo | src/Q3Demo/Loader/ShaderParser.hs | bsd-3-clause | kw :: ByteString -> Parser ()
kw s = ((\w -> if B.map toLower w == s then return () else fail "") =<< word) <?> B.unpack s | 122 | kw :: ByteString -> Parser ()
kw s = ((\w -> if B.map toLower w == s then return () else fail "") =<< word) <?> B.unpack s | 122 | kw s = ((\w -> if B.map toLower w == s then return () else fail "") =<< word) <?> B.unpack s | 92 | false | true | 0 | 13 | 27 | 77 | 38 | 39 | null | null |
AlexanderPankiv/ghc | compiler/basicTypes/OccName.hs | bsd-3-clause | mkForeignExportOcc = mk_simple_deriv varName "$f" | 51 | mkForeignExportOcc = mk_simple_deriv varName "$f" | 51 | mkForeignExportOcc = mk_simple_deriv varName "$f" | 51 | false | false | 0 | 5 | 6 | 11 | 5 | 6 | null | null |
k16shikano/hpdft | src/PDF/ContentStream.hs | mit | bytesletter :: CMap -> PSParser T.Text
bytesletter cmap = do
txt <- (many1 $ choice [ try $ ')' <$ (string "\\)")
, try $ '(' <$ (string "\\(")
, try $ (chr 10) <$ (string "\\n")
, try $ (chr 13) <$ (string "\\r")
, try $ (chr 8) <$ (string "\\b")
, try $ (chr 9) <$ (string "\\t")
, try $ (chr 12) <$ (string "\\f")
, try $ (chr 92) <$ (string "\\\\")
, try $ (chr 0) <$ (char '\NUL')
, try $ (chr 32) <$ (char ' ')
, try $ chr <$> ((string "\\") *> octnum)
, try $ noneOf ")"
])
return $ byteStringToText cmap txt
where
byteStringToText :: CMap -> String -> T.Text
byteStringToText cmap str = T.concat $ map (toUcs cmap) $ asInt16 $ map ord str
asInt16 :: [Int] -> [Int]
asInt16 [] = []
asInt16 (a:[]) = [a] --error $ "Can not read string "++(show a)
asInt16 (a:b:rest) = (a * 256 + b):(asInt16 rest)
-- for debug
-- myToUcs cmap x = if x == 636 then trace (show cmap) $ toUcs cmap x else toUcs cmap x | 1,243 | bytesletter :: CMap -> PSParser T.Text
bytesletter cmap = do
txt <- (many1 $ choice [ try $ ')' <$ (string "\\)")
, try $ '(' <$ (string "\\(")
, try $ (chr 10) <$ (string "\\n")
, try $ (chr 13) <$ (string "\\r")
, try $ (chr 8) <$ (string "\\b")
, try $ (chr 9) <$ (string "\\t")
, try $ (chr 12) <$ (string "\\f")
, try $ (chr 92) <$ (string "\\\\")
, try $ (chr 0) <$ (char '\NUL')
, try $ (chr 32) <$ (char ' ')
, try $ chr <$> ((string "\\") *> octnum)
, try $ noneOf ")"
])
return $ byteStringToText cmap txt
where
byteStringToText :: CMap -> String -> T.Text
byteStringToText cmap str = T.concat $ map (toUcs cmap) $ asInt16 $ map ord str
asInt16 :: [Int] -> [Int]
asInt16 [] = []
asInt16 (a:[]) = [a] --error $ "Can not read string "++(show a)
asInt16 (a:b:rest) = (a * 256 + b):(asInt16 rest)
-- for debug
-- myToUcs cmap x = if x == 636 then trace (show cmap) $ toUcs cmap x else toUcs cmap x | 1,243 | bytesletter cmap = do
txt <- (many1 $ choice [ try $ ')' <$ (string "\\)")
, try $ '(' <$ (string "\\(")
, try $ (chr 10) <$ (string "\\n")
, try $ (chr 13) <$ (string "\\r")
, try $ (chr 8) <$ (string "\\b")
, try $ (chr 9) <$ (string "\\t")
, try $ (chr 12) <$ (string "\\f")
, try $ (chr 92) <$ (string "\\\\")
, try $ (chr 0) <$ (char '\NUL')
, try $ (chr 32) <$ (char ' ')
, try $ chr <$> ((string "\\") *> octnum)
, try $ noneOf ")"
])
return $ byteStringToText cmap txt
where
byteStringToText :: CMap -> String -> T.Text
byteStringToText cmap str = T.concat $ map (toUcs cmap) $ asInt16 $ map ord str
asInt16 :: [Int] -> [Int]
asInt16 [] = []
asInt16 (a:[]) = [a] --error $ "Can not read string "++(show a)
asInt16 (a:b:rest) = (a * 256 + b):(asInt16 rest)
-- for debug
-- myToUcs cmap x = if x == 636 then trace (show cmap) $ toUcs cmap x else toUcs cmap x | 1,204 | false | true | 4 | 16 | 530 | 451 | 233 | 218 | null | null |
tek/proteome | packages/proteome/lib/Proteome/Files.hs | mit | existingSubdirCount ::
MonadIO m =>
[Text] ->
Path Abs Dir ->
m Int
existingSubdirCount =
loop 0
where
loop count [] _ =
pure count
loop count (h : t) dir =
case parseRelDir (toString h) of
Right f ->
ifM (doesDirExist sub) (loop (count + 1) t sub) (pure count)
where sub = dir </> f
Left _ ->
pure count | 382 | existingSubdirCount ::
MonadIO m =>
[Text] ->
Path Abs Dir ->
m Int
existingSubdirCount =
loop 0
where
loop count [] _ =
pure count
loop count (h : t) dir =
case parseRelDir (toString h) of
Right f ->
ifM (doesDirExist sub) (loop (count + 1) t sub) (pure count)
where sub = dir </> f
Left _ ->
pure count | 382 | existingSubdirCount =
loop 0
where
loop count [] _ =
pure count
loop count (h : t) dir =
case parseRelDir (toString h) of
Right f ->
ifM (doesDirExist sub) (loop (count + 1) t sub) (pure count)
where sub = dir </> f
Left _ ->
pure count | 306 | false | true | 1 | 12 | 139 | 173 | 78 | 95 | null | null |
lexml/lexml-linker | src/main/haskell/LexML/URN/Atalhos.hs | gpl-2.0 | autoridadeSenado = A_Normal [SJ_Instituicao (Instituicao $ Nome ["senado","federal"]) [] Nothing] | 97 | autoridadeSenado = A_Normal [SJ_Instituicao (Instituicao $ Nome ["senado","federal"]) [] Nothing] | 97 | autoridadeSenado = A_Normal [SJ_Instituicao (Instituicao $ Nome ["senado","federal"]) [] Nothing] | 97 | false | false | 1 | 11 | 9 | 41 | 19 | 22 | null | null |
maoe/Haskell-Turtle-Library | src/Turtle/Prelude.hs | bsd-3-clause | fork :: IO a -> Managed (Async a)
fork io = managed (withAsync io) | 66 | fork :: IO a -> Managed (Async a)
fork io = managed (withAsync io) | 66 | fork io = managed (withAsync io) | 32 | false | true | 0 | 8 | 13 | 39 | 18 | 21 | null | null |
green-haskell/ghc | compiler/llvmGen/Llvm/Types.hs | bsd-3-clause | -- | Test if a 'LlvmVar' is global.
isGlobal :: LlvmVar -> Bool
isGlobal (LMGlobalVar _ _ _ _ _ _) = True | 105 | isGlobal :: LlvmVar -> Bool
isGlobal (LMGlobalVar _ _ _ _ _ _) = True | 69 | isGlobal (LMGlobalVar _ _ _ _ _ _) = True | 41 | true | true | 0 | 7 | 22 | 35 | 18 | 17 | null | null |
kazu-yamamoto/wai-app-file-cgi | Network/Wai/Application/Classic/Def.hs | bsd-3-clause | defaultIsHTml :: Path -> Bool
defaultIsHTml file = ".html" `isSuffixOf` file || ".htm" `isSuffixOf` file | 104 | defaultIsHTml :: Path -> Bool
defaultIsHTml file = ".html" `isSuffixOf` file || ".htm" `isSuffixOf` file | 104 | defaultIsHTml file = ".html" `isSuffixOf` file || ".htm" `isSuffixOf` file | 74 | false | true | 0 | 7 | 14 | 34 | 19 | 15 | null | null |
egaburov/funstuff | Haskell/tytag/codes3/IntroHOT.hs | apache-2.0 | -- * partial pattern match in lookp
-- So, we can get stuck if we try to evaluate an open term
ti2o = A (L (V (VS VZ))) (B True) | 128 | ti2o = A (L (V (VS VZ))) (B True) | 33 | ti2o = A (L (V (VS VZ))) (B True) | 33 | true | false | 1 | 11 | 29 | 41 | 19 | 22 | null | null |
spanners/dissertation | dissertation/code/elm-lang.org/server/Editor.hs | mit | bar :: AttributeValue -> Html -> Html
bar id' body = H.div ! A.id id' ! A.class_ "option" $ body | 96 | bar :: AttributeValue -> Html -> Html
bar id' body = H.div ! A.id id' ! A.class_ "option" $ body | 96 | bar id' body = H.div ! A.id id' ! A.class_ "option" $ body | 58 | false | true | 0 | 9 | 19 | 48 | 23 | 25 | null | null |
rueshyna/gogol | gogol-games/gen/Network/Google/Resource/Games/Achievements/Increment.hs | mpl-2.0 | -- | A randomly generated numeric ID for each request specified by the
-- caller. This number is used at the server to ensure that the request is
-- handled correctly across retries.
aiRequestId :: Lens' AchievementsIncrement (Maybe Int64)
aiRequestId
= lens _aiRequestId (\ s a -> s{_aiRequestId = a}) .
mapping _Coerce | 328 | aiRequestId :: Lens' AchievementsIncrement (Maybe Int64)
aiRequestId
= lens _aiRequestId (\ s a -> s{_aiRequestId = a}) .
mapping _Coerce | 145 | aiRequestId
= lens _aiRequestId (\ s a -> s{_aiRequestId = a}) .
mapping _Coerce | 88 | true | true | 1 | 9 | 60 | 61 | 30 | 31 | null | null |
graninas/The-Amoeba-World | src/Amoeba/GameLogic/Language/Translation/Actions.hs | gpl-3.0 | setCells (CellsProperty _ propTokens) = do
log "setCells"
mapM_ setCell propTokens | 90 | setCells (CellsProperty _ propTokens) = do
log "setCells"
mapM_ setCell propTokens | 90 | setCells (CellsProperty _ propTokens) = do
log "setCells"
mapM_ setCell propTokens | 90 | false | false | 0 | 7 | 18 | 31 | 13 | 18 | null | null |
Yuras/plist | src/Text/XML/Plist/PlObject.hs | bsd-3-clause | fromPlArray o = fail $ "not an array: " ++ show o | 49 | fromPlArray o = fail $ "not an array: " ++ show o | 49 | fromPlArray o = fail $ "not an array: " ++ show o | 49 | false | false | 0 | 6 | 11 | 20 | 9 | 11 | null | null |
niluhdea/Zenx-trainer-training | haskell/allone.hs | epl-1.0 | mul 0 b = 0 | 11 | mul 0 b = 0 | 11 | mul 0 b = 0 | 11 | false | false | 1 | 5 | 4 | 14 | 5 | 9 | null | null |
sanjoy/echoes | src/HIR/DeadAssignmentElimination.hs | gpl-3.0 | daeLattice :: DataflowLattice DAEFact
daeLattice = DataflowLattice {
fact_name = "Dead Code Elimination",
fact_bot = S.empty,
fact_join = optimizedUnion
} where
optimizedUnion _ (OldFact old) (NewFact new)
| S.null new = (NoChange, old)
| otherwise = (SomeChange, old `S.union` new) | 300 | daeLattice :: DataflowLattice DAEFact
daeLattice = DataflowLattice {
fact_name = "Dead Code Elimination",
fact_bot = S.empty,
fact_join = optimizedUnion
} where
optimizedUnion _ (OldFact old) (NewFact new)
| S.null new = (NoChange, old)
| otherwise = (SomeChange, old `S.union` new) | 300 | daeLattice = DataflowLattice {
fact_name = "Dead Code Elimination",
fact_bot = S.empty,
fact_join = optimizedUnion
} where
optimizedUnion _ (OldFact old) (NewFact new)
| S.null new = (NoChange, old)
| otherwise = (SomeChange, old `S.union` new) | 262 | false | true | 1 | 9 | 57 | 117 | 58 | 59 | null | null |
input-output-hk/pos-haskell-prototype | auxx/src/Lang/DisplayError.hs | mit | ppEvalError :: EvalError -> Doc
ppEvalError (InvalidArguments name procError) =
"Invalid arguments for" <+> (squotes . highlight . nameToDoc) name `mappend` ":"
<$> indent 2 (ppProcError procError) | 209 | ppEvalError :: EvalError -> Doc
ppEvalError (InvalidArguments name procError) =
"Invalid arguments for" <+> (squotes . highlight . nameToDoc) name `mappend` ":"
<$> indent 2 (ppProcError procError) | 209 | ppEvalError (InvalidArguments name procError) =
"Invalid arguments for" <+> (squotes . highlight . nameToDoc) name `mappend` ":"
<$> indent 2 (ppProcError procError) | 177 | false | true | 4 | 9 | 38 | 74 | 34 | 40 | null | null |
seereason/ghcjs | src/Gen2/Utils.hs | mit | jnull :: JExpr
jnull = ValExpr (JVar $ TxtI "null") | 51 | jnull :: JExpr
jnull = ValExpr (JVar $ TxtI "null") | 51 | jnull = ValExpr (JVar $ TxtI "null") | 36 | false | true | 0 | 8 | 9 | 24 | 12 | 12 | null | null |
JPMoresmau/leksah | src/IDE/Utils/ExternalTool.hs | gpl-2.0 | runExternalTool' :: MonadIDE m
=> Text
-> FilePath
-> [Text]
-> FilePath
-> C.Sink ToolOutput IDEM ()
-> m ()
runExternalTool' description executable args dir handleOutput = do
runExternalTool (do
run <- isRunning
return (not run))
(\_ -> return ())
description
executable
args
dir
handleOutput
return() | 615 | runExternalTool' :: MonadIDE m
=> Text
-> FilePath
-> [Text]
-> FilePath
-> C.Sink ToolOutput IDEM ()
-> m ()
runExternalTool' description executable args dir handleOutput = do
runExternalTool (do
run <- isRunning
return (not run))
(\_ -> return ())
description
executable
args
dir
handleOutput
return() | 615 | runExternalTool' description executable args dir handleOutput = do
runExternalTool (do
run <- isRunning
return (not run))
(\_ -> return ())
description
executable
args
dir
handleOutput
return() | 409 | false | true | 0 | 14 | 357 | 134 | 62 | 72 | null | null |
ghcjs/ghcjs-base | test/Tests/Properties/Numeric.hs | mit | j_decimal_integer_big (Big a) = j_decimal a | 43 | j_decimal_integer_big (Big a) = j_decimal a | 43 | j_decimal_integer_big (Big a) = j_decimal a | 43 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
blender/Rome | src/Data/Romefile.hs | mit | repositoryMapJSONKey :: T.Text
repositoryMapJSONKey = "repositoryMap" | 69 | repositoryMapJSONKey :: T.Text
repositoryMapJSONKey = "repositoryMap" | 69 | repositoryMapJSONKey = "repositoryMap" | 38 | false | true | 0 | 7 | 5 | 20 | 8 | 12 | null | null |
nomeata/ghc | compiler/codeGen/CgPrimOp.hs | bsd-3-clause | emitPrimOp res WriteByteArrayOp_Int16 args _ = doWriteByteArrayOp (Just mo_WordTo16) b16 res args | 102 | emitPrimOp res WriteByteArrayOp_Int16 args _ = doWriteByteArrayOp (Just mo_WordTo16) b16 res args | 102 | emitPrimOp res WriteByteArrayOp_Int16 args _ = doWriteByteArrayOp (Just mo_WordTo16) b16 res args | 102 | false | false | 0 | 7 | 16 | 33 | 14 | 19 | null | null |
bitemyapp/7startups | Backends/XMPP.hs | bsd-3-clause | toNode (PDirection (Neighboring n)) = toNode (PNeighbor n) | 58 | toNode (PDirection (Neighboring n)) = toNode (PNeighbor n) | 58 | toNode (PDirection (Neighboring n)) = toNode (PNeighbor n) | 58 | false | false | 0 | 8 | 7 | 31 | 14 | 17 | null | null |
akru/haste-webaudio | src/Haste/WebAudio/Node.hs | mit | node5 :: (Node t1, Node t2, Node t3, Node t4, Node t5)
=> WebAudio (t1, t2, t3, t4, t5)
node5 = (,,,,) <$> node <*> node <*> node <*> node <*> node | 153 | node5 :: (Node t1, Node t2, Node t3, Node t4, Node t5)
=> WebAudio (t1, t2, t3, t4, t5)
node5 = (,,,,) <$> node <*> node <*> node <*> node <*> node | 153 | node5 = (,,,,) <$> node <*> node <*> node <*> node <*> node | 59 | false | true | 0 | 10 | 37 | 88 | 49 | 39 | null | null |
psibi/yesod | yesod-core/Yesod/Core/Handler.hs | mit | -- | Takes a POST parameter name to lookup a CSRF token. If the value doesn't match the token stored in the session,
-- this function throws a 'PermissionDenied' error.
--
-- @since 1.4.14
checkCsrfParamNamed :: MonadHandler m => Text -> m ()
checkCsrfParamNamed paramName = do
(valid, mParam) <- hasValidCsrfParamNamed' paramName
unless valid (permissionDenied $ csrfErrorMessage [CSRFParam paramName mParam])
-- | Takes a POST parameter name to lookup a CSRF token, and returns whether the value matches the token stored in the session.
--
-- @since 1.4.14 | 563 | checkCsrfParamNamed :: MonadHandler m => Text -> m ()
checkCsrfParamNamed paramName = do
(valid, mParam) <- hasValidCsrfParamNamed' paramName
unless valid (permissionDenied $ csrfErrorMessage [CSRFParam paramName mParam])
-- | Takes a POST parameter name to lookup a CSRF token, and returns whether the value matches the token stored in the session.
--
-- @since 1.4.14 | 374 | checkCsrfParamNamed paramName = do
(valid, mParam) <- hasValidCsrfParamNamed' paramName
unless valid (permissionDenied $ csrfErrorMessage [CSRFParam paramName mParam])
-- | Takes a POST parameter name to lookup a CSRF token, and returns whether the value matches the token stored in the session.
--
-- @since 1.4.14 | 320 | true | true | 0 | 12 | 92 | 79 | 41 | 38 | null | null |
hsyl20/unums | src/Data/Unums/Unum.hs | bsd-3-clause | -- | Negate
unumNegate ::
( u ~ Unum ess fss
, w ~ BackingWord u
, FiniteBits w
, Integral w
, KnownNat fss
, KnownNat ess
) => Unum ess fss -> Unum ess fss
unumNegate u@(Unum w) = case unumSign u of
Positive -> Unum (setBit w (fromIntegral (unumSignOffset u)))
Negative -> Unum (clearBit w (fromIntegral (unumSignOffset u)))
| 355 | unumNegate ::
( u ~ Unum ess fss
, w ~ BackingWord u
, FiniteBits w
, Integral w
, KnownNat fss
, KnownNat ess
) => Unum ess fss -> Unum ess fss
unumNegate u@(Unum w) = case unumSign u of
Positive -> Unum (setBit w (fromIntegral (unumSignOffset u)))
Negative -> Unum (clearBit w (fromIntegral (unumSignOffset u)))
| 343 | unumNegate u@(Unum w) = case unumSign u of
Positive -> Unum (setBit w (fromIntegral (unumSignOffset u)))
Negative -> Unum (clearBit w (fromIntegral (unumSignOffset u)))
| 177 | true | true | 5 | 11 | 90 | 153 | 76 | 77 | null | null |
ransingh/cs194-haskell-course | week-3/golf.hs | mit | deleteAll :: [Integer] -> [Integer]
deleteAll xs = deleters xs
where deleters = foldr (.) id $ map delete [0..9] | 114 | deleteAll :: [Integer] -> [Integer]
deleteAll xs = deleters xs
where deleters = foldr (.) id $ map delete [0..9] | 114 | deleteAll xs = deleters xs
where deleters = foldr (.) id $ map delete [0..9] | 78 | false | true | 3 | 8 | 21 | 66 | 30 | 36 | null | null |
hinneburg/TopicExplorer | creator-server/creator/src/Query/Parser.hs | agpl-3.0 | prefix :: String -> (a -> a) -> Expr.Operator Char () a
prefix name fun = Expr.Prefix (fun <$ string name) | 107 | prefix :: String -> (a -> a) -> Expr.Operator Char () a
prefix name fun = Expr.Prefix (fun <$ string name) | 107 | prefix name fun = Expr.Prefix (fun <$ string name) | 51 | false | true | 0 | 8 | 21 | 61 | 29 | 32 | null | null |
Zigazou/HaMinitel | src/Minitel/UI/TextField.hs | gpl-3.0 | pad l (_:xs) = ' ':pad (l - 1) xs | 33 | pad l (_:xs) = ' ':pad (l - 1) xs | 33 | pad l (_:xs) = ' ':pad (l - 1) xs | 33 | false | false | 0 | 8 | 9 | 35 | 17 | 18 | null | null |
snoyberg/ghc | testsuite/tests/concurrent/prog001/Thread.hs | bsd-3-clause | t2 m (1:0:x) (b:1:0:y) = putMVar m 31 | 37 | t2 m (1:0:x) (b:1:0:y) = putMVar m 31 | 37 | t2 m (1:0:x) (b:1:0:y) = putMVar m 31 | 37 | false | false | 0 | 8 | 7 | 48 | 22 | 26 | null | null |
kmilner/tamarin-prover | lib/theory/src/Theory/Constraint/System.hs | gpl-3.0 | filterRestrictions :: ProofContext -> System -> [LNGuarded] -> [LNGuarded]
filterRestrictions ctxt sys formulas = filter (unifiableNodes) formulas
where
runMaude = (`runReader` L.get pcMaudeHandle ctxt)
-- | 'True' iff there in every solution to the system the two node-ids are
-- instantiated to a different index *in* the trace.
unifiableNodes :: LNGuarded -> Bool
unifiableNodes fm = case fm of
(GAto ato) -> unifiableAtoms {-$ trace ("atom on which bvarToLVar will be applied [ato]: " ++ show ato)-} $ [bvarToLVar ato]
(GDisj fms) -> any unifiableNodes $ getDisj fms
(GConj fms) -> any unifiableNodes $ getConj fms
gg@(GGuarded _ _ _ _) -> case evalFreshAvoiding (openGuarded gg) (L.get sNodes sys) of
Nothing -> error "Bug in filterRestrictions, please report."
Just (_, _, atos, gf) -> (unifiableNodes gf) || (unifiableAtoms atos)
unifiableAtoms :: [Atom (VTerm Name (LVar))] -> Bool
unifiableAtoms [] = False
unifiableAtoms ((Action _ fact):fs) = unifiableFact fact || unifiableAtoms fs
unifiableAtoms (_:fs) = unifiableAtoms fs
unifiableFact :: LNFact -> Bool
unifiableFact fact = mapper fact
mapper fact = any (runMaude . unifiableLNFacts fact) $ concat $ map (L.get rActs . snd) $ M.toList (L.get sNodes sys)
-- | Data type for a trivalent logic used to return whether restrictions on mirrors are valid, invalid or unknown | 1,557 | filterRestrictions :: ProofContext -> System -> [LNGuarded] -> [LNGuarded]
filterRestrictions ctxt sys formulas = filter (unifiableNodes) formulas
where
runMaude = (`runReader` L.get pcMaudeHandle ctxt)
-- | 'True' iff there in every solution to the system the two node-ids are
-- instantiated to a different index *in* the trace.
unifiableNodes :: LNGuarded -> Bool
unifiableNodes fm = case fm of
(GAto ato) -> unifiableAtoms {-$ trace ("atom on which bvarToLVar will be applied [ato]: " ++ show ato)-} $ [bvarToLVar ato]
(GDisj fms) -> any unifiableNodes $ getDisj fms
(GConj fms) -> any unifiableNodes $ getConj fms
gg@(GGuarded _ _ _ _) -> case evalFreshAvoiding (openGuarded gg) (L.get sNodes sys) of
Nothing -> error "Bug in filterRestrictions, please report."
Just (_, _, atos, gf) -> (unifiableNodes gf) || (unifiableAtoms atos)
unifiableAtoms :: [Atom (VTerm Name (LVar))] -> Bool
unifiableAtoms [] = False
unifiableAtoms ((Action _ fact):fs) = unifiableFact fact || unifiableAtoms fs
unifiableAtoms (_:fs) = unifiableAtoms fs
unifiableFact :: LNFact -> Bool
unifiableFact fact = mapper fact
mapper fact = any (runMaude . unifiableLNFacts fact) $ concat $ map (L.get rActs . snd) $ M.toList (L.get sNodes sys)
-- | Data type for a trivalent logic used to return whether restrictions on mirrors are valid, invalid or unknown | 1,557 | filterRestrictions ctxt sys formulas = filter (unifiableNodes) formulas
where
runMaude = (`runReader` L.get pcMaudeHandle ctxt)
-- | 'True' iff there in every solution to the system the two node-ids are
-- instantiated to a different index *in* the trace.
unifiableNodes :: LNGuarded -> Bool
unifiableNodes fm = case fm of
(GAto ato) -> unifiableAtoms {-$ trace ("atom on which bvarToLVar will be applied [ato]: " ++ show ato)-} $ [bvarToLVar ato]
(GDisj fms) -> any unifiableNodes $ getDisj fms
(GConj fms) -> any unifiableNodes $ getConj fms
gg@(GGuarded _ _ _ _) -> case evalFreshAvoiding (openGuarded gg) (L.get sNodes sys) of
Nothing -> error "Bug in filterRestrictions, please report."
Just (_, _, atos, gf) -> (unifiableNodes gf) || (unifiableAtoms atos)
unifiableAtoms :: [Atom (VTerm Name (LVar))] -> Bool
unifiableAtoms [] = False
unifiableAtoms ((Action _ fact):fs) = unifiableFact fact || unifiableAtoms fs
unifiableAtoms (_:fs) = unifiableAtoms fs
unifiableFact :: LNFact -> Bool
unifiableFact fact = mapper fact
mapper fact = any (runMaude . unifiableLNFacts fact) $ concat $ map (L.get rActs . snd) $ M.toList (L.get sNodes sys)
-- | Data type for a trivalent logic used to return whether restrictions on mirrors are valid, invalid or unknown | 1,482 | false | true | 2 | 13 | 431 | 445 | 216 | 229 | null | null |
idris-hackers/idris-java | src/IRTS/CodegenJava.hs | bsd-3-clause | mkCaseBinding :: BlockPostprocessor -> LVar -> Int -> [Name] -> SExp -> CodeGeneration [BlockStmt]
mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 584 | mkCaseBinding :: BlockPostprocessor -> LVar -> Int -> [Name] -> SExp -> CodeGeneration [BlockStmt]
mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 584 | mkCaseBinding pp var stackStart params branchExpression =
mkExp pp (toLetIn var stackStart params branchExpression)
where
toLetIn :: LVar -> Int -> [Name] -> SExp -> SExp
toLetIn var stackStart members start =
foldr
(\ pos inExp -> SLet (Loc (stackStart + pos)) (SProj var pos) inExp)
start
[0.. (length members - 1)]
-----------------------------------------------------------------------
-- Projection (retrieve the n-th field of an object) | 485 | false | true | 0 | 12 | 118 | 171 | 88 | 83 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 2014 = 2013 | 11 | 2014 = 2013 | 11 | 2014 = 2013 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/InspectorFrontendHost.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/InspectorFrontendHost.unbufferedLog Mozilla InspectorFrontendHost.unbufferedLog documentation>
unbufferedLog ::
(MonadDOM m, ToJSString message) =>
InspectorFrontendHost -> message -> m ()
unbufferedLog self message
= liftDOM (void (self ^. jsf "unbufferedLog" [toJSVal message])) | 368 | unbufferedLog ::
(MonadDOM m, ToJSString message) =>
InspectorFrontendHost -> message -> m ()
unbufferedLog self message
= liftDOM (void (self ^. jsf "unbufferedLog" [toJSVal message])) | 217 | unbufferedLog self message
= liftDOM (void (self ^. jsf "unbufferedLog" [toJSVal message])) | 93 | true | true | 0 | 12 | 63 | 77 | 37 | 40 | null | null |
ezyang/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | compare_RDR = varQual_RDR gHC_CLASSES (fsLit "compare") | 68 | compare_RDR = varQual_RDR gHC_CLASSES (fsLit "compare") | 68 | compare_RDR = varQual_RDR gHC_CLASSES (fsLit "compare") | 68 | false | false | 1 | 7 | 18 | 20 | 8 | 12 | null | null |
gbaz/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | infoCommand :: CommandUI InfoFlags
infoCommand = CommandUI {
commandName = "info",
commandSynopsis = "Display detailed information about a particular package.",
commandDescription = Just $ \_ -> wrapText $
"If there is a sandbox in the current directory and "
++ "config:ignore-sandbox is False, use the sandbox package database. "
++ "Otherwise, use the package database specified with --package-db. "
++ "If not specified, use the user package database.\n",
commandNotes = Nothing,
commandUsage = usageAlternatives "info" ["[FLAGS] PACKAGES"],
commandDefaultFlags = defaultInfoFlags,
commandOptions = \_ -> [
optionVerbosity infoVerbosity (\v flags -> flags { infoVerbosity = v })
, option "" ["package-db"]
( "Append the given package database to the list of package"
++ " databases used (to satisfy dependencies and register into)."
++ " May be a specific file, 'global' or 'user'. The initial list"
++ " is ['global'], ['global', 'user'], or ['global', $sandbox],"
++ " depending on context. Use 'clear' to reset the list to empty."
++ " See the user guide for details.")
infoPackageDBs (\v flags -> flags { infoPackageDBs = v })
(reqArg' "DB" readPackageDbList showPackageDbList)
]
} | 1,392 | infoCommand :: CommandUI InfoFlags
infoCommand = CommandUI {
commandName = "info",
commandSynopsis = "Display detailed information about a particular package.",
commandDescription = Just $ \_ -> wrapText $
"If there is a sandbox in the current directory and "
++ "config:ignore-sandbox is False, use the sandbox package database. "
++ "Otherwise, use the package database specified with --package-db. "
++ "If not specified, use the user package database.\n",
commandNotes = Nothing,
commandUsage = usageAlternatives "info" ["[FLAGS] PACKAGES"],
commandDefaultFlags = defaultInfoFlags,
commandOptions = \_ -> [
optionVerbosity infoVerbosity (\v flags -> flags { infoVerbosity = v })
, option "" ["package-db"]
( "Append the given package database to the list of package"
++ " databases used (to satisfy dependencies and register into)."
++ " May be a specific file, 'global' or 'user'. The initial list"
++ " is ['global'], ['global', 'user'], or ['global', $sandbox],"
++ " depending on context. Use 'clear' to reset the list to empty."
++ " See the user guide for details.")
infoPackageDBs (\v flags -> flags { infoPackageDBs = v })
(reqArg' "DB" readPackageDbList showPackageDbList)
]
} | 1,392 | infoCommand = CommandUI {
commandName = "info",
commandSynopsis = "Display detailed information about a particular package.",
commandDescription = Just $ \_ -> wrapText $
"If there is a sandbox in the current directory and "
++ "config:ignore-sandbox is False, use the sandbox package database. "
++ "Otherwise, use the package database specified with --package-db. "
++ "If not specified, use the user package database.\n",
commandNotes = Nothing,
commandUsage = usageAlternatives "info" ["[FLAGS] PACKAGES"],
commandDefaultFlags = defaultInfoFlags,
commandOptions = \_ -> [
optionVerbosity infoVerbosity (\v flags -> flags { infoVerbosity = v })
, option "" ["package-db"]
( "Append the given package database to the list of package"
++ " databases used (to satisfy dependencies and register into)."
++ " May be a specific file, 'global' or 'user'. The initial list"
++ " is ['global'], ['global', 'user'], or ['global', $sandbox],"
++ " depending on context. Use 'clear' to reset the list to empty."
++ " See the user guide for details.")
infoPackageDBs (\v flags -> flags { infoPackageDBs = v })
(reqArg' "DB" readPackageDbList showPackageDbList)
]
} | 1,356 | false | true | 0 | 15 | 382 | 192 | 109 | 83 | null | null |
dkandalov/katas | haskell/p99/src/p9x/p00/P00_.hs | unlicense | combinations :: Int -> [a] -> [[a]]
combinations 0 _ = [ [] ] | 62 | combinations :: Int -> [a] -> [[a]]
combinations 0 _ = [ [] ] | 62 | combinations 0 _ = [ [] ] | 26 | false | true | 0 | 8 | 14 | 38 | 21 | 17 | null | null |
nomeata/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkRtsApFastLabel :: FastString -> CLabel
mkRtsApFastLabel str = RtsLabel (RtsApFast str) | 88 | mkRtsApFastLabel :: FastString -> CLabel
mkRtsApFastLabel str = RtsLabel (RtsApFast str) | 88 | mkRtsApFastLabel str = RtsLabel (RtsApFast str) | 47 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
christiaanb/ghc | compiler/deSugar/Check.hs | bsd-3-clause | construct_matrix :: Pat Id -> [(EqnNo, EquationInfo)] -> ([ExhaustivePat],EqnSet)
construct_matrix con qs =
(map (make_con con) pats,indexs)
where
(pats,indexs) = (check' (remove_first_column con qs))
{-
Here remove first column is more difficult that with literals due to the fact
that constructors can have arguments.
For instance, the matrix
\begin{verbatim}
(: x xs) y
z y
\end{verbatim}
is transformed in:
\begin{verbatim}
x xs y
_ _ y
\end{verbatim}
-} | 482 | construct_matrix :: Pat Id -> [(EqnNo, EquationInfo)] -> ([ExhaustivePat],EqnSet)
construct_matrix con qs =
(map (make_con con) pats,indexs)
where
(pats,indexs) = (check' (remove_first_column con qs))
{-
Here remove first column is more difficult that with literals due to the fact
that constructors can have arguments.
For instance, the matrix
\begin{verbatim}
(: x xs) y
z y
\end{verbatim}
is transformed in:
\begin{verbatim}
x xs y
_ _ y
\end{verbatim}
-} | 482 | construct_matrix con qs =
(map (make_con con) pats,indexs)
where
(pats,indexs) = (check' (remove_first_column con qs))
{-
Here remove first column is more difficult that with literals due to the fact
that constructors can have arguments.
For instance, the matrix
\begin{verbatim}
(: x xs) y
z y
\end{verbatim}
is transformed in:
\begin{verbatim}
x xs y
_ _ y
\end{verbatim}
-} | 400 | false | true | 0 | 8 | 91 | 92 | 50 | 42 | null | null |
mindriot101/pandoc | src/Text/Pandoc/Readers/Docx/Parse.hs | gpl-2.0 | archiveToRelationships :: Archive -> [Relationship]
archiveToRelationships archive =
let relPaths = filter filePathIsRel (filesInArchive archive)
entries = mapMaybe (\f -> findEntryByPath f archive) relPaths
relElems = mapMaybe (parseXMLDoc . UTF8.toStringLazy . fromEntry) entries
rels = mapMaybe relElemToRelationship $ concatMap elChildren relElems
in
rels | 389 | archiveToRelationships :: Archive -> [Relationship]
archiveToRelationships archive =
let relPaths = filter filePathIsRel (filesInArchive archive)
entries = mapMaybe (\f -> findEntryByPath f archive) relPaths
relElems = mapMaybe (parseXMLDoc . UTF8.toStringLazy . fromEntry) entries
rels = mapMaybe relElemToRelationship $ concatMap elChildren relElems
in
rels | 389 | archiveToRelationships archive =
let relPaths = filter filePathIsRel (filesInArchive archive)
entries = mapMaybe (\f -> findEntryByPath f archive) relPaths
relElems = mapMaybe (parseXMLDoc . UTF8.toStringLazy . fromEntry) entries
rels = mapMaybe relElemToRelationship $ concatMap elChildren relElems
in
rels | 337 | false | true | 0 | 13 | 72 | 110 | 54 | 56 | null | null |
bitc/omegagb | src/WordUtil.hs | gpl-2.0 | showHex1 :: Word8 -> String
showHex1 n =
let s = map toUpper (N.showHex n "") in
if n > 0xF then s else '0' : s | 115 | showHex1 :: Word8 -> String
showHex1 n =
let s = map toUpper (N.showHex n "") in
if n > 0xF then s else '0' : s | 115 | showHex1 n =
let s = map toUpper (N.showHex n "") in
if n > 0xF then s else '0' : s | 87 | false | true | 0 | 12 | 30 | 66 | 31 | 35 | null | null |
liamoc/tea-hs | Tea/Input.hs | bsd-3-clause | sdlKey SDL.SDLK_KP2 = KeyPad2 | 38 | sdlKey SDL.SDLK_KP2 = KeyPad2 | 38 | sdlKey SDL.SDLK_KP2 = KeyPad2 | 38 | false | false | 0 | 6 | 12 | 11 | 5 | 6 | null | null |
noteed/rescoyl-checks | Network/Docker/Registry/Checks.hs | bsd-3-clause | checkPushRepositoryTag :: Int -> String -> Repository -> Image -> ByteString -> Test
checkPushRepositoryTag n title r i tag = TestLabel title $ TestCase $
pushRepositoryTag r i tag >>= expectCode n | 199 | checkPushRepositoryTag :: Int -> String -> Repository -> Image -> ByteString -> Test
checkPushRepositoryTag n title r i tag = TestLabel title $ TestCase $
pushRepositoryTag r i tag >>= expectCode n | 199 | checkPushRepositoryTag n title r i tag = TestLabel title $ TestCase $
pushRepositoryTag r i tag >>= expectCode n | 114 | false | true | 0 | 9 | 33 | 68 | 32 | 36 | null | null |
mrhania/haddock | haddock-api/src/Haddock/Backends/Xhtml/Layout.hs | bsd-2-clause | subTable :: Qualification -> [SubDecl] -> Maybe Html
subTable _ [] = Nothing | 76 | subTable :: Qualification -> [SubDecl] -> Maybe Html
subTable _ [] = Nothing | 76 | subTable _ [] = Nothing | 23 | false | true | 0 | 7 | 12 | 32 | 16 | 16 | null | null |
romanb/amazonka | amazonka-s3/gen/Network/AWS/S3/Types.hs | mpl-2.0 | -- | 'NoncurrentVersionTransition' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'nvtNoncurrentDays' @::@ 'Int'
--
-- * 'nvtStorageClass' @::@ 'TransitionStorageClass'
--
noncurrentVersionTransition :: Int -- ^ 'nvtNoncurrentDays'
-> TransitionStorageClass -- ^ 'nvtStorageClass'
-> NoncurrentVersionTransition
noncurrentVersionTransition p1 p2 = NoncurrentVersionTransition
{ _nvtNoncurrentDays = p1
, _nvtStorageClass = p2
} | 533 | noncurrentVersionTransition :: Int -- ^ 'nvtNoncurrentDays'
-> TransitionStorageClass -- ^ 'nvtStorageClass'
-> NoncurrentVersionTransition
noncurrentVersionTransition p1 p2 = NoncurrentVersionTransition
{ _nvtNoncurrentDays = p1
, _nvtStorageClass = p2
} | 325 | noncurrentVersionTransition p1 p2 = NoncurrentVersionTransition
{ _nvtNoncurrentDays = p1
, _nvtStorageClass = p2
} | 129 | true | true | 0 | 6 | 122 | 48 | 31 | 17 | null | null |
Lythimus/lptv | sites/all/modules/jgm-pandoc-8be6cc2/src/Text/Pandoc/Readers/RST.hs | gpl-2.0 | hyphens :: GenParser Char ParserState Inline
hyphens = do
result <- many1 (char '-')
option Space endline
-- don't want to treat endline after hyphen or dash as a space
return $ Str result | 197 | hyphens :: GenParser Char ParserState Inline
hyphens = do
result <- many1 (char '-')
option Space endline
-- don't want to treat endline after hyphen or dash as a space
return $ Str result | 197 | hyphens = do
result <- many1 (char '-')
option Space endline
-- don't want to treat endline after hyphen or dash as a space
return $ Str result | 152 | false | true | 0 | 10 | 42 | 53 | 24 | 29 | null | null |
paulsamways/hs-scheme | src/Scheme.hs | bsd-3-clause | parseQuoted :: Parser LispValue
parseQuoted = do
_ <- char '\''
x <- parseExpr
return $ LispList [LispAtom "quote", x] | 124 | parseQuoted :: Parser LispValue
parseQuoted = do
_ <- char '\''
x <- parseExpr
return $ LispList [LispAtom "quote", x] | 124 | parseQuoted = do
_ <- char '\''
x <- parseExpr
return $ LispList [LispAtom "quote", x] | 92 | false | true | 1 | 11 | 25 | 54 | 23 | 31 | null | null |
databrary/databrary | src/Model/Volume/SQL.hs | agpl-3.0 | makeVolume
:: ([VolumeOwner] -> VolumeRolePolicy -> a)
-> Maybe [Maybe T.Text]
-> VolumeRolePolicy
-> a
makeVolume vol own rolePolicy =
vol
(maybe [] (map (parseOwner . fromMaybe (error "NULL volume.owner"))) own)
rolePolicy | 242 | makeVolume
:: ([VolumeOwner] -> VolumeRolePolicy -> a)
-> Maybe [Maybe T.Text]
-> VolumeRolePolicy
-> a
makeVolume vol own rolePolicy =
vol
(maybe [] (map (parseOwner . fromMaybe (error "NULL volume.owner"))) own)
rolePolicy | 242 | makeVolume vol own rolePolicy =
vol
(maybe [] (map (parseOwner . fromMaybe (error "NULL volume.owner"))) own)
rolePolicy | 130 | false | true | 0 | 13 | 49 | 101 | 48 | 53 | null | null |
tmcgilchrist/scheme | src/Scheme/RTS.hs | bsd-3-clause | apply (IOFunc func) args = func args | 36 | apply (IOFunc func) args = func args | 36 | apply (IOFunc func) args = func args | 36 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
saep/repo-based-blog | test-suite/Web/RBB/Crawler/MetaParserSpec.hs | bsd-3-clause | spec :: Spec
spec = parallel $ do
let ptest :: Parser a -> String -> Either ParseError a
ptest p = parse p "MetaSpec"
describe "pSpaceDelimitedElement" $ do
let p = ptest pSpaceDelimitedElement
it "should parse a spaceless string" $ do
p "foo" `shouldBe` Right (TagReplace, "foo")
p "-foo" `shouldBe` Right (TagRemove, "foo")
p "+foo" `shouldBe` Right (TagAdd, "foo")
it "should fail on a space at the beginning" $ do
p " bar" `shouldSatisfy` isLeft
it "should parse a double quoted element" $ do
p "\"foo\"" `shouldBe` Right (TagReplace, "foo")
p "-\"foo\"" `shouldBe` Right (TagRemove, "foo")
p "+\"foo\"" `shouldBe` Right (TagAdd, "foo")
p "\"foo bar quz\"" `shouldBe` Right (TagReplace, "foo bar quz")
p "-\"foo bar quz\"" `shouldBe` Right (TagRemove, "foo bar quz")
p "+\"foo bar quz\"" `shouldBe` Right (TagAdd, "foo bar quz")
it "should parse a single quoted element" $ do
p "'foo'" `shouldBe` Right (TagReplace, "foo")
p "-'foo'" `shouldBe` Right (TagRemove, "foo")
p "+'foo'" `shouldBe` Right (TagAdd, "foo")
p "'foo bar quz'" `shouldBe` Right (TagReplace, "foo bar quz")
p "-'foo bar quz'" `shouldBe` Right (TagRemove, "foo bar quz")
p "+'foo bar quz'" `shouldBe` Right (TagAdd, "foo bar quz")
let cmp = compare `on` snd
complexCase = sortBy cmp [ (TagAdd, "'bar mit'zwa")
, (TagReplace, "foo")
, (TagRemove, "quz'")
]
describe "pSpaceElements" $ do
let p = ptest pSpaceElements
it "should parse simple elements correctly" $ do
p "foo -bar +quz"
`shouldBe` Right [(TagReplace, "foo"), (TagRemove, "bar"),(TagAdd, "quz")]
it "should parse a mixture of different elements" $ do
let perms = permutations ["foo", "+\"'bar mit'zwa\"", "-\'quz'\'"]
intercalations = [" ", " ", " \n \n \n"]
forM_ perms $ \perm -> forM intercalations $ \ic ->
case (p . intercalate ic) perm of
Right xs -> sortBy cmp xs `shouldBe` complexCase
Left err -> error $ show err
describe "parseMeta" $ do
context "tags with a complex result case" $ do
let complexCase' = Right [Tags complexCase]
it "should parse the case without newlines" $ do
parseMeta "taG:+\"'bar mit'zwa\" foo -quz'"
`shouldBe` complexCase'
context "title" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Title "foo bar quz"]
parseMeta "tiTLE: foo bar quz" `shouldBe` result
parseMeta "titLe : foo bar quz" `shouldBe` result
parseMeta "title: foo bar quz" `shouldBe` result
parseMeta "titlE :foo bar quz" `shouldBe` result
parseMeta "Title:foo bar quz" `shouldBe` result
parseMeta "TItlE:foo\nbar\nquz\n\n" `shouldBe` result
context "context" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Context "foo bar quz"]
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context : foo bar quz" `shouldBe` result
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context :foo bar quz" `shouldBe` result
parseMeta "context:foo bar quz" `shouldBe` result
parseMeta "context:foo\nbar\nquz\n\n" `shouldBe` result
context "regression test" $ do
it "should handle the regression case" $ do
let str = concat
[ "abc def g h i jklmnop \n\n"
, "qrstuv wxyz\n\n"
, "Title: some things came up\n\n"
, "Tags: a b c d"
]
result = Right [ None
, None
, Title "some things came up"
, Tags [ (TagReplace, "a")
, (TagReplace, "b")
, (TagReplace, "c")
, (TagReplace, "d")
]
]
parseMeta str `shouldBe` result | 4,699 | spec :: Spec
spec = parallel $ do
let ptest :: Parser a -> String -> Either ParseError a
ptest p = parse p "MetaSpec"
describe "pSpaceDelimitedElement" $ do
let p = ptest pSpaceDelimitedElement
it "should parse a spaceless string" $ do
p "foo" `shouldBe` Right (TagReplace, "foo")
p "-foo" `shouldBe` Right (TagRemove, "foo")
p "+foo" `shouldBe` Right (TagAdd, "foo")
it "should fail on a space at the beginning" $ do
p " bar" `shouldSatisfy` isLeft
it "should parse a double quoted element" $ do
p "\"foo\"" `shouldBe` Right (TagReplace, "foo")
p "-\"foo\"" `shouldBe` Right (TagRemove, "foo")
p "+\"foo\"" `shouldBe` Right (TagAdd, "foo")
p "\"foo bar quz\"" `shouldBe` Right (TagReplace, "foo bar quz")
p "-\"foo bar quz\"" `shouldBe` Right (TagRemove, "foo bar quz")
p "+\"foo bar quz\"" `shouldBe` Right (TagAdd, "foo bar quz")
it "should parse a single quoted element" $ do
p "'foo'" `shouldBe` Right (TagReplace, "foo")
p "-'foo'" `shouldBe` Right (TagRemove, "foo")
p "+'foo'" `shouldBe` Right (TagAdd, "foo")
p "'foo bar quz'" `shouldBe` Right (TagReplace, "foo bar quz")
p "-'foo bar quz'" `shouldBe` Right (TagRemove, "foo bar quz")
p "+'foo bar quz'" `shouldBe` Right (TagAdd, "foo bar quz")
let cmp = compare `on` snd
complexCase = sortBy cmp [ (TagAdd, "'bar mit'zwa")
, (TagReplace, "foo")
, (TagRemove, "quz'")
]
describe "pSpaceElements" $ do
let p = ptest pSpaceElements
it "should parse simple elements correctly" $ do
p "foo -bar +quz"
`shouldBe` Right [(TagReplace, "foo"), (TagRemove, "bar"),(TagAdd, "quz")]
it "should parse a mixture of different elements" $ do
let perms = permutations ["foo", "+\"'bar mit'zwa\"", "-\'quz'\'"]
intercalations = [" ", " ", " \n \n \n"]
forM_ perms $ \perm -> forM intercalations $ \ic ->
case (p . intercalate ic) perm of
Right xs -> sortBy cmp xs `shouldBe` complexCase
Left err -> error $ show err
describe "parseMeta" $ do
context "tags with a complex result case" $ do
let complexCase' = Right [Tags complexCase]
it "should parse the case without newlines" $ do
parseMeta "taG:+\"'bar mit'zwa\" foo -quz'"
`shouldBe` complexCase'
context "title" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Title "foo bar quz"]
parseMeta "tiTLE: foo bar quz" `shouldBe` result
parseMeta "titLe : foo bar quz" `shouldBe` result
parseMeta "title: foo bar quz" `shouldBe` result
parseMeta "titlE :foo bar quz" `shouldBe` result
parseMeta "Title:foo bar quz" `shouldBe` result
parseMeta "TItlE:foo\nbar\nquz\n\n" `shouldBe` result
context "context" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Context "foo bar quz"]
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context : foo bar quz" `shouldBe` result
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context :foo bar quz" `shouldBe` result
parseMeta "context:foo bar quz" `shouldBe` result
parseMeta "context:foo\nbar\nquz\n\n" `shouldBe` result
context "regression test" $ do
it "should handle the regression case" $ do
let str = concat
[ "abc def g h i jklmnop \n\n"
, "qrstuv wxyz\n\n"
, "Title: some things came up\n\n"
, "Tags: a b c d"
]
result = Right [ None
, None
, Title "some things came up"
, Tags [ (TagReplace, "a")
, (TagReplace, "b")
, (TagReplace, "c")
, (TagReplace, "d")
]
]
parseMeta str `shouldBe` result | 4,699 | spec = parallel $ do
let ptest :: Parser a -> String -> Either ParseError a
ptest p = parse p "MetaSpec"
describe "pSpaceDelimitedElement" $ do
let p = ptest pSpaceDelimitedElement
it "should parse a spaceless string" $ do
p "foo" `shouldBe` Right (TagReplace, "foo")
p "-foo" `shouldBe` Right (TagRemove, "foo")
p "+foo" `shouldBe` Right (TagAdd, "foo")
it "should fail on a space at the beginning" $ do
p " bar" `shouldSatisfy` isLeft
it "should parse a double quoted element" $ do
p "\"foo\"" `shouldBe` Right (TagReplace, "foo")
p "-\"foo\"" `shouldBe` Right (TagRemove, "foo")
p "+\"foo\"" `shouldBe` Right (TagAdd, "foo")
p "\"foo bar quz\"" `shouldBe` Right (TagReplace, "foo bar quz")
p "-\"foo bar quz\"" `shouldBe` Right (TagRemove, "foo bar quz")
p "+\"foo bar quz\"" `shouldBe` Right (TagAdd, "foo bar quz")
it "should parse a single quoted element" $ do
p "'foo'" `shouldBe` Right (TagReplace, "foo")
p "-'foo'" `shouldBe` Right (TagRemove, "foo")
p "+'foo'" `shouldBe` Right (TagAdd, "foo")
p "'foo bar quz'" `shouldBe` Right (TagReplace, "foo bar quz")
p "-'foo bar quz'" `shouldBe` Right (TagRemove, "foo bar quz")
p "+'foo bar quz'" `shouldBe` Right (TagAdd, "foo bar quz")
let cmp = compare `on` snd
complexCase = sortBy cmp [ (TagAdd, "'bar mit'zwa")
, (TagReplace, "foo")
, (TagRemove, "quz'")
]
describe "pSpaceElements" $ do
let p = ptest pSpaceElements
it "should parse simple elements correctly" $ do
p "foo -bar +quz"
`shouldBe` Right [(TagReplace, "foo"), (TagRemove, "bar"),(TagAdd, "quz")]
it "should parse a mixture of different elements" $ do
let perms = permutations ["foo", "+\"'bar mit'zwa\"", "-\'quz'\'"]
intercalations = [" ", " ", " \n \n \n"]
forM_ perms $ \perm -> forM intercalations $ \ic ->
case (p . intercalate ic) perm of
Right xs -> sortBy cmp xs `shouldBe` complexCase
Left err -> error $ show err
describe "parseMeta" $ do
context "tags with a complex result case" $ do
let complexCase' = Right [Tags complexCase]
it "should parse the case without newlines" $ do
parseMeta "taG:+\"'bar mit'zwa\" foo -quz'"
`shouldBe` complexCase'
context "title" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Title "foo bar quz"]
parseMeta "tiTLE: foo bar quz" `shouldBe` result
parseMeta "titLe : foo bar quz" `shouldBe` result
parseMeta "title: foo bar quz" `shouldBe` result
parseMeta "titlE :foo bar quz" `shouldBe` result
parseMeta "Title:foo bar quz" `shouldBe` result
parseMeta "TItlE:foo\nbar\nquz\n\n" `shouldBe` result
context "context" $ do
it "should handle an eof terminated single line case" $ do
let result = Right [Context "foo bar quz"]
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context : foo bar quz" `shouldBe` result
parseMeta "context: foo bar quz" `shouldBe` result
parseMeta "context :foo bar quz" `shouldBe` result
parseMeta "context:foo bar quz" `shouldBe` result
parseMeta "context:foo\nbar\nquz\n\n" `shouldBe` result
context "regression test" $ do
it "should handle the regression case" $ do
let str = concat
[ "abc def g h i jklmnop \n\n"
, "qrstuv wxyz\n\n"
, "Title: some things came up\n\n"
, "Tags: a b c d"
]
result = Right [ None
, None
, Title "some things came up"
, Tags [ (TagReplace, "a")
, (TagReplace, "b")
, (TagReplace, "c")
, (TagReplace, "d")
]
]
parseMeta str `shouldBe` result | 4,686 | false | true | 0 | 38 | 1,903 | 1,096 | 547 | 549 | null | null |
AdamHarries/yggdrasil | spare/spareCode.hs | mit | groupUp :: (a -> Bool) -> [a] -> [[a]]
groupUp _ [] = [] | 56 | groupUp :: (a -> Bool) -> [a] -> [[a]]
groupUp _ [] = [] | 56 | groupUp _ [] = [] | 17 | false | true | 0 | 8 | 13 | 44 | 24 | 20 | null | null |
bfraikin/netpbm | src/Data/PNM.hs | gpl-2.0 | toRGB :: [Int] -> [Color]
toRGB (r:g:b:others) = (RGB r g b) : toRGB others | 75 | toRGB :: [Int] -> [Color]
toRGB (r:g:b:others) = (RGB r g b) : toRGB others | 75 | toRGB (r:g:b:others) = (RGB r g b) : toRGB others | 49 | false | true | 0 | 9 | 14 | 56 | 29 | 27 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/List.hs | mit | deListInstDecl (InsType l type1 type2) = InsType (id l) (deListType type1) (deListType type2) | 93 | deListInstDecl (InsType l type1 type2) = InsType (id l) (deListType type1) (deListType type2) | 93 | deListInstDecl (InsType l type1 type2) = InsType (id l) (deListType type1) (deListType type2) | 93 | false | false | 0 | 7 | 12 | 44 | 21 | 23 | null | null |
Teaspot-Studio/Urho3D-Haskell | src/Graphics/Urho3D/Graphics/Camera.hs | mit | cameraGetViewSpaceFrustum :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child
-> m Frustum
cameraGetViewSpaceFrustum p = liftIO $ alloca $ \frp -> do
let ptr = parentPointer p
[C.exp| void {*$(Frustum* frp) = $(Camera* ptr)->GetViewSpaceFrustum()} |]
peek frp
-- | Return split frustum in view space.
-- Frustum GetViewSpaceSplitFrustum(float nearClip, float farClip) const; | 410 | cameraGetViewSpaceFrustum :: (Parent Camera a, Pointer p a, MonadIO m) => p -- ^ Camera pointer or child
-> m Frustum
cameraGetViewSpaceFrustum p = liftIO $ alloca $ \frp -> do
let ptr = parentPointer p
[C.exp| void {*$(Frustum* frp) = $(Camera* ptr)->GetViewSpaceFrustum()} |]
peek frp
-- | Return split frustum in view space.
-- Frustum GetViewSpaceSplitFrustum(float nearClip, float farClip) const; | 410 | cameraGetViewSpaceFrustum p = liftIO $ alloca $ \frp -> do
let ptr = parentPointer p
[C.exp| void {*$(Frustum* frp) = $(Camera* ptr)->GetViewSpaceFrustum()} |]
peek frp
-- | Return split frustum in view space.
-- Frustum GetViewSpaceSplitFrustum(float nearClip, float farClip) const; | 290 | false | true | 0 | 13 | 69 | 94 | 47 | 47 | null | null |
BJTerry/matfile | Data/MatFile.hs | bsd-3-clause | promoteToDouble dataType = MiDouble $ promoteFloat dataType | 59 | promoteToDouble dataType = MiDouble $ promoteFloat dataType | 59 | promoteToDouble dataType = MiDouble $ promoteFloat dataType | 59 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F03.hs | bsd-3-clause | -- glColorFragmentOp1ATI -------------------------------------------------------
glColorFragmentOp1ATI
:: MonadIO m
=> GLenum -- ^ @op@ of type [FragmentOpATI](Graphics-GL-Groups.html#FragmentOpATI).
-> GLuint -- ^ @dst@.
-> GLuint -- ^ @dstMask@.
-> GLuint -- ^ @dstMod@.
-> GLuint -- ^ @arg1@.
-> GLuint -- ^ @arg1Rep@.
-> GLuint -- ^ @arg1Mod@.
-> m ()
glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn127 ptr_glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 | 482 | glColorFragmentOp1ATI
:: MonadIO m
=> GLenum -- ^ @op@ of type [FragmentOpATI](Graphics-GL-Groups.html#FragmentOpATI).
-> GLuint -- ^ @dst@.
-> GLuint -- ^ @dstMask@.
-> GLuint -- ^ @dstMod@.
-> GLuint -- ^ @arg1@.
-> GLuint -- ^ @arg1Rep@.
-> GLuint -- ^ @arg1Mod@.
-> m ()
glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn127 ptr_glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 | 400 | glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 = liftIO $ dyn127 ptr_glColorFragmentOp1ATI v1 v2 v3 v4 v5 v6 v7 | 107 | true | true | 0 | 15 | 86 | 99 | 51 | 48 | null | null |
wavewave/qft | old/lib/Data/Enumerated/SeqZipper.hs | gpl-3.0 | current :: NSeqZipper' m n a -> a
current (NSZ x _ _) = x | 58 | current :: NSeqZipper' m n a -> a
current (NSZ x _ _) = x | 57 | current (NSZ x _ _) = x | 23 | false | true | 0 | 9 | 15 | 41 | 18 | 23 | null | null |
ony/Yampa-core | tests/AFRPTestsDelay.hs | bsd-3-clause | delay_t4r =
[ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -- 0.0 s -- 0.9 s
-1, 0, 1, 2, 3, 4, -- 1.0 s -- 1.5 s
9, 14, 15, 15, 15, 15, -- 2.0 s -- 2.9 s
15, 16, 16, 16, 16, 16, 17, 18, 19, 20, -- 3.0 s -- 3.9 s
21, -- 4.0 s
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -- 6.0 s -- 6.9 s
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -- 7.0 s -- 7.9 s
42 -- 8.0 s
] | 432 | delay_t4r =
[ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -- 0.0 s -- 0.9 s
-1, 0, 1, 2, 3, 4, -- 1.0 s -- 1.5 s
9, 14, 15, 15, 15, 15, -- 2.0 s -- 2.9 s
15, 16, 16, 16, 16, 16, 17, 18, 19, 20, -- 3.0 s -- 3.9 s
21, -- 4.0 s
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -- 6.0 s -- 6.9 s
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -- 7.0 s -- 7.9 s
42 -- 8.0 s
] | 432 | delay_t4r =
[ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -- 0.0 s -- 0.9 s
-1, 0, 1, 2, 3, 4, -- 1.0 s -- 1.5 s
9, 14, 15, 15, 15, 15, -- 2.0 s -- 2.9 s
15, 16, 16, 16, 16, 16, 17, 18, 19, 20, -- 3.0 s -- 3.9 s
21, -- 4.0 s
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, -- 6.0 s -- 6.9 s
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, -- 7.0 s -- 7.9 s
42 -- 8.0 s
] | 432 | false | false | 0 | 6 | 181 | 198 | 130 | 68 | null | null |
a143753/AOJ | 0073.hs | apache-2.0 | ans (x:h:xs) =
((calc x h):(ans xs)) | 38 | ans (x:h:xs) =
((calc x h):(ans xs)) | 38 | ans (x:h:xs) =
((calc x h):(ans xs)) | 38 | false | false | 0 | 8 | 8 | 41 | 21 | 20 | null | null |
brendanhay/gogol | gogol-analytics/gen/Network/Google/Resource/Analytics/UserDeletion/UserDeletionRequest/Upsert.hs | mpl-2.0 | -- | Multipart request metadata.
ududruPayload :: Lens' UserDeletionUserDeletionRequestUpsert UserDeletionRequest
ududruPayload
= lens _ududruPayload
(\ s a -> s{_ududruPayload = a}) | 190 | ududruPayload :: Lens' UserDeletionUserDeletionRequestUpsert UserDeletionRequest
ududruPayload
= lens _ududruPayload
(\ s a -> s{_ududruPayload = a}) | 157 | ududruPayload
= lens _ududruPayload
(\ s a -> s{_ududruPayload = a}) | 76 | true | true | 1 | 9 | 28 | 46 | 22 | 24 | null | null |
tanakh/optparse-declarative | src/Options/Declarative.hs | mit | -- runner
run' :: IsCmd c => c -> [String] -> Maybe String -> [String] -> IO ()
run' cmd name mbver args = do
let optDescr =
getOptDescr cmd
++ [ Option "?" ["help"] (NoArg ("help", "t")) "display this help and exit" ]
++ [ Option "V" ["version"] (NoArg ("version", "t")) "output version information and exit"
| isJust mbver ]
++ [ Option "v" ["verbose"] (OptArg (\arg -> ("verbose", fromMaybe "" arg)) "n") "set verbosity level" ]
prog = unwords name
verMsg = prog ++ maybe "" (" version " ++) mbver
header = "Usage: " ++ prog ++ " [OPTION...]" ++ getUsageHeader cmd prog ++ "\n" ++
" " ++ getCmdHelp cmd ++ "\n\n" ++
"Options:"
usage =
usageInfo header optDescr ++
getUsageFooter cmd prog
case getOpt' RequireOrder optDescr args of
(options, nonOptions, unrecognized, errors)
| not $ null errors ->
errorExit name $ intercalate ", " errors
| isJust (lookup "help" options) -> do
putStr usage
exitSuccess
| isJust (lookup "version" options) -> do
putStrLn verMsg
exitSuccess
| otherwise ->
runCmd cmd name mbver options nonOptions unrecognized
-- | Run a command with specifying program name and version | 1,450 | run' :: IsCmd c => c -> [String] -> Maybe String -> [String] -> IO ()
run' cmd name mbver args = do
let optDescr =
getOptDescr cmd
++ [ Option "?" ["help"] (NoArg ("help", "t")) "display this help and exit" ]
++ [ Option "V" ["version"] (NoArg ("version", "t")) "output version information and exit"
| isJust mbver ]
++ [ Option "v" ["verbose"] (OptArg (\arg -> ("verbose", fromMaybe "" arg)) "n") "set verbosity level" ]
prog = unwords name
verMsg = prog ++ maybe "" (" version " ++) mbver
header = "Usage: " ++ prog ++ " [OPTION...]" ++ getUsageHeader cmd prog ++ "\n" ++
" " ++ getCmdHelp cmd ++ "\n\n" ++
"Options:"
usage =
usageInfo header optDescr ++
getUsageFooter cmd prog
case getOpt' RequireOrder optDescr args of
(options, nonOptions, unrecognized, errors)
| not $ null errors ->
errorExit name $ intercalate ", " errors
| isJust (lookup "help" options) -> do
putStr usage
exitSuccess
| isJust (lookup "version" options) -> do
putStrLn verMsg
exitSuccess
| otherwise ->
runCmd cmd name mbver options nonOptions unrecognized
-- | Run a command with specifying program name and version | 1,439 | run' cmd name mbver args = do
let optDescr =
getOptDescr cmd
++ [ Option "?" ["help"] (NoArg ("help", "t")) "display this help and exit" ]
++ [ Option "V" ["version"] (NoArg ("version", "t")) "output version information and exit"
| isJust mbver ]
++ [ Option "v" ["verbose"] (OptArg (\arg -> ("verbose", fromMaybe "" arg)) "n") "set verbosity level" ]
prog = unwords name
verMsg = prog ++ maybe "" (" version " ++) mbver
header = "Usage: " ++ prog ++ " [OPTION...]" ++ getUsageHeader cmd prog ++ "\n" ++
" " ++ getCmdHelp cmd ++ "\n\n" ++
"Options:"
usage =
usageInfo header optDescr ++
getUsageFooter cmd prog
case getOpt' RequireOrder optDescr args of
(options, nonOptions, unrecognized, errors)
| not $ null errors ->
errorExit name $ intercalate ", " errors
| isJust (lookup "help" options) -> do
putStr usage
exitSuccess
| isJust (lookup "version" options) -> do
putStrLn verMsg
exitSuccess
| otherwise ->
runCmd cmd name mbver options nonOptions unrecognized
-- | Run a command with specifying program name and version | 1,369 | true | true | 0 | 19 | 536 | 420 | 205 | 215 | null | null |
andrey013/mynd | src/Reactive/Banana/GLFW.hs | mit | keyCallback _ fr key False = fr key | 36 | keyCallback _ fr key False = fr key | 36 | keyCallback _ fr key False = fr key | 36 | false | false | 0 | 5 | 8 | 18 | 8 | 10 | null | null |
rdtaylor/CelestialBodies | Entities.hs | mit | updateAsteroids :: [Asteroid] -> [Asteroid]
updateAsteroids asteroids =
map updateAsteroid $ filter filterDeadAsteroids asteroids | 131 | updateAsteroids :: [Asteroid] -> [Asteroid]
updateAsteroids asteroids =
map updateAsteroid $ filter filterDeadAsteroids asteroids | 131 | updateAsteroids asteroids =
map updateAsteroid $ filter filterDeadAsteroids asteroids | 87 | false | true | 0 | 6 | 15 | 36 | 18 | 18 | null | null |
Fermat/Gottlob | Language/Syntax.hs | bsd-3-clause | fVar (App f1 f2) = S.empty | 26 | fVar (App f1 f2) = S.empty | 26 | fVar (App f1 f2) = S.empty | 26 | false | false | 0 | 7 | 5 | 19 | 9 | 10 | null | null |
nakaji-dayo/persistent | persistent-sqlite/Database/Persist/Sqlite.hs | mit | escape :: DBName -> Text
escape (DBName s) =
T.concat [q, T.concatMap go s, q]
where
q = T.singleton '"'
go '"' = "\"\""
go c = T.singleton c
-- | Information required to connect to a sqlite database | 218 | escape :: DBName -> Text
escape (DBName s) =
T.concat [q, T.concatMap go s, q]
where
q = T.singleton '"'
go '"' = "\"\""
go c = T.singleton c
-- | Information required to connect to a sqlite database | 218 | escape (DBName s) =
T.concat [q, T.concatMap go s, q]
where
q = T.singleton '"'
go '"' = "\"\""
go c = T.singleton c
-- | Information required to connect to a sqlite database | 193 | false | true | 0 | 8 | 57 | 80 | 40 | 40 | null | null |
SumAll/haskell-eureka-monitor | src/Site.hs | apache-2.0 | stage = "http://ec2-174-129-8-246.compute-1.amazonaws.com:8080/eureka/v2/apps" | 78 | stage = "http://ec2-174-129-8-246.compute-1.amazonaws.com:8080/eureka/v2/apps" | 78 | stage = "http://ec2-174-129-8-246.compute-1.amazonaws.com:8080/eureka/v2/apps" | 78 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
mattias-lundell/timber-llvm | src/Scp.hs | bsd-3-clause | value (EVar _) = False | 22 | value (EVar _) = False | 22 | value (EVar _) = False | 22 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
spell-music/temporal-music-notation-demo | src/Temporal/Music/Demo/GeneralMidi.hs | bsd-3-clause | pad3Polysynth = instr 90 | 24 | pad3Polysynth = instr 90 | 24 | pad3Polysynth = instr 90 | 24 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
abakst/liquidhaskell | benchmarks/hmatrix-0.15.0.1/examples/ode.hs | bsd-3-clause | vanderpol mu = do
let xdot mu t [x,v] = [v, -x + mu * v * (1-x^2)]
ts = linspace 1000 (0,50)
sol = toColumns $ odeSolve (xdot mu) [1,0] ts
mplot (ts : sol)
mplot sol | 193 | vanderpol mu = do
let xdot mu t [x,v] = [v, -x + mu * v * (1-x^2)]
ts = linspace 1000 (0,50)
sol = toColumns $ odeSolve (xdot mu) [1,0] ts
mplot (ts : sol)
mplot sol | 193 | vanderpol mu = do
let xdot mu t [x,v] = [v, -x + mu * v * (1-x^2)]
ts = linspace 1000 (0,50)
sol = toColumns $ odeSolve (xdot mu) [1,0] ts
mplot (ts : sol)
mplot sol | 193 | false | false | 0 | 14 | 65 | 125 | 64 | 61 | null | null |
takenobu-hs/processor-creative-kit | Language/Pck/Tool/Assembler.hs | bsd-3-clause | strToFCond "ne" = FCNE | 22 | strToFCond "ne" = FCNE | 22 | strToFCond "ne" = FCNE | 22 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
danielbarter/xcomputer | src/AssemblerTranslator.hs | bsd-3-clause | produceMemoryChunk :: [ASM] -> Word10 -> [(Word10,Word16)]
produceMemoryChunk p s = [ (k, translateASM a) | (k,a) <- l ]
where (e,(l,r),m) = execState moveToEnd $ initial p s
translateOperand o = case o of Label word -> m ! o
Lit n -> toEnum n
translateASM ASMdata = 0
translateASM (Op i y) | i == ADD = g 0b000000 y
| i == SUB = g 0b000001 y
| i == AND = g 0b000010 y
| i == OR = g 0b000011 y
| i == NOT = g 0b000100 y
| i == SHL = g 0b000101 y
| i == SHR = g 0b000110 y
| i == INC = g 0b000111 y
| i == DEC = g 0b001000 y
| i == LOD = g 0b001001 y
| i == STO = g 0b001010 y
| i == HLT = g 0b001011 y
| i == JMP = g 0b001100 y
| i == JMZ = g 0b001101 y
| i == JMN = g 0b001110 y
| i == JMF = g 0b001111 y
| i == ADDC = g 0b010000 y
| i == SUBC = g 0b010001 y
| i == ANDC = g 0b010010 y
| i == ORC = g 0b010011 y
| i == LODC = g 0b011001 y
| i == ADDI = g 0b100000 y
| i == SUBI = g 0b100001 y
| i == ANDI = g 0b100010 y
| i == ORI = g 0b100011 y
| i == LODI = g 0b101001 y
| i == STOI = g 0b101010 y
| i == JMPI = g 0b101100 y
| i == JMZI = g 0b101101 y
| i == JMNI = g 0b101110 y
| i == JMFI = g 0b101111 y
f = 2^10
g n y = case y of Just o -> n * f + (word10toword16 $ translateOperand o)
Nothing -> n * f | 2,241 | produceMemoryChunk :: [ASM] -> Word10 -> [(Word10,Word16)]
produceMemoryChunk p s = [ (k, translateASM a) | (k,a) <- l ]
where (e,(l,r),m) = execState moveToEnd $ initial p s
translateOperand o = case o of Label word -> m ! o
Lit n -> toEnum n
translateASM ASMdata = 0
translateASM (Op i y) | i == ADD = g 0b000000 y
| i == SUB = g 0b000001 y
| i == AND = g 0b000010 y
| i == OR = g 0b000011 y
| i == NOT = g 0b000100 y
| i == SHL = g 0b000101 y
| i == SHR = g 0b000110 y
| i == INC = g 0b000111 y
| i == DEC = g 0b001000 y
| i == LOD = g 0b001001 y
| i == STO = g 0b001010 y
| i == HLT = g 0b001011 y
| i == JMP = g 0b001100 y
| i == JMZ = g 0b001101 y
| i == JMN = g 0b001110 y
| i == JMF = g 0b001111 y
| i == ADDC = g 0b010000 y
| i == SUBC = g 0b010001 y
| i == ANDC = g 0b010010 y
| i == ORC = g 0b010011 y
| i == LODC = g 0b011001 y
| i == ADDI = g 0b100000 y
| i == SUBI = g 0b100001 y
| i == ANDI = g 0b100010 y
| i == ORI = g 0b100011 y
| i == LODI = g 0b101001 y
| i == STOI = g 0b101010 y
| i == JMPI = g 0b101100 y
| i == JMZI = g 0b101101 y
| i == JMNI = g 0b101110 y
| i == JMFI = g 0b101111 y
f = 2^10
g n y = case y of Just o -> n * f + (word10toword16 $ translateOperand o)
Nothing -> n * f | 2,241 | produceMemoryChunk p s = [ (k, translateASM a) | (k,a) <- l ]
where (e,(l,r),m) = execState moveToEnd $ initial p s
translateOperand o = case o of Label word -> m ! o
Lit n -> toEnum n
translateASM ASMdata = 0
translateASM (Op i y) | i == ADD = g 0b000000 y
| i == SUB = g 0b000001 y
| i == AND = g 0b000010 y
| i == OR = g 0b000011 y
| i == NOT = g 0b000100 y
| i == SHL = g 0b000101 y
| i == SHR = g 0b000110 y
| i == INC = g 0b000111 y
| i == DEC = g 0b001000 y
| i == LOD = g 0b001001 y
| i == STO = g 0b001010 y
| i == HLT = g 0b001011 y
| i == JMP = g 0b001100 y
| i == JMZ = g 0b001101 y
| i == JMN = g 0b001110 y
| i == JMF = g 0b001111 y
| i == ADDC = g 0b010000 y
| i == SUBC = g 0b010001 y
| i == ANDC = g 0b010010 y
| i == ORC = g 0b010011 y
| i == LODC = g 0b011001 y
| i == ADDI = g 0b100000 y
| i == SUBI = g 0b100001 y
| i == ANDI = g 0b100010 y
| i == ORI = g 0b100011 y
| i == LODI = g 0b101001 y
| i == STOI = g 0b101010 y
| i == JMPI = g 0b101100 y
| i == JMZI = g 0b101101 y
| i == JMNI = g 0b101110 y
| i == JMFI = g 0b101111 y
f = 2^10
g n y = case y of Just o -> n * f + (word10toword16 $ translateOperand o)
Nothing -> n * f | 2,182 | false | true | 0 | 11 | 1,360 | 774 | 359 | 415 | null | null |
danr/hipspec | testsuite/prod/zeno_version/PropT16.hs | gpl-3.0 | half (S Z) = Z | 14 | half (S Z) = Z | 14 | half (S Z) = Z | 14 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
Fuuzetsu/h-booru | src/HBooru/Types.hs | gpl-3.0 | width ∷ Proxy "width"
width = Proxy | 35 | width ∷ Proxy "width"
width = Proxy | 35 | width = Proxy | 13 | false | true | 1 | 5 | 6 | 18 | 7 | 11 | null | null |
nkartashov/haskell | sem10/tree.hs | gpl-2.0 | (Node i l r) = do
let ls = go l
l' <- get ls
ls | 57 | (Node i l r) = do
let ls = go l
l' <- get ls
ls | 57 | (Node i l r) = do
let ls = go l
l' <- get ls
ls | 57 | false | false | 0 | 10 | 25 | 42 | 18 | 24 | null | null |
yhoshino11/learning_haskell | ch3.hs | mit | sayMe 4 = "Four!" | 17 | sayMe 4 = "Four!" | 17 | sayMe 4 = "Four!" | 17 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Ian-Stewart-Binks/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/Html/Parse.hs | gpl-3.0 | _ `closes` "option" = True | 32 | _ `closes` "option" = True | 32 | _ `closes` "option" = True | 32 | false | false | 0 | 5 | 10 | 14 | 7 | 7 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.