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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
LukaHorvat/ArtGallery | src/Domain/Initial.hs | mit | inwardFacingVectors :: SimplePolygon -> [Vector]
inwardFacingVectors (Simple pts) = map inward $ slidingWindow 3 loop
where loop = last pts : pts ++ [head pts]
inward [a, b, c] = normalize $ normalize vec1 + normalize vec2
where vec1 = rotate (a `vecTo` b) rotAngle
vec2 = rotate (b `vecTo` c) rotAngle
inward _ = error "slidingWindow returned a list with more than 3 elements"
rotAngle = pi / 2 | 471 | inwardFacingVectors :: SimplePolygon -> [Vector]
inwardFacingVectors (Simple pts) = map inward $ slidingWindow 3 loop
where loop = last pts : pts ++ [head pts]
inward [a, b, c] = normalize $ normalize vec1 + normalize vec2
where vec1 = rotate (a `vecTo` b) rotAngle
vec2 = rotate (b `vecTo` c) rotAngle
inward _ = error "slidingWindow returned a list with more than 3 elements"
rotAngle = pi / 2 | 471 | inwardFacingVectors (Simple pts) = map inward $ slidingWindow 3 loop
where loop = last pts : pts ++ [head pts]
inward [a, b, c] = normalize $ normalize vec1 + normalize vec2
where vec1 = rotate (a `vecTo` b) rotAngle
vec2 = rotate (b `vecTo` c) rotAngle
inward _ = error "slidingWindow returned a list with more than 3 elements"
rotAngle = pi / 2 | 422 | false | true | 8 | 7 | 145 | 177 | 81 | 96 | null | null |
ekmett/bitwise | src/Data/Bits/Bitwise.hs | bsd-3-clause | repeat :: (Num b, Bits b) => Bool -> b
repeat False = 0 | 55 | repeat :: (Num b, Bits b) => Bool -> b
repeat False = 0 | 55 | repeat False = 0 | 16 | false | true | 0 | 8 | 13 | 39 | 18 | 21 | null | null |
seinokatsuhiro/koshu-java-tool | koshu-java-class.hs | bsd-3-clause | concatGap :: [[String]] -> [String]
concatGap [] = [] | 53 | concatGap :: [[String]] -> [String]
concatGap [] = [] | 53 | concatGap [] = [] | 17 | false | true | 0 | 7 | 8 | 31 | 17 | 14 | null | null |
chpatrick/codec | src/Data/Binary/Bits/Codec.hs | bsd-3-clause | bitCodec :: (Int -> G.Block a) -> (Int -> a -> BitPut ()) -> Int -> BitCodec a
bitCodec r w n = Codec (r n) (fmapArg (w n)) | 123 | bitCodec :: (Int -> G.Block a) -> (Int -> a -> BitPut ()) -> Int -> BitCodec a
bitCodec r w n = Codec (r n) (fmapArg (w n)) | 123 | bitCodec r w n = Codec (r n) (fmapArg (w n)) | 44 | false | true | 0 | 12 | 28 | 90 | 42 | 48 | null | null |
aelyasov/Haslog | src/Eu/Fittest/Logging/Analysis/Base.hs | bsd-3-clause | removeIndep_ :: Eq e => [(e,e)] -> Rule_ [EPS e p s]
removeIndep_ indepPairs s = Just . worker . reverse $ s
where
worker s = worker_ [head s] (tail s)
worker_ prefix [] = prefix
worker_ prefix (x:t) = if forall_ prefix (\y-> (event_ x, event_ y) `elem` indepPairs
||
(event_ y, event_ x) `elem` indepPairs)
then worker_ prefix t
else worker_ (x:prefix) t | 540 | removeIndep_ :: Eq e => [(e,e)] -> Rule_ [EPS e p s]
removeIndep_ indepPairs s = Just . worker . reverse $ s
where
worker s = worker_ [head s] (tail s)
worker_ prefix [] = prefix
worker_ prefix (x:t) = if forall_ prefix (\y-> (event_ x, event_ y) `elem` indepPairs
||
(event_ y, event_ x) `elem` indepPairs)
then worker_ prefix t
else worker_ (x:prefix) t | 529 | removeIndep_ indepPairs s = Just . worker . reverse $ s
where
worker s = worker_ [head s] (tail s)
worker_ prefix [] = prefix
worker_ prefix (x:t) = if forall_ prefix (\y-> (event_ x, event_ y) `elem` indepPairs
||
(event_ y, event_ x) `elem` indepPairs)
then worker_ prefix t
else worker_ (x:prefix) t | 476 | false | true | 0 | 13 | 250 | 196 | 101 | 95 | null | null |
Jxck/yesod-tutorial | Application.hs | bsd-2-clause | makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO App
makeFoundation conf setLogger = do
manager <- newManager def
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
Database.Persist.Store.loadConfig >>=
Database.Persist.Store.applyEnv
p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)
Database.Persist.Store.runPool dbconf (runMigration migrateAll) p
return $ App conf setLogger s p manager dbconf
-- for yesod devel | 540 | makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO App
makeFoundation conf setLogger = do
manager <- newManager def
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
Database.Persist.Store.loadConfig >>=
Database.Persist.Store.applyEnv
p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)
Database.Persist.Store.runPool dbconf (runMigration migrateAll) p
return $ App conf setLogger s p manager dbconf
-- for yesod devel | 540 | makeFoundation conf setLogger = do
manager <- newManager def
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
Database.Persist.Store.loadConfig >>=
Database.Persist.Store.applyEnv
p <- Database.Persist.Store.createPoolConfig (dbconf :: Settings.PersistConfig)
Database.Persist.Store.runPool dbconf (runMigration migrateAll) p
return $ App conf setLogger s p manager dbconf
-- for yesod devel | 475 | false | true | 0 | 11 | 107 | 144 | 71 | 73 | null | null |
gridaphobe/ghc | compiler/utils/Outputable.hs | bsd-3-clause | -- 'quotes' encloses something in single quotes...
-- but it omits them if the thing begins or ends in a single quote
-- so that we don't get `foo''. Instead we just have foo'.
quotes d =
sdocWithDynFlags $ \dflags ->
if useUnicode dflags
then char '‘' <> d <> char '’'
else SDoc $ \sty ->
let pp_d = runSDoc d sty
str = show pp_d
in case (str, snocView str) of
(_, Just (_, '\'')) -> pp_d
('\'' : _, _) -> pp_d
_other -> Pretty.quotes pp_d | 561 | quotes d =
sdocWithDynFlags $ \dflags ->
if useUnicode dflags
then char '‘' <> d <> char '’'
else SDoc $ \sty ->
let pp_d = runSDoc d sty
str = show pp_d
in case (str, snocView str) of
(_, Just (_, '\'')) -> pp_d
('\'' : _, _) -> pp_d
_other -> Pretty.quotes pp_d | 383 | quotes d =
sdocWithDynFlags $ \dflags ->
if useUnicode dflags
then char '‘' <> d <> char '’'
else SDoc $ \sty ->
let pp_d = runSDoc d sty
str = show pp_d
in case (str, snocView str) of
(_, Just (_, '\'')) -> pp_d
('\'' : _, _) -> pp_d
_other -> Pretty.quotes pp_d | 383 | true | false | 0 | 17 | 209 | 140 | 73 | 67 | null | null |
DNNX/shkoliner | src/Lib.hs | bsd-3-clause | extractArticle :: [Tag T.Text] -> ArticleMetaData
extractArticle tags =
ArticleMetaData
(extractTitle tags)
(extractPubAt tags)
(extractLink tags)
(extractNewsId tags)
(extractAuthor tags) | 210 | extractArticle :: [Tag T.Text] -> ArticleMetaData
extractArticle tags =
ArticleMetaData
(extractTitle tags)
(extractPubAt tags)
(extractLink tags)
(extractNewsId tags)
(extractAuthor tags) | 210 | extractArticle tags =
ArticleMetaData
(extractTitle tags)
(extractPubAt tags)
(extractLink tags)
(extractNewsId tags)
(extractAuthor tags) | 160 | false | true | 0 | 8 | 41 | 67 | 33 | 34 | null | null |
IxpertaSolutions/freer-effects | tests/Tests/Exception.hs | bsd-3-clause | tes1 :: (Members '[State Int, Exc String] r) => Eff r b
tes1 = incr >> throwError "exc" | 87 | tes1 :: (Members '[State Int, Exc String] r) => Eff r b
tes1 = incr >> throwError "exc" | 87 | tes1 = incr >> throwError "exc" | 31 | false | true | 0 | 9 | 17 | 48 | 24 | 24 | null | null |
nevrenato/HetsAlloy | Maude/PreComorphism.hs | gpl-2.0 | qualifyExVarsTerm (CAS.Mixfix_braced ts r) = CAS.Mixfix_braced ts' r
where ts' = map qualifyExVarsTerm ts | 116 | qualifyExVarsTerm (CAS.Mixfix_braced ts r) = CAS.Mixfix_braced ts' r
where ts' = map qualifyExVarsTerm ts | 116 | qualifyExVarsTerm (CAS.Mixfix_braced ts r) = CAS.Mixfix_braced ts' r
where ts' = map qualifyExVarsTerm ts | 116 | false | false | 0 | 8 | 24 | 38 | 18 | 20 | null | null |
mapinguari/SC_HS_Proxy | src/Proxy/Query/Unit.hs | mit | buildTime UnknownUnitType = 0 | 29 | buildTime UnknownUnitType = 0 | 29 | buildTime UnknownUnitType = 0 | 29 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
facebookarchive/lex-pass | src/Options.hs | bsd-3-clause | defaultOptions :: Options
defaultOptions = Options {
optCacheAsts = True,
optNumCores = 1,
optFiles = False,
optDir = Nothing,
optStartAtFile = Nothing} | 206 | defaultOptions :: Options
defaultOptions = Options {
optCacheAsts = True,
optNumCores = 1,
optFiles = False,
optDir = Nothing,
optStartAtFile = Nothing} | 206 | defaultOptions = Options {
optCacheAsts = True,
optNumCores = 1,
optFiles = False,
optDir = Nothing,
optStartAtFile = Nothing} | 180 | false | true | 0 | 6 | 75 | 43 | 27 | 16 | null | null |
CloudI/CloudI | src/api/haskell/external/bytestring-0.10.10.0/Data/ByteString/Internal.hs | mit | packBytes :: [Word8] -> ByteString
packBytes ws = unsafePackLenBytes (List.length ws) ws | 88 | packBytes :: [Word8] -> ByteString
packBytes ws = unsafePackLenBytes (List.length ws) ws | 88 | packBytes ws = unsafePackLenBytes (List.length ws) ws | 53 | false | true | 0 | 8 | 11 | 34 | 17 | 17 | null | null |
robdockins/edison | edison-core/src/Data/Edison/Assoc/AssocList.hs | mit | properSubmap = A.properSubmap | 29 | properSubmap = A.properSubmap | 29 | properSubmap = A.properSubmap | 29 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
flowbox-public/mainland-pretty | Text/PrettyPrint/Mainland.hs | bsd-3-clause | -- | Render a document without indentation on infinitely long lines. Since no
-- \'pretty\' printing is involved, this renderer is fast. The resulting output
-- contains fewer characters.
renderCompact :: Doc -> RDoc
renderCompact doc = scan 0 [doc]
where
scan :: Int -> [Doc] -> RDoc
scan !_ [] = REmpty
scan !k (d:ds) =
case d of
Empty -> scan k ds
Char c -> RChar c (scan (k+1) ds)
String l s -> RString l s (scan (k+l) ds)
Text s -> RText s (scan (k+T.length s) ds)
LazyText s -> RLazyText s (scan (k+fromIntegral (L.length s)) ds)
Line -> RLine 0 (scan 0 ds)
Nest _ x -> scan k (x:ds)
SrcLoc _ -> scan k ds
Cat x y -> scan k (x:y:ds)
Alt x _ -> scan k (x:ds)
Column f -> scan k (f k:ds)
Nesting f -> scan k (f 0:ds)
-- | Display a rendered document. | 945 | renderCompact :: Doc -> RDoc
renderCompact doc = scan 0 [doc]
where
scan :: Int -> [Doc] -> RDoc
scan !_ [] = REmpty
scan !k (d:ds) =
case d of
Empty -> scan k ds
Char c -> RChar c (scan (k+1) ds)
String l s -> RString l s (scan (k+l) ds)
Text s -> RText s (scan (k+T.length s) ds)
LazyText s -> RLazyText s (scan (k+fromIntegral (L.length s)) ds)
Line -> RLine 0 (scan 0 ds)
Nest _ x -> scan k (x:ds)
SrcLoc _ -> scan k ds
Cat x y -> scan k (x:y:ds)
Alt x _ -> scan k (x:ds)
Column f -> scan k (f k:ds)
Nesting f -> scan k (f 0:ds)
-- | Display a rendered document. | 757 | renderCompact doc = scan 0 [doc]
where
scan :: Int -> [Doc] -> RDoc
scan !_ [] = REmpty
scan !k (d:ds) =
case d of
Empty -> scan k ds
Char c -> RChar c (scan (k+1) ds)
String l s -> RString l s (scan (k+l) ds)
Text s -> RText s (scan (k+T.length s) ds)
LazyText s -> RLazyText s (scan (k+fromIntegral (L.length s)) ds)
Line -> RLine 0 (scan 0 ds)
Nest _ x -> scan k (x:ds)
SrcLoc _ -> scan k ds
Cat x y -> scan k (x:y:ds)
Alt x _ -> scan k (x:ds)
Column f -> scan k (f k:ds)
Nesting f -> scan k (f 0:ds)
-- | Display a rendered document. | 728 | true | true | 0 | 16 | 346 | 385 | 186 | 199 | null | null |
valderman/data-bundle | embedtool.hs | mit | runAct :: Option -> (Overwrite, Int) -> [String] -> IO ()
runAct Write (ovr, s) fs = do
case fs of
(outf : infs) | not (null infs) -> do
alreadyHasBundle <- hasBundle outf
when alreadyHasBundle $ do
case ovr of
DontOverwrite -> do
hPutStrLn stderr $ "file `" ++ outf ++ "' already has a " ++
"bundle; aborting"
exitFailure
Replace ->
eraseBundle outf
_ ->
return ()
appendBundle outf (map (FilePath s) infs)
_ -> do
hPutStrLn stderr $ "need an output file and at least one input file " ++
"to create a bundle"
hPutStrLn stderr $ "try `embedtool -w outfile infile1 [infile2 ...]'"
exitFailure | 779 | runAct :: Option -> (Overwrite, Int) -> [String] -> IO ()
runAct Write (ovr, s) fs = do
case fs of
(outf : infs) | not (null infs) -> do
alreadyHasBundle <- hasBundle outf
when alreadyHasBundle $ do
case ovr of
DontOverwrite -> do
hPutStrLn stderr $ "file `" ++ outf ++ "' already has a " ++
"bundle; aborting"
exitFailure
Replace ->
eraseBundle outf
_ ->
return ()
appendBundle outf (map (FilePath s) infs)
_ -> do
hPutStrLn stderr $ "need an output file and at least one input file " ++
"to create a bundle"
hPutStrLn stderr $ "try `embedtool -w outfile infile1 [infile2 ...]'"
exitFailure | 779 | runAct Write (ovr, s) fs = do
case fs of
(outf : infs) | not (null infs) -> do
alreadyHasBundle <- hasBundle outf
when alreadyHasBundle $ do
case ovr of
DontOverwrite -> do
hPutStrLn stderr $ "file `" ++ outf ++ "' already has a " ++
"bundle; aborting"
exitFailure
Replace ->
eraseBundle outf
_ ->
return ()
appendBundle outf (map (FilePath s) infs)
_ -> do
hPutStrLn stderr $ "need an output file and at least one input file " ++
"to create a bundle"
hPutStrLn stderr $ "try `embedtool -w outfile infile1 [infile2 ...]'"
exitFailure | 721 | false | true | 0 | 25 | 295 | 218 | 101 | 117 | null | null |
siddhanathan/ghc | compiler/cmm/PprC.hs | bsd-3-clause | machRepCType :: CmmType -> SDoc
machRepCType ty | isFloatType ty = machRep_F_CType w
| otherwise = machRep_U_CType w
where
w = typeWidth ty | 194 | machRepCType :: CmmType -> SDoc
machRepCType ty | isFloatType ty = machRep_F_CType w
| otherwise = machRep_U_CType w
where
w = typeWidth ty | 194 | machRepCType ty | isFloatType ty = machRep_F_CType w
| otherwise = machRep_U_CType w
where
w = typeWidth ty | 162 | false | true | 1 | 8 | 77 | 64 | 25 | 39 | null | null |
vTurbine/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | typeable7ClassKey = mkPreludeClassUnique 27 | 49 | typeable7ClassKey = mkPreludeClassUnique 27 | 49 | typeable7ClassKey = mkPreludeClassUnique 27 | 49 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
bigsleep/Wf | wf-kvs/src/Wf/Application/Kvs.hs | mit | set :: (Typeable v, Bin.Binary v, Member Kvs r) => B.ByteString -> v -> Eff r ()
set = Wf.Control.Eff.Kvs.set DefaultKvs | 120 | set :: (Typeable v, Bin.Binary v, Member Kvs r) => B.ByteString -> v -> Eff r ()
set = Wf.Control.Eff.Kvs.set DefaultKvs | 120 | set = Wf.Control.Eff.Kvs.set DefaultKvs | 39 | false | true | 0 | 9 | 20 | 61 | 32 | 29 | null | null |
jonahkagan/zero | src/Text.hs | mit | mapWords :: Eq ic =>
Alphabet ic -> (Text ic -> Text oc) -> (Text ic -> Text oc)
-> Text ic -> Text oc
mapWords alpha fword fseps text = helper text
where
isSep = flip elem $ seps alpha
helper [] = []
helper text =
let (seps, rest) = span isSep text
(word, rest') = span (not . isSep) rest
in fseps seps ++ fword word ++ helper rest' | 373 | mapWords :: Eq ic =>
Alphabet ic -> (Text ic -> Text oc) -> (Text ic -> Text oc)
-> Text ic -> Text oc
mapWords alpha fword fseps text = helper text
where
isSep = flip elem $ seps alpha
helper [] = []
helper text =
let (seps, rest) = span isSep text
(word, rest') = span (not . isSep) rest
in fseps seps ++ fword word ++ helper rest' | 373 | mapWords alpha fword fseps text = helper text
where
isSep = flip elem $ seps alpha
helper [] = []
helper text =
let (seps, rest) = span isSep text
(word, rest') = span (not . isSep) rest
in fseps seps ++ fword word ++ helper rest' | 266 | false | true | 0 | 12 | 111 | 184 | 86 | 98 | null | null |
jonsterling/hs-aws-dynamodb-streams | src/Aws/DynamoDb/Streams/Types.hs | apache-2.0 | -- | A prism for 'AVStringSet'.
--
-- @
-- '_AVStringSet' ∷ Prism' 'AttributeValue' ('S.Set' 'T.Text')
-- @
_AVStringSet
∷ ( Choice p
, Applicative f
)
⇒ p (S.Set T.Text) (f (S.Set T.Text))
→ p AttributeValue (f AttributeValue)
_AVStringSet =
dimap to fro ∘ right'
where
to = \case
AVStringSet e → Right e
e → Left e
fro = either pure (fmap AVStringSet)
| 402 | _AVStringSet
∷ ( Choice p
, Applicative f
)
⇒ p (S.Set T.Text) (f (S.Set T.Text))
→ p AttributeValue (f AttributeValue)
_AVStringSet =
dimap to fro ∘ right'
where
to = \case
AVStringSet e → Right e
e → Left e
fro = either pure (fmap AVStringSet)
| 294 | _AVStringSet =
dimap to fro ∘ right'
where
to = \case
AVStringSet e → Right e
e → Left e
fro = either pure (fmap AVStringSet)
| 160 | true | true | 4 | 13 | 113 | 146 | 68 | 78 | null | null |
ocean0yohsuke/Simply-Typed-Lambda | Start/Lib/Prelude.hs | bsd-3-clause | map f (x:xs) = f x : map f xs | 29 | map f (x:xs) = f x : map f xs | 29 | map f (x:xs) = f x : map f xs | 29 | false | false | 0 | 6 | 9 | 32 | 14 | 18 | null | null |
kim/bouquet | src/Network/Bouquet/Base.hs | mpl-2.0 | leastUsed :: Choice x a
leastUsed (Pools pools _) =
snd . minimumBy (compare `on` fst) <$> mapM usage (H.elems pools)
where
usage :: Pool' a -> IO (Int, Pool' a)
usage p = flip (,) p <$> readIORef (inUse p) | 220 | leastUsed :: Choice x a
leastUsed (Pools pools _) =
snd . minimumBy (compare `on` fst) <$> mapM usage (H.elems pools)
where
usage :: Pool' a -> IO (Int, Pool' a)
usage p = flip (,) p <$> readIORef (inUse p) | 220 | leastUsed (Pools pools _) =
snd . minimumBy (compare `on` fst) <$> mapM usage (H.elems pools)
where
usage :: Pool' a -> IO (Int, Pool' a)
usage p = flip (,) p <$> readIORef (inUse p) | 196 | false | true | 0 | 9 | 54 | 116 | 57 | 59 | null | null |
rfranek/duckling | Duckling/Time/SV/Rules.hs | bsd-3-clause | ruleIntersectBy :: Rule
ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 316 | ruleIntersectBy :: Rule
ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 316 | ruleIntersectBy = Rule
{ name = "intersect by \",\""
, pattern =
[ Predicate isNotLatent
, regex ","
, Predicate isNotLatent
]
, prod = \tokens -> case tokens of
(Token Time td1:_:Token Time td2:_) ->
Token Time <$> intersect td1 td2
_ -> Nothing
} | 292 | false | true | 0 | 16 | 92 | 111 | 57 | 54 | null | null |
jmgimeno/haskell-playground | src/FingerTrees.hs | unlicense | toTree :: (Reduce f) => f a -> FingerTree a
toTree s = s <|^ Empty | 66 | toTree :: (Reduce f) => f a -> FingerTree a
toTree s = s <|^ Empty | 66 | toTree s = s <|^ Empty | 22 | false | true | 3 | 8 | 15 | 45 | 21 | 24 | null | null |
silky/Tidal | Sound/Tidal/Strategies.hs | gpl-3.0 | stut :: Integer -> Double -> Rational -> OscPattern -> OscPattern
stut steps feedback time p = stack (p:(map (\x -> (((x%steps)*time) ~> (p |+| gain (pure $ scale (fromIntegral x))))) [1..(steps-1)]))
where scale x
= ((+feedback) . (*(1-feedback)) . (/(fromIntegral steps)) . ((fromIntegral steps)-)) x | 316 | stut :: Integer -> Double -> Rational -> OscPattern -> OscPattern
stut steps feedback time p = stack (p:(map (\x -> (((x%steps)*time) ~> (p |+| gain (pure $ scale (fromIntegral x))))) [1..(steps-1)]))
where scale x
= ((+feedback) . (*(1-feedback)) . (/(fromIntegral steps)) . ((fromIntegral steps)-)) x | 316 | stut steps feedback time p = stack (p:(map (\x -> (((x%steps)*time) ~> (p |+| gain (pure $ scale (fromIntegral x))))) [1..(steps-1)]))
where scale x
= ((+feedback) . (*(1-feedback)) . (/(fromIntegral steps)) . ((fromIntegral steps)-)) x | 250 | false | true | 1 | 21 | 59 | 193 | 101 | 92 | null | null |
rCEx/feldspar-lang-small | src/Feldspar/Core/Constructs/Conversion.hs | bsd-3-clause | rangeProp :: forall a . (Bounded a, Integral a) => Range Integer -> Range a
rangeProp (Range l u)
| withinBounds l && withinBounds u
= range (fromIntegral l) (fromIntegral u)
| otherwise = range minBound maxBound
where withinBounds i = toInteger (minBound :: a) <= i &&
i <= toInteger (maxBound :: a) | 343 | rangeProp :: forall a . (Bounded a, Integral a) => Range Integer -> Range a
rangeProp (Range l u)
| withinBounds l && withinBounds u
= range (fromIntegral l) (fromIntegral u)
| otherwise = range minBound maxBound
where withinBounds i = toInteger (minBound :: a) <= i &&
i <= toInteger (maxBound :: a) | 343 | rangeProp (Range l u)
| withinBounds l && withinBounds u
= range (fromIntegral l) (fromIntegral u)
| otherwise = range minBound maxBound
where withinBounds i = toInteger (minBound :: a) <= i &&
i <= toInteger (maxBound :: a) | 267 | false | true | 1 | 9 | 96 | 137 | 67 | 70 | null | null |
sgillespie/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | mkStaticConEntryLabel name c = IdLabel name c StaticConEntry | 65 | mkStaticConEntryLabel name c = IdLabel name c StaticConEntry | 65 | mkStaticConEntryLabel name c = IdLabel name c StaticConEntry | 65 | false | false | 0 | 5 | 12 | 18 | 8 | 10 | null | null |
olsner/ghc | compiler/types/Type.hs | bsd-3-clause | tyConAppTyCon_maybe (TyConApp tc _) = Just tc | 45 | tyConAppTyCon_maybe (TyConApp tc _) = Just tc | 45 | tyConAppTyCon_maybe (TyConApp tc _) = Just tc | 45 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
thinkpad20/rowling | test/SpecHelper.hs | mit | shouldBeN :: (Show a) => Maybe a -> IO ()
shouldBeN = flip shouldSatisfy isNothing | 82 | shouldBeN :: (Show a) => Maybe a -> IO ()
shouldBeN = flip shouldSatisfy isNothing | 82 | shouldBeN = flip shouldSatisfy isNothing | 40 | false | true | 0 | 9 | 14 | 42 | 19 | 23 | null | null |
fpco/hlint | src/Hint/Extensions.hs | bsd-3-clause | used :: KnownExtension -> Module_ -> Bool
used RecursiveDo = hasS isMDo | 71 | used :: KnownExtension -> Module_ -> Bool
used RecursiveDo = hasS isMDo | 71 | used RecursiveDo = hasS isMDo | 29 | false | true | 0 | 8 | 11 | 30 | 13 | 17 | null | null |
ambiata/highlighting-kate | Text/Highlighting/Kate/Syntax/Bibtex.hs | gpl-2.0 | regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 = compileRegex True "\\\\([a-zA-Z@]+|[^ ])" | 97 | regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 = compileRegex True "\\\\([a-zA-Z@]+|[^ ])" | 97 | regex_'5c'5c'28'5ba'2dzA'2dZ'40'5d'2b'7c'5b'5e_'5d'29 = compileRegex True "\\\\([a-zA-Z@]+|[^ ])" | 97 | false | false | 0 | 5 | 5 | 11 | 5 | 6 | null | null |
brodyberg/Notes | ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/Chapter7GrabBag.hs | mit | -- addFive2 3 4 (\x y -> if x > y then y else x)
mflip1 f = \x -> \y -> f y x | 78 | mflip1 f = \x -> \y -> f y x | 28 | mflip1 f = \x -> \y -> f y x | 28 | true | false | 0 | 7 | 25 | 25 | 13 | 12 | null | null |
ku-fpg/kansas-amber | System/Hardware/Haskino/Protocol.hs | bsd-3-clause | packageCommand (NoToneE p) =
addCommand ALG_CMD_NOTONE_PIN (packageExpr p) | 79 | packageCommand (NoToneE p) =
addCommand ALG_CMD_NOTONE_PIN (packageExpr p) | 79 | packageCommand (NoToneE p) =
addCommand ALG_CMD_NOTONE_PIN (packageExpr p) | 79 | false | false | 0 | 7 | 12 | 26 | 12 | 14 | null | null |
ardumont/haskell-platform | hptool/src/OS/Posix.hs | bsd-3-clause | posixOS :: BuildConfig -> OS
posixOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
prefix = fromMaybe "/usr/local/haskell" bcPrefix
absPrefix = "/" </> prefix
relPrefix = drop 1 absPrefix
versionName = "ghc-" ++ showVersion ghcVersion ++ "-" ++ bcArch
absVersionDir = absPrefix </> versionName
relVersionDir = relPrefix </> versionName
osHpPrefix = absVersionDir
osGhcPrefix = absVersionDir
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
hpTargetDir = targetDir </+> osHpPrefix
hpBinDir = hpTargetDir </> "bin"
versionFile = hpTargetDir </> "version-" ++ showVersion hpVersion
cabalFile = hpTargetDir </> "haskell-platform.cabal"
osTargetAction = do
need [vdir hpBinDir, versionFile, cabalFile ]
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> productName ++ ".tar.gz"
usrLocalTar = productDir </> "hp-usr-local" ++ ".tar.gz"
installScript = extrasDir </> "installer" </> "install-haskell-platform.sh"
productName =
"haskell-platform-" ++ showVersion hpVersion ++ "-unknown-posix-" ++ bcArch
genericExtrasSrc = "hptool/os-extras/posix"
osRules _hpRelease _bc = do
extrasDir %/> \dst -> do
ctx <- platformContext
let ctx' = ctxConcat [ assocListContext [("absVersionDir", absVersionDir)], ctx ]
copyExpandedDir ctx' genericExtrasSrc dst
osProduct %> \out -> do
let installFile = takeFileName installScript
need [ usrLocalTar, dir extrasDir]
command_ [] "cp" [ installScript, productDir ]
command_ [Cwd productDir]
"tar" ["czf", out ® targetDir, installFile, usrLocalTar ® productDir ]
mapM_ putNormal
[ replicate 72 '-'
, "To install this build:"
, "1) copy " ++ out ++ " to the target machine"
, "2) untar it (creates files in the working directory)"
, "3) as root, run the script ./" ++ installFile
]
usrLocalTar %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd targetDir]
"tar" ["czf", out ® targetDir, hpTargetDir ® targetDir]
versionFile %> \out -> do
writeFileChanged out $ unlines
[ "platform " ++ showVersion hpVersion
, "ghc " ++ showVersion ghcVersion
, "arch " ++ bcArch
]
cabalFile %> copyFile' hpCabalFile
hpBinDir ~/> do
-- These items are being merged into the bin directory, which has
-- bin items from the packages, hence it is a virtual target dir.
makeDirectory hpBinDir
need [dir extrasDir]
binFiles <- getDirectoryFiles "" [extrasDir </> "bin/*"]
forM_ binFiles $ \f -> do
copyFile' f $ hpBinDir </> takeFileName f
return Nothing
osPackageConfigureExtraArgs _pkg =
[ override "prefix" "/usr/local" (absPrefix </> "$compiler-$arch")
, stock "bindir" "$prefix/bin"
, stock "libdir" "$prefix/lib"
, override "libsubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, stock "libexecdir" "$prefix/libexec"
, stock "datadir" "$prefix/share"
, override "datasubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, override "docdir" "$datadir/doc/$arch-$os-$compiler/$pkgid"
"$prefix/lib/$pkgid/doc"
, stock "htmldir" "$docdir/html"
, stock "haddockdir" "$htmldir"
--, stock "sysconfdir" "$prefix/etc"
]
where
stock k v0 = "--" ++ k ++ "=" ++ v0 -- the 1.18 default value
override k _v0 v1 = "--" ++ k ++ "=" ++ v1 -- our override
-- N.B.: Because the default cabal layout changed in 1.18, and because the
-- host cabal is used to build the packages, and it might be pre-1.18, we
-- need to specify every dir parameter explicitly.
--
-- See also the file notes/cabal-layouts | 5,045 | posixOS :: BuildConfig -> OS
posixOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
prefix = fromMaybe "/usr/local/haskell" bcPrefix
absPrefix = "/" </> prefix
relPrefix = drop 1 absPrefix
versionName = "ghc-" ++ showVersion ghcVersion ++ "-" ++ bcArch
absVersionDir = absPrefix </> versionName
relVersionDir = relPrefix </> versionName
osHpPrefix = absVersionDir
osGhcPrefix = absVersionDir
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
hpTargetDir = targetDir </+> osHpPrefix
hpBinDir = hpTargetDir </> "bin"
versionFile = hpTargetDir </> "version-" ++ showVersion hpVersion
cabalFile = hpTargetDir </> "haskell-platform.cabal"
osTargetAction = do
need [vdir hpBinDir, versionFile, cabalFile ]
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> productName ++ ".tar.gz"
usrLocalTar = productDir </> "hp-usr-local" ++ ".tar.gz"
installScript = extrasDir </> "installer" </> "install-haskell-platform.sh"
productName =
"haskell-platform-" ++ showVersion hpVersion ++ "-unknown-posix-" ++ bcArch
genericExtrasSrc = "hptool/os-extras/posix"
osRules _hpRelease _bc = do
extrasDir %/> \dst -> do
ctx <- platformContext
let ctx' = ctxConcat [ assocListContext [("absVersionDir", absVersionDir)], ctx ]
copyExpandedDir ctx' genericExtrasSrc dst
osProduct %> \out -> do
let installFile = takeFileName installScript
need [ usrLocalTar, dir extrasDir]
command_ [] "cp" [ installScript, productDir ]
command_ [Cwd productDir]
"tar" ["czf", out ® targetDir, installFile, usrLocalTar ® productDir ]
mapM_ putNormal
[ replicate 72 '-'
, "To install this build:"
, "1) copy " ++ out ++ " to the target machine"
, "2) untar it (creates files in the working directory)"
, "3) as root, run the script ./" ++ installFile
]
usrLocalTar %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd targetDir]
"tar" ["czf", out ® targetDir, hpTargetDir ® targetDir]
versionFile %> \out -> do
writeFileChanged out $ unlines
[ "platform " ++ showVersion hpVersion
, "ghc " ++ showVersion ghcVersion
, "arch " ++ bcArch
]
cabalFile %> copyFile' hpCabalFile
hpBinDir ~/> do
-- These items are being merged into the bin directory, which has
-- bin items from the packages, hence it is a virtual target dir.
makeDirectory hpBinDir
need [dir extrasDir]
binFiles <- getDirectoryFiles "" [extrasDir </> "bin/*"]
forM_ binFiles $ \f -> do
copyFile' f $ hpBinDir </> takeFileName f
return Nothing
osPackageConfigureExtraArgs _pkg =
[ override "prefix" "/usr/local" (absPrefix </> "$compiler-$arch")
, stock "bindir" "$prefix/bin"
, stock "libdir" "$prefix/lib"
, override "libsubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, stock "libexecdir" "$prefix/libexec"
, stock "datadir" "$prefix/share"
, override "datasubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, override "docdir" "$datadir/doc/$arch-$os-$compiler/$pkgid"
"$prefix/lib/$pkgid/doc"
, stock "htmldir" "$docdir/html"
, stock "haddockdir" "$htmldir"
--, stock "sysconfdir" "$prefix/etc"
]
where
stock k v0 = "--" ++ k ++ "=" ++ v0 -- the 1.18 default value
override k _v0 v1 = "--" ++ k ++ "=" ++ v1 -- our override
-- N.B.: Because the default cabal layout changed in 1.18, and because the
-- host cabal is used to build the packages, and it might be pre-1.18, we
-- need to specify every dir parameter explicitly.
--
-- See also the file notes/cabal-layouts | 5,045 | posixOS BuildConfig{..} = OS{..}
where
HpVersion{..} = bcHpVersion
GhcVersion{..} = bcGhcVersion
prefix = fromMaybe "/usr/local/haskell" bcPrefix
absPrefix = "/" </> prefix
relPrefix = drop 1 absPrefix
versionName = "ghc-" ++ showVersion ghcVersion ++ "-" ++ bcArch
absVersionDir = absPrefix </> versionName
relVersionDir = relPrefix </> versionName
osHpPrefix = absVersionDir
osGhcPrefix = absVersionDir
osGhcLocalInstall = GhcInstallConfigure
osGhcTargetInstall = GhcInstallConfigure
osPackageTargetDir p = osHpPrefix </> "lib" </> packagePattern p
osDoShared = True
osPackagePostRegister _ = return ()
osPackageInstallAction p = do
let confFile = packageTargetConf p
let regDir = targetDir </+> osHpPrefix </> "etc" </> "registrations"
let regFile = regDir </> show p
makeDirectory regDir
hasReg <- doesFileExist confFile
if hasReg
then command_ [] "cp" [confFile, regFile]
else command_ [] "rm" ["-f", regFile]
hpTargetDir = targetDir </+> osHpPrefix
hpBinDir = hpTargetDir </> "bin"
versionFile = hpTargetDir </> "version-" ++ showVersion hpVersion
cabalFile = hpTargetDir </> "haskell-platform.cabal"
osTargetAction = do
need [vdir hpBinDir, versionFile, cabalFile ]
osGhcDbDir = "lib" </> show bcGhcVersion </> "package.conf.d"
osGhcPkgHtmlFieldExtras = []
osPlatformPkgPathMunge = flip const
osGhcPkgPathMunge = flip const
osPkgHtmlDir pkg = osPackageTargetDir pkg </> "doc" </> "html"
osDocAction = return ()
osProduct = productDir </> productName ++ ".tar.gz"
usrLocalTar = productDir </> "hp-usr-local" ++ ".tar.gz"
installScript = extrasDir </> "installer" </> "install-haskell-platform.sh"
productName =
"haskell-platform-" ++ showVersion hpVersion ++ "-unknown-posix-" ++ bcArch
genericExtrasSrc = "hptool/os-extras/posix"
osRules _hpRelease _bc = do
extrasDir %/> \dst -> do
ctx <- platformContext
let ctx' = ctxConcat [ assocListContext [("absVersionDir", absVersionDir)], ctx ]
copyExpandedDir ctx' genericExtrasSrc dst
osProduct %> \out -> do
let installFile = takeFileName installScript
need [ usrLocalTar, dir extrasDir]
command_ [] "cp" [ installScript, productDir ]
command_ [Cwd productDir]
"tar" ["czf", out ® targetDir, installFile, usrLocalTar ® productDir ]
mapM_ putNormal
[ replicate 72 '-'
, "To install this build:"
, "1) copy " ++ out ++ " to the target machine"
, "2) untar it (creates files in the working directory)"
, "3) as root, run the script ./" ++ installFile
]
usrLocalTar %> \out -> do
need [targetDir, vdir ghcVirtualTarget]
command_ [Cwd targetDir]
"tar" ["czf", out ® targetDir, hpTargetDir ® targetDir]
versionFile %> \out -> do
writeFileChanged out $ unlines
[ "platform " ++ showVersion hpVersion
, "ghc " ++ showVersion ghcVersion
, "arch " ++ bcArch
]
cabalFile %> copyFile' hpCabalFile
hpBinDir ~/> do
-- These items are being merged into the bin directory, which has
-- bin items from the packages, hence it is a virtual target dir.
makeDirectory hpBinDir
need [dir extrasDir]
binFiles <- getDirectoryFiles "" [extrasDir </> "bin/*"]
forM_ binFiles $ \f -> do
copyFile' f $ hpBinDir </> takeFileName f
return Nothing
osPackageConfigureExtraArgs _pkg =
[ override "prefix" "/usr/local" (absPrefix </> "$compiler-$arch")
, stock "bindir" "$prefix/bin"
, stock "libdir" "$prefix/lib"
, override "libsubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, stock "libexecdir" "$prefix/libexec"
, stock "datadir" "$prefix/share"
, override "datasubdir" "$arch-$os-$compiler/$pkgid" "$pkgid"
, override "docdir" "$datadir/doc/$arch-$os-$compiler/$pkgid"
"$prefix/lib/$pkgid/doc"
, stock "htmldir" "$docdir/html"
, stock "haddockdir" "$htmldir"
--, stock "sysconfdir" "$prefix/etc"
]
where
stock k v0 = "--" ++ k ++ "=" ++ v0 -- the 1.18 default value
override k _v0 v1 = "--" ++ k ++ "=" ++ v1 -- our override
-- N.B.: Because the default cabal layout changed in 1.18, and because the
-- host cabal is used to build the packages, and it might be pre-1.18, we
-- need to specify every dir parameter explicitly.
--
-- See also the file notes/cabal-layouts | 5,016 | false | true | 0 | 18 | 1,589 | 1,065 | 532 | 533 | null | null |
csrhodes/pandoc | src/Text/Pandoc/Writers/Haddock.hs | gpl-2.0 | blockToHaddock :: WriterOptions -- ^ Options
-> Block -- ^ Block element
-> State WriterState Doc
blockToHaddock _ Null = return empty | 174 | blockToHaddock :: WriterOptions -- ^ Options
-> Block -- ^ Block element
-> State WriterState Doc
blockToHaddock _ Null = return empty | 174 | blockToHaddock _ Null = return empty | 36 | false | true | 0 | 7 | 61 | 34 | 17 | 17 | null | null |
rleshchinskiy/vector | Data/Vector/Internal/Check.hs | bsd-3-clause | check file line kind loc msg cond x
| not (doChecks kind) || cond = x
| otherwise = checkError file line kind loc msg | 121 | check file line kind loc msg cond x
| not (doChecks kind) || cond = x
| otherwise = checkError file line kind loc msg | 121 | check file line kind loc msg cond x
| not (doChecks kind) || cond = x
| otherwise = checkError file line kind loc msg | 121 | false | false | 0 | 11 | 28 | 76 | 29 | 47 | null | null |
sebastiaanvisser/jail | src/System/IO/Jail/ByteString.hs | bsd-3-clause | hPutStrLn :: Handle -> ByteString -> IO ()
hPutStrLn h b = embedHandle "hPutStrLn" (flip B.hPutStrLn b) h | 105 | hPutStrLn :: Handle -> ByteString -> IO ()
hPutStrLn h b = embedHandle "hPutStrLn" (flip B.hPutStrLn b) h | 105 | hPutStrLn h b = embedHandle "hPutStrLn" (flip B.hPutStrLn b) h | 62 | false | true | 0 | 8 | 17 | 46 | 22 | 24 | null | null |
azadbolour/boardgame | haskell-server/src/BoardGame/Server/Domain/GameConfig.hs | agpl-3.0 | -- | Generic JSON-like representation of the default configuration.
defaultServerParametersObj :: Yaml.Value
defaultServerParametersObj = toJSON defaultServerParameters | 168 | defaultServerParametersObj :: Yaml.Value
defaultServerParametersObj = toJSON defaultServerParameters | 100 | defaultServerParametersObj = toJSON defaultServerParameters | 59 | true | true | 0 | 5 | 15 | 17 | 9 | 8 | null | null |
kiripon/gh-pages | Color.hs | bsd-3-clause | eri = "#00adb9" | 15 | eri = "#00adb9" | 15 | eri = "#00adb9" | 15 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
haskell-streaming/streaming | benchmarks/old/Stream/Folding/Prelude.hs | bsd-3-clause | -- --------
-- cons
-- --------
cons :: Monad m => a -> Folding (Of a) m r -> Folding (Of a) m r
cons a_ (Folding phi) = Folding $ \construct wrap done ->
phi (\(a :> a2p) a0 -> construct (a0 :> a2p a)
)
(\m a0 -> wrap $ liftM ($ a0) m
)
(\r a0 -> construct (a0 :> done r)
)
a_ | 341 | cons :: Monad m => a -> Folding (Of a) m r -> Folding (Of a) m r
cons a_ (Folding phi) = Folding $ \construct wrap done ->
phi (\(a :> a2p) a0 -> construct (a0 :> a2p a)
)
(\m a0 -> wrap $ liftM ($ a0) m
)
(\r a0 -> construct (a0 :> done r)
)
a_ | 309 | cons a_ (Folding phi) = Folding $ \construct wrap done ->
phi (\(a :> a2p) a0 -> construct (a0 :> a2p a)
)
(\m a0 -> wrap $ liftM ($ a0) m
)
(\r a0 -> construct (a0 :> done r)
)
a_ | 244 | true | true | 0 | 10 | 130 | 173 | 86 | 87 | null | null |
ihc/futhark | src/Language/Futhark/TypeChecker/Terms.hs | isc | checkExp (Reduce comm fun startexp arrexp pos) = do
(startexp', startarg) <- checkArg startexp
(arrexp', arrarg) <- checkSOACArrayArg arrexp
fun' <- checkLambda fun [startarg, arrarg]
let redtype = lambdaReturnType fun'
unless (typeOf startexp' `subtypeOf` redtype) $
bad $ TypeError pos $ "Initial value is of type " ++ pretty (typeOf startexp') ++ ", but reduce function returns type " ++ pretty redtype ++ "."
unless (argType arrarg `subtypeOf` redtype) $
bad $ TypeError pos $ "Array element value is of type " ++ pretty (argType arrarg) ++ ", but reduce function returns type " ++ pretty redtype ++ "."
return $ Reduce comm fun' startexp' arrexp' pos | 677 | checkExp (Reduce comm fun startexp arrexp pos) = do
(startexp', startarg) <- checkArg startexp
(arrexp', arrarg) <- checkSOACArrayArg arrexp
fun' <- checkLambda fun [startarg, arrarg]
let redtype = lambdaReturnType fun'
unless (typeOf startexp' `subtypeOf` redtype) $
bad $ TypeError pos $ "Initial value is of type " ++ pretty (typeOf startexp') ++ ", but reduce function returns type " ++ pretty redtype ++ "."
unless (argType arrarg `subtypeOf` redtype) $
bad $ TypeError pos $ "Array element value is of type " ++ pretty (argType arrarg) ++ ", but reduce function returns type " ++ pretty redtype ++ "."
return $ Reduce comm fun' startexp' arrexp' pos | 677 | checkExp (Reduce comm fun startexp arrexp pos) = do
(startexp', startarg) <- checkArg startexp
(arrexp', arrarg) <- checkSOACArrayArg arrexp
fun' <- checkLambda fun [startarg, arrarg]
let redtype = lambdaReturnType fun'
unless (typeOf startexp' `subtypeOf` redtype) $
bad $ TypeError pos $ "Initial value is of type " ++ pretty (typeOf startexp') ++ ", but reduce function returns type " ++ pretty redtype ++ "."
unless (argType arrarg `subtypeOf` redtype) $
bad $ TypeError pos $ "Array element value is of type " ++ pretty (argType arrarg) ++ ", but reduce function returns type " ++ pretty redtype ++ "."
return $ Reduce comm fun' startexp' arrexp' pos | 677 | false | false | 0 | 17 | 128 | 225 | 107 | 118 | null | null |
talw/quoridor-hs | src/Quoridor.hs | bsd-3-clause | getCurrentValidMoves :: (Monad m, Functor m) => Game m [Cell]
getCurrentValidMoves = liftM3 getValidMoves posCurrP
(reader boardSize)
get
where posCurrP = gets $ pos . currP | 262 | getCurrentValidMoves :: (Monad m, Functor m) => Game m [Cell]
getCurrentValidMoves = liftM3 getValidMoves posCurrP
(reader boardSize)
get
where posCurrP = gets $ pos . currP | 262 | getCurrentValidMoves = liftM3 getValidMoves posCurrP
(reader boardSize)
get
where posCurrP = gets $ pos . currP | 200 | false | true | 0 | 7 | 114 | 65 | 33 | 32 | null | null |
brendanhay/gogol | gogol-cloudiot/gen/Network/Google/Resource/CloudIOT/Projects/Locations/Registries/Groups/Devices/States/List.hs | mpl-2.0 | -- | Creates a value of 'ProjectsLocationsRegistriesGroupsDevicesStatesList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plrgdslXgafv'
--
-- * 'plrgdslUploadProtocol'
--
-- * 'plrgdslAccessToken'
--
-- * 'plrgdslUploadType'
--
-- * 'plrgdslName'
--
-- * 'plrgdslNumStates'
--
-- * 'plrgdslCallback'
projectsLocationsRegistriesGroupsDevicesStatesList
:: Text -- ^ 'plrgdslName'
-> ProjectsLocationsRegistriesGroupsDevicesStatesList
projectsLocationsRegistriesGroupsDevicesStatesList pPlrgdslName_ =
ProjectsLocationsRegistriesGroupsDevicesStatesList'
{ _plrgdslXgafv = Nothing
, _plrgdslUploadProtocol = Nothing
, _plrgdslAccessToken = Nothing
, _plrgdslUploadType = Nothing
, _plrgdslName = pPlrgdslName_
, _plrgdslNumStates = Nothing
, _plrgdslCallback = Nothing
} | 897 | projectsLocationsRegistriesGroupsDevicesStatesList
:: Text -- ^ 'plrgdslName'
-> ProjectsLocationsRegistriesGroupsDevicesStatesList
projectsLocationsRegistriesGroupsDevicesStatesList pPlrgdslName_ =
ProjectsLocationsRegistriesGroupsDevicesStatesList'
{ _plrgdslXgafv = Nothing
, _plrgdslUploadProtocol = Nothing
, _plrgdslAccessToken = Nothing
, _plrgdslUploadType = Nothing
, _plrgdslName = pPlrgdslName_
, _plrgdslNumStates = Nothing
, _plrgdslCallback = Nothing
} | 508 | projectsLocationsRegistriesGroupsDevicesStatesList pPlrgdslName_ =
ProjectsLocationsRegistriesGroupsDevicesStatesList'
{ _plrgdslXgafv = Nothing
, _plrgdslUploadProtocol = Nothing
, _plrgdslAccessToken = Nothing
, _plrgdslUploadType = Nothing
, _plrgdslName = pPlrgdslName_
, _plrgdslNumStates = Nothing
, _plrgdslCallback = Nothing
} | 368 | true | true | 0 | 7 | 140 | 89 | 58 | 31 | null | null |
valderman/selda | selda/src/Database/Selda/Frontend.hs | mit | createTableWithoutIndexes :: MonadSelda m => OnError -> Table a -> m ()
createTableWithoutIndexes onerror tbl = withBackend $ \b -> do
void $ exec (compileCreateTable (ppConfig b) onerror tbl) []
-- | Create all indexes for the given table. Fails if any of the table's indexes
-- already exists. | 300 | createTableWithoutIndexes :: MonadSelda m => OnError -> Table a -> m ()
createTableWithoutIndexes onerror tbl = withBackend $ \b -> do
void $ exec (compileCreateTable (ppConfig b) onerror tbl) []
-- | Create all indexes for the given table. Fails if any of the table's indexes
-- already exists. | 300 | createTableWithoutIndexes onerror tbl = withBackend $ \b -> do
void $ exec (compileCreateTable (ppConfig b) onerror tbl) []
-- | Create all indexes for the given table. Fails if any of the table's indexes
-- already exists. | 228 | false | true | 0 | 15 | 53 | 85 | 40 | 45 | null | null |
NightRa/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | doOp v (LUDiv ITChar) [l, r] = doOp v (LUDiv ITNative) [l, r] | 61 | doOp v (LUDiv ITChar) [l, r] = doOp v (LUDiv ITNative) [l, r] | 61 | doOp v (LUDiv ITChar) [l, r] = doOp v (LUDiv ITNative) [l, r] | 61 | false | false | 0 | 7 | 12 | 44 | 23 | 21 | null | null |
Zankoku-Okuno/octopus | Language/Octopus/Primitive.hs | gpl-3.0 | resolveSymbol _ _ = Nothing | 27 | resolveSymbol _ _ = Nothing | 27 | resolveSymbol _ _ = Nothing | 27 | false | false | 1 | 5 | 4 | 12 | 5 | 7 | null | null |
cjp256/manager | xenmgr/Vm/Config.hs | gpl-2.0 | vmExtraHvm num = property $ "config.extra-hvm." ++ show num | 59 | vmExtraHvm num = property $ "config.extra-hvm." ++ show num | 59 | vmExtraHvm num = property $ "config.extra-hvm." ++ show num | 59 | false | false | 0 | 6 | 8 | 20 | 9 | 11 | null | null |
ssaavedra/liquidhaskell | benchmarks/bytestring-0.9.2.1/Data/ByteString.hs | bsd-3-clause | -- | 'foldl1' is a variant of 'foldl' that has no starting value
-- argument, and thus must be applied to non-empty 'ByteStrings'.
-- This function is subject to array fusion.
-- An exception will be thrown in the case of an empty ByteString.
{-@ foldl1 :: (Word8 -> Word8 -> Word8) -> ByteStringNE -> Word8 @-}
foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldl1 f ps
| null ps = errorEmptyList "foldl1"
| otherwise = foldl f (unsafeHead ps) (unsafeTail ps) | 483 | foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldl1 f ps
| null ps = errorEmptyList "foldl1"
| otherwise = foldl f (unsafeHead ps) (unsafeTail ps) | 170 | foldl1 f ps
| null ps = errorEmptyList "foldl1"
| otherwise = foldl f (unsafeHead ps) (unsafeTail ps) | 111 | true | true | 0 | 9 | 96 | 87 | 42 | 45 | null | null |
ssaavedra/liquidhaskell | docs/slides/NEU14/02_Termination-blank.hs | bsd-3-clause | loop :: Int -> Int -> Int
loop = undefined | 52 | loop :: Int -> Int -> Int
loop = undefined | 52 | loop = undefined | 21 | false | true | 0 | 6 | 19 | 19 | 10 | 9 | null | null |
bergey/haskell-OpenGL-examples | wikibook/tutorial-05-3D/Vinyl.hs | bsd-3-clause | -- This does not result in the same face order as the C++ example.
-- The first 4 vertices correspond to the right (positive X) face.
vertices :: [V.FieldRec '[Pos]]
vertices = map (coord3d =:) $ L.V3 <$> [1, -1] <*> [1, -1] <*> [1, -1] | 236 | vertices :: [V.FieldRec '[Pos]]
vertices = map (coord3d =:) $ L.V3 <$> [1, -1] <*> [1, -1] <*> [1, -1] | 102 | vertices = map (coord3d =:) $ L.V3 <$> [1, -1] <*> [1, -1] <*> [1, -1] | 70 | true | true | 0 | 10 | 45 | 82 | 44 | 38 | null | null |
elieux/ghc | compiler/main/DynFlags.hs | bsd-3-clause | unsafeGlobalDynFlags :: DynFlags
unsafeGlobalDynFlags = unsafePerformIO $ readIORef v_unsafeGlobalDynFlags | 106 | unsafeGlobalDynFlags :: DynFlags
unsafeGlobalDynFlags = unsafePerformIO $ readIORef v_unsafeGlobalDynFlags | 106 | unsafeGlobalDynFlags = unsafePerformIO $ readIORef v_unsafeGlobalDynFlags | 73 | false | true | 0 | 6 | 8 | 18 | 9 | 9 | null | null |
edsko/cabal | Cabal/src/Distribution/PackageDescription.hs | bsd-3-clause | hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String]
hcSharedOptions = lookupHcOptions sharedOptions | 106 | hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String]
hcSharedOptions = lookupHcOptions sharedOptions | 106 | hcSharedOptions = lookupHcOptions sharedOptions | 47 | false | true | 0 | 7 | 10 | 25 | 13 | 12 | null | null |
phi16/Lambia | src/Lambia/Parse.hs | gpl-3.0 | none :: Parser ()
none = void $ many $ char ' ' <|> char '\t' | 61 | none :: Parser ()
none = void $ many $ char ' ' <|> char '\t' | 61 | none = void $ many $ char ' ' <|> char '\t' | 43 | false | true | 0 | 7 | 15 | 34 | 16 | 18 | null | null |
k16shikano/qnda | src/EPUB/HtmlReader.hs | mit | ftnText :: (ArrowXml a) => a XmlTree XmlTree
ftnText = fromSLA 0 $
processBottomUp $
(mkFtnText $<< (nextState (+1) >>> arr show) &&& this)
`when` (hasName "footnote") | 174 | ftnText :: (ArrowXml a) => a XmlTree XmlTree
ftnText = fromSLA 0 $
processBottomUp $
(mkFtnText $<< (nextState (+1) >>> arr show) &&& this)
`when` (hasName "footnote") | 174 | ftnText = fromSLA 0 $
processBottomUp $
(mkFtnText $<< (nextState (+1) >>> arr show) &&& this)
`when` (hasName "footnote") | 129 | false | true | 0 | 12 | 33 | 80 | 41 | 39 | null | null |
fffej/HS-Poker | LookupPatternMatch.hs | bsd-3-clause | getValueFromProduct 313565 = 4776 | 33 | getValueFromProduct 313565 = 4776 | 33 | getValueFromProduct 313565 = 4776 | 33 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
spechub/Hets | CSL/InteractiveTests.hs | gpl-2.0 | execSMTTester :: CMP.VarEnv -> SmtTester a -> IO (a, Int)
execSMTTester ve smt = do
(x, s) <- teFromVE ve >>= runStateT smt
hClose $ loghdl s
return (x, counter s) | 169 | execSMTTester :: CMP.VarEnv -> SmtTester a -> IO (a, Int)
execSMTTester ve smt = do
(x, s) <- teFromVE ve >>= runStateT smt
hClose $ loghdl s
return (x, counter s) | 169 | execSMTTester ve smt = do
(x, s) <- teFromVE ve >>= runStateT smt
hClose $ loghdl s
return (x, counter s) | 111 | false | true | 0 | 10 | 36 | 91 | 42 | 49 | null | null |
jaspervdj/patat | tests/haskell/Patat/Presentation/Interactive/Tests.hs | gpl-2.0 | testReadPresentationCommands :: [ArbitraryCommand] -> IO Bool
testReadPresentationCommands commands = do
tmpdir <- getTemporaryDirectory
(tmppath, h) <- IO.openBinaryTempFile tmpdir "patat.input"
IO.hSetBuffering h IO.NoBuffering
forM_ commands $ \(ArbitraryCommand s _) -> IO.hPutStr h s
IO.hSeek h IO.AbsoluteSeek 0
parsed <- replicateM (length commands) (readPresentationCommand h)
IO.hClose h
removeFile tmppath
return $ [expect | ArbitraryCommand _ expect <- commands] == parsed | 527 | testReadPresentationCommands :: [ArbitraryCommand] -> IO Bool
testReadPresentationCommands commands = do
tmpdir <- getTemporaryDirectory
(tmppath, h) <- IO.openBinaryTempFile tmpdir "patat.input"
IO.hSetBuffering h IO.NoBuffering
forM_ commands $ \(ArbitraryCommand s _) -> IO.hPutStr h s
IO.hSeek h IO.AbsoluteSeek 0
parsed <- replicateM (length commands) (readPresentationCommand h)
IO.hClose h
removeFile tmppath
return $ [expect | ArbitraryCommand _ expect <- commands] == parsed | 527 | testReadPresentationCommands commands = do
tmpdir <- getTemporaryDirectory
(tmppath, h) <- IO.openBinaryTempFile tmpdir "patat.input"
IO.hSetBuffering h IO.NoBuffering
forM_ commands $ \(ArbitraryCommand s _) -> IO.hPutStr h s
IO.hSeek h IO.AbsoluteSeek 0
parsed <- replicateM (length commands) (readPresentationCommand h)
IO.hClose h
removeFile tmppath
return $ [expect | ArbitraryCommand _ expect <- commands] == parsed | 465 | false | true | 0 | 12 | 101 | 176 | 80 | 96 | null | null |
cmahon/interactive-brokers | library/API/IB/Data.hs | bsd-3-clause | parseError :: Parser IBResponse
parseError = do
_ <- parseVersion
Error <$>
parseSignedIntField <*>
parseIntField <*>
parseStringField | 151 | parseError :: Parser IBResponse
parseError = do
_ <- parseVersion
Error <$>
parseSignedIntField <*>
parseIntField <*>
parseStringField | 151 | parseError = do
_ <- parseVersion
Error <$>
parseSignedIntField <*>
parseIntField <*>
parseStringField | 119 | false | true | 0 | 9 | 33 | 36 | 17 | 19 | null | null |
ehird/mchost | MC/Protocol/Fields.hs | bsd-3-clause | multiBlockChangeData :: String -> FieldInfo
multiBlockChangeData = simpleField [t| MultiBlockChangeData |] | 106 | multiBlockChangeData :: String -> FieldInfo
multiBlockChangeData = simpleField [t| MultiBlockChangeData |] | 106 | multiBlockChangeData = simpleField [t| MultiBlockChangeData |] | 62 | false | true | 0 | 5 | 10 | 22 | 13 | 9 | null | null |
dorchard/effect-monad | src/Control/Effect/Parameterised/SafeFiles.hs | bsd-2-clause | -- hClose :: Handle -> IO ()
hClose :: Member h opens =>
SafeHandle h
-> SafeFiles (St n opens) (St n (Delete h opens)) ()
hClose (SafeHandle h) = SafeFiles (IO.hClose h) | 177 | hClose :: Member h opens =>
SafeHandle h
-> SafeFiles (St n opens) (St n (Delete h opens)) ()
hClose (SafeHandle h) = SafeFiles (IO.hClose h) | 148 | hClose (SafeHandle h) = SafeFiles (IO.hClose h) | 47 | true | true | 0 | 12 | 39 | 86 | 40 | 46 | null | null |
frantisekfarka/ghc-dsi | compiler/cmm/MkGraph.hs | bsd-3-clause | mkCallReturnsTo :: DynFlags -> CmmExpr -> Convention -> [CmmActual]
-> BlockId
-> ByteOff
-> UpdFrameOffset
-> [CmmActual]
-> CmmAGraph
mkCallReturnsTo dflags f callConv actuals ret_lbl ret_off updfr_off extra_stack = do
lastWithArgsAndExtraStack dflags Call (Young ret_lbl) callConv actuals
updfr_off extra_stack $
toCall f (Just ret_lbl) updfr_off ret_off
-- Like mkCallReturnsTo, but does not push the return address (it is assumed to be
-- already on the stack). | 561 | mkCallReturnsTo :: DynFlags -> CmmExpr -> Convention -> [CmmActual]
-> BlockId
-> ByteOff
-> UpdFrameOffset
-> [CmmActual]
-> CmmAGraph
mkCallReturnsTo dflags f callConv actuals ret_lbl ret_off updfr_off extra_stack = do
lastWithArgsAndExtraStack dflags Call (Young ret_lbl) callConv actuals
updfr_off extra_stack $
toCall f (Just ret_lbl) updfr_off ret_off
-- Like mkCallReturnsTo, but does not push the return address (it is assumed to be
-- already on the stack). | 561 | mkCallReturnsTo dflags f callConv actuals ret_lbl ret_off updfr_off extra_stack = do
lastWithArgsAndExtraStack dflags Call (Young ret_lbl) callConv actuals
updfr_off extra_stack $
toCall f (Just ret_lbl) updfr_off ret_off
-- Like mkCallReturnsTo, but does not push the return address (it is assumed to be
-- already on the stack). | 345 | false | true | 0 | 13 | 160 | 111 | 56 | 55 | null | null |
fmapfmapfmap/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/DescribeHSMClientCertificates.hs | mpl-2.0 | -- | Creates a value of 'DescribeHSMClientCertificates' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dhccTagValues'
--
-- * 'dhccTagKeys'
--
-- * 'dhccHSMClientCertificateIdentifier'
--
-- * 'dhccMarker'
--
-- * 'dhccMaxRecords'
describeHSMClientCertificates
:: DescribeHSMClientCertificates
describeHSMClientCertificates =
DescribeHSMClientCertificates'
{ _dhccTagValues = Nothing
, _dhccTagKeys = Nothing
, _dhccHSMClientCertificateIdentifier = Nothing
, _dhccMarker = Nothing
, _dhccMaxRecords = Nothing
} | 629 | describeHSMClientCertificates
:: DescribeHSMClientCertificates
describeHSMClientCertificates =
DescribeHSMClientCertificates'
{ _dhccTagValues = Nothing
, _dhccTagKeys = Nothing
, _dhccHSMClientCertificateIdentifier = Nothing
, _dhccMarker = Nothing
, _dhccMaxRecords = Nothing
} | 311 | describeHSMClientCertificates =
DescribeHSMClientCertificates'
{ _dhccTagValues = Nothing
, _dhccTagKeys = Nothing
, _dhccHSMClientCertificateIdentifier = Nothing
, _dhccMarker = Nothing
, _dhccMaxRecords = Nothing
} | 244 | true | true | 1 | 7 | 108 | 63 | 41 | 22 | null | null |
mcschroeder/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcTyFamInsts (ForAllTy bndr ty) = tcTyFamInsts (binderType bndr)
++ tcTyFamInsts ty | 117 | tcTyFamInsts (ForAllTy bndr ty) = tcTyFamInsts (binderType bndr)
++ tcTyFamInsts ty | 117 | tcTyFamInsts (ForAllTy bndr ty) = tcTyFamInsts (binderType bndr)
++ tcTyFamInsts ty | 117 | false | false | 0 | 8 | 44 | 33 | 15 | 18 | null | null |
bravit/Idris-dev | src/Idris/Primitives.hs | bsd-3-clause | bCmp :: IntTy -> (forall a. (Integral a, Ord a) => a -> a -> Bool) -> [Const] -> Maybe Const
bCmp (ITFixed IT8) op [B8 x, B8 y] = Just $ I (if (op x y) then 1 else 0) | 173 | bCmp :: IntTy -> (forall a. (Integral a, Ord a) => a -> a -> Bool) -> [Const] -> Maybe Const
bCmp (ITFixed IT8) op [B8 x, B8 y] = Just $ I (if (op x y) then 1 else 0) | 173 | bCmp (ITFixed IT8) op [B8 x, B8 y] = Just $ I (if (op x y) then 1 else 0) | 80 | false | true | 0 | 11 | 47 | 111 | 58 | 53 | null | null |
mboes/dedukti | System/Console/Option.hs | gpl-3.0 | -- | Parse the arguments from the command line into a triple
-- consisting of a list of options, a list of non options and a list
-- of errors.
parseCmdline :: Description f -> [String] -> ([f], [String], [String])
parseCmdline desc args =
let (hyphened, rest) = partition (\arg -> "-" `isPrefixOf` arg) args
(errors, flags) = partitionEithers $ map toFlag hyphened
in (flags, rest, errors)
where flagmap = concatMap fst desc
unpack ('-':'-':name) = (name, "")
unpack ('-':name:arg) = ([name], arg)
unpack x = error $ "Malformed argument: " ++ x
lookupFlag name arg (Nullary n f : desc)
| fst (unpack n) == name =
if null arg
then Right f
else Left $ "No argument expected for flag " ++ n
lookupFlag name arg (Unary n f : desc)
| fst (unpack n) == name = Right (f arg)
lookupFlag name _ [] = Left $ "Flag not found: " ++ name
lookupFlag name arg (_:desc) = lookupFlag name arg desc
toFlag x | (name, arg) <- unpack x = lookupFlag name arg flagmap
-- | Print short help message to stderr. | 1,164 | parseCmdline :: Description f -> [String] -> ([f], [String], [String])
parseCmdline desc args =
let (hyphened, rest) = partition (\arg -> "-" `isPrefixOf` arg) args
(errors, flags) = partitionEithers $ map toFlag hyphened
in (flags, rest, errors)
where flagmap = concatMap fst desc
unpack ('-':'-':name) = (name, "")
unpack ('-':name:arg) = ([name], arg)
unpack x = error $ "Malformed argument: " ++ x
lookupFlag name arg (Nullary n f : desc)
| fst (unpack n) == name =
if null arg
then Right f
else Left $ "No argument expected for flag " ++ n
lookupFlag name arg (Unary n f : desc)
| fst (unpack n) == name = Right (f arg)
lookupFlag name _ [] = Left $ "Flag not found: " ++ name
lookupFlag name arg (_:desc) = lookupFlag name arg desc
toFlag x | (name, arg) <- unpack x = lookupFlag name arg flagmap
-- | Print short help message to stderr. | 1,020 | parseCmdline desc args =
let (hyphened, rest) = partition (\arg -> "-" `isPrefixOf` arg) args
(errors, flags) = partitionEithers $ map toFlag hyphened
in (flags, rest, errors)
where flagmap = concatMap fst desc
unpack ('-':'-':name) = (name, "")
unpack ('-':name:arg) = ([name], arg)
unpack x = error $ "Malformed argument: " ++ x
lookupFlag name arg (Nullary n f : desc)
| fst (unpack n) == name =
if null arg
then Right f
else Left $ "No argument expected for flag " ++ n
lookupFlag name arg (Unary n f : desc)
| fst (unpack n) == name = Right (f arg)
lookupFlag name _ [] = Left $ "Flag not found: " ++ name
lookupFlag name arg (_:desc) = lookupFlag name arg desc
toFlag x | (name, arg) <- unpack x = lookupFlag name arg flagmap
-- | Print short help message to stderr. | 949 | true | true | 2 | 12 | 362 | 420 | 209 | 211 | null | null |
ricardopenyamari/ir2haskell | clir-parser-haskell-master/lib/sexp-grammar/examples/ExprTH.hs | gpl-2.0 | test :: String -> SexpG a -> (a, String)
test str g = either error id $ do
e <- decodeWith g (B8.pack str)
sexp' <- genSexp g e
return (e, B8.unpack (Sexp.encode sexp'))
-- λ> test "(cond :pred 1 :true (+ 42 10) :false (* 2 (* 2 2)))" (sexpIso :: SexpG Expr)
-- (IfZero (Lit 1) (Add (Lit 42) (Lit 10)) (Just (Mul (Lit 2) (Mul (Lit 2) (Lit 2)))),"(cond :false (* 2 (* 2 2)) :pred 1 :true (+ 42 10))") | 406 | test :: String -> SexpG a -> (a, String)
test str g = either error id $ do
e <- decodeWith g (B8.pack str)
sexp' <- genSexp g e
return (e, B8.unpack (Sexp.encode sexp'))
-- λ> test "(cond :pred 1 :true (+ 42 10) :false (* 2 (* 2 2)))" (sexpIso :: SexpG Expr)
-- (IfZero (Lit 1) (Add (Lit 42) (Lit 10)) (Just (Mul (Lit 2) (Mul (Lit 2) (Lit 2)))),"(cond :false (* 2 (* 2 2)) :pred 1 :true (+ 42 10))") | 406 | test str g = either error id $ do
e <- decodeWith g (B8.pack str)
sexp' <- genSexp g e
return (e, B8.unpack (Sexp.encode sexp'))
-- λ> test "(cond :pred 1 :true (+ 42 10) :false (* 2 (* 2 2)))" (sexpIso :: SexpG Expr)
-- (IfZero (Lit 1) (Add (Lit 42) (Lit 10)) (Just (Mul (Lit 2) (Mul (Lit 2) (Lit 2)))),"(cond :false (* 2 (* 2 2)) :pred 1 :true (+ 42 10))") | 365 | false | true | 0 | 13 | 90 | 101 | 49 | 52 | null | null |
acfoltzer/nbt | src/Data/NBT.hs | bsd-3-clause | typeOf ListTag {} = ListType | 33 | typeOf ListTag {} = ListType | 33 | typeOf ListTag {} = ListType | 33 | false | false | 0 | 6 | 9 | 13 | 6 | 7 | null | null |
dimara/ganeti | src/Ganeti/HTools/Node.hs | bsd-2-clause | pCpuEff :: Node -> Double
pCpuEff n = pCpu n / tCpuSpeed n | 58 | pCpuEff :: Node -> Double
pCpuEff n = pCpu n / tCpuSpeed n | 58 | pCpuEff n = pCpu n / tCpuSpeed n | 32 | false | true | 0 | 6 | 12 | 28 | 13 | 15 | null | null |
TOSPIO/yi | src/library/Yi/Mode/Haskell/Dollarify.hs | gpl-2.0 | -- Assumes length of token is one character
queueReplaceWith :: R.YiString -> TT -> QueuedUpdate
queueReplaceWith s t = QueuedUpdate { qUpdatePoint = posnOfs $ tokPosn t
, qInsert = s
, qDelete = 1
} | 307 | queueReplaceWith :: R.YiString -> TT -> QueuedUpdate
queueReplaceWith s t = QueuedUpdate { qUpdatePoint = posnOfs $ tokPosn t
, qInsert = s
, qDelete = 1
} | 263 | queueReplaceWith s t = QueuedUpdate { qUpdatePoint = posnOfs $ tokPosn t
, qInsert = s
, qDelete = 1
} | 210 | true | true | 0 | 8 | 143 | 54 | 30 | 24 | null | null |
deontologician/orbRPG | Game/OrbRPG/Combinations.hs | gpl-3.0 | -- Primary + Demon
P Red @>> D Mammon = T Piston | 48 | P Red @>> D Mammon = T Piston | 29 | P Red @>> D Mammon = T Piston | 29 | true | false | 3 | 6 | 11 | 24 | 10 | 14 | null | null |
ml9951/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | dsRecCmd
:: DsCmdEnv -- arrow combinators
-> IdSet -- set of local vars available to this statement
-> [CmdLStmt Id] -- list of statements inside the RecCmd
-> [Id] -- list of vars defined here and used later
-> [HsExpr Id] -- expressions corresponding to later_ids
-> [Id] -- list of vars fed back through the loop
-> [HsExpr Id] -- expressions corresponding to rec_ids
-> DsM (CoreExpr, -- desugared statement
IdSet, -- subset of local vars that occur free
[Id]) -- same local vars as a list
dsRecCmd ids local_vars stmts later_ids later_rets rec_ids rec_rets = do
let
later_id_set = mkVarSet later_ids
rec_id_set = mkVarSet rec_ids
local_vars' = rec_id_set `unionVarSet` later_id_set `unionVarSet` local_vars
-- mk_pair_fn = \ (out_ids) -> ((later_rets),(rec_rets))
core_later_rets <- mapM dsExpr later_rets
core_rec_rets <- mapM dsExpr rec_rets
let
-- possibly polymorphic version of vars of later_ids and rec_ids
out_ids = varSetElems (unionVarSets (map exprFreeIds (core_later_rets ++ core_rec_rets)))
out_ty = mkBigCoreVarTupTy out_ids
later_tuple = mkBigCoreTup core_later_rets
later_ty = mkBigCoreVarTupTy later_ids
rec_tuple = mkBigCoreTup core_rec_rets
rec_ty = mkBigCoreVarTupTy rec_ids
out_pair = mkCorePairExpr later_tuple rec_tuple
out_pair_ty = mkCorePairTy later_ty rec_ty
mk_pair_fn <- matchEnv out_ids out_pair
-- ss
(core_stmts, fv_stmts, env_ids) <- dsfixCmdStmts ids local_vars' out_ids stmts
-- squash_pair_fn = \ ((env1_ids), ~(rec_ids)) -> (env_ids)
rec_id <- newSysLocalDs rec_ty
let
env1_id_set = fv_stmts `minusVarSet` rec_id_set
env1_ids = varSetElems env1_id_set
env1_ty = mkBigCoreVarTupTy env1_ids
in_pair_ty = mkCorePairTy env1_ty rec_ty
core_body = mkBigCoreTup (map selectVar env_ids)
where
selectVar v
| v `elemVarSet` rec_id_set
= mkTupleSelector rec_ids v rec_id (Var rec_id)
| otherwise = Var v
squash_pair_fn <- matchEnvStack env1_ids rec_id core_body
-- loop (premap squash_pair_fn (ss >>> arr mk_pair_fn))
let
env_ty = mkBigCoreVarTupTy env_ids
core_loop = do_loop ids env1_ty later_ty rec_ty
(do_premap ids in_pair_ty env_ty out_pair_ty
squash_pair_fn
(do_compose ids env_ty out_ty out_pair_ty
core_stmts
(do_arr ids out_ty out_pair_ty mk_pair_fn)))
return (core_loop, env1_id_set, env1_ids)
{-
A sequence of statements (as in a rec) is desugared to an arrow between
two environments (no stack)
-} | 2,973 | dsRecCmd
:: DsCmdEnv -- arrow combinators
-> IdSet -- set of local vars available to this statement
-> [CmdLStmt Id] -- list of statements inside the RecCmd
-> [Id] -- list of vars defined here and used later
-> [HsExpr Id] -- expressions corresponding to later_ids
-> [Id] -- list of vars fed back through the loop
-> [HsExpr Id] -- expressions corresponding to rec_ids
-> DsM (CoreExpr, -- desugared statement
IdSet, -- subset of local vars that occur free
[Id])
dsRecCmd ids local_vars stmts later_ids later_rets rec_ids rec_rets = do
let
later_id_set = mkVarSet later_ids
rec_id_set = mkVarSet rec_ids
local_vars' = rec_id_set `unionVarSet` later_id_set `unionVarSet` local_vars
-- mk_pair_fn = \ (out_ids) -> ((later_rets),(rec_rets))
core_later_rets <- mapM dsExpr later_rets
core_rec_rets <- mapM dsExpr rec_rets
let
-- possibly polymorphic version of vars of later_ids and rec_ids
out_ids = varSetElems (unionVarSets (map exprFreeIds (core_later_rets ++ core_rec_rets)))
out_ty = mkBigCoreVarTupTy out_ids
later_tuple = mkBigCoreTup core_later_rets
later_ty = mkBigCoreVarTupTy later_ids
rec_tuple = mkBigCoreTup core_rec_rets
rec_ty = mkBigCoreVarTupTy rec_ids
out_pair = mkCorePairExpr later_tuple rec_tuple
out_pair_ty = mkCorePairTy later_ty rec_ty
mk_pair_fn <- matchEnv out_ids out_pair
-- ss
(core_stmts, fv_stmts, env_ids) <- dsfixCmdStmts ids local_vars' out_ids stmts
-- squash_pair_fn = \ ((env1_ids), ~(rec_ids)) -> (env_ids)
rec_id <- newSysLocalDs rec_ty
let
env1_id_set = fv_stmts `minusVarSet` rec_id_set
env1_ids = varSetElems env1_id_set
env1_ty = mkBigCoreVarTupTy env1_ids
in_pair_ty = mkCorePairTy env1_ty rec_ty
core_body = mkBigCoreTup (map selectVar env_ids)
where
selectVar v
| v `elemVarSet` rec_id_set
= mkTupleSelector rec_ids v rec_id (Var rec_id)
| otherwise = Var v
squash_pair_fn <- matchEnvStack env1_ids rec_id core_body
-- loop (premap squash_pair_fn (ss >>> arr mk_pair_fn))
let
env_ty = mkBigCoreVarTupTy env_ids
core_loop = do_loop ids env1_ty later_ty rec_ty
(do_premap ids in_pair_ty env_ty out_pair_ty
squash_pair_fn
(do_compose ids env_ty out_ty out_pair_ty
core_stmts
(do_arr ids out_ty out_pair_ty mk_pair_fn)))
return (core_loop, env1_id_set, env1_ids)
{-
A sequence of statements (as in a rec) is desugared to an arrow between
two environments (no stack)
-} | 2,933 | dsRecCmd ids local_vars stmts later_ids later_rets rec_ids rec_rets = do
let
later_id_set = mkVarSet later_ids
rec_id_set = mkVarSet rec_ids
local_vars' = rec_id_set `unionVarSet` later_id_set `unionVarSet` local_vars
-- mk_pair_fn = \ (out_ids) -> ((later_rets),(rec_rets))
core_later_rets <- mapM dsExpr later_rets
core_rec_rets <- mapM dsExpr rec_rets
let
-- possibly polymorphic version of vars of later_ids and rec_ids
out_ids = varSetElems (unionVarSets (map exprFreeIds (core_later_rets ++ core_rec_rets)))
out_ty = mkBigCoreVarTupTy out_ids
later_tuple = mkBigCoreTup core_later_rets
later_ty = mkBigCoreVarTupTy later_ids
rec_tuple = mkBigCoreTup core_rec_rets
rec_ty = mkBigCoreVarTupTy rec_ids
out_pair = mkCorePairExpr later_tuple rec_tuple
out_pair_ty = mkCorePairTy later_ty rec_ty
mk_pair_fn <- matchEnv out_ids out_pair
-- ss
(core_stmts, fv_stmts, env_ids) <- dsfixCmdStmts ids local_vars' out_ids stmts
-- squash_pair_fn = \ ((env1_ids), ~(rec_ids)) -> (env_ids)
rec_id <- newSysLocalDs rec_ty
let
env1_id_set = fv_stmts `minusVarSet` rec_id_set
env1_ids = varSetElems env1_id_set
env1_ty = mkBigCoreVarTupTy env1_ids
in_pair_ty = mkCorePairTy env1_ty rec_ty
core_body = mkBigCoreTup (map selectVar env_ids)
where
selectVar v
| v `elemVarSet` rec_id_set
= mkTupleSelector rec_ids v rec_id (Var rec_id)
| otherwise = Var v
squash_pair_fn <- matchEnvStack env1_ids rec_id core_body
-- loop (premap squash_pair_fn (ss >>> arr mk_pair_fn))
let
env_ty = mkBigCoreVarTupTy env_ids
core_loop = do_loop ids env1_ty later_ty rec_ty
(do_premap ids in_pair_ty env_ty out_pair_ty
squash_pair_fn
(do_compose ids env_ty out_ty out_pair_ty
core_stmts
(do_arr ids out_ty out_pair_ty mk_pair_fn)))
return (core_loop, env1_id_set, env1_ids)
{-
A sequence of statements (as in a rec) is desugared to an arrow between
two environments (no stack)
-} | 2,273 | true | true | 0 | 16 | 952 | 517 | 264 | 253 | null | null |
janschulz/pandoc | src/Text/Pandoc/Writers/CommonMark.hs | gpl-2.0 | inlineToNodes :: Inline -> [Node] -> [Node]
inlineToNodes (Str s) = (node (TEXT (T.pack s)) [] :) | 97 | inlineToNodes :: Inline -> [Node] -> [Node]
inlineToNodes (Str s) = (node (TEXT (T.pack s)) [] :) | 97 | inlineToNodes (Str s) = (node (TEXT (T.pack s)) [] :) | 53 | false | true | 0 | 11 | 16 | 59 | 31 | 28 | null | null |
rueshyna/gogol | gogol-sheets/gen/Network/Google/Sheets/Types/Product.hs | mpl-2.0 | -- | The number of rows or columns to append.
adrLength :: Lens' AppendDimensionRequest (Maybe Int32)
adrLength
= lens _adrLength (\ s a -> s{_adrLength = a}) .
mapping _Coerce | 184 | adrLength :: Lens' AppendDimensionRequest (Maybe Int32)
adrLength
= lens _adrLength (\ s a -> s{_adrLength = a}) .
mapping _Coerce | 138 | adrLength
= lens _adrLength (\ s a -> s{_adrLength = a}) .
mapping _Coerce | 82 | true | true | 1 | 10 | 37 | 58 | 28 | 30 | null | null |
siddhanathan/ghc | compiler/prelude/THNames.hs | bsd-3-clause | namedWildCardTIdKey = mkPreludeMiscIdUnique 396 | 47 | namedWildCardTIdKey = mkPreludeMiscIdUnique 396 | 47 | namedWildCardTIdKey = mkPreludeMiscIdUnique 396 | 47 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
joelelmercarlson/bifrost | src/Control.hs | mit | getCursorKeyDirections :: GLFW.Window -> IO (Double, Double)
getCursorKeyDirections win = do
x0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Left
x1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Right
y0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Up
y1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Down
let x0n = if x0 then (-1) else 0
x1n = if x1 then 1 else 0
y0n = if y0 then (-1) else 0
y1n = if y1 then 1 else 0
return (x0n + x1n, y0n + y1n) | 479 | getCursorKeyDirections :: GLFW.Window -> IO (Double, Double)
getCursorKeyDirections win = do
x0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Left
x1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Right
y0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Up
y1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Down
let x0n = if x0 then (-1) else 0
x1n = if x1 then 1 else 0
y0n = if y0 then (-1) else 0
y1n = if y1 then 1 else 0
return (x0n + x1n, y0n + y1n) | 479 | getCursorKeyDirections win = do
x0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Left
x1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Right
y0 <- isPress `fmap` GLFW.getKey win GLFW.Key'Up
y1 <- isPress `fmap` GLFW.getKey win GLFW.Key'Down
let x0n = if x0 then (-1) else 0
x1n = if x1 then 1 else 0
y0n = if y0 then (-1) else 0
y1n = if y1 then 1 else 0
return (x0n + x1n, y0n + y1n) | 418 | false | true | 0 | 12 | 118 | 203 | 108 | 95 | null | null |
mettekou/ghc | compiler/main/ErrUtils.hs | bsd-3-clause | mkErrDoc :: DynFlags -> SrcSpan -> PrintUnqualified -> ErrDoc -> ErrMsg
mkErrDoc dflags = mk_err_msg dflags SevError | 116 | mkErrDoc :: DynFlags -> SrcSpan -> PrintUnqualified -> ErrDoc -> ErrMsg
mkErrDoc dflags = mk_err_msg dflags SevError | 116 | mkErrDoc dflags = mk_err_msg dflags SevError | 44 | false | true | 0 | 8 | 16 | 35 | 17 | 18 | null | null |
apyrgio/snf-ganeti | src/Ganeti/OpParams.hs | bsd-2-clause | -- | Default a field to 'False'.
defaultFalse :: String -> Field
defaultFalse = defaultField [| False |] . booleanField | 119 | defaultFalse :: String -> Field
defaultFalse = defaultField [| False |] . booleanField | 86 | defaultFalse = defaultField [| False |] . booleanField | 54 | true | true | 0 | 6 | 19 | 26 | 15 | 11 | null | null |
dysinger/amazonka | amazonka-ecs/gen/Network/AWS/ECS/Types.hs | mpl-2.0 | -- | The name of the container to mount volumes from.
vfSourceContainer :: Lens' VolumeFrom (Maybe Text)
vfSourceContainer =
lens _vfSourceContainer (\s a -> s { _vfSourceContainer = a }) | 191 | vfSourceContainer :: Lens' VolumeFrom (Maybe Text)
vfSourceContainer =
lens _vfSourceContainer (\s a -> s { _vfSourceContainer = a }) | 137 | vfSourceContainer =
lens _vfSourceContainer (\s a -> s { _vfSourceContainer = a }) | 86 | true | true | 0 | 9 | 33 | 46 | 25 | 21 | null | null |
gcross/PauliQSC | Data/Quantum/Small/Operator/ReducedEschelonForm.hs | bsd-2-clause | makeSingletonPseudoGeneratorFromColumn :: Int → Operator → PseudoGenerator -- {{{
makeSingletonPseudoGeneratorFromColumn column op =
case getPauliAt column op of
X → PGX op
Y → PGX op
Z → PGZ op
_ → error $ "tried to make a pseudo-generator using trivial column " ++ show column ++ " of operator " ++ show op
| 345 | makeSingletonPseudoGeneratorFromColumn :: Int → Operator → PseudoGenerator
makeSingletonPseudoGeneratorFromColumn column op =
case getPauliAt column op of
X → PGX op
Y → PGX op
Z → PGZ op
_ → error $ "tried to make a pseudo-generator using trivial column " ++ show column ++ " of operator " ++ show op
| 338 | makeSingletonPseudoGeneratorFromColumn column op =
case getPauliAt column op of
X → PGX op
Y → PGX op
Z → PGZ op
_ → error $ "tried to make a pseudo-generator using trivial column " ++ show column ++ " of operator " ++ show op
| 263 | true | true | 0 | 11 | 90 | 89 | 42 | 47 | null | null |
roberth/uu-helium | test/parser/Contexts.hs | gpl-3.0 | b = 4 | 5 | b = 4 | 5 | b = 4 | 5 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
tbarnetlamb/hyphen | hyphen/lowlevel_src/HsType.hs | gpl-2.0 | breakFnTypeUnsafe :: HsType -> (HsType, HsType)
breakFnTypeUnsafe (HsType {typeHead=Left tc, typeTail=[fr, to]})
| tc == fnTyCon = (fr, to) | 141 | breakFnTypeUnsafe :: HsType -> (HsType, HsType)
breakFnTypeUnsafe (HsType {typeHead=Left tc, typeTail=[fr, to]})
| tc == fnTyCon = (fr, to) | 141 | breakFnTypeUnsafe (HsType {typeHead=Left tc, typeTail=[fr, to]})
| tc == fnTyCon = (fr, to) | 93 | false | true | 0 | 9 | 20 | 72 | 38 | 34 | null | null |
brodyberg/Notes | ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/Chapter10Exercises.hs | mit | f'' :: [[Char]] -> [[Char]] -> [([Char], [Char], [Char])]
f'' ns vs = [(n, v, n') | n <- ns, v <- vs, n' <- ns] | 111 | f'' :: [[Char]] -> [[Char]] -> [([Char], [Char], [Char])]
f'' ns vs = [(n, v, n') | n <- ns, v <- vs, n' <- ns] | 111 | f'' ns vs = [(n, v, n') | n <- ns, v <- vs, n' <- ns] | 53 | false | true | 0 | 9 | 25 | 93 | 54 | 39 | null | null |
brow/noise | src/Text/Noise/Renderer/SVG/Attributes.hs | mit | y2 :: D.Number -> Attribute
y2 = SVG.y2 . stringValue . show | 60 | y2 :: D.Number -> Attribute
y2 = SVG.y2 . stringValue . show | 60 | y2 = SVG.y2 . stringValue . show | 32 | false | true | 0 | 7 | 11 | 34 | 15 | 19 | null | null |
markus-git/co-feldspar | src/Feldspar/Software/Frontend.hs | bsd-3-clause | -- | Get a primitive value from a handle.
fget :: (Formattable a, SType' a) => Handle -> Software (SExp a)
fget = Software . Imp.fget | 133 | fget :: (Formattable a, SType' a) => Handle -> Software (SExp a)
fget = Software . Imp.fget | 91 | fget = Software . Imp.fget | 26 | true | true | 0 | 10 | 25 | 52 | 25 | 27 | null | null |
Lignum/Tetoris | src/Board.hs | mit | boardShiftDownFrom :: Int -> State Board ()
boardShiftDownFrom y = do
b <- get
let (bw, bh) = boardSize b
if y >= 0 && y < bh && not (boardRowEmpty b $ y - 1) then do boardMoveRow (y - 1) y
boardShiftDownFrom (y - 1)
else pure () | 353 | boardShiftDownFrom :: Int -> State Board ()
boardShiftDownFrom y = do
b <- get
let (bw, bh) = boardSize b
if y >= 0 && y < bh && not (boardRowEmpty b $ y - 1) then do boardMoveRow (y - 1) y
boardShiftDownFrom (y - 1)
else pure () | 353 | boardShiftDownFrom y = do
b <- get
let (bw, bh) = boardSize b
if y >= 0 && y < bh && not (boardRowEmpty b $ y - 1) then do boardMoveRow (y - 1) y
boardShiftDownFrom (y - 1)
else pure () | 309 | false | true | 0 | 14 | 173 | 133 | 62 | 71 | null | null |
TK009/sensorbox | src/LatestStore.hs | mit | setSensorData :: SensorData -> Update LatestStore ()
setSensorData sensorData@SensorData {sdSensor = sensor} = do
LatestStore allData <- get
put . LatestStore $ Map.insert sensor sensorData allData | 205 | setSensorData :: SensorData -> Update LatestStore ()
setSensorData sensorData@SensorData {sdSensor = sensor} = do
LatestStore allData <- get
put . LatestStore $ Map.insert sensor sensorData allData | 205 | setSensorData sensorData@SensorData {sdSensor = sensor} = do
LatestStore allData <- get
put . LatestStore $ Map.insert sensor sensorData allData | 152 | false | true | 0 | 10 | 33 | 72 | 33 | 39 | null | null |
da-x/lamdu | Lamdu/Sugar/Convert/Binder/Params.hs | gpl-3.0 | convertBinderToFunction ::
Monad m =>
T m (ValI m) -> BinderKind m -> Val (ValIProperty m) ->
T m (ParamAddResult, ValI m)
convertBinderToFunction mkArg binderKind val =
do
(newParam, newValI) <- DataOps.lambdaWrap (val ^. Val.payload)
case binderKind of
BinderKindDef defI ->
convertVarToCalls mkArg (ExprIRef.globalId defI) val
BinderKindLet redexLam ->
convertVarToCalls mkArg
(redexLam ^. V.lamParamId) (redexLam ^. V.lamResult)
BinderKindLambda -> error "Lambda will never be an empty-params binder"
return
( ParamAddResultNewVar (EntityId.ofLambdaParam newParam) newParam
, newValI
) | 749 | convertBinderToFunction ::
Monad m =>
T m (ValI m) -> BinderKind m -> Val (ValIProperty m) ->
T m (ParamAddResult, ValI m)
convertBinderToFunction mkArg binderKind val =
do
(newParam, newValI) <- DataOps.lambdaWrap (val ^. Val.payload)
case binderKind of
BinderKindDef defI ->
convertVarToCalls mkArg (ExprIRef.globalId defI) val
BinderKindLet redexLam ->
convertVarToCalls mkArg
(redexLam ^. V.lamParamId) (redexLam ^. V.lamResult)
BinderKindLambda -> error "Lambda will never be an empty-params binder"
return
( ParamAddResultNewVar (EntityId.ofLambdaParam newParam) newParam
, newValI
) | 749 | convertBinderToFunction mkArg binderKind val =
do
(newParam, newValI) <- DataOps.lambdaWrap (val ^. Val.payload)
case binderKind of
BinderKindDef defI ->
convertVarToCalls mkArg (ExprIRef.globalId defI) val
BinderKindLet redexLam ->
convertVarToCalls mkArg
(redexLam ^. V.lamParamId) (redexLam ^. V.lamResult)
BinderKindLambda -> error "Lambda will never be an empty-params binder"
return
( ParamAddResultNewVar (EntityId.ofLambdaParam newParam) newParam
, newValI
) | 614 | false | true | 0 | 13 | 235 | 201 | 96 | 105 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Codebase/Path.hs | mit | parseSplit' :: (String -> Either String NameSegment)
-> String
-> Either String Split'
parseSplit' lastSegment p = do
(p', rem) <- parsePathImpl' p
seg <- lastSegment rem
pure (p', seg) | 215 | parseSplit' :: (String -> Either String NameSegment)
-> String
-> Either String Split'
parseSplit' lastSegment p = do
(p', rem) <- parsePathImpl' p
seg <- lastSegment rem
pure (p', seg) | 215 | parseSplit' lastSegment p = do
(p', rem) <- parsePathImpl' p
seg <- lastSegment rem
pure (p', seg) | 104 | false | true | 0 | 8 | 59 | 79 | 38 | 41 | null | null |
Twinside/pandoc | src/Text/Pandoc/Writers/Docx.hs | gpl-2.0 | getNumId :: WS Int
getNumId = (((baseListId - 1) +) . length) `fmap` gets stLists | 81 | getNumId :: WS Int
getNumId = (((baseListId - 1) +) . length) `fmap` gets stLists | 81 | getNumId = (((baseListId - 1) +) . length) `fmap` gets stLists | 62 | false | true | 0 | 10 | 14 | 41 | 23 | 18 | null | null |
robashton/ghcmud | src/CommandParsing.hs | bsd-3-clause | isLookCommand "peer" = True | 27 | isLookCommand "peer" = True | 27 | isLookCommand "peer" = True | 27 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
olorin/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'VPCAttachment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'vaState'
--
-- * 'vaVPCId'
vpcAttachment
:: VPCAttachment
vpcAttachment =
VPCAttachment'
{ _vaState = Nothing
, _vaVPCId = Nothing
} | 326 | vpcAttachment
:: VPCAttachment
vpcAttachment =
VPCAttachment'
{ _vaState = Nothing
, _vaVPCId = Nothing
} | 125 | vpcAttachment =
VPCAttachment'
{ _vaState = Nothing
, _vaVPCId = Nothing
} | 90 | true | true | 0 | 6 | 72 | 32 | 22 | 10 | null | null |
forste/haReFork | tools/base/TI/TiClasses.hs | bsd-3-clause | tcLocalDecls ds = fmap (snd.snd) # tcTopDecls id ds | 51 | tcLocalDecls ds = fmap (snd.snd) # tcTopDecls id ds | 51 | tcLocalDecls ds = fmap (snd.snd) # tcTopDecls id ds | 51 | false | false | 0 | 8 | 8 | 26 | 12 | 14 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- | The LUXI daemon waits this number of seconds for ensuring that a canceled
-- job terminates before giving up.
luxiCancelJobTimeout :: Int
luxiCancelJobTimeout = (luxiDefRwto - 1) `div` 4 | 191 | luxiCancelJobTimeout :: Int
luxiCancelJobTimeout = (luxiDefRwto - 1) `div` 4 | 76 | luxiCancelJobTimeout = (luxiDefRwto - 1) `div` 4 | 48 | true | true | 0 | 7 | 30 | 26 | 16 | 10 | null | null |
TOSPIO/yi | src/library/Yi/Syntax/JavaScript.hs | gpl-2.0 | -- | General recovery parser, inserts an error token.
anything :: P s TT
anything = recoverWith (pure errorToken) | 113 | anything :: P s TT
anything = recoverWith (pure errorToken) | 59 | anything = recoverWith (pure errorToken) | 40 | true | true | 0 | 7 | 18 | 26 | 13 | 13 | null | null |
copland/cmdargs | System/Console/CmdArgs/Implicit/Local.hs | bsd-3-clause | flag_ name (Ann a b) = map (flagAnn a) $ flag_ name b | 53 | flag_ name (Ann a b) = map (flagAnn a) $ flag_ name b | 53 | flag_ name (Ann a b) = map (flagAnn a) $ flag_ name b | 53 | false | false | 0 | 8 | 12 | 38 | 17 | 21 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_428 (176#) = happyShift action_86 | 40 | action_428 (176#) = happyShift action_86 | 40 | action_428 (176#) = happyShift action_86 | 40 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
CharlesRandles/cryptoChallenge | challenge12.hs | gpl-3.0 | findBlockSize :: B.ByteString -> Int
findBlockSize str = if lenCipher == lenNextCipher
then findBlockSize nextStr
else lenNextCipher - lenCipher
where lenCipher = B8.length (encrypt str)
lenNextCipher = B8.length (encrypt nextStr)
nextStr = B.append str (B8.pack [constChar]) | 387 | findBlockSize :: B.ByteString -> Int
findBlockSize str = if lenCipher == lenNextCipher
then findBlockSize nextStr
else lenNextCipher - lenCipher
where lenCipher = B8.length (encrypt str)
lenNextCipher = B8.length (encrypt nextStr)
nextStr = B.append str (B8.pack [constChar]) | 387 | findBlockSize str = if lenCipher == lenNextCipher
then findBlockSize nextStr
else lenNextCipher - lenCipher
where lenCipher = B8.length (encrypt str)
lenNextCipher = B8.length (encrypt nextStr)
nextStr = B.append str (B8.pack [constChar]) | 350 | false | true | 0 | 10 | 147 | 96 | 49 | 47 | null | null |
tibbe/ghc | compiler/cmm/PprC.hs | bsd-3-clause | -- This is for finding the types of foreign call arguments. For a pointer
-- argument, we always cast the argument to (void *), to avoid warnings from
-- the C compiler.
machRepHintCType :: CmmType -> ForeignHint -> SDoc
machRepHintCType _ AddrHint = ptext (sLit "void *") | 277 | machRepHintCType :: CmmType -> ForeignHint -> SDoc
machRepHintCType _ AddrHint = ptext (sLit "void *") | 106 | machRepHintCType _ AddrHint = ptext (sLit "void *") | 55 | true | true | 0 | 7 | 51 | 36 | 19 | 17 | null | null |
zaxtax/hakaru-old | Language/Hakaru/ImportanceSampler.hs | bsd-3-clause | updateMixture Nothing dist = \g0 -> let (e, g) = distSample dist g0
in (point (fromDensity e) 1, g) | 144 | updateMixture Nothing dist = \g0 -> let (e, g) = distSample dist g0
in (point (fromDensity e) 1, g) | 144 | updateMixture Nothing dist = \g0 -> let (e, g) = distSample dist g0
in (point (fromDensity e) 1, g) | 144 | false | false | 0 | 11 | 63 | 56 | 28 | 28 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.