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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
christiaanb/clash-compiler
|
examples/CochleaPlus.hs
|
bsd-2-clause
|
topEntity :: Signal (Vec 6 Integer) -> Signal (Vec 12 Integer)
topEntity = c_frm `mealy` (c_ws0,c_ts0,c_hist0)
| 111
|
topEntity :: Signal (Vec 6 Integer) -> Signal (Vec 12 Integer)
topEntity = c_frm `mealy` (c_ws0,c_ts0,c_hist0)
| 110
|
topEntity = c_frm `mealy` (c_ws0,c_ts0,c_hist0)
| 47
| false
| true
| 2
| 6
| 16
| 48
| 27
| 21
| null | null |
KommuSoft/dep-software
|
Dep.Ui.hs
|
gpl-3.0
|
clearAndExit :: IO Bool -- ^ The IO monad that handles the request to exit, always returns True.
clearAndExit = setCursorPosition 0 0 >> clearScreen >> exitSuccess >> return True
| 178
|
clearAndExit :: IO Bool
clearAndExit = setCursorPosition 0 0 >> clearScreen >> exitSuccess >> return True
| 105
|
clearAndExit = setCursorPosition 0 0 >> clearScreen >> exitSuccess >> return True
| 81
| true
| true
| 0
| 8
| 29
| 35
| 17
| 18
| null | null |
RobinKrom/fasths
|
src/Codec/Fast/Encoder.hs
|
bsd-3-clause
|
field2Cop (ByteVecField (ByteVectorField f@(FieldInstrContent fname _ _ ) maybe_len )) = contramap (fmap fromValue . assertNameIs fname) (bytevecF2Cop f maybe_len :: FEncoder (Maybe B.ByteString))
| 196
|
field2Cop (ByteVecField (ByteVectorField f@(FieldInstrContent fname _ _ ) maybe_len )) = contramap (fmap fromValue . assertNameIs fname) (bytevecF2Cop f maybe_len :: FEncoder (Maybe B.ByteString))
| 196
|
field2Cop (ByteVecField (ByteVectorField f@(FieldInstrContent fname _ _ ) maybe_len )) = contramap (fmap fromValue . assertNameIs fname) (bytevecF2Cop f maybe_len :: FEncoder (Maybe B.ByteString))
| 196
| false
| false
| 0
| 11
| 23
| 77
| 37
| 40
| null | null |
vladimir-ipatov/ganeti
|
src/Ganeti/DataCollectors/Drbd.hs
|
gpl-2.0
|
-- | The name of this data collector.
dcName :: String
dcName = "drbd"
| 70
|
dcName :: String
dcName = "drbd"
| 32
|
dcName = "drbd"
| 15
| true
| true
| 0
| 4
| 13
| 12
| 7
| 5
| null | null |
arekfu/project_euler
|
p0079/p0079.hs
|
mit
|
shortest input = (solution, checkSolution solution input)
where solution = (reverse . charSeq . makeMap) input
| 114
|
shortest input = (solution, checkSolution solution input)
where solution = (reverse . charSeq . makeMap) input
| 114
|
shortest input = (solution, checkSolution solution input)
where solution = (reverse . charSeq . makeMap) input
| 114
| false
| false
| 0
| 10
| 19
| 41
| 21
| 20
| null | null |
kfish/hogg
|
Codec/Container/Ogg/MessageHeaders.hs
|
bsd-3-clause
|
readMHlines :: MessageHeaders -> [String] -> [(MessageHeaders, String)]
readMHlines mhdrs [] = [(mhdrs, "")]
| 108
|
readMHlines :: MessageHeaders -> [String] -> [(MessageHeaders, String)]
readMHlines mhdrs [] = [(mhdrs, "")]
| 108
|
readMHlines mhdrs [] = [(mhdrs, "")]
| 36
| false
| true
| 0
| 8
| 13
| 47
| 27
| 20
| null | null |
kawamuray/ganeti
|
test/hs/Test/Ganeti/Utils.hs
|
gpl-2.0
|
prop_parseUnit :: NonNegative Int -> Property
prop_parseUnit (NonNegative n) =
conjoin
[ parseUnit (show n) ==? (Ok n::Result Int)
, parseUnit (show n ++ "m") ==? (Ok n::Result Int)
, parseUnit (show n ++ "M") ==? (Ok (truncate n_mb)::Result Int)
, parseUnit (show n ++ "g") ==? (Ok (n*1024)::Result Int)
, parseUnit (show n ++ "G") ==? (Ok (truncate n_gb)::Result Int)
, parseUnit (show n ++ "t") ==? (Ok (n*1048576)::Result Int)
, parseUnit (show n ++ "T") ==? (Ok (truncate n_tb)::Result Int)
, printTestCase "Internal error/overflow?"
(n_mb >=0 && n_gb >= 0 && n_tb >= 0)
, property (isBad (parseUnit (show n ++ "x")::Result Int))
]
where n_mb = (fromIntegral n::Rational) * 1000 * 1000 / 1024 / 1024
n_gb = n_mb * 1000
n_tb = n_gb * 1000
| 788
|
prop_parseUnit :: NonNegative Int -> Property
prop_parseUnit (NonNegative n) =
conjoin
[ parseUnit (show n) ==? (Ok n::Result Int)
, parseUnit (show n ++ "m") ==? (Ok n::Result Int)
, parseUnit (show n ++ "M") ==? (Ok (truncate n_mb)::Result Int)
, parseUnit (show n ++ "g") ==? (Ok (n*1024)::Result Int)
, parseUnit (show n ++ "G") ==? (Ok (truncate n_gb)::Result Int)
, parseUnit (show n ++ "t") ==? (Ok (n*1048576)::Result Int)
, parseUnit (show n ++ "T") ==? (Ok (truncate n_tb)::Result Int)
, printTestCase "Internal error/overflow?"
(n_mb >=0 && n_gb >= 0 && n_tb >= 0)
, property (isBad (parseUnit (show n ++ "x")::Result Int))
]
where n_mb = (fromIntegral n::Rational) * 1000 * 1000 / 1024 / 1024
n_gb = n_mb * 1000
n_tb = n_gb * 1000
| 788
|
prop_parseUnit (NonNegative n) =
conjoin
[ parseUnit (show n) ==? (Ok n::Result Int)
, parseUnit (show n ++ "m") ==? (Ok n::Result Int)
, parseUnit (show n ++ "M") ==? (Ok (truncate n_mb)::Result Int)
, parseUnit (show n ++ "g") ==? (Ok (n*1024)::Result Int)
, parseUnit (show n ++ "G") ==? (Ok (truncate n_gb)::Result Int)
, parseUnit (show n ++ "t") ==? (Ok (n*1048576)::Result Int)
, parseUnit (show n ++ "T") ==? (Ok (truncate n_tb)::Result Int)
, printTestCase "Internal error/overflow?"
(n_mb >=0 && n_gb >= 0 && n_tb >= 0)
, property (isBad (parseUnit (show n ++ "x")::Result Int))
]
where n_mb = (fromIntegral n::Rational) * 1000 * 1000 / 1024 / 1024
n_gb = n_mb * 1000
n_tb = n_gb * 1000
| 742
| false
| true
| 5
| 13
| 174
| 413
| 202
| 211
| null | null |
harlanhaskins/Letter
|
Haskell/src/Letter/Compiler/Core.hs
|
mit
|
funDecl :: String -> [String] -> String
funDecl id args = "long " ++ cleanedFunName id ++ (inParens . intercalate ", " . map (("long " ++) . cleanedExpName)) args
| 162
|
funDecl :: String -> [String] -> String
funDecl id args = "long " ++ cleanedFunName id ++ (inParens . intercalate ", " . map (("long " ++) . cleanedExpName)) args
| 162
|
funDecl id args = "long " ++ cleanedFunName id ++ (inParens . intercalate ", " . map (("long " ++) . cleanedExpName)) args
| 122
| false
| true
| 2
| 12
| 29
| 75
| 36
| 39
| null | null |
ben-schulz/Idris-dev
|
src/Idris/Delaborate.hs
|
bsd-3-clause
|
pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once"
| 148
|
pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once"
| 148
|
pprintErr' i (UniqueError _ n) = text "Unique name" <+> annName' n (showbasic n)
<+> text "is used more than once"
| 148
| false
| false
| 0
| 9
| 54
| 44
| 20
| 24
| null | null |
henrytill/hecate
|
src/Hecate/Configuration.hs
|
apache-2.0
|
getAllowMultipleKeys :: [(T.Text, TOML.Value)] -> Maybe Bool
getAllowMultipleKeys tbl
= tbl ^? tableAt "entries" . lup "allow_multiple_keys" . _Just . _Bool
| 158
|
getAllowMultipleKeys :: [(T.Text, TOML.Value)] -> Maybe Bool
getAllowMultipleKeys tbl
= tbl ^? tableAt "entries" . lup "allow_multiple_keys" . _Just . _Bool
| 158
|
getAllowMultipleKeys tbl
= tbl ^? tableAt "entries" . lup "allow_multiple_keys" . _Just . _Bool
| 97
| false
| true
| 2
| 9
| 22
| 62
| 29
| 33
| null | null |
dschalk/score3
|
Main.hs
|
mit
|
get4 _ = [-1,-1,-1,-1]
| 22
|
get4 _ = [-1,-1,-1,-1]
| 22
|
get4 _ = [-1,-1,-1,-1]
| 22
| false
| false
| 0
| 6
| 3
| 29
| 16
| 13
| null | null |
UCSD-PL/230-web
|
static/lec-intro.hs
|
mit
|
areaCircle :: CircleT -> Double
areaCircle (Circle _ _ r) = pi * r * r
| 70
|
areaCircle :: CircleT -> Double
areaCircle (Circle _ _ r) = pi * r * r
| 70
|
areaCircle (Circle _ _ r) = pi * r * r
| 38
| false
| true
| 0
| 7
| 15
| 36
| 18
| 18
| null | null |
green-haskell/ghc
|
compiler/prelude/TysPrim.hs
|
bsd-3-clause
|
mkBuiltInPrimTc :: FastString -> Unique -> TyCon -> Name
mkBuiltInPrimTc fs unique tycon
= mkWiredInName gHC_PRIM (mkTcOccFS fs)
unique
(ATyCon tycon) -- Relevant TyCon
BuiltInSyntax
| 245
|
mkBuiltInPrimTc :: FastString -> Unique -> TyCon -> Name
mkBuiltInPrimTc fs unique tycon
= mkWiredInName gHC_PRIM (mkTcOccFS fs)
unique
(ATyCon tycon) -- Relevant TyCon
BuiltInSyntax
| 245
|
mkBuiltInPrimTc fs unique tycon
= mkWiredInName gHC_PRIM (mkTcOccFS fs)
unique
(ATyCon tycon) -- Relevant TyCon
BuiltInSyntax
| 188
| false
| true
| 0
| 7
| 87
| 54
| 27
| 27
| null | null |
snoyberg/ghc
|
libraries/base/GHC/IO/Handle.hs
|
bsd-3-clause
|
hIsReadable handle =
withHandle_ "hIsReadable" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
htype -> return (isReadableHandleType htype)
| 266
|
hIsReadable handle =
withHandle_ "hIsReadable" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
htype -> return (isReadableHandleType htype)
| 266
|
hIsReadable handle =
withHandle_ "hIsReadable" handle $ \ handle_ -> do
case haType handle_ of
ClosedHandle -> ioe_closedHandle
SemiClosedHandle -> ioe_semiclosedHandle
htype -> return (isReadableHandleType htype)
| 266
| false
| false
| 0
| 14
| 78
| 60
| 28
| 32
| null | null |
frontrowed/stratosphere
|
library-gen/Stratosphere/ResourceProperties/S3BucketDataExport.hs
|
mit
|
s3BucketDataExport
:: S3BucketDestination -- ^ 'sbdeDestination'
-> Val Text -- ^ 'sbdeOutputSchemaVersion'
-> S3BucketDataExport
s3BucketDataExport destinationarg outputSchemaVersionarg =
S3BucketDataExport
{ _s3BucketDataExportDestination = destinationarg
, _s3BucketDataExportOutputSchemaVersion = outputSchemaVersionarg
}
| 339
|
s3BucketDataExport
:: S3BucketDestination -- ^ 'sbdeDestination'
-> Val Text -- ^ 'sbdeOutputSchemaVersion'
-> S3BucketDataExport
s3BucketDataExport destinationarg outputSchemaVersionarg =
S3BucketDataExport
{ _s3BucketDataExportDestination = destinationarg
, _s3BucketDataExportOutputSchemaVersion = outputSchemaVersionarg
}
| 339
|
s3BucketDataExport destinationarg outputSchemaVersionarg =
S3BucketDataExport
{ _s3BucketDataExportDestination = destinationarg
, _s3BucketDataExportOutputSchemaVersion = outputSchemaVersionarg
}
| 203
| false
| true
| 0
| 8
| 41
| 52
| 26
| 26
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/HsSyn/HsUtils.hs
|
bsd-3-clause
|
mkLHsPatTup [lpat] = lpat
| 25
|
mkLHsPatTup [lpat] = lpat
| 25
|
mkLHsPatTup [lpat] = lpat
| 25
| false
| false
| 0
| 5
| 3
| 13
| 6
| 7
| null | null |
stefan-hoeck/labeled-graph
|
Data/Graph/Graphs.hs
|
bsd-3-clause
|
neopentane = fromList 5 [0 <-> 1,1 <-> 2,1 <-> 3,1 <-> 4]
| 57
|
neopentane = fromList 5 [0 <-> 1,1 <-> 2,1 <-> 3,1 <-> 4]
| 57
|
neopentane = fromList 5 [0 <-> 1,1 <-> 2,1 <-> 3,1 <-> 4]
| 57
| false
| false
| 0
| 7
| 12
| 39
| 21
| 18
| null | null |
rahulmutt/ghcvm
|
eta/Eta/REPL/UI/Tags.hs
|
bsd-3-clause
|
collateAndWriteTags ETags file tagInfos = do -- etags style, Emacs/XEmacs
tagInfoGroups <- makeTagGroupsWithSrcInfo $filter tagExported tagInfos
let tagGroups = map processGroup tagInfoGroups
tryIO (writeTagsSafely file $ concat tagGroups)
where
processGroup [] = throwGhcException (CmdLineError "empty tag file group??")
processGroup group@(tagInfo:_) =
let tags = unlines $ map showETag group in
"\x0c\n" ++ tagFile tagInfo ++ "," ++ show (length tags) ++ "\n" ++ tags
| 499
|
collateAndWriteTags ETags file tagInfos = do -- etags style, Emacs/XEmacs
tagInfoGroups <- makeTagGroupsWithSrcInfo $filter tagExported tagInfos
let tagGroups = map processGroup tagInfoGroups
tryIO (writeTagsSafely file $ concat tagGroups)
where
processGroup [] = throwGhcException (CmdLineError "empty tag file group??")
processGroup group@(tagInfo:_) =
let tags = unlines $ map showETag group in
"\x0c\n" ++ tagFile tagInfo ++ "," ++ show (length tags) ++ "\n" ++ tags
| 499
|
collateAndWriteTags ETags file tagInfos = do -- etags style, Emacs/XEmacs
tagInfoGroups <- makeTagGroupsWithSrcInfo $filter tagExported tagInfos
let tagGroups = map processGroup tagInfoGroups
tryIO (writeTagsSafely file $ concat tagGroups)
where
processGroup [] = throwGhcException (CmdLineError "empty tag file group??")
processGroup group@(tagInfo:_) =
let tags = unlines $ map showETag group in
"\x0c\n" ++ tagFile tagInfo ++ "," ++ show (length tags) ++ "\n" ++ tags
| 499
| false
| false
| 0
| 12
| 92
| 154
| 71
| 83
| null | null |
rahulmutt/codec-jvm
|
src/Codec/JVM/Opcode.hs
|
apache-2.0
|
ifne = Opcode 0x9a
| 18
|
ifne = Opcode 0x9a
| 18
|
ifne = Opcode 0x9a
| 18
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
ekmett/text
|
tests/Tests/Properties.hs
|
bsd-2-clause
|
t_findContains (NotEmpty s) = all (T.isPrefixOf s . snd) . T.breakOnAll s .
T.intercalate s
| 121
|
t_findContains (NotEmpty s) = all (T.isPrefixOf s . snd) . T.breakOnAll s .
T.intercalate s
| 121
|
t_findContains (NotEmpty s) = all (T.isPrefixOf s . snd) . T.breakOnAll s .
T.intercalate s
| 121
| false
| false
| 0
| 11
| 44
| 48
| 22
| 26
| null | null |
HIPERFIT/futhark
|
src/Futhark/CodeGen/ImpGen.hs
|
isc
|
compileOutParam MemArray {} =
pure (Nothing, ArrayDestination Nothing)
| 72
|
compileOutParam MemArray {} =
pure (Nothing, ArrayDestination Nothing)
| 72
|
compileOutParam MemArray {} =
pure (Nothing, ArrayDestination Nothing)
| 72
| false
| false
| 0
| 7
| 9
| 25
| 12
| 13
| null | null |
SKA-ScienceDataProcessor/RC
|
MS5/programs/imaging.hs
|
apache-2.0
|
gcfKernel :: GridPar -> Flow Tag -> Flow Vis -> Kernel GCFs
gcfKernel _ = halideWrapper "gcfs" (planRepr :. visRepr :. Z) gcfsRepr
| 130
|
gcfKernel :: GridPar -> Flow Tag -> Flow Vis -> Kernel GCFs
gcfKernel _ = halideWrapper "gcfs" (planRepr :. visRepr :. Z) gcfsRepr
| 130
|
gcfKernel _ = halideWrapper "gcfs" (planRepr :. visRepr :. Z) gcfsRepr
| 70
| false
| true
| 0
| 8
| 22
| 53
| 25
| 28
| null | null |
jabaraster/first-heroku
|
Application.hs
|
bsd-2-clause
|
-- This function allocates resources (such as a database connection pool),
-- performs initialization and creates a WAI application. This is also the
-- place to put your migrate statements to have automatic database
-- migrations handled by Yesod.
withJabaraster :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
withJabaraster conf logger f = do
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
$ either error return . Database.Persist.Base.loadConfig
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do
Database.Persist.Base.runPool dbconf (runMigration migrateAll) p
let h = Jabaraster conf logger s p
defaultRunner (f . logWare) h
where
#ifdef DEVELOPMENT
logWare = logHandleDev (\msg -> logBS logger msg >> flushLogger logger)
#else
logWare = logStdout
#endif
-- for yesod devel
| 921
|
withJabaraster :: AppConfig DefaultEnv () -> Logger -> (Application -> IO ()) -> IO ()
withJabaraster conf logger f = do
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
$ either error return . Database.Persist.Base.loadConfig
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do
Database.Persist.Base.runPool dbconf (runMigration migrateAll) p
let h = Jabaraster conf logger s p
defaultRunner (f . logWare) h
where
#ifdef DEVELOPMENT
logWare = logHandleDev (\msg -> logBS logger msg >> flushLogger logger)
#else
logWare = logStdout
#endif
-- for yesod devel
| 672
|
withJabaraster conf logger f = do
s <- staticSite
dbconf <- withYamlEnvironment "config/sqlite.yml" (appEnv conf)
$ either error return . Database.Persist.Base.loadConfig
Database.Persist.Base.withPool (dbconf :: Settings.PersistConfig) $ \p -> do
Database.Persist.Base.runPool dbconf (runMigration migrateAll) p
let h = Jabaraster conf logger s p
defaultRunner (f . logWare) h
where
#ifdef DEVELOPMENT
logWare = logHandleDev (\msg -> logBS logger msg >> flushLogger logger)
#else
logWare = logStdout
#endif
-- for yesod devel
| 585
| true
| true
| 1
| 14
| 182
| 223
| 110
| 113
| null | null |
ancientlanguage/haskell-analysis
|
grammar/src/Grammar/Common/Decompose.hs
|
mit
|
decomposeChar '\x2F888' = "\x3862"
| 34
|
decomposeChar '\x2F888' = "\x3862"
| 34
|
decomposeChar '\x2F888' = "\x3862"
| 34
| false
| false
| 0
| 5
| 3
| 9
| 4
| 5
| null | null |
porglezomp/learn-languages
|
haskell/Parsec2.hs
|
unlicense
|
parseJSON :: String -> Either ParseError JSON
parseJSON = parse jsonFile "(unknown)"
| 84
|
parseJSON :: String -> Either ParseError JSON
parseJSON = parse jsonFile "(unknown)"
| 84
|
parseJSON = parse jsonFile "(unknown)"
| 38
| false
| true
| 0
| 7
| 11
| 31
| 13
| 18
| null | null |
castaway/pandoc
|
src/Tests/Old.hs
|
gpl-2.0
|
lhsWriterTests :: String -> [Test]
lhsWriterTests format
= [ t "lhs to normal" format
, t "lhs to lhs" (format ++ "+lhs")
]
where
t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
"lhs-test.native" ("lhs-test" <.> f)
| 261
|
lhsWriterTests :: String -> [Test]
lhsWriterTests format
= [ t "lhs to normal" format
, t "lhs to lhs" (format ++ "+lhs")
]
where
t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
"lhs-test.native" ("lhs-test" <.> f)
| 261
|
lhsWriterTests format
= [ t "lhs to normal" format
, t "lhs to lhs" (format ++ "+lhs")
]
where
t n f = test n ["--columns=78", "-r", "native", "-s", "-w", f]
"lhs-test.native" ("lhs-test" <.> f)
| 226
| false
| true
| 0
| 8
| 71
| 90
| 49
| 41
| null | null |
wilbowma/accelerate
|
accelerate-examples/tests/primitives/Backpermute.hs
|
bsd-3-clause
|
reverseRef :: UArray Int Float -> UArray Int Float
reverseRef xs = listArray (bounds xs) (reverse (elems xs))
| 109
|
reverseRef :: UArray Int Float -> UArray Int Float
reverseRef xs = listArray (bounds xs) (reverse (elems xs))
| 109
|
reverseRef xs = listArray (bounds xs) (reverse (elems xs))
| 58
| false
| true
| 0
| 9
| 17
| 51
| 24
| 27
| null | null |
clintonmead/indextype
|
codegen/SourceGen.hs
|
mit
|
genClass constraintName className = f "class" ++ f "instance" ++ "\n" where
f s = s ++ " (" ++ constraintName ++ " n " ++ typeVar ++ ") => " ++ className ++ " n " ++ typeVar ++ "\n"
| 183
|
genClass constraintName className = f "class" ++ f "instance" ++ "\n" where
f s = s ++ " (" ++ constraintName ++ " n " ++ typeVar ++ ") => " ++ className ++ " n " ++ typeVar ++ "\n"
| 183
|
genClass constraintName className = f "class" ++ f "instance" ++ "\n" where
f s = s ++ " (" ++ constraintName ++ " n " ++ typeVar ++ ") => " ++ className ++ " n " ++ typeVar ++ "\n"
| 183
| false
| false
| 0
| 15
| 42
| 76
| 35
| 41
| null | null |
mathologist/hTestMaker
|
testmaker/src/TestMaker/SageTex.hs
|
gpl-3.0
|
findMatch' _ pos "" = pos
| 25
|
findMatch' _ pos "" = pos
| 25
|
findMatch' _ pos "" = pos
| 25
| false
| false
| 2
| 5
| 5
| 19
| 6
| 13
| null | null |
gridaphobe/hpc
|
tests/ghc_ghci/A.hs
|
bsd-3-clause
|
a :: Char
a = 'z'
| 17
|
a :: Char
a = 'z'
| 17
|
a = 'z'
| 7
| false
| true
| 0
| 6
| 5
| 18
| 7
| 11
| null | null |
badi/super-user-spark
|
src/Constants.hs
|
mit
|
whitespaceChars :: [Char]
whitespaceChars = linespaceChars ++ endOfLineChars
| 76
|
whitespaceChars :: [Char]
whitespaceChars = linespaceChars ++ endOfLineChars
| 76
|
whitespaceChars = linespaceChars ++ endOfLineChars
| 50
| false
| true
| 0
| 5
| 7
| 18
| 10
| 8
| null | null |
colah/ImplicitCAD
|
Graphics/Implicit/ExtOpenScad/Util/StateC.hs
|
agpl-3.0
|
warnC :: SourcePosition -> Text -> StateC ()
warnC = addMessage Warning
| 71
|
warnC :: SourcePosition -> Text -> StateC ()
warnC = addMessage Warning
| 71
|
warnC = addMessage Warning
| 26
| false
| true
| 0
| 8
| 11
| 27
| 13
| 14
| null | null |
edsko/cabal
|
Cabal/src/Distribution/ParseUtils.hs
|
bsd-3-clause
|
catchParseError :: ParseResult a -> (PError -> ParseResult a)
-> ParseResult a
p@(ParseOk _ _) `catchParseError` _ = p
| 134
|
catchParseError :: ParseResult a -> (PError -> ParseResult a)
-> ParseResult a
p@(ParseOk _ _) `catchParseError` _ = p
| 134
|
p@(ParseOk _ _) `catchParseError` _ = p
| 39
| false
| true
| 1
| 9
| 34
| 57
| 27
| 30
| null | null |
da-eto-ya/trash
|
haskell/simplest/lists.hs
|
mit
|
main :: IO ()
main = putStrLn "lists"
| 37
|
main :: IO ()
main = putStrLn "lists"
| 37
|
main = putStrLn "lists"
| 23
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
kishoredbn/barrelfish
|
tools/sockeye/SockeyeBackendLISA.hs
|
mit
|
generateInstantiation :: String -> Maybe AuxData -> SPAST.Definition -> [SPAST.Module] -> String
generateInstantiation moduleName auxData (SPAST.Instantiates meta inst mod args) modules = let
params = case find (((==) mod) . SPAST.moduleName) modules of
Nothing -> error $ "Module parameters not found for " ++ mod ++ " : " ++ (show meta)
Just x -> map SPAST.paramName (SPAST.parameters x)
mapParamName _name = case auxData of
Nothing -> _name
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{translation=(Just translation)} -> translation
_ -> _name
mapParamValue _name value = case auxData of
Nothing -> value
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{value=(Just _value)} -> _value
_ -> value
in
(generate inst) ++ ": " ++ mod ++ "(" ++ (intercalate ", " (map (\(name, arg) -> "\"" ++ (mapParamName name) ++ "\"=" ++ (mapParamValue name $ generate arg)) (zip params args))) ++ ");"
| 1,351
|
generateInstantiation :: String -> Maybe AuxData -> SPAST.Definition -> [SPAST.Module] -> String
generateInstantiation moduleName auxData (SPAST.Instantiates meta inst mod args) modules = let
params = case find (((==) mod) . SPAST.moduleName) modules of
Nothing -> error $ "Module parameters not found for " ++ mod ++ " : " ++ (show meta)
Just x -> map SPAST.paramName (SPAST.parameters x)
mapParamName _name = case auxData of
Nothing -> _name
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{translation=(Just translation)} -> translation
_ -> _name
mapParamValue _name value = case auxData of
Nothing -> value
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{value=(Just _value)} -> _value
_ -> value
in
(generate inst) ++ ": " ++ mod ++ "(" ++ (intercalate ", " (map (\(name, arg) -> "\"" ++ (mapParamName name) ++ "\"=" ++ (mapParamValue name $ generate arg)) (zip params args))) ++ ");"
| 1,351
|
generateInstantiation moduleName auxData (SPAST.Instantiates meta inst mod args) modules = let
params = case find (((==) mod) . SPAST.moduleName) modules of
Nothing -> error $ "Module parameters not found for " ++ mod ++ " : " ++ (show meta)
Just x -> map SPAST.paramName (SPAST.parameters x)
mapParamName _name = case auxData of
Nothing -> _name
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{translation=(Just translation)} -> translation
_ -> _name
mapParamValue _name value = case auxData of
Nothing -> value
Just AuxData{parameters=params} -> case find (\AuxParameter{moduleName=modName, name=__name, component=cName} -> (modName == moduleName) && (_name == __name) && (SAST.refName inst) == cName) params of
Just AuxParameter{value=(Just _value)} -> _value
_ -> value
in
(generate inst) ++ ": " ++ mod ++ "(" ++ (intercalate ", " (map (\(name, arg) -> "\"" ++ (mapParamName name) ++ "\"=" ++ (mapParamValue name $ generate arg)) (zip params args))) ++ ");"
| 1,254
| false
| true
| 2
| 20
| 294
| 528
| 271
| 257
| null | null |
danr/hipspec
|
examples/old-examples/quickspec/ProductiveUseOfFailure2.hs
|
gpl-3.0
|
isort (x:xs) = insert x (isort xs)
| 34
|
isort (x:xs) = insert x (isort xs)
| 34
|
isort (x:xs) = insert x (isort xs)
| 34
| false
| false
| 0
| 7
| 6
| 28
| 13
| 15
| null | null |
mathhun/stack
|
src/Path/IO.hs
|
bsd-3-clause
|
-- | Move a dir. Optimistically assumes it exists. If it doesn't,
-- doesn't complain.
moveDirIfExists :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m ()
moveDirIfExists from to = ignoreDoesNotExist (moveDir from to)
| 216
|
moveDirIfExists :: MonadIO m => Path b1 Dir -> Path b2 Dir -> m ()
moveDirIfExists from to = ignoreDoesNotExist (moveDir from to)
| 129
|
moveDirIfExists from to = ignoreDoesNotExist (moveDir from to)
| 62
| true
| true
| 0
| 9
| 37
| 59
| 28
| 31
| null | null |
dservgun/haskell_test_code
|
src/Main.hs
|
gpl-2.0
|
insert a (x: xs)
| a <= x = a : x : xs
| otherwise = x : (insert a xs)
| 87
|
insert a (x: xs)
| a <= x = a : x : xs
| otherwise = x : (insert a xs)
| 87
|
insert a (x: xs)
| a <= x = a : x : xs
| otherwise = x : (insert a xs)
| 87
| false
| false
| 0
| 8
| 38
| 57
| 27
| 30
| null | null |
manyoo/reflex-dom
|
src-ghcjs/Reflex/Dom/Xhr/Foreign.hs
|
bsd-3-clause
|
xmlHttpRequestGetResponseType :: XMLHttpRequest -> IO (Maybe XhrResponseType)
xmlHttpRequestGetResponseType = fmap toResponseType . getResponseType
| 147
|
xmlHttpRequestGetResponseType :: XMLHttpRequest -> IO (Maybe XhrResponseType)
xmlHttpRequestGetResponseType = fmap toResponseType . getResponseType
| 147
|
xmlHttpRequestGetResponseType = fmap toResponseType . getResponseType
| 69
| false
| true
| 0
| 8
| 12
| 31
| 15
| 16
| null | null |
nomeata/codeworld
|
codeworld-prediction/tests/prediction.hs
|
apache-2.0
|
-- decimal display
-- Generation of random schedules
-- The actual check:
-- Exhaustively search the order in which these events could happen
-- Memoize every initial segment
-- Ensure that all possible ways reach the same conclusion.
failedChecks :: EventSchedule -> [CheckReport]
failedChecks schedule = map mkReport $ filter (not . check) allChecks
where
allDone :: [EventsDone]
allDone = do
let (tss,em) = schedule
tss' <- inits tss
em' <- traverse inits em -- wow!
return (tss', em')
allChecks :: [Check]
allChecks = allDone >>= prevs
prevs :: EventsDone -> [Check]
prevs (tss,m) =
[ ((init tss, m), Left (last tss))
| not (null tss)
] ++
[ ((tss, IM.adjust init i m), Right (i, last done))
| i <- IM.keys m
, let done = m IM.! i
, not (null done)
]
memo :: M.Map EventsDone (Future Log)
memo = M.fromList [ (eventsDone, recreate eventsDone) | eventsDone <- allDone ]
recreate :: EventsDone -> Future Log
recreate m = case prevs m of
[] -> initFuture [] (IM.size (snd m))
(c:_) -> checkActual c
check :: Check -> Bool
check c = checkActual c `eqFuture` checkExpected c
checkExpected :: Check -> Future Log
checkExpected (prev, Left t) = memo M.! first (++[t]) prev
checkExpected (prev, Right (p,(t,e))) = memo M.! second (IM.adjust (++[(t,e)]) p) prev
checkActual :: Check -> Future Log
checkActual (prev, Left t) =
currentTimePasses step rate t $
memo M.! prev
checkActual (prev, Right (p,(t,e))) =
addEvent step rate p t (handle <$> e) $
memo M.! prev
mkReport :: Check -> CheckReport
mkReport c = (c, memo M.! fst c, checkExpected c, checkActual c)
-- The quickcheck test, with reporting
| 1,859
|
failedChecks :: EventSchedule -> [CheckReport]
failedChecks schedule = map mkReport $ filter (not . check) allChecks
where
allDone :: [EventsDone]
allDone = do
let (tss,em) = schedule
tss' <- inits tss
em' <- traverse inits em -- wow!
return (tss', em')
allChecks :: [Check]
allChecks = allDone >>= prevs
prevs :: EventsDone -> [Check]
prevs (tss,m) =
[ ((init tss, m), Left (last tss))
| not (null tss)
] ++
[ ((tss, IM.adjust init i m), Right (i, last done))
| i <- IM.keys m
, let done = m IM.! i
, not (null done)
]
memo :: M.Map EventsDone (Future Log)
memo = M.fromList [ (eventsDone, recreate eventsDone) | eventsDone <- allDone ]
recreate :: EventsDone -> Future Log
recreate m = case prevs m of
[] -> initFuture [] (IM.size (snd m))
(c:_) -> checkActual c
check :: Check -> Bool
check c = checkActual c `eqFuture` checkExpected c
checkExpected :: Check -> Future Log
checkExpected (prev, Left t) = memo M.! first (++[t]) prev
checkExpected (prev, Right (p,(t,e))) = memo M.! second (IM.adjust (++[(t,e)]) p) prev
checkActual :: Check -> Future Log
checkActual (prev, Left t) =
currentTimePasses step rate t $
memo M.! prev
checkActual (prev, Right (p,(t,e))) =
addEvent step rate p t (handle <$> e) $
memo M.! prev
mkReport :: Check -> CheckReport
mkReport c = (c, memo M.! fst c, checkExpected c, checkActual c)
-- The quickcheck test, with reporting
| 1,620
|
failedChecks schedule = map mkReport $ filter (not . check) allChecks
where
allDone :: [EventsDone]
allDone = do
let (tss,em) = schedule
tss' <- inits tss
em' <- traverse inits em -- wow!
return (tss', em')
allChecks :: [Check]
allChecks = allDone >>= prevs
prevs :: EventsDone -> [Check]
prevs (tss,m) =
[ ((init tss, m), Left (last tss))
| not (null tss)
] ++
[ ((tss, IM.adjust init i m), Right (i, last done))
| i <- IM.keys m
, let done = m IM.! i
, not (null done)
]
memo :: M.Map EventsDone (Future Log)
memo = M.fromList [ (eventsDone, recreate eventsDone) | eventsDone <- allDone ]
recreate :: EventsDone -> Future Log
recreate m = case prevs m of
[] -> initFuture [] (IM.size (snd m))
(c:_) -> checkActual c
check :: Check -> Bool
check c = checkActual c `eqFuture` checkExpected c
checkExpected :: Check -> Future Log
checkExpected (prev, Left t) = memo M.! first (++[t]) prev
checkExpected (prev, Right (p,(t,e))) = memo M.! second (IM.adjust (++[(t,e)]) p) prev
checkActual :: Check -> Future Log
checkActual (prev, Left t) =
currentTimePasses step rate t $
memo M.! prev
checkActual (prev, Right (p,(t,e))) =
addEvent step rate p t (handle <$> e) $
memo M.! prev
mkReport :: Check -> CheckReport
mkReport c = (c, memo M.! fst c, checkExpected c, checkActual c)
-- The quickcheck test, with reporting
| 1,573
| true
| true
| 36
| 12
| 540
| 657
| 351
| 306
| null | null |
acowley/ghc
|
compiler/prelude/PrelNames.hs
|
bsd-3-clause
|
rationalTyConKey = mkPreludeTyConUnique 33
| 65
|
rationalTyConKey = mkPreludeTyConUnique 33
| 65
|
rationalTyConKey = mkPreludeTyConUnique 33
| 65
| false
| false
| 0
| 5
| 26
| 9
| 4
| 5
| null | null |
guilt/webify
|
src/TTF.hs
|
mit
|
cmapEnd CmapFormat12{c12Groups = groups} = fromIntegral $ f12EndCharCode $ last groups
| 86
|
cmapEnd CmapFormat12{c12Groups = groups} = fromIntegral $ f12EndCharCode $ last groups
| 86
|
cmapEnd CmapFormat12{c12Groups = groups} = fromIntegral $ f12EndCharCode $ last groups
| 86
| false
| false
| 0
| 8
| 10
| 29
| 14
| 15
| null | null |
LukaHorvat/Echo
|
src/Common/Prelude.hs
|
mit
|
startsWith :: Eq a => [a] -> [a] -> Bool
startsWith list prefix = take (length prefix) list == prefix
| 101
|
startsWith :: Eq a => [a] -> [a] -> Bool
startsWith list prefix = take (length prefix) list == prefix
| 101
|
startsWith list prefix = take (length prefix) list == prefix
| 60
| false
| true
| 0
| 9
| 19
| 59
| 27
| 32
| null | null |
leshchevds/ganeti
|
src/Ganeti/HTools/Tags.hs
|
bsd-2-clause
|
stripFirstPrefix (':':_) = Just ""
| 34
|
stripFirstPrefix (':':_) = Just ""
| 34
|
stripFirstPrefix (':':_) = Just ""
| 34
| false
| false
| 0
| 7
| 4
| 19
| 9
| 10
| null | null |
garetxe/cabal
|
cabal-install/tests/UnitTests/Distribution/Client/Dependency/Modular/DSL.hs
|
bsd-3-clause
|
exInstPkgId :: ExampleInstalled -> C.PackageIdentifier
exInstPkgId ex = C.PackageIdentifier {
pkgName = C.PackageName (exInstName ex)
, pkgVersion = Version [exInstVersion ex, 0, 0] []
}
| 203
|
exInstPkgId :: ExampleInstalled -> C.PackageIdentifier
exInstPkgId ex = C.PackageIdentifier {
pkgName = C.PackageName (exInstName ex)
, pkgVersion = Version [exInstVersion ex, 0, 0] []
}
| 203
|
exInstPkgId ex = C.PackageIdentifier {
pkgName = C.PackageName (exInstName ex)
, pkgVersion = Version [exInstVersion ex, 0, 0] []
}
| 148
| false
| true
| 0
| 9
| 41
| 66
| 35
| 31
| null | null |
yliu120/K3
|
src/Language/K3/Utils/Pretty/Syntax.hs
|
apache-2.0
|
typ' (tag -> TInt) = return $ text "int"
| 47
|
typ' (tag -> TInt) = return $ text "int"
| 47
|
typ' (tag -> TInt) = return $ text "int"
| 47
| false
| false
| 0
| 7
| 15
| 23
| 11
| 12
| null | null |
profan/mal
|
haskell/Core.hs
|
mpl-2.0
|
_pairup (MalString x:y:xs) = do
rest <- _pairup xs
return $ (x,y):rest
| 78
|
_pairup (MalString x:y:xs) = do
rest <- _pairup xs
return $ (x,y):rest
| 78
|
_pairup (MalString x:y:xs) = do
rest <- _pairup xs
return $ (x,y):rest
| 78
| false
| false
| 0
| 9
| 19
| 50
| 24
| 26
| null | null |
foreverbell/parakeet
|
src/Parakeet/Parser/Stage1.hs
|
mit
|
separator :: Parser ()
separator = void $ try $ do
spaces
char M.separator
notFollowedBy (char M.separator)
| 113
|
separator :: Parser ()
separator = void $ try $ do
spaces
char M.separator
notFollowedBy (char M.separator)
| 113
|
separator = void $ try $ do
spaces
char M.separator
notFollowedBy (char M.separator)
| 90
| false
| true
| 4
| 11
| 22
| 57
| 23
| 34
| null | null |
ekmett/promises
|
src/Data/Promise.hs
|
bsd-2-clause
|
-- | Run a lazy computation. The final answer is given in the form of a promise to be fulfilled.
-- If the promise is unfulfilled then a user supplied default value will be returned.
runLazy :: (forall s. Promise s a -> Lazy s b) -> a -> a
runLazy f d = unsafePerformIO (runLazyIO f d)
| 285
|
runLazy :: (forall s. Promise s a -> Lazy s b) -> a -> a
runLazy f d = unsafePerformIO (runLazyIO f d)
| 102
|
runLazy f d = unsafePerformIO (runLazyIO f d)
| 45
| true
| true
| 0
| 9
| 57
| 63
| 31
| 32
| null | null |
mumuki/mulang
|
src/Language/Mulang/Inspector/Literal.hs
|
gpl-3.0
|
isMath :: Inspection
isMath (Primitive Plus) = True
| 55
|
isMath :: Inspection
isMath (Primitive Plus) = True
| 55
|
isMath (Primitive Plus) = True
| 34
| false
| true
| 0
| 7
| 11
| 20
| 10
| 10
| null | null |
joelburget/interplanetary-computation
|
src/Planetary/Library/FrankExamples.hs
|
bsd-3-clause
|
charHandler1 _ = throwError (FailedForeignFun "charHandler1")
| 61
|
charHandler1 _ = throwError (FailedForeignFun "charHandler1")
| 61
|
charHandler1 _ = throwError (FailedForeignFun "charHandler1")
| 61
| false
| false
| 0
| 7
| 5
| 18
| 8
| 10
| null | null |
ducis/haAni
|
hs/common/Graphics/Rendering/OpenGL/GL/Framebuffer.hs
|
gpl-2.0
|
-- | 'True' if left and right buffers exist.
stereoBuffer :: GettableStateVar Bool
stereoBuffer =
makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetStereo
| 166
|
stereoBuffer :: GettableStateVar Bool
stereoBuffer =
makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetStereo
| 120
|
stereoBuffer =
makeGettableStateVar $ getBoolean1 unmarshalGLboolean GetStereo
| 82
| true
| true
| 0
| 6
| 24
| 24
| 12
| 12
| null | null |
FranklinChen/IHaskell
|
ihaskell-display/ihaskell-widgets/src/IHaskell/Display/Widgets/Output.hs
|
mit
|
appendOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 191
|
appendOutput :: IHaskellDisplay a => OutputWidget -> a -> IO ()
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 191
|
appendOutput widget out = do
disp <- display out
widgetPublishDisplay widget disp
-- | Clear the output widget immediately
| 127
| false
| true
| 0
| 9
| 34
| 55
| 25
| 30
| null | null |
Heather/hackport
|
Portage/Dependency/Types.hs
|
gpl-3.0
|
dep_is_case_of _ _ = False
| 26
|
dep_is_case_of _ _ = False
| 26
|
dep_is_case_of _ _ = False
| 26
| false
| false
| 0
| 5
| 4
| 11
| 5
| 6
| null | null |
tphyahoo/haskoin
|
haskoin-core/Network/Haskoin/Script/Evaluator.hs
|
unlicense
|
eval OP_VERIFY = popBool >>= \case
True -> return ()
False -> programError "OP_VERIFY failed"
| 102
|
eval OP_VERIFY = popBool >>= \case
True -> return ()
False -> programError "OP_VERIFY failed"
| 102
|
eval OP_VERIFY = popBool >>= \case
True -> return ()
False -> programError "OP_VERIFY failed"
| 102
| false
| false
| 1
| 11
| 23
| 39
| 16
| 23
| null | null |
brendanhay/gogol
|
gogol-dlp/gen/Network/Google/Resource/DLP/Projects/StoredInfoTypes/Delete.hs
|
mpl-2.0
|
-- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
psitdUploadType :: Lens' ProjectsStoredInfoTypesDelete (Maybe Text)
psitdUploadType
= lens _psitdUploadType
(\ s a -> s{_psitdUploadType = a})
| 221
|
psitdUploadType :: Lens' ProjectsStoredInfoTypesDelete (Maybe Text)
psitdUploadType
= lens _psitdUploadType
(\ s a -> s{_psitdUploadType = a})
| 150
|
psitdUploadType
= lens _psitdUploadType
(\ s a -> s{_psitdUploadType = a})
| 82
| true
| true
| 1
| 9
| 34
| 51
| 25
| 26
| null | null |
romanb/amazonka
|
amazonka-datapipeline/gen/Network/AWS/DataPipeline/PollForTask.hs
|
mpl-2.0
|
-- | Identity information for the EC2 instance that is hosting the task runner.
-- You can get this value from the instance using 'http://169.254.169.254/latest/meta-data/instance-id'. For more information, see <http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html Instance Metadata> in the /Amazon Elastic ComputeCloud User Guide./ Passing in this value proves that your task runner is
-- running on an EC2 instance, and ensures the proper AWS Data Pipeline service
-- charges are applied to your pipeline.
pftInstanceIdentity :: Lens' PollForTask (Maybe InstanceIdentity)
pftInstanceIdentity =
lens _pftInstanceIdentity (\s a -> s { _pftInstanceIdentity = a })
| 696
|
pftInstanceIdentity :: Lens' PollForTask (Maybe InstanceIdentity)
pftInstanceIdentity =
lens _pftInstanceIdentity (\s a -> s { _pftInstanceIdentity = a })
| 158
|
pftInstanceIdentity =
lens _pftInstanceIdentity (\s a -> s { _pftInstanceIdentity = a })
| 92
| true
| true
| 0
| 9
| 92
| 49
| 28
| 21
| null | null |
simonmichael/hledger
|
hledger-lib/Hledger/Query.hs
|
gpl-3.0
|
matchesPosting (Real v) p = v == isReal p
| 41
|
matchesPosting (Real v) p = v == isReal p
| 41
|
matchesPosting (Real v) p = v == isReal p
| 41
| false
| false
| 2
| 6
| 8
| 29
| 11
| 18
| null | null |
alexander-at-github/eta
|
compiler/ETA/Prelude/PrimOp.hs
|
bsd-3-clause
|
primOpCodeSize DoubleCosOp = primOpCodeSizeForeignCall
| 55
|
primOpCodeSize DoubleCosOp = primOpCodeSizeForeignCall
| 55
|
primOpCodeSize DoubleCosOp = primOpCodeSizeForeignCall
| 55
| false
| false
| 0
| 5
| 4
| 9
| 4
| 5
| null | null |
cgswords/Grift
|
Compiler/EnforceConventions.hs
|
mit
|
effects (Nop:es) tail binds = effects es tail binds
| 66
|
effects (Nop:es) tail binds = effects es tail binds
| 66
|
effects (Nop:es) tail binds = effects es tail binds
| 66
| false
| false
| 0
| 7
| 23
| 27
| 13
| 14
| null | null |
MaartenFaddegon/libgraph
|
Data/Graph/Libgraph/Dagify.hs
|
bsd-3-clause
|
dagify :: (Ord v, Eq a, Show v) => ([v]->v) -> Graph v a -> Graph v a
dagify merge = {-# SCC "dagify" #-} (collapse merge) . remove
| 132
|
dagify :: (Ord v, Eq a, Show v) => ([v]->v) -> Graph v a -> Graph v a
dagify merge = {-# SCC "dagify" #-} (collapse merge) . remove
| 132
|
dagify merge = {-# SCC "dagify" #-} (collapse merge) . remove
| 61
| false
| true
| 0
| 9
| 29
| 74
| 38
| 36
| null | null |
rueshyna/gogol
|
gogol-billing/gen/Network/Google/Resource/CloudBilling/Projects/GetBillingInfo.hs
|
mpl-2.0
|
-- | OAuth access token.
pgbiAccessToken :: Lens' ProjectsGetBillingInfo (Maybe Text)
pgbiAccessToken
= lens _pgbiAccessToken
(\ s a -> s{_pgbiAccessToken = a})
| 168
|
pgbiAccessToken :: Lens' ProjectsGetBillingInfo (Maybe Text)
pgbiAccessToken
= lens _pgbiAccessToken
(\ s a -> s{_pgbiAccessToken = a})
| 143
|
pgbiAccessToken
= lens _pgbiAccessToken
(\ s a -> s{_pgbiAccessToken = a})
| 82
| true
| true
| 1
| 9
| 29
| 52
| 25
| 27
| null | null |
robeverest/accelerate
|
Data/Array/Accelerate/Trafo/Fusion.hs
|
bsd-3-clause
|
aletD :: (Arrays a, Arrays b)
=> OpenAcc aenv a
-> OpenAcc (aenv, a) b
-> DelayedAcc aenv b
aletD bndAcc bodyAcc =
case delayOpenAcc bndAcc of
-- If the binding is marked as "done" (i.e. needs to be computed now), add
-- it to the extended environment of the delayed body and continue. Since
-- manifest arrays also fall into this category, this elegantly handles
-- let-floating.
--
Done env1 a
-> case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b -> Done (env1 `join` a `cons` env2) b
Step env2 sh2 ix2 f2 b -> Step (env1 `join` a `cons` env2) sh2 ix2 f2 b
Yield env2 sh2 f2 -> Yield (env1 `join` a `cons` env2) sh2 f2
-- If instead the binding is still in a delayed state, we might be able to
-- fuse it directly into the body. For example, functions such as reverse
-- and transpose:
--
-- reverse xs = backpermute (shape xs) (\i -> length xs - i - 1) xs
--
-- These generate a let binding for the input array because it is required
-- for both its data and shape information. However, if the data is only
-- used once within the body, we can still fuse the two together because we
-- can generate the shape directly.
--
Step env1 sh1 ix1 f1 a1
-> let OpenAcc bnd = force $ Step BaseEnv sh1 ix1 f1 a1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 (f1 `compose` indexArray a1 `compose` ix1) b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1)
(f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1) f2)
Yield env1 sh1 f1
-> let OpenAcc bnd = force $ Yield BaseEnv sh1 f1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 f1 b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 f1 (f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 f1 f2)
where
-- When does the cost of re-computation out weight global memory access? For
-- the moment only do the substitution on a single use of the bound array,
-- but it is likely advantageous to be far more aggressive here.
--
lIMIT = 1
-- Eliminating a let binding pushes the binding subject into the body as a
-- scalar shape and generator function, producing a delayed Yield node.
--
yield :: (Shape sh, Shape sh', Elt e, Elt e')
=> Extend aenv aenv'
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Exp aenv'' sh'
-> Fun aenv' (sh -> e)
-> Fun aenv'' (sh' -> e')
-> Maybe (DelayedAcc aenv (Array sh' e'))
yield env1 env2 sh1 sh2 f1 f2
| usesOfEA a0 sh2 + usesOfFA a0 f2 + usesOfAX a0 env2 <= lIMIT
= Just $ Yield (env1 `join` env2') (replaceE sh1' f1' a0 sh2) (replaceF sh1' f1' a0 f2)
| otherwise
= Nothing
where
-- If we do the merge, 'bnd' becomes dead code and will be later
-- eliminated by the shrinking step.
--
OpenAcc bnd = force $ Yield BaseEnv sh1 f1
a0 = sink env2 ZeroIdx
env2' = bnd `cons` env2
sh1' = sinkE env2' sh1
f1' = sinkF env2' f1
-- If the body is forward permutation, we might be able to fuse into the
-- shape and index transformation. See radix sort for an example.
--
into :: (Shape sh, Elt e, Arrays a)
=> Extend aenv aenv''
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Fun aenv' (sh -> e)
-> PreOpenAcc OpenAcc aenv'' a
-> DelayedAcc aenv a
into env env2 sh1 f1 body
| Permute c2 d2 ix2 s2 <- body
, usesOfFA a0 c2 + usesOfFA a0 ix2 + usesOfAX a0 env2 + usesOf a0 d2 + usesOf a0 s2 <= lIMIT
= Done env $ Permute (replaceF sh1' f1' a0 c2) d2 (replaceF sh1' f1' a0 ix2) s2
| otherwise
= Done env body
where
a0 = sink env2 ZeroIdx
sh1' = sinkE env2 $ weakenEA sh1
f1' = sinkF env2 $ weakenFA f1
-- Count the number of uses of an array variable. This is specialised from
-- the procedure for shrinking in that we ignore uses that occur as part of
-- a Shape.
--
usesOfAX :: Idx aenv' a -> Extend (aenv, a) aenv' -> Int
usesOfAX _ BaseEnv = 0
usesOfAX (SuccIdx idx) (PushEnv env a) = usesOfPA idx a + usesOfAX idx env
usesOfAX _ _ = error "usesOfAExt: inconsistent valuation"
usesOf :: Idx aenv s -> OpenAcc aenv t -> Int
usesOf idx (OpenAcc acc) = usesOfPA idx acc
usesOfPA :: Idx aenv s -> PreOpenAcc OpenAcc aenv t -> Int
usesOfPA idx acc =
case acc of
Alet bnd body -> usesOf idx bnd + usesOf (SuccIdx idx) body
Avar idx'
| Just REFL <- matchIdx idx idx' -> 1
| otherwise -> 0
Atuple tup -> usesOfATA idx tup
Aprj _ a -> usesOf idx a
Apply _ a -> usesOf idx a
Acond p t e -> usesOfEA idx p + usesOf idx t + usesOf idx e
Use _ -> 0
Unit e -> usesOfEA idx e
Reshape e a -> usesOfEA idx e + usesOf idx a
Generate e f -> usesOfEA idx e + usesOfFA idx f
Transform sh ix f a -> usesOfEA idx sh + usesOfFA idx ix + usesOfFA idx f + usesOf idx a
Replicate _ slix a -> usesOfEA idx slix + usesOf idx a
Slice _ a slix -> usesOfEA idx slix + usesOf idx a
Map f a -> usesOfFA idx f + usesOf idx a
ZipWith f a1 a2 -> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Fold f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Fold1 f a -> usesOfFA idx f + usesOf idx a
FoldSeg f z a s -> usesOfFA idx f + usesOfEA idx z + usesOf idx a + usesOf idx s
Fold1Seg f a s -> usesOfFA idx f + usesOf idx a + usesOf idx s
Scanl f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl1 f a -> usesOfFA idx f + usesOf idx a
Scanr f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr1 f a -> usesOfFA idx f + usesOf idx a
Permute f1 a1 f2 a2 -> usesOfFA idx f1 + usesOf idx a1 + usesOfFA idx f2 + usesOf idx a2
Backpermute sh f a -> usesOfEA idx sh + usesOfFA idx f + usesOf idx a
Stencil f _ a -> usesOfFA idx f + usesOf idx a
Stencil2 f _ a1 _ a2-> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Foreign _ _ a -> usesOf idx a
usesOfATA :: Idx aenv s -> Atuple (OpenAcc aenv) t -> Int
usesOfATA idx atup =
case atup of
NilAtup -> 0
SnocAtup t a -> usesOfATA idx t + usesOf idx a
usesOfEA :: Idx aenv a -> OpenExp env aenv t -> Int
usesOfEA idx exp =
case exp of
Let bnd body -> usesOfEA idx bnd + usesOfEA idx body
Var _ -> 0
Const _ -> 0
Tuple t -> usesOfTA idx t
Prj _ e -> usesOfEA idx e
IndexNil -> 0
IndexCons sl sz -> usesOfEA idx sl + usesOfEA idx sz
IndexHead sh -> usesOfEA idx sh
IndexTail sh -> usesOfEA idx sh
IndexSlice _ ix sh -> usesOfEA idx ix + usesOfEA idx sh
IndexFull _ ix sl -> usesOfEA idx ix + usesOfEA idx sl
IndexAny -> 0
ToIndex sh ix -> usesOfEA idx sh + usesOfEA idx ix
FromIndex sh i -> usesOfEA idx sh + usesOfEA idx i
Cond p t e -> usesOfEA idx p + usesOfEA idx t + usesOfEA idx e
Iterate n f x -> usesOfEA idx n + usesOfEA idx f + usesOfEA idx x
PrimConst _ -> 0
PrimApp _ x -> usesOfEA idx x
ShapeSize sh -> usesOfEA idx sh
Intersect sh sz -> usesOfEA idx sh + usesOfEA idx sz
--
-- Special case: Because we are looking to fuse two array computations
-- together, it is not necessary to consider the contribution of Shape since
-- this would be replaced with a simple scalar expression.
--
Index a sh -> usesOf idx a + usesOfEA idx sh
LinearIndex a i -> usesOf idx a + usesOfEA idx i
Shape _ -> 0
usesOfTA :: Idx aenv a -> Tuple (OpenExp env aenv) t -> Int
usesOfTA idx tup =
case tup of
NilTup -> 0
SnocTup t e -> usesOfTA idx t + usesOfEA idx e
usesOfFA :: Idx aenv a -> OpenFun env aenv f -> Int
usesOfFA idx fun =
case fun of
Body e -> usesOfEA idx e
Lam f -> usesOfFA idx f
-- Substitute shape and array indexing with scalar functions at the given
-- array index.
--
replaceF :: (Shape sh, Elt e)
=> OpenExp env' aenv sh
-> OpenFun env' aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenFun env' aenv f
-> OpenFun env' aenv f
replaceF sh ix idx fun =
case fun of
Body e -> Body (replaceE sh ix idx e)
Lam f -> Lam (replaceF (weakenE sh) (weakenFE ix) idx f)
replaceE
:: forall sh e t env aenv. (Shape sh, Elt e)
=> OpenExp env aenv sh
-> OpenFun env aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenExp env aenv t
-> OpenExp env aenv t
replaceE sh_ ix_ idx exp =
let travE :: OpenExp env aenv t' -> OpenExp env aenv t'
travE = replaceE sh_ ix_ idx
travT :: Tuple (OpenExp env aenv) t' -> Tuple (OpenExp env aenv) t'
travT NilTup = NilTup
travT (SnocTup t e) = travT t `SnocTup` travE e
in case exp of
Let bnd body -> Let (travE bnd) (replaceE (weakenE sh_) (weakenFE ix_) idx body)
Var i -> Var i
Const c -> Const c
Tuple t -> Tuple (travT t)
Prj ix e -> Prj ix (travE e)
IndexNil -> IndexNil
IndexCons sl sz -> IndexCons (travE sl) (travE sz)
IndexHead sh -> IndexHead (travE sh)
IndexTail sz -> IndexTail (travE sz)
IndexAny -> IndexAny
IndexSlice x ix sh -> IndexSlice x (travE ix) (travE sh)
IndexFull x ix sl -> IndexFull x (travE ix) (travE sl)
ToIndex sh ix -> ToIndex (travE sh) (travE ix)
FromIndex sh i -> FromIndex (travE sh) (travE i)
Cond p t e -> Cond (travE p) (travE t) (travE e)
Iterate n f x -> Iterate (travE n) (replaceE (weakenE sh_) (weakenFE ix_) idx f) (travE x)
PrimConst c -> PrimConst c
PrimApp g x -> PrimApp g (travE x)
ShapeSize sh -> ShapeSize (travE sh)
Intersect sh sl -> Intersect (travE sh) (travE sl)
Shape (OpenAcc a)
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
-> sh_
| otherwise
-> exp
--
Index (OpenAcc a) sh
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let sh f
| otherwise
-> Index (OpenAcc a) (travE sh)
--
LinearIndex (OpenAcc a) i
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let (Let i (FromIndex (weakenE sh_) (Var ZeroIdx))) f
| otherwise
-> LinearIndex (OpenAcc a) (travE i)
-- Environment manipulation
-- ------------------------
-- NOTE: [Extend]
--
-- As part of the fusion transformation we often need to lift out array valued
-- inputs to be let-bound at a higher point. This is used by the delayed
-- representations to witness how the array environment is extended in the
-- presence of fused operators.
--
| 12,964
|
aletD :: (Arrays a, Arrays b)
=> OpenAcc aenv a
-> OpenAcc (aenv, a) b
-> DelayedAcc aenv b
aletD bndAcc bodyAcc =
case delayOpenAcc bndAcc of
-- If the binding is marked as "done" (i.e. needs to be computed now), add
-- it to the extended environment of the delayed body and continue. Since
-- manifest arrays also fall into this category, this elegantly handles
-- let-floating.
--
Done env1 a
-> case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b -> Done (env1 `join` a `cons` env2) b
Step env2 sh2 ix2 f2 b -> Step (env1 `join` a `cons` env2) sh2 ix2 f2 b
Yield env2 sh2 f2 -> Yield (env1 `join` a `cons` env2) sh2 f2
-- If instead the binding is still in a delayed state, we might be able to
-- fuse it directly into the body. For example, functions such as reverse
-- and transpose:
--
-- reverse xs = backpermute (shape xs) (\i -> length xs - i - 1) xs
--
-- These generate a let binding for the input array because it is required
-- for both its data and shape information. However, if the data is only
-- used once within the body, we can still fuse the two together because we
-- can generate the shape directly.
--
Step env1 sh1 ix1 f1 a1
-> let OpenAcc bnd = force $ Step BaseEnv sh1 ix1 f1 a1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 (f1 `compose` indexArray a1 `compose` ix1) b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1)
(f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1) f2)
Yield env1 sh1 f1
-> let OpenAcc bnd = force $ Yield BaseEnv sh1 f1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 f1 b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 f1 (f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 f1 f2)
where
-- When does the cost of re-computation out weight global memory access? For
-- the moment only do the substitution on a single use of the bound array,
-- but it is likely advantageous to be far more aggressive here.
--
lIMIT = 1
-- Eliminating a let binding pushes the binding subject into the body as a
-- scalar shape and generator function, producing a delayed Yield node.
--
yield :: (Shape sh, Shape sh', Elt e, Elt e')
=> Extend aenv aenv'
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Exp aenv'' sh'
-> Fun aenv' (sh -> e)
-> Fun aenv'' (sh' -> e')
-> Maybe (DelayedAcc aenv (Array sh' e'))
yield env1 env2 sh1 sh2 f1 f2
| usesOfEA a0 sh2 + usesOfFA a0 f2 + usesOfAX a0 env2 <= lIMIT
= Just $ Yield (env1 `join` env2') (replaceE sh1' f1' a0 sh2) (replaceF sh1' f1' a0 f2)
| otherwise
= Nothing
where
-- If we do the merge, 'bnd' becomes dead code and will be later
-- eliminated by the shrinking step.
--
OpenAcc bnd = force $ Yield BaseEnv sh1 f1
a0 = sink env2 ZeroIdx
env2' = bnd `cons` env2
sh1' = sinkE env2' sh1
f1' = sinkF env2' f1
-- If the body is forward permutation, we might be able to fuse into the
-- shape and index transformation. See radix sort for an example.
--
into :: (Shape sh, Elt e, Arrays a)
=> Extend aenv aenv''
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Fun aenv' (sh -> e)
-> PreOpenAcc OpenAcc aenv'' a
-> DelayedAcc aenv a
into env env2 sh1 f1 body
| Permute c2 d2 ix2 s2 <- body
, usesOfFA a0 c2 + usesOfFA a0 ix2 + usesOfAX a0 env2 + usesOf a0 d2 + usesOf a0 s2 <= lIMIT
= Done env $ Permute (replaceF sh1' f1' a0 c2) d2 (replaceF sh1' f1' a0 ix2) s2
| otherwise
= Done env body
where
a0 = sink env2 ZeroIdx
sh1' = sinkE env2 $ weakenEA sh1
f1' = sinkF env2 $ weakenFA f1
-- Count the number of uses of an array variable. This is specialised from
-- the procedure for shrinking in that we ignore uses that occur as part of
-- a Shape.
--
usesOfAX :: Idx aenv' a -> Extend (aenv, a) aenv' -> Int
usesOfAX _ BaseEnv = 0
usesOfAX (SuccIdx idx) (PushEnv env a) = usesOfPA idx a + usesOfAX idx env
usesOfAX _ _ = error "usesOfAExt: inconsistent valuation"
usesOf :: Idx aenv s -> OpenAcc aenv t -> Int
usesOf idx (OpenAcc acc) = usesOfPA idx acc
usesOfPA :: Idx aenv s -> PreOpenAcc OpenAcc aenv t -> Int
usesOfPA idx acc =
case acc of
Alet bnd body -> usesOf idx bnd + usesOf (SuccIdx idx) body
Avar idx'
| Just REFL <- matchIdx idx idx' -> 1
| otherwise -> 0
Atuple tup -> usesOfATA idx tup
Aprj _ a -> usesOf idx a
Apply _ a -> usesOf idx a
Acond p t e -> usesOfEA idx p + usesOf idx t + usesOf idx e
Use _ -> 0
Unit e -> usesOfEA idx e
Reshape e a -> usesOfEA idx e + usesOf idx a
Generate e f -> usesOfEA idx e + usesOfFA idx f
Transform sh ix f a -> usesOfEA idx sh + usesOfFA idx ix + usesOfFA idx f + usesOf idx a
Replicate _ slix a -> usesOfEA idx slix + usesOf idx a
Slice _ a slix -> usesOfEA idx slix + usesOf idx a
Map f a -> usesOfFA idx f + usesOf idx a
ZipWith f a1 a2 -> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Fold f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Fold1 f a -> usesOfFA idx f + usesOf idx a
FoldSeg f z a s -> usesOfFA idx f + usesOfEA idx z + usesOf idx a + usesOf idx s
Fold1Seg f a s -> usesOfFA idx f + usesOf idx a + usesOf idx s
Scanl f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl1 f a -> usesOfFA idx f + usesOf idx a
Scanr f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr1 f a -> usesOfFA idx f + usesOf idx a
Permute f1 a1 f2 a2 -> usesOfFA idx f1 + usesOf idx a1 + usesOfFA idx f2 + usesOf idx a2
Backpermute sh f a -> usesOfEA idx sh + usesOfFA idx f + usesOf idx a
Stencil f _ a -> usesOfFA idx f + usesOf idx a
Stencil2 f _ a1 _ a2-> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Foreign _ _ a -> usesOf idx a
usesOfATA :: Idx aenv s -> Atuple (OpenAcc aenv) t -> Int
usesOfATA idx atup =
case atup of
NilAtup -> 0
SnocAtup t a -> usesOfATA idx t + usesOf idx a
usesOfEA :: Idx aenv a -> OpenExp env aenv t -> Int
usesOfEA idx exp =
case exp of
Let bnd body -> usesOfEA idx bnd + usesOfEA idx body
Var _ -> 0
Const _ -> 0
Tuple t -> usesOfTA idx t
Prj _ e -> usesOfEA idx e
IndexNil -> 0
IndexCons sl sz -> usesOfEA idx sl + usesOfEA idx sz
IndexHead sh -> usesOfEA idx sh
IndexTail sh -> usesOfEA idx sh
IndexSlice _ ix sh -> usesOfEA idx ix + usesOfEA idx sh
IndexFull _ ix sl -> usesOfEA idx ix + usesOfEA idx sl
IndexAny -> 0
ToIndex sh ix -> usesOfEA idx sh + usesOfEA idx ix
FromIndex sh i -> usesOfEA idx sh + usesOfEA idx i
Cond p t e -> usesOfEA idx p + usesOfEA idx t + usesOfEA idx e
Iterate n f x -> usesOfEA idx n + usesOfEA idx f + usesOfEA idx x
PrimConst _ -> 0
PrimApp _ x -> usesOfEA idx x
ShapeSize sh -> usesOfEA idx sh
Intersect sh sz -> usesOfEA idx sh + usesOfEA idx sz
--
-- Special case: Because we are looking to fuse two array computations
-- together, it is not necessary to consider the contribution of Shape since
-- this would be replaced with a simple scalar expression.
--
Index a sh -> usesOf idx a + usesOfEA idx sh
LinearIndex a i -> usesOf idx a + usesOfEA idx i
Shape _ -> 0
usesOfTA :: Idx aenv a -> Tuple (OpenExp env aenv) t -> Int
usesOfTA idx tup =
case tup of
NilTup -> 0
SnocTup t e -> usesOfTA idx t + usesOfEA idx e
usesOfFA :: Idx aenv a -> OpenFun env aenv f -> Int
usesOfFA idx fun =
case fun of
Body e -> usesOfEA idx e
Lam f -> usesOfFA idx f
-- Substitute shape and array indexing with scalar functions at the given
-- array index.
--
replaceF :: (Shape sh, Elt e)
=> OpenExp env' aenv sh
-> OpenFun env' aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenFun env' aenv f
-> OpenFun env' aenv f
replaceF sh ix idx fun =
case fun of
Body e -> Body (replaceE sh ix idx e)
Lam f -> Lam (replaceF (weakenE sh) (weakenFE ix) idx f)
replaceE
:: forall sh e t env aenv. (Shape sh, Elt e)
=> OpenExp env aenv sh
-> OpenFun env aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenExp env aenv t
-> OpenExp env aenv t
replaceE sh_ ix_ idx exp =
let travE :: OpenExp env aenv t' -> OpenExp env aenv t'
travE = replaceE sh_ ix_ idx
travT :: Tuple (OpenExp env aenv) t' -> Tuple (OpenExp env aenv) t'
travT NilTup = NilTup
travT (SnocTup t e) = travT t `SnocTup` travE e
in case exp of
Let bnd body -> Let (travE bnd) (replaceE (weakenE sh_) (weakenFE ix_) idx body)
Var i -> Var i
Const c -> Const c
Tuple t -> Tuple (travT t)
Prj ix e -> Prj ix (travE e)
IndexNil -> IndexNil
IndexCons sl sz -> IndexCons (travE sl) (travE sz)
IndexHead sh -> IndexHead (travE sh)
IndexTail sz -> IndexTail (travE sz)
IndexAny -> IndexAny
IndexSlice x ix sh -> IndexSlice x (travE ix) (travE sh)
IndexFull x ix sl -> IndexFull x (travE ix) (travE sl)
ToIndex sh ix -> ToIndex (travE sh) (travE ix)
FromIndex sh i -> FromIndex (travE sh) (travE i)
Cond p t e -> Cond (travE p) (travE t) (travE e)
Iterate n f x -> Iterate (travE n) (replaceE (weakenE sh_) (weakenFE ix_) idx f) (travE x)
PrimConst c -> PrimConst c
PrimApp g x -> PrimApp g (travE x)
ShapeSize sh -> ShapeSize (travE sh)
Intersect sh sl -> Intersect (travE sh) (travE sl)
Shape (OpenAcc a)
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
-> sh_
| otherwise
-> exp
--
Index (OpenAcc a) sh
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let sh f
| otherwise
-> Index (OpenAcc a) (travE sh)
--
LinearIndex (OpenAcc a) i
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let (Let i (FromIndex (weakenE sh_) (Var ZeroIdx))) f
| otherwise
-> LinearIndex (OpenAcc a) (travE i)
-- Environment manipulation
-- ------------------------
-- NOTE: [Extend]
--
-- As part of the fusion transformation we often need to lift out array valued
-- inputs to be let-bound at a higher point. This is used by the delayed
-- representations to witness how the array environment is extended in the
-- presence of fused operators.
--
| 12,964
|
aletD bndAcc bodyAcc =
case delayOpenAcc bndAcc of
-- If the binding is marked as "done" (i.e. needs to be computed now), add
-- it to the extended environment of the delayed body and continue. Since
-- manifest arrays also fall into this category, this elegantly handles
-- let-floating.
--
Done env1 a
-> case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b -> Done (env1 `join` a `cons` env2) b
Step env2 sh2 ix2 f2 b -> Step (env1 `join` a `cons` env2) sh2 ix2 f2 b
Yield env2 sh2 f2 -> Yield (env1 `join` a `cons` env2) sh2 f2
-- If instead the binding is still in a delayed state, we might be able to
-- fuse it directly into the body. For example, functions such as reverse
-- and transpose:
--
-- reverse xs = backpermute (shape xs) (\i -> length xs - i - 1) xs
--
-- These generate a let binding for the input array because it is required
-- for both its data and shape information. However, if the data is only
-- used once within the body, we can still fuse the two together because we
-- can generate the shape directly.
--
Step env1 sh1 ix1 f1 a1
-> let OpenAcc bnd = force $ Step BaseEnv sh1 ix1 f1 a1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 (f1 `compose` indexArray a1 `compose` ix1) b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1)
(f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 (f1 `compose` indexArray a1 `compose` ix1) f2)
Yield env1 sh1 f1
-> let OpenAcc bnd = force $ Yield BaseEnv sh1 f1
in case delayOpenAcc (sinkA1 env1 bodyAcc) of
Done env2 b
-> into (env1 `join` bnd `cons` env2) env2 sh1 f1 b
Step env2 sh2 ix2 f2 a2
-> fromMaybe (Step (env1 `join` bnd `cons` env2) sh2 ix2 f2 a2)
(yield env1 env2 sh1 sh2 f1 (f2 `compose` indexArray a2 `compose` ix2))
Yield env2 sh2 f2
-> fromMaybe (Yield (env1 `join` bnd `cons` env2) sh2 f2)
(yield env1 env2 sh1 sh2 f1 f2)
where
-- When does the cost of re-computation out weight global memory access? For
-- the moment only do the substitution on a single use of the bound array,
-- but it is likely advantageous to be far more aggressive here.
--
lIMIT = 1
-- Eliminating a let binding pushes the binding subject into the body as a
-- scalar shape and generator function, producing a delayed Yield node.
--
yield :: (Shape sh, Shape sh', Elt e, Elt e')
=> Extend aenv aenv'
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Exp aenv'' sh'
-> Fun aenv' (sh -> e)
-> Fun aenv'' (sh' -> e')
-> Maybe (DelayedAcc aenv (Array sh' e'))
yield env1 env2 sh1 sh2 f1 f2
| usesOfEA a0 sh2 + usesOfFA a0 f2 + usesOfAX a0 env2 <= lIMIT
= Just $ Yield (env1 `join` env2') (replaceE sh1' f1' a0 sh2) (replaceF sh1' f1' a0 f2)
| otherwise
= Nothing
where
-- If we do the merge, 'bnd' becomes dead code and will be later
-- eliminated by the shrinking step.
--
OpenAcc bnd = force $ Yield BaseEnv sh1 f1
a0 = sink env2 ZeroIdx
env2' = bnd `cons` env2
sh1' = sinkE env2' sh1
f1' = sinkF env2' f1
-- If the body is forward permutation, we might be able to fuse into the
-- shape and index transformation. See radix sort for an example.
--
into :: (Shape sh, Elt e, Arrays a)
=> Extend aenv aenv''
-> Extend (aenv', Array sh e) aenv''
-> Exp aenv' sh
-> Fun aenv' (sh -> e)
-> PreOpenAcc OpenAcc aenv'' a
-> DelayedAcc aenv a
into env env2 sh1 f1 body
| Permute c2 d2 ix2 s2 <- body
, usesOfFA a0 c2 + usesOfFA a0 ix2 + usesOfAX a0 env2 + usesOf a0 d2 + usesOf a0 s2 <= lIMIT
= Done env $ Permute (replaceF sh1' f1' a0 c2) d2 (replaceF sh1' f1' a0 ix2) s2
| otherwise
= Done env body
where
a0 = sink env2 ZeroIdx
sh1' = sinkE env2 $ weakenEA sh1
f1' = sinkF env2 $ weakenFA f1
-- Count the number of uses of an array variable. This is specialised from
-- the procedure for shrinking in that we ignore uses that occur as part of
-- a Shape.
--
usesOfAX :: Idx aenv' a -> Extend (aenv, a) aenv' -> Int
usesOfAX _ BaseEnv = 0
usesOfAX (SuccIdx idx) (PushEnv env a) = usesOfPA idx a + usesOfAX idx env
usesOfAX _ _ = error "usesOfAExt: inconsistent valuation"
usesOf :: Idx aenv s -> OpenAcc aenv t -> Int
usesOf idx (OpenAcc acc) = usesOfPA idx acc
usesOfPA :: Idx aenv s -> PreOpenAcc OpenAcc aenv t -> Int
usesOfPA idx acc =
case acc of
Alet bnd body -> usesOf idx bnd + usesOf (SuccIdx idx) body
Avar idx'
| Just REFL <- matchIdx idx idx' -> 1
| otherwise -> 0
Atuple tup -> usesOfATA idx tup
Aprj _ a -> usesOf idx a
Apply _ a -> usesOf idx a
Acond p t e -> usesOfEA idx p + usesOf idx t + usesOf idx e
Use _ -> 0
Unit e -> usesOfEA idx e
Reshape e a -> usesOfEA idx e + usesOf idx a
Generate e f -> usesOfEA idx e + usesOfFA idx f
Transform sh ix f a -> usesOfEA idx sh + usesOfFA idx ix + usesOfFA idx f + usesOf idx a
Replicate _ slix a -> usesOfEA idx slix + usesOf idx a
Slice _ a slix -> usesOfEA idx slix + usesOf idx a
Map f a -> usesOfFA idx f + usesOf idx a
ZipWith f a1 a2 -> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Fold f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Fold1 f a -> usesOfFA idx f + usesOf idx a
FoldSeg f z a s -> usesOfFA idx f + usesOfEA idx z + usesOf idx a + usesOf idx s
Fold1Seg f a s -> usesOfFA idx f + usesOf idx a + usesOf idx s
Scanl f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanl1 f a -> usesOfFA idx f + usesOf idx a
Scanr f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr' f z a -> usesOfFA idx f + usesOfEA idx z + usesOf idx a
Scanr1 f a -> usesOfFA idx f + usesOf idx a
Permute f1 a1 f2 a2 -> usesOfFA idx f1 + usesOf idx a1 + usesOfFA idx f2 + usesOf idx a2
Backpermute sh f a -> usesOfEA idx sh + usesOfFA idx f + usesOf idx a
Stencil f _ a -> usesOfFA idx f + usesOf idx a
Stencil2 f _ a1 _ a2-> usesOfFA idx f + usesOf idx a1 + usesOf idx a2
Foreign _ _ a -> usesOf idx a
usesOfATA :: Idx aenv s -> Atuple (OpenAcc aenv) t -> Int
usesOfATA idx atup =
case atup of
NilAtup -> 0
SnocAtup t a -> usesOfATA idx t + usesOf idx a
usesOfEA :: Idx aenv a -> OpenExp env aenv t -> Int
usesOfEA idx exp =
case exp of
Let bnd body -> usesOfEA idx bnd + usesOfEA idx body
Var _ -> 0
Const _ -> 0
Tuple t -> usesOfTA idx t
Prj _ e -> usesOfEA idx e
IndexNil -> 0
IndexCons sl sz -> usesOfEA idx sl + usesOfEA idx sz
IndexHead sh -> usesOfEA idx sh
IndexTail sh -> usesOfEA idx sh
IndexSlice _ ix sh -> usesOfEA idx ix + usesOfEA idx sh
IndexFull _ ix sl -> usesOfEA idx ix + usesOfEA idx sl
IndexAny -> 0
ToIndex sh ix -> usesOfEA idx sh + usesOfEA idx ix
FromIndex sh i -> usesOfEA idx sh + usesOfEA idx i
Cond p t e -> usesOfEA idx p + usesOfEA idx t + usesOfEA idx e
Iterate n f x -> usesOfEA idx n + usesOfEA idx f + usesOfEA idx x
PrimConst _ -> 0
PrimApp _ x -> usesOfEA idx x
ShapeSize sh -> usesOfEA idx sh
Intersect sh sz -> usesOfEA idx sh + usesOfEA idx sz
--
-- Special case: Because we are looking to fuse two array computations
-- together, it is not necessary to consider the contribution of Shape since
-- this would be replaced with a simple scalar expression.
--
Index a sh -> usesOf idx a + usesOfEA idx sh
LinearIndex a i -> usesOf idx a + usesOfEA idx i
Shape _ -> 0
usesOfTA :: Idx aenv a -> Tuple (OpenExp env aenv) t -> Int
usesOfTA idx tup =
case tup of
NilTup -> 0
SnocTup t e -> usesOfTA idx t + usesOfEA idx e
usesOfFA :: Idx aenv a -> OpenFun env aenv f -> Int
usesOfFA idx fun =
case fun of
Body e -> usesOfEA idx e
Lam f -> usesOfFA idx f
-- Substitute shape and array indexing with scalar functions at the given
-- array index.
--
replaceF :: (Shape sh, Elt e)
=> OpenExp env' aenv sh
-> OpenFun env' aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenFun env' aenv f
-> OpenFun env' aenv f
replaceF sh ix idx fun =
case fun of
Body e -> Body (replaceE sh ix idx e)
Lam f -> Lam (replaceF (weakenE sh) (weakenFE ix) idx f)
replaceE
:: forall sh e t env aenv. (Shape sh, Elt e)
=> OpenExp env aenv sh
-> OpenFun env aenv (sh -> e)
-> Idx aenv (Array sh e)
-> OpenExp env aenv t
-> OpenExp env aenv t
replaceE sh_ ix_ idx exp =
let travE :: OpenExp env aenv t' -> OpenExp env aenv t'
travE = replaceE sh_ ix_ idx
travT :: Tuple (OpenExp env aenv) t' -> Tuple (OpenExp env aenv) t'
travT NilTup = NilTup
travT (SnocTup t e) = travT t `SnocTup` travE e
in case exp of
Let bnd body -> Let (travE bnd) (replaceE (weakenE sh_) (weakenFE ix_) idx body)
Var i -> Var i
Const c -> Const c
Tuple t -> Tuple (travT t)
Prj ix e -> Prj ix (travE e)
IndexNil -> IndexNil
IndexCons sl sz -> IndexCons (travE sl) (travE sz)
IndexHead sh -> IndexHead (travE sh)
IndexTail sz -> IndexTail (travE sz)
IndexAny -> IndexAny
IndexSlice x ix sh -> IndexSlice x (travE ix) (travE sh)
IndexFull x ix sl -> IndexFull x (travE ix) (travE sl)
ToIndex sh ix -> ToIndex (travE sh) (travE ix)
FromIndex sh i -> FromIndex (travE sh) (travE i)
Cond p t e -> Cond (travE p) (travE t) (travE e)
Iterate n f x -> Iterate (travE n) (replaceE (weakenE sh_) (weakenFE ix_) idx f) (travE x)
PrimConst c -> PrimConst c
PrimApp g x -> PrimApp g (travE x)
ShapeSize sh -> ShapeSize (travE sh)
Intersect sh sl -> Intersect (travE sh) (travE sl)
Shape (OpenAcc a)
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
-> sh_
| otherwise
-> exp
--
Index (OpenAcc a) sh
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let sh f
| otherwise
-> Index (OpenAcc a) (travE sh)
--
LinearIndex (OpenAcc a) i
| Avar idx' <- a
, Just REFL <- matchIdx idx idx'
, Lam (Body f) <- ix_
-> Let (Let i (FromIndex (weakenE sh_) (Var ZeroIdx))) f
| otherwise
-> LinearIndex (OpenAcc a) (travE i)
-- Environment manipulation
-- ------------------------
-- NOTE: [Extend]
--
-- As part of the fusion transformation we often need to lift out array valued
-- inputs to be let-bound at a higher point. This is used by the delayed
-- representations to witness how the array environment is extended in the
-- presence of fused operators.
--
| 12,838
| false
| true
| 319
| 19
| 4,990
| 3,971
| 2,039
| 1,932
| null | null |
michaelmp/chess
|
src/Chess/Board.hs
|
agpl-3.0
|
e8 = AlgebraicSquare (File 'e') (Rank 8)
| 40
|
e8 = AlgebraicSquare (File 'e') (Rank 8)
| 40
|
e8 = AlgebraicSquare (File 'e') (Rank 8)
| 40
| false
| false
| 1
| 7
| 6
| 26
| 11
| 15
| null | null |
geophf/1HaskellADay
|
exercises/HAD/Y2021/M02/D22/Exercise.hs
|
mit
|
-- removeExactMatches is a Set.removeBy-function
{--
>>> let smgwss = removeExactMatches em gwss
>>> Set.size smgwss
16836
>>> let smwwbcs = removeExactMatches em wwbcs
>>> Set.size smwwbcs
481
Okay. Now let's remove any aliased wineries, ... that we will eventually be
having.
--}
aliasedWineriesQuery :: Cypher
aliasedWineriesQuery = T.concat ["MATCH (aw:AliasedWinery)--(w:Winery) ",
"RETURN aw.name, w.name"]
| 451
|
aliasedWineriesQuery :: Cypher
aliasedWineriesQuery = T.concat ["MATCH (aw:AliasedWinery)--(w:Winery) ",
"RETURN aw.name, w.name"]
| 163
|
aliasedWineriesQuery = T.concat ["MATCH (aw:AliasedWinery)--(w:Winery) ",
"RETURN aw.name, w.name"]
| 132
| true
| true
| 0
| 6
| 93
| 30
| 15
| 15
| null | null |
ribag/ganeti-experiments
|
src/Ganeti/WConfd/Core.hs
|
gpl-2.0
|
-- * Functions available to the RPC module
-- Just a test function
echo :: String -> WConfdMonad String
echo = return
| 118
|
echo :: String -> WConfdMonad String
echo = return
| 50
|
echo = return
| 13
| true
| true
| 0
| 7
| 22
| 26
| 12
| 14
| null | null |
javgh/mtgoxapi
|
Network/MtGoxAPI/CurlWrapper.hs
|
bsd-3-clause
|
-- | Will start a thread which will execute cURL requests that are passed to it
-- using 'performCurlRequest'. Internally only a single cURL handle is opened,
-- which means that keep-alive connections are automatically reused.
initCurlWrapper :: IO CurlHandle
initCurlWrapper = do
chan <- newChan :: IO (Chan CurlData)
_ <- forkIO $ curlThread chan
return $ CurlHandle chan
| 386
|
initCurlWrapper :: IO CurlHandle
initCurlWrapper = do
chan <- newChan :: IO (Chan CurlData)
_ <- forkIO $ curlThread chan
return $ CurlHandle chan
| 158
|
initCurlWrapper = do
chan <- newChan :: IO (Chan CurlData)
_ <- forkIO $ curlThread chan
return $ CurlHandle chan
| 125
| true
| true
| 0
| 10
| 71
| 60
| 29
| 31
| null | null |
kmate/HaRe
|
old/refactorer/RefacInstantiate.hs
|
bsd-3-clause
|
addMatch x _ = error "You can only instantiate patterns on the LHS of a match!"
| 79
|
addMatch x _ = error "You can only instantiate patterns on the LHS of a match!"
| 79
|
addMatch x _ = error "You can only instantiate patterns on the LHS of a match!"
| 79
| false
| false
| 0
| 4
| 15
| 16
| 6
| 10
| null | null |
jtdaugherty/vty
|
src/Data/Terminfo/Eval.hs
|
bsd-3-clause
|
writeCapOp (PushValue v) = do
push v
| 40
|
writeCapOp (PushValue v) = do
push v
| 40
|
writeCapOp (PushValue v) = do
push v
| 40
| false
| false
| 0
| 7
| 10
| 22
| 9
| 13
| null | null |
unisonweb/platform
|
parser-typechecker/src/Unison/Runtime/Foreign.hs
|
mit
|
wrapBuiltin :: forall f. BuiltinForeign f => f -> Foreign
wrapBuiltin x = Wrap r x
where
Tagged r = foreignRef :: Tagged f Reference
| 136
|
wrapBuiltin :: forall f. BuiltinForeign f => f -> Foreign
wrapBuiltin x = Wrap r x
where
Tagged r = foreignRef :: Tagged f Reference
| 136
|
wrapBuiltin x = Wrap r x
where
Tagged r = foreignRef :: Tagged f Reference
| 78
| false
| true
| 0
| 7
| 28
| 55
| 26
| 29
| null | null |
HJvT/com
|
System/Win32/Com/Server.hs
|
bsd-3-clause
|
getTypeInfoCount :: Ptr () -> Ptr Word32 -> IO HRESULT
getTypeInfoCount iptr pctInfo = do
-- putMessage "getTypeInfoCount"
writeWord32 pctInfo 1
return s_OK
| 161
|
getTypeInfoCount :: Ptr () -> Ptr Word32 -> IO HRESULT
getTypeInfoCount iptr pctInfo = do
-- putMessage "getTypeInfoCount"
writeWord32 pctInfo 1
return s_OK
| 161
|
getTypeInfoCount iptr pctInfo = do
-- putMessage "getTypeInfoCount"
writeWord32 pctInfo 1
return s_OK
| 106
| false
| true
| 0
| 7
| 27
| 50
| 22
| 28
| null | null |
Fuuzetsu/yi-emacs-colours
|
src/Yi/Style/EmacsColours.hs
|
gpl-2.0
|
-- | Names: @["gray61"]@
--
-- R156 G156 B156, 0x9c9c9c
gray61 :: Color
gray61 = RGB 156 156 156
| 96
|
gray61 :: Color
gray61 = RGB 156 156 156
| 40
|
gray61 = RGB 156 156 156
| 24
| true
| true
| 0
| 6
| 18
| 27
| 13
| 14
| null | null |
GaloisInc/mistral
|
src/Mistral/TypeCheck/AST.hs
|
bsd-3-clause
|
-- | Assert equality between two types. This boils down to solving via
-- unification.
(~~) :: Type -> Type -> Prop
a ~~ b = tapp eqPropCon [a,b]
| 146
|
(~~) :: Type -> Type -> Prop
a ~~ b = tapp eqPropCon [a,b]
| 58
|
a ~~ b = tapp eqPropCon [a,b]
| 29
| true
| true
| 0
| 9
| 29
| 41
| 22
| 19
| null | null |
stevely/hspirv
|
src/SpirV/Builder.hs
|
bsd-3-clause
|
-- Id 1: Result type
-- Id 2: Value to add to group
groupIAdd :: TypeId -> ExecutionScope -> GroupOperation -> Id -> Builder Id
groupIAdd (TypeId i) = R.groupIAdd i
| 164
|
groupIAdd :: TypeId -> ExecutionScope -> GroupOperation -> Id -> Builder Id
groupIAdd (TypeId i) = R.groupIAdd i
| 112
|
groupIAdd (TypeId i) = R.groupIAdd i
| 36
| true
| true
| 0
| 12
| 30
| 51
| 24
| 27
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/WebGPURenderPipelineDescriptor.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/WebGPURenderPipelineDescriptor.fragmentFunction Mozilla WebGPURenderPipelineDescriptor.fragmentFunction documentation>
getFragmentFunction ::
(MonadDOM m) =>
WebGPURenderPipelineDescriptor -> m (Maybe WebGPUFunction)
getFragmentFunction self
= liftDOM ((self ^. js "fragmentFunction") >>= fromJSVal)
| 399
|
getFragmentFunction ::
(MonadDOM m) =>
WebGPURenderPipelineDescriptor -> m (Maybe WebGPUFunction)
getFragmentFunction self
= liftDOM ((self ^. js "fragmentFunction") >>= fromJSVal)
| 224
|
getFragmentFunction self
= liftDOM ((self ^. js "fragmentFunction") >>= fromJSVal)
| 84
| true
| true
| 0
| 10
| 70
| 57
| 29
| 28
| null | null |
typelead/epm
|
epm/Distribution/Client/BuildReports/Anonymous.hs
|
bsd-3-clause
|
-- -----------------------------------------------------------------------------
-- Description of the fields, for parsing/printing
fieldDescrs :: [FieldDescr BuildReport]
fieldDescrs =
[ simpleField "package" Text.disp Text.parse
package (\v r -> r { package = v })
, simpleField "os" Text.disp Text.parse
os (\v r -> r { os = v })
, simpleField "arch" Text.disp Text.parse
arch (\v r -> r { arch = v })
, simpleField "compiler" Text.disp Text.parse
compiler (\v r -> r { compiler = v })
, simpleField "client" Text.disp Text.parse
client (\v r -> r { client = v })
, listField "flags" dispFlag parseFlag
flagAssignment (\v r -> r { flagAssignment = v })
, listField "dependencies" Text.disp Text.parse
dependencies (\v r -> r { dependencies = v })
, simpleField "install-outcome" Text.disp Text.parse
installOutcome (\v r -> r { installOutcome = v })
, simpleField "docs-outcome" Text.disp Text.parse
docsOutcome (\v r -> r { docsOutcome = v })
, simpleField "tests-outcome" Text.disp Text.parse
testsOutcome (\v r -> r { testsOutcome = v })
]
| 1,558
|
fieldDescrs :: [FieldDescr BuildReport]
fieldDescrs =
[ simpleField "package" Text.disp Text.parse
package (\v r -> r { package = v })
, simpleField "os" Text.disp Text.parse
os (\v r -> r { os = v })
, simpleField "arch" Text.disp Text.parse
arch (\v r -> r { arch = v })
, simpleField "compiler" Text.disp Text.parse
compiler (\v r -> r { compiler = v })
, simpleField "client" Text.disp Text.parse
client (\v r -> r { client = v })
, listField "flags" dispFlag parseFlag
flagAssignment (\v r -> r { flagAssignment = v })
, listField "dependencies" Text.disp Text.parse
dependencies (\v r -> r { dependencies = v })
, simpleField "install-outcome" Text.disp Text.parse
installOutcome (\v r -> r { installOutcome = v })
, simpleField "docs-outcome" Text.disp Text.parse
docsOutcome (\v r -> r { docsOutcome = v })
, simpleField "tests-outcome" Text.disp Text.parse
testsOutcome (\v r -> r { testsOutcome = v })
]
| 1,425
|
fieldDescrs =
[ simpleField "package" Text.disp Text.parse
package (\v r -> r { package = v })
, simpleField "os" Text.disp Text.parse
os (\v r -> r { os = v })
, simpleField "arch" Text.disp Text.parse
arch (\v r -> r { arch = v })
, simpleField "compiler" Text.disp Text.parse
compiler (\v r -> r { compiler = v })
, simpleField "client" Text.disp Text.parse
client (\v r -> r { client = v })
, listField "flags" dispFlag parseFlag
flagAssignment (\v r -> r { flagAssignment = v })
, listField "dependencies" Text.disp Text.parse
dependencies (\v r -> r { dependencies = v })
, simpleField "install-outcome" Text.disp Text.parse
installOutcome (\v r -> r { installOutcome = v })
, simpleField "docs-outcome" Text.disp Text.parse
docsOutcome (\v r -> r { docsOutcome = v })
, simpleField "tests-outcome" Text.disp Text.parse
testsOutcome (\v r -> r { testsOutcome = v })
]
| 1,385
| true
| true
| 0
| 11
| 678
| 382
| 210
| 172
| null | null |
michaelficarra/purescript
|
src/Language/PureScript/Sugar/TypeClasses/Deriving.hs
|
mit
|
mkSpineFunction _ _ = internalError "mkSpineFunction: expected DataDeclaration"
| 79
|
mkSpineFunction _ _ = internalError "mkSpineFunction: expected DataDeclaration"
| 79
|
mkSpineFunction _ _ = internalError "mkSpineFunction: expected DataDeclaration"
| 79
| false
| false
| 0
| 5
| 7
| 14
| 6
| 8
| null | null |
forked-upstream-packages-for-ghcjs/ghc
|
compiler/deSugar/DsArrows.hs
|
bsd-3-clause
|
{-
The input is divided into a local environment, which is a flat tuple
(unless it's too big), and a stack, which is a right-nested pair.
In general, the input has the form
((x1,...,xn), (s1,...(sk,())...))
where xi are the environment values, and si the ones on the stack,
with s1 being the "top", the first one to be matched with a lambda.
-}
envStackType :: [Id] -> Type -> Type
envStackType ids stack_ty = mkCorePairTy (mkBigCoreVarTupTy ids) stack_ty
| 466
|
envStackType :: [Id] -> Type -> Type
envStackType ids stack_ty = mkCorePairTy (mkBigCoreVarTupTy ids) stack_ty
| 110
|
envStackType ids stack_ty = mkCorePairTy (mkBigCoreVarTupTy ids) stack_ty
| 73
| true
| true
| 0
| 7
| 88
| 39
| 20
| 19
| null | null |
jsavatgy/talvipaivanseisauksen-ajanlasku
|
bmt-test-03.hs
|
gpl-3.0
|
timeParsed :: String -> UTCTime
timeParsed line =
fromJust t where
t = parseTime defaultTimeLocale "%Y-%m-%d %H:%M" line
| 126
|
timeParsed :: String -> UTCTime
timeParsed line =
fromJust t where
t = parseTime defaultTimeLocale "%Y-%m-%d %H:%M" line
| 126
|
timeParsed line =
fromJust t where
t = parseTime defaultTimeLocale "%Y-%m-%d %H:%M" line
| 94
| false
| true
| 0
| 7
| 23
| 35
| 17
| 18
| null | null |
egison/egison
|
hs-src/Language/Egison/PrettyMath/Mathematica.hs
|
mit
|
showMathExpr (Partial f xs) = showMathExpr f ++ "_" ++ showMathExprs "_" xs
| 75
|
showMathExpr (Partial f xs) = showMathExpr f ++ "_" ++ showMathExprs "_" xs
| 75
|
showMathExpr (Partial f xs) = showMathExpr f ++ "_" ++ showMathExprs "_" xs
| 75
| false
| false
| 2
| 6
| 12
| 35
| 15
| 20
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/DeSugar/DsArrows.hs
|
bsd-3-clause
|
dsCmdLStmt :: DsCmdEnv -> IdSet -> [Id] -> CmdLStmt Id -> [Id]
-> DsM (CoreExpr, IdSet)
dsCmdLStmt ids local_vars out_ids cmd env_ids
= dsCmdStmt ids local_vars out_ids (unLoc cmd) env_ids
| 201
|
dsCmdLStmt :: DsCmdEnv -> IdSet -> [Id] -> CmdLStmt Id -> [Id]
-> DsM (CoreExpr, IdSet)
dsCmdLStmt ids local_vars out_ids cmd env_ids
= dsCmdStmt ids local_vars out_ids (unLoc cmd) env_ids
| 201
|
dsCmdLStmt ids local_vars out_ids cmd env_ids
= dsCmdStmt ids local_vars out_ids (unLoc cmd) env_ids
| 102
| false
| true
| 0
| 11
| 42
| 77
| 39
| 38
| null | null |
jstolarek/ghc
|
compiler/vectorise/Vectorise/Type/Classify.hs
|
bsd-3-clause
|
-- Compute mutually recursive groups of tycons in topological order.
--
tyConGroups :: [TyCon] -> [TyConGroup]
tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges)
where
edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs
, let ds = tyConsOfTyCon tc]
mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds)
mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss)
where
(tcs, dss) = unzip els
-- |Collect the set of TyCons used by the representation of some data type.
--
| 542
|
tyConGroups :: [TyCon] -> [TyConGroup]
tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges)
where
edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs
, let ds = tyConsOfTyCon tc]
mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds)
mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss)
where
(tcs, dss) = unzip els
-- |Collect the set of TyCons used by the representation of some data type.
--
| 470
|
tyConGroups tcs = map mk_grp (stronglyConnCompFromEdgedVertices edges)
where
edges = [((tc, ds), tc, uniqSetToList ds) | tc <- tcs
, let ds = tyConsOfTyCon tc]
mk_grp (AcyclicSCC (tc, ds)) = ([tc], ds)
mk_grp (CyclicSCC els) = (tcs, unionManyUniqSets dss)
where
(tcs, dss) = unzip els
-- |Collect the set of TyCons used by the representation of some data type.
--
| 431
| true
| true
| 0
| 10
| 143
| 158
| 87
| 71
| null | null |
mikeizbicki/HLearn
|
src/HLearn/Optimization/Univariate.hs
|
bsd-3-clause
|
fminuncM_bracketed_dbrent ::
( OrdField a
, cxt a
) => StopCondition (Iterator_dbrent a) -- ^ controls when to stop
-> LineBracket a -- ^ search for the solution within this range
-> (a -> History cxt a) -- ^ monadic function we're minimizing
-> (a -> History cxt a) -- ^ derivative of the function we're minimizing
-> History cxt (Iterator_dbrent a) -- ^ result of the optimization
fminuncM_bracketed_dbrent stop (LineBracket ax bx cx fa fb fc) f df = beginFunction "dbrent" $ do
fbx <- f bx
dfx <- df bx
iterate (step_dbrent f df) stop $ Iterator_dbrent
{ _dbrent_a = min ax cx
, _dbrent_b = max ax cx
, _dbrent_d = zero
, _dbrent_e = zero
, _dbrent_v = bx
, _dbrent_w = bx
, _dbrent_x = bx
, _dbrent_fv = fbx
, _dbrent_fw = fbx
, _dbrent_fx = fbx
, _dbrent_dv = dfx
, _dbrent_dw = dfx
, _dbrent_dx = dfx
, _dbrent_break = False
}
where
step_dbrent f df dbrent@(Iterator_dbrent a b d e fv fw fx dv dw dx v w x _) = do
let zeps = 1e-10
sign a b = if b>0 then abs a else -(abs a)
tol = 1e-6
xm = 0.5*(a+b)
tol1' = tol*(abs x)+zeps
tol2' = 2*tol1'
(d',e') = if abs e > tol1'
then let
d1 = if dw /= dx then (w-x)*dx/(dx-dw) else 2*(b-a)
d2 = if dv /= dx then (v-x)*dx/(dx-dv) else 2*(b-a)
u1 = x+d1
u2 = x+d2
ok1 = (a-u1)*(u1-b) > 0 && dx*d1 <= 0
ok2 = (a-u2)*(u2-b) > 0 && dx*d2 <= 0
in if ok1 || ok2
then let
d'' = if ok1 && ok2
then if abs d1 < abs d2 then d1 else d2
else if ok1 then d1 else d2
in if abs d'' <= abs (0.5 * e)
then let u' = x + d''
in if u'-a < tol2' || b-u' < tol2'
then (sign tol1' xm-x, d)
else (d'', d)
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
u' = if abs d' >= tol1' then x+d' else x+sign tol1' d'
fu' <- f u'
du' <- df u'
return $ if abs d' < tol1' && fu' > fx
then dbrent
{ _dbrent_x = x
, _dbrent_fx = fx
, _dbrent_break = True
}
else
if fu' <= fx
then dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' >= x then x else a
, _dbrent_b = if u' >= x then b else x
, _dbrent_v = w
, _dbrent_w = x
, _dbrent_x = u'
, _dbrent_fv = fw
, _dbrent_fw = fx
, _dbrent_fx = fu'
, _dbrent_dv = dw
, _dbrent_dw = dx
, _dbrent_dx = du'
}
else dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' < x then u' else a
, _dbrent_b = if u' < x then b else u'
, _dbrent_v = if fu' <= fw || w==x then w else if fu' <= fv || v==x || v==w then u' else v
, _dbrent_fv = if fu' <= fw || w==x then fw else if fu' <= fv || v==x || v==w then fu' else fv
, _dbrent_dv = if fu' <= fw || w==x then dw else if fu' <= fv || v==x || v==w then du' else dv
, _dbrent_w = if fu' <= fw || w==x then u' else w
, _dbrent_fw = if fu' <= fw || w==x then fu' else fw
, _dbrent_dw = if fu' <= fw || w==x then du' else dw
}
-- | Does not stop until the independent variable is accurate to within the tolerance passed in.
| 4,956
|
fminuncM_bracketed_dbrent ::
( OrdField a
, cxt a
) => StopCondition (Iterator_dbrent a) -- ^ controls when to stop
-> LineBracket a -- ^ search for the solution within this range
-> (a -> History cxt a) -- ^ monadic function we're minimizing
-> (a -> History cxt a) -- ^ derivative of the function we're minimizing
-> History cxt (Iterator_dbrent a)
fminuncM_bracketed_dbrent stop (LineBracket ax bx cx fa fb fc) f df = beginFunction "dbrent" $ do
fbx <- f bx
dfx <- df bx
iterate (step_dbrent f df) stop $ Iterator_dbrent
{ _dbrent_a = min ax cx
, _dbrent_b = max ax cx
, _dbrent_d = zero
, _dbrent_e = zero
, _dbrent_v = bx
, _dbrent_w = bx
, _dbrent_x = bx
, _dbrent_fv = fbx
, _dbrent_fw = fbx
, _dbrent_fx = fbx
, _dbrent_dv = dfx
, _dbrent_dw = dfx
, _dbrent_dx = dfx
, _dbrent_break = False
}
where
step_dbrent f df dbrent@(Iterator_dbrent a b d e fv fw fx dv dw dx v w x _) = do
let zeps = 1e-10
sign a b = if b>0 then abs a else -(abs a)
tol = 1e-6
xm = 0.5*(a+b)
tol1' = tol*(abs x)+zeps
tol2' = 2*tol1'
(d',e') = if abs e > tol1'
then let
d1 = if dw /= dx then (w-x)*dx/(dx-dw) else 2*(b-a)
d2 = if dv /= dx then (v-x)*dx/(dx-dv) else 2*(b-a)
u1 = x+d1
u2 = x+d2
ok1 = (a-u1)*(u1-b) > 0 && dx*d1 <= 0
ok2 = (a-u2)*(u2-b) > 0 && dx*d2 <= 0
in if ok1 || ok2
then let
d'' = if ok1 && ok2
then if abs d1 < abs d2 then d1 else d2
else if ok1 then d1 else d2
in if abs d'' <= abs (0.5 * e)
then let u' = x + d''
in if u'-a < tol2' || b-u' < tol2'
then (sign tol1' xm-x, d)
else (d'', d)
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
u' = if abs d' >= tol1' then x+d' else x+sign tol1' d'
fu' <- f u'
du' <- df u'
return $ if abs d' < tol1' && fu' > fx
then dbrent
{ _dbrent_x = x
, _dbrent_fx = fx
, _dbrent_break = True
}
else
if fu' <= fx
then dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' >= x then x else a
, _dbrent_b = if u' >= x then b else x
, _dbrent_v = w
, _dbrent_w = x
, _dbrent_x = u'
, _dbrent_fv = fw
, _dbrent_fw = fx
, _dbrent_fx = fu'
, _dbrent_dv = dw
, _dbrent_dw = dx
, _dbrent_dx = du'
}
else dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' < x then u' else a
, _dbrent_b = if u' < x then b else u'
, _dbrent_v = if fu' <= fw || w==x then w else if fu' <= fv || v==x || v==w then u' else v
, _dbrent_fv = if fu' <= fw || w==x then fw else if fu' <= fv || v==x || v==w then fu' else fv
, _dbrent_dv = if fu' <= fw || w==x then dw else if fu' <= fv || v==x || v==w then du' else dv
, _dbrent_w = if fu' <= fw || w==x then u' else w
, _dbrent_fw = if fu' <= fw || w==x then fu' else fw
, _dbrent_dw = if fu' <= fw || w==x then du' else dw
}
-- | Does not stop until the independent variable is accurate to within the tolerance passed in.
| 4,917
|
fminuncM_bracketed_dbrent stop (LineBracket ax bx cx fa fb fc) f df = beginFunction "dbrent" $ do
fbx <- f bx
dfx <- df bx
iterate (step_dbrent f df) stop $ Iterator_dbrent
{ _dbrent_a = min ax cx
, _dbrent_b = max ax cx
, _dbrent_d = zero
, _dbrent_e = zero
, _dbrent_v = bx
, _dbrent_w = bx
, _dbrent_x = bx
, _dbrent_fv = fbx
, _dbrent_fw = fbx
, _dbrent_fx = fbx
, _dbrent_dv = dfx
, _dbrent_dw = dfx
, _dbrent_dx = dfx
, _dbrent_break = False
}
where
step_dbrent f df dbrent@(Iterator_dbrent a b d e fv fw fx dv dw dx v w x _) = do
let zeps = 1e-10
sign a b = if b>0 then abs a else -(abs a)
tol = 1e-6
xm = 0.5*(a+b)
tol1' = tol*(abs x)+zeps
tol2' = 2*tol1'
(d',e') = if abs e > tol1'
then let
d1 = if dw /= dx then (w-x)*dx/(dx-dw) else 2*(b-a)
d2 = if dv /= dx then (v-x)*dx/(dx-dv) else 2*(b-a)
u1 = x+d1
u2 = x+d2
ok1 = (a-u1)*(u1-b) > 0 && dx*d1 <= 0
ok2 = (a-u2)*(u2-b) > 0 && dx*d2 <= 0
in if ok1 || ok2
then let
d'' = if ok1 && ok2
then if abs d1 < abs d2 then d1 else d2
else if ok1 then d1 else d2
in if abs d'' <= abs (0.5 * e)
then let u' = x + d''
in if u'-a < tol2' || b-u' < tol2'
then (sign tol1' xm-x, d)
else (d'', d)
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
else
let e'' = if dx>=0 then a-x else b-x
in (0.5*e'',e'')
u' = if abs d' >= tol1' then x+d' else x+sign tol1' d'
fu' <- f u'
du' <- df u'
return $ if abs d' < tol1' && fu' > fx
then dbrent
{ _dbrent_x = x
, _dbrent_fx = fx
, _dbrent_break = True
}
else
if fu' <= fx
then dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' >= x then x else a
, _dbrent_b = if u' >= x then b else x
, _dbrent_v = w
, _dbrent_w = x
, _dbrent_x = u'
, _dbrent_fv = fw
, _dbrent_fw = fx
, _dbrent_fx = fu'
, _dbrent_dv = dw
, _dbrent_dw = dx
, _dbrent_dx = du'
}
else dbrent
{ _dbrent_e = e'
, _dbrent_d = d'
, _dbrent_a = if u' < x then u' else a
, _dbrent_b = if u' < x then b else u'
, _dbrent_v = if fu' <= fw || w==x then w else if fu' <= fv || v==x || v==w then u' else v
, _dbrent_fv = if fu' <= fw || w==x then fw else if fu' <= fv || v==x || v==w then fu' else fv
, _dbrent_dv = if fu' <= fw || w==x then dw else if fu' <= fv || v==x || v==w then du' else dv
, _dbrent_w = if fu' <= fw || w==x then u' else w
, _dbrent_fw = if fu' <= fw || w==x then fu' else fw
, _dbrent_dw = if fu' <= fw || w==x then du' else dw
}
-- | Does not stop until the independent variable is accurate to within the tolerance passed in.
| 4,464
| true
| true
| 3
| 28
| 2,746
| 1,411
| 780
| 631
| null | null |
scottgw/language-eiffel
|
Language/Eiffel/Parser/Expr.hs
|
bsd-3-clause
|
resultVar :: Parser UnPosExpr
resultVar = keyword TokResult >> return ResultVar
| 79
|
resultVar :: Parser UnPosExpr
resultVar = keyword TokResult >> return ResultVar
| 79
|
resultVar = keyword TokResult >> return ResultVar
| 49
| false
| true
| 0
| 6
| 10
| 24
| 11
| 13
| null | null |
marmutro/console-calendar
|
Calendar.hs
|
bsd-2-clause
|
byMonth = groupBy (\a b -> (monthOfDate a) == (monthOfDate b))
| 62
|
byMonth = groupBy (\a b -> (monthOfDate a) == (monthOfDate b))
| 62
|
byMonth = groupBy (\a b -> (monthOfDate a) == (monthOfDate b))
| 62
| false
| false
| 1
| 10
| 10
| 39
| 18
| 21
| null | null |
spechub/Hets
|
Persistence/Reasoning.hs
|
gpl-2.0
|
setOmsConsistencyCheckStatus :: MonadIO m
=> Entity DatabaseSchema.LocIdBase
-> ConsistencyStatusType.ConsistencyStatusType
-> DBMonad m ()
setOmsConsistencyCheckStatus (Entity omsKey _) consistencyCheckStatus = do
E.update $ \ oms -> do
set oms [OMSConsistencyStatus E.=. val consistencyCheckStatus]
where_ $ coerceId (oms ^. OMSId) ==. val omsKey
return ()
| 457
|
setOmsConsistencyCheckStatus :: MonadIO m
=> Entity DatabaseSchema.LocIdBase
-> ConsistencyStatusType.ConsistencyStatusType
-> DBMonad m ()
setOmsConsistencyCheckStatus (Entity omsKey _) consistencyCheckStatus = do
E.update $ \ oms -> do
set oms [OMSConsistencyStatus E.=. val consistencyCheckStatus]
where_ $ coerceId (oms ^. OMSId) ==. val omsKey
return ()
| 457
|
setOmsConsistencyCheckStatus (Entity omsKey _) consistencyCheckStatus = do
E.update $ \ oms -> do
set oms [OMSConsistencyStatus E.=. val consistencyCheckStatus]
where_ $ coerceId (oms ^. OMSId) ==. val omsKey
return ()
| 230
| false
| true
| 0
| 15
| 141
| 119
| 55
| 64
| null | null |
sinjar666/fbthrift
|
thrift/compiler/test/fixtures/qualified/gen-hs/Module2_Types.hs
|
apache-2.0
|
to_BigStruct _ = error "not a struct"
| 37
|
to_BigStruct _ = error "not a struct"
| 37
|
to_BigStruct _ = error "not a struct"
| 37
| false
| false
| 0
| 5
| 6
| 12
| 5
| 7
| null | null |
DaMSL/K3
|
test/Language/K3/Interpreter/Values.hs
|
apache-2.0
|
packCollection :: [Test]
packCollection = []
| 44
|
packCollection :: [Test]
packCollection = []
| 44
|
packCollection = []
| 19
| false
| true
| 0
| 7
| 5
| 23
| 10
| 13
| null | null |
ghorn/dynobud
|
dynobud/src/Dyno/NlpSolver.hs
|
lgpl-3.0
|
toOutput ::
View xg
=> (ScaleFuns x g DM -> (J xg (Vector Double) -> J xg (Vector Double)))
-> String -> NlpSol x p g -> M.Map String (Vector Double) -> J xg (Vector Double)
toOutput scaleFun name nlpSol dmMap = case M.lookup name dmMap of
Nothing -> error $ "couldn't find output " ++ show name ++ " in outputs " ++ show (M.keys dmMap)
Just r -> scaleFun (isScale nlpSol) (mkM r)
-- (d2v used to be dnonzeros)
| 422
|
toOutput ::
View xg
=> (ScaleFuns x g DM -> (J xg (Vector Double) -> J xg (Vector Double)))
-> String -> NlpSol x p g -> M.Map String (Vector Double) -> J xg (Vector Double)
toOutput scaleFun name nlpSol dmMap = case M.lookup name dmMap of
Nothing -> error $ "couldn't find output " ++ show name ++ " in outputs " ++ show (M.keys dmMap)
Just r -> scaleFun (isScale nlpSol) (mkM r)
-- (d2v used to be dnonzeros)
| 422
|
toOutput scaleFun name nlpSol dmMap = case M.lookup name dmMap of
Nothing -> error $ "couldn't find output " ++ show name ++ " in outputs " ++ show (M.keys dmMap)
Just r -> scaleFun (isScale nlpSol) (mkM r)
-- (d2v used to be dnonzeros)
| 242
| false
| true
| 0
| 14
| 92
| 192
| 91
| 101
| null | null |
rahulmutt/codec-jvm
|
src/Codec/JVM/ASM/Code.hs
|
apache-2.0
|
if_fcmpne = floatInvBranch jfloat OP.fcmpl ifeq
| 47
|
if_fcmpne = floatInvBranch jfloat OP.fcmpl ifeq
| 47
|
if_fcmpne = floatInvBranch jfloat OP.fcmpl ifeq
| 47
| false
| false
| 1
| 6
| 5
| 18
| 7
| 11
| null | null |
mattias-lundell/timber-llvm
|
src/Kindle.hs
|
bsd-3-clause
|
tFloat = tId Float
| 51
|
tFloat = tId Float
| 51
|
tFloat = tId Float
| 51
| false
| false
| 0
| 5
| 36
| 9
| 4
| 5
| null | null |
c0deaddict/project-euler
|
src/Part2/Problem46.hs
|
bsd-3-clause
|
--
-- Problem 46: Goldbach's other conjecture
--
-- It was proposed by Christian Goldbach that every odd composite number can be
-- written as the sum of a prime and twice a square.
--
-- 9 = 7 + 2×1^2
-- 15 = 7 + 2×2^2
-- 21 = 3 + 2×3^2
-- 25 = 7 + 2×3^2
-- 27 = 19 + 2×2^2
-- 33 = 31 + 2×1^2
--
-- It turns out that the conjecture was false.
--
-- What is the smallest odd composite that cannot be written as the sum of a
-- prime and twice a square?
problem46 :: Maybe Int
problem46 = find (not . isGoldbach) oddComposites
| 526
|
problem46 :: Maybe Int
problem46 = find (not . isGoldbach) oddComposites
| 72
|
problem46 = find (not . isGoldbach) oddComposites
| 49
| true
| true
| 0
| 7
| 115
| 49
| 31
| 18
| null | null |
armoredsoftware/protocol
|
tpm/mainline/src/TPM/Const.hs
|
bsd-3-clause
|
tpm_ord_convertmigrationblob = (0x0000002a :: Word32)
| 53
|
tpm_ord_convertmigrationblob = (0x0000002a :: Word32)
| 53
|
tpm_ord_convertmigrationblob = (0x0000002a :: Word32)
| 53
| false
| false
| 0
| 5
| 4
| 12
| 7
| 5
| null | null |
diegomachadosoares/hcomp
|
Parser.hs
|
gpl-3.0
|
statement :: Parser Com
statement = parens statement
<|> statement'
| 81
|
statement :: Parser Com
statement = parens statement
<|> statement'
| 81
|
statement = parens statement
<|> statement'
| 57
| false
| true
| 0
| 6
| 23
| 21
| 10
| 11
| null | null |
danr/hipspec
|
examples/old-examples/hip/Expr.hs
|
gpl-3.0
|
mirror :: Expr -> Expr
mirror (Add e1 e2) = Add (mirror e2) (mirror e1)
| 71
|
mirror :: Expr -> Expr
mirror (Add e1 e2) = Add (mirror e2) (mirror e1)
| 71
|
mirror (Add e1 e2) = Add (mirror e2) (mirror e1)
| 48
| false
| true
| 0
| 9
| 14
| 49
| 22
| 27
| null | null |
tonyfloatersu/solution-haskell-craft-of-FP
|
Chapter_11_my_note.hs
|
mit
|
_succ :: Integer -> Integer
_succ a = a + 1
| 46
|
_succ :: Integer -> Integer
_succ a = a + 1
| 46
|
_succ a = a + 1
| 18
| false
| true
| 0
| 7
| 13
| 28
| 12
| 16
| null | null |
ulricha/dsh
|
src/Database/DSH/SL/Opt/Properties/VectorType.hs
|
bsd-3-clause
|
inferVectorTypeUnOp :: VectorProp VectorType -> UnOp -> Either String (VectorProp VectorType)
inferVectorTypeUnOp s op =
case op of
WinFun _ -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec $ w + 1
Unique -> VProp <$> unpack s
UnboxKey -> Right $ VProp $ VTNA
Segment -> VProp <$> unpack s
Unsegment -> VProp <$> unpack s
Reverse -> liftM2 VPropPair (unpack s) (Right VTNA)
R1 ->
case s of
VPropPair s1 _ -> Right $ VProp s1
VPropTriple s1 _ _ -> Right $ VProp s1
_ -> Left "Input of R1 is not a tuple"
R2 ->
case s of
VPropPair _ s2 -> Right $ VProp s2
VPropTriple _ s2 _ -> Right $ VProp s2
_ -> Left "Input of R2 is not a tuple"
R3 ->
case s of
VPropTriple s3 _ _ -> Right $ VProp s3
_ -> Left "Input of R3 is not a tuple"
Project valProjs -> Right $ VProp $ VTDataVec $ length valProjs
Select _ -> VPropPair <$> unpack s <*> (Right VTNA)
Sort _ -> liftM2 VPropPair (unpack s) (Right VTNA)
Group es ->
case s of
VProp t@(VTDataVec _) ->
Right $ VPropTriple (VTDataVec $ length es) t VTNA
_ ->
Left "Input of GroupS is not a value vector"
GroupAggr (g, as) -> Right $ VProp $ VTDataVec (length g + N.length as)
Number -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec (w + 1)
| 1,465
|
inferVectorTypeUnOp :: VectorProp VectorType -> UnOp -> Either String (VectorProp VectorType)
inferVectorTypeUnOp s op =
case op of
WinFun _ -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec $ w + 1
Unique -> VProp <$> unpack s
UnboxKey -> Right $ VProp $ VTNA
Segment -> VProp <$> unpack s
Unsegment -> VProp <$> unpack s
Reverse -> liftM2 VPropPair (unpack s) (Right VTNA)
R1 ->
case s of
VPropPair s1 _ -> Right $ VProp s1
VPropTriple s1 _ _ -> Right $ VProp s1
_ -> Left "Input of R1 is not a tuple"
R2 ->
case s of
VPropPair _ s2 -> Right $ VProp s2
VPropTriple _ s2 _ -> Right $ VProp s2
_ -> Left "Input of R2 is not a tuple"
R3 ->
case s of
VPropTriple s3 _ _ -> Right $ VProp s3
_ -> Left "Input of R3 is not a tuple"
Project valProjs -> Right $ VProp $ VTDataVec $ length valProjs
Select _ -> VPropPair <$> unpack s <*> (Right VTNA)
Sort _ -> liftM2 VPropPair (unpack s) (Right VTNA)
Group es ->
case s of
VProp t@(VTDataVec _) ->
Right $ VPropTriple (VTDataVec $ length es) t VTNA
_ ->
Left "Input of GroupS is not a value vector"
GroupAggr (g, as) -> Right $ VProp $ VTDataVec (length g + N.length as)
Number -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec (w + 1)
| 1,465
|
inferVectorTypeUnOp s op =
case op of
WinFun _ -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec $ w + 1
Unique -> VProp <$> unpack s
UnboxKey -> Right $ VProp $ VTNA
Segment -> VProp <$> unpack s
Unsegment -> VProp <$> unpack s
Reverse -> liftM2 VPropPair (unpack s) (Right VTNA)
R1 ->
case s of
VPropPair s1 _ -> Right $ VProp s1
VPropTriple s1 _ _ -> Right $ VProp s1
_ -> Left "Input of R1 is not a tuple"
R2 ->
case s of
VPropPair _ s2 -> Right $ VProp s2
VPropTriple _ s2 _ -> Right $ VProp s2
_ -> Left "Input of R2 is not a tuple"
R3 ->
case s of
VPropTriple s3 _ _ -> Right $ VProp s3
_ -> Left "Input of R3 is not a tuple"
Project valProjs -> Right $ VProp $ VTDataVec $ length valProjs
Select _ -> VPropPair <$> unpack s <*> (Right VTNA)
Sort _ -> liftM2 VPropPair (unpack s) (Right VTNA)
Group es ->
case s of
VProp t@(VTDataVec _) ->
Right $ VPropTriple (VTDataVec $ length es) t VTNA
_ ->
Left "Input of GroupS is not a value vector"
GroupAggr (g, as) -> Right $ VProp $ VTDataVec (length g + N.length as)
Number -> do
VTDataVec w <- unpack s
return $ VProp $ VTDataVec (w + 1)
| 1,371
| false
| true
| 26
| 12
| 519
| 557
| 248
| 309
| null | null |
scast/bigbrother
|
src/TypeChecking.hs
|
gpl-2.0
|
boperator ">=" Bool Bool = Just Bool
| 36
|
boperator ">=" Bool Bool = Just Bool
| 36
|
boperator ">=" Bool Bool = Just Bool
| 36
| false
| false
| 0
| 5
| 6
| 16
| 7
| 9
| null | null |
creichert/persistent
|
persistent-mongoDB/Database/Persist/MongoDB.hs
|
mit
|
opToText :: MongoUpdateOperator -> Text
opToText MongoPush = "$push"
| 72
|
opToText :: MongoUpdateOperator -> Text
opToText MongoPush = "$push"
| 72
|
opToText MongoPush = "$push"
| 32
| false
| true
| 0
| 5
| 12
| 18
| 9
| 9
| null | null |
MgaMPKAy/language-sh
|
Language/Sh/Parser/Internal.hs
|
bsd-3-clause
|
mkRedir ">>" (Just s) t = return $ s :>> t
| 43
|
mkRedir ">>" (Just s) t = return $ s :>> t
| 43
|
mkRedir ">>" (Just s) t = return $ s :>> t
| 43
| false
| false
| 1
| 6
| 11
| 32
| 13
| 19
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.