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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rootzlevel/hledger-add
|
src/DateParser.hs
|
bsd-3-clause
|
relativeDays :: [Parser (Day -> Day)]
relativeDays = map try
[ addDays 1 <$ string "tomorrow"
, id <$ string "today"
, addDays (-1) <$ string "yesterday"
, addDays (-1) <$ string "yest"
]
| 210 |
relativeDays :: [Parser (Day -> Day)]
relativeDays = map try
[ addDays 1 <$ string "tomorrow"
, id <$ string "today"
, addDays (-1) <$ string "yesterday"
, addDays (-1) <$ string "yest"
]
| 210 |
relativeDays = map try
[ addDays 1 <$ string "tomorrow"
, id <$ string "today"
, addDays (-1) <$ string "yesterday"
, addDays (-1) <$ string "yest"
]
| 172 | false | true | 0 | 9 | 56 | 89 | 44 | 45 | null | null |
kantp/Haxl
|
Haxl/Prelude.hs
|
bsd-3-clause
|
(./=) :: Eq a => GenHaxl u a -> GenHaxl u a -> GenHaxl u Bool
(./=) = liftA2 (Prelude./=)
| 89 |
(./=) :: Eq a => GenHaxl u a -> GenHaxl u a -> GenHaxl u Bool
(./=) = liftA2 (Prelude./=)
| 89 |
(./=) = liftA2 (Prelude./=)
| 27 | false | true | 0 | 8 | 19 | 52 | 27 | 25 | null | null |
matthewscottgordon/funk
|
src/Funk/Renamer.hs
|
apache-2.0
|
rename :: MonadError String m => AST.Module UnresolvedName -> m (AST.Module ResolvedName)
rename (AST.Module decls defs) = do
defs' <- mapM (renameDef moduleScope) defs
decls' <- mapM (renameDecl moduleScope) decls
return (AST.Module decls' defs')
where
moduleScope = foldl' addDefToScope createGlobalScope defs
| 323 |
rename :: MonadError String m => AST.Module UnresolvedName -> m (AST.Module ResolvedName)
rename (AST.Module decls defs) = do
defs' <- mapM (renameDef moduleScope) defs
decls' <- mapM (renameDecl moduleScope) decls
return (AST.Module decls' defs')
where
moduleScope = foldl' addDefToScope createGlobalScope defs
| 323 |
rename (AST.Module decls defs) = do
defs' <- mapM (renameDef moduleScope) defs
decls' <- mapM (renameDecl moduleScope) decls
return (AST.Module decls' defs')
where
moduleScope = foldl' addDefToScope createGlobalScope defs
| 233 | false | true | 1 | 11 | 52 | 128 | 56 | 72 | null | null |
forste/haReFork
|
refactorer/RefacDupTrans.hs
|
bsd-3-clause
|
foldAgainstAbs pats (Exp (HsList es1)) (Exp (HsList es2))
= concat (foldAgainstAbs' pats es1 es2)
| 98 |
foldAgainstAbs pats (Exp (HsList es1)) (Exp (HsList es2))
= concat (foldAgainstAbs' pats es1 es2)
| 98 |
foldAgainstAbs pats (Exp (HsList es1)) (Exp (HsList es2))
= concat (foldAgainstAbs' pats es1 es2)
| 98 | false | false | 0 | 8 | 14 | 53 | 24 | 29 | null | null |
kishoredbn/barrelfish
|
tools/skate/Main.hs
|
mit
|
compilerOpts :: [String] -> IO (Options)
compilerOpts argv =
case getOpt Permute options argv of
(o,[n],[]) -> return ( optSetInFile n (foldl (flip id) defaultOptions o) )
(_,_,errs) -> usageError errs
| 211 |
compilerOpts :: [String] -> IO (Options)
compilerOpts argv =
case getOpt Permute options argv of
(o,[n],[]) -> return ( optSetInFile n (foldl (flip id) defaultOptions o) )
(_,_,errs) -> usageError errs
| 211 |
compilerOpts argv =
case getOpt Permute options argv of
(o,[n],[]) -> return ( optSetInFile n (foldl (flip id) defaultOptions o) )
(_,_,errs) -> usageError errs
| 170 | false | true | 0 | 14 | 40 | 103 | 54 | 49 | null | null |
joashc/neuralnet
|
neuralNet.hs
|
gpl-2.0
|
feedForward :: Input -> Network -> Output
feedForward i (Network []) = i
| 72 |
feedForward :: Input -> Network -> Output
feedForward i (Network []) = i
| 72 |
feedForward i (Network []) = i
| 30 | false | true | 0 | 11 | 12 | 38 | 17 | 21 | null | null |
bos/critbit
|
Data/CritBit/Tree.hs
|
bsd-2-clause
|
leafBranch _ _ _ _ _ = error "Data.CritBit.Tree.leafBranch: unpossible"
| 71 |
leafBranch _ _ _ _ _ = error "Data.CritBit.Tree.leafBranch: unpossible"
| 71 |
leafBranch _ _ _ _ _ = error "Data.CritBit.Tree.leafBranch: unpossible"
| 71 | false | false | 0 | 5 | 9 | 20 | 9 | 11 | null | null |
UoYCS-plasma/LazySmallCheck2012
|
suite/Functionality.hs
|
bsd-3-clause
|
runTest (Test str t v d) = do putStrLn $ "\n## Test '" ++ str ++ "': "
expect v $ mapM_ (`depthCheck` t) [0..d]
putStrLn $ "## Test response correct."
| 210 |
runTest (Test str t v d) = do putStrLn $ "\n## Test '" ++ str ++ "': "
expect v $ mapM_ (`depthCheck` t) [0..d]
putStrLn $ "## Test response correct."
| 210 |
runTest (Test str t v d) = do putStrLn $ "\n## Test '" ++ str ++ "': "
expect v $ mapM_ (`depthCheck` t) [0..d]
putStrLn $ "## Test response correct."
| 210 | false | false | 0 | 9 | 90 | 69 | 34 | 35 | null | null |
ulricha/dsh-example-queries
|
Queries/TPCH/BuildingBlocks.hs
|
bsd-3-clause
|
yearInterval :: Day -> Integer -> Interval
yearInterval d years = Interval d (C.addGregorianYearsRollOver years d)
| 114 |
yearInterval :: Day -> Integer -> Interval
yearInterval d years = Interval d (C.addGregorianYearsRollOver years d)
| 114 |
yearInterval d years = Interval d (C.addGregorianYearsRollOver years d)
| 71 | false | true | 0 | 8 | 15 | 39 | 19 | 20 | null | null |
rzil/honours
|
LeavittPathAlgebras/GraphMonoid.hs
|
mit
|
rand5 = randomGraph 1211 17 0.3
| 31 |
rand5 = randomGraph 1211 17 0.3
| 31 |
rand5 = randomGraph 1211 17 0.3
| 31 | false | false | 1 | 5 | 5 | 18 | 6 | 12 | null | null |
phadej/stack
|
src/Stack/Config.hs
|
bsd-3-clause
|
resolvePackageLocation
:: (MonadIO m, MonadThrow m, MonadReader env m, HasHttpManager env, MonadLogger m, MonadCatch m
,MonadBaseControl IO m, HasConfig env)
=> EnvOverride
-> Path Abs Dir -- ^ project root
-> PackageLocation
-> m (Path Abs Dir)
resolvePackageLocation _ projRoot (PLFilePath fp) = resolveDir projRoot fp
| 347 |
resolvePackageLocation
:: (MonadIO m, MonadThrow m, MonadReader env m, HasHttpManager env, MonadLogger m, MonadCatch m
,MonadBaseControl IO m, HasConfig env)
=> EnvOverride
-> Path Abs Dir -- ^ project root
-> PackageLocation
-> m (Path Abs Dir)
resolvePackageLocation _ projRoot (PLFilePath fp) = resolveDir projRoot fp
| 347 |
resolvePackageLocation _ projRoot (PLFilePath fp) = resolveDir projRoot fp
| 74 | false | true | 0 | 11 | 72 | 113 | 56 | 57 | null | null |
psibi/cabal2nix
|
src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs
|
bsd-3-clause
|
libNixName "sodium" = return "libsodium"
| 68 |
libNixName "sodium" = return "libsodium"
| 68 |
libNixName "sodium" = return "libsodium"
| 68 | false | false | 0 | 5 | 32 | 12 | 5 | 7 | null | null |
abooij/cubicaltt
|
CTT.hs
|
mit
|
declTers :: [Decl] -> [Ter]
declTers decls = [ d | (_,(_,d)) <- decls ]
| 71 |
declTers :: [Decl] -> [Ter]
declTers decls = [ d | (_,(_,d)) <- decls ]
| 71 |
declTers decls = [ d | (_,(_,d)) <- decls ]
| 43 | false | true | 0 | 10 | 14 | 53 | 28 | 25 | null | null |
jacekszymanski/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxAUI_MGR_DEFAULT :: Int
wxAUI_MGR_DEFAULT = 201
| 48 |
wxAUI_MGR_DEFAULT :: Int
wxAUI_MGR_DEFAULT = 201
| 48 |
wxAUI_MGR_DEFAULT = 201
| 23 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
snoyberg/ghc
|
libraries/template-haskell/Language/Haskell/TH/Lib.hs
|
bsd-3-clause
|
funD :: Name -> [ClauseQ] -> DecQ
funD nm cs =
do { cs1 <- sequence cs
; return (FunD nm cs1)
}
| 104 |
funD :: Name -> [ClauseQ] -> DecQ
funD nm cs =
do { cs1 <- sequence cs
; return (FunD nm cs1)
}
| 104 |
funD nm cs =
do { cs1 <- sequence cs
; return (FunD nm cs1)
}
| 70 | false | true | 0 | 10 | 31 | 60 | 28 | 32 | null | null |
glguy/5puzzle
|
Crosscells/Tokens.hs
|
isc
|
parseRaw :: Vector (Vector Char) -> [(Region, Token)]
parseRaw file =
[ result
| (rowIx, row) <- toList (V.indexed file)
, (colIx, col) <- toList (V.indexed row)
, isStart row colIx
, Just result <- [parseRaw1 file row col rowIx colIx]
]
| 259 |
parseRaw :: Vector (Vector Char) -> [(Region, Token)]
parseRaw file =
[ result
| (rowIx, row) <- toList (V.indexed file)
, (colIx, col) <- toList (V.indexed row)
, isStart row colIx
, Just result <- [parseRaw1 file row col rowIx colIx]
]
| 259 |
parseRaw file =
[ result
| (rowIx, row) <- toList (V.indexed file)
, (colIx, col) <- toList (V.indexed row)
, isStart row colIx
, Just result <- [parseRaw1 file row col rowIx colIx]
]
| 205 | false | true | 0 | 12 | 63 | 129 | 64 | 65 | null | null |
Copilot-Language/sbv-for-copilot
|
SBVUnitTest/TestSuite/Uninterpreted/Axioms.hs
|
bsd-3-clause
|
a :: SBitstring -> SBool
a = uninterpret "a"
| 44 |
a :: SBitstring -> SBool
a = uninterpret "a"
| 44 |
a = uninterpret "a"
| 19 | false | true | 0 | 7 | 8 | 25 | 10 | 15 | null | null |
chrisbanks/cpiwb
|
CPi/Logic.hs
|
gpl-3.0
|
rewriteU (Impl f1 f2) = Impl (rewriteU f1) (rewriteU f2)
| 56 |
rewriteU (Impl f1 f2) = Impl (rewriteU f1) (rewriteU f2)
| 56 |
rewriteU (Impl f1 f2) = Impl (rewriteU f1) (rewriteU f2)
| 56 | false | false | 0 | 7 | 9 | 34 | 16 | 18 | null | null |
alanz/hroq
|
src/Data/Concurrent/Queue/Roq/Sup.hs
|
bsd-3-clause
|
childSpec :: a -> Closure (String -> Process ()) -> [ChildSpec]
childSpec alarmFun queueWatchFun =
[
defaultWorker hroqStatsGatherer
-- , defaultWorker hroq_log_dumper
, defaultWorker hroqGroups
, defaultWorker hroqAlarms
, defaultWorker hroqQueueWatch
, defaultWorker hroqHandlePool
]
where
hroqStatsGatherer = RunClosure hroq_stats_gatherer_closure
hroqGroups = RunClosure hroq_groups_closure
hroqAlarms = RunClosure hroq_alarm_server_closure
hroqQueueWatch = RunClosure (hroq_queue_watch_server_closure queueWatchNoOpCallbackClosure)
hroqHandlePool = RunClosure hroq_handle_pool_server_closure
| 672 |
childSpec :: a -> Closure (String -> Process ()) -> [ChildSpec]
childSpec alarmFun queueWatchFun =
[
defaultWorker hroqStatsGatherer
-- , defaultWorker hroq_log_dumper
, defaultWorker hroqGroups
, defaultWorker hroqAlarms
, defaultWorker hroqQueueWatch
, defaultWorker hroqHandlePool
]
where
hroqStatsGatherer = RunClosure hroq_stats_gatherer_closure
hroqGroups = RunClosure hroq_groups_closure
hroqAlarms = RunClosure hroq_alarm_server_closure
hroqQueueWatch = RunClosure (hroq_queue_watch_server_closure queueWatchNoOpCallbackClosure)
hroqHandlePool = RunClosure hroq_handle_pool_server_closure
| 672 |
childSpec alarmFun queueWatchFun =
[
defaultWorker hroqStatsGatherer
-- , defaultWorker hroq_log_dumper
, defaultWorker hroqGroups
, defaultWorker hroqAlarms
, defaultWorker hroqQueueWatch
, defaultWorker hroqHandlePool
]
where
hroqStatsGatherer = RunClosure hroq_stats_gatherer_closure
hroqGroups = RunClosure hroq_groups_closure
hroqAlarms = RunClosure hroq_alarm_server_closure
hroqQueueWatch = RunClosure (hroq_queue_watch_server_closure queueWatchNoOpCallbackClosure)
hroqHandlePool = RunClosure hroq_handle_pool_server_closure
| 608 | false | true | 0 | 12 | 132 | 127 | 62 | 65 | null | null |
CGenie/haskell-snake
|
src/Game/HSnake/Player.hs
|
gpl-3.0
|
initialPlayer :: Player
initialPlayer = Player
Human
initialSnake
(initialSnake^.direction)
Green
| 153 |
initialPlayer :: Player
initialPlayer = Player
Human
initialSnake
(initialSnake^.direction)
Green
| 153 |
initialPlayer = Player
Human
initialSnake
(initialSnake^.direction)
Green
| 129 | false | true | 0 | 7 | 65 | 27 | 14 | 13 | null | null |
icyfork/shellcheck
|
ShellCheck/Parser.hs
|
gpl-3.0
|
prop_readExtglob2 = isOk readExtglob "!(*.mp3|*.wmv)"
| 53 |
prop_readExtglob2 = isOk readExtglob "!(*.mp3|*.wmv)"
| 53 |
prop_readExtglob2 = isOk readExtglob "!(*.mp3|*.wmv)"
| 53 | false | false | 1 | 5 | 4 | 15 | 5 | 10 | null | null |
onponomarev/ganeti
|
test/hs/Test/Ganeti/TestCommon.hs
|
bsd-2-clause
|
genFields :: Gen [String]
genFields = do
n <- choose (1, 32)
vectorOf n genName
-- | Generates a list of a given size with non-duplicate elements.
| 151 |
genFields :: Gen [String]
genFields = do
n <- choose (1, 32)
vectorOf n genName
-- | Generates a list of a given size with non-duplicate elements.
| 151 |
genFields = do
n <- choose (1, 32)
vectorOf n genName
-- | Generates a list of a given size with non-duplicate elements.
| 125 | false | true | 0 | 9 | 31 | 42 | 21 | 21 | null | null |
literate-unitb/literate-unitb
|
src/UnitB/Event.hs
|
mit
|
ba_pred :: HasExpr expr => Action' expr -> RawExpr
ba_pred (Assign v e) = Word (prime v) `zeq` getExpr e
| 104 |
ba_pred :: HasExpr expr => Action' expr -> RawExpr
ba_pred (Assign v e) = Word (prime v) `zeq` getExpr e
| 104 |
ba_pred (Assign v e) = Word (prime v) `zeq` getExpr e
| 53 | false | true | 0 | 10 | 19 | 59 | 27 | 32 | null | null |
fmapfmapfmap/amazonka
|
amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'JobInput' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'jiFrameRate'
--
-- * 'jiResolution'
--
-- * 'jiAspectRatio'
--
-- * 'jiEncryption'
--
-- * 'jiKey'
--
-- * 'jiDetectedProperties'
--
-- * 'jiContainer'
--
-- * 'jiInterlaced'
jobInput
:: JobInput
jobInput =
JobInput'
{ _jiFrameRate = Nothing
, _jiResolution = Nothing
, _jiAspectRatio = Nothing
, _jiEncryption = Nothing
, _jiKey = Nothing
, _jiDetectedProperties = Nothing
, _jiContainer = Nothing
, _jiInterlaced = Nothing
}
| 639 |
jobInput
:: JobInput
jobInput =
JobInput'
{ _jiFrameRate = Nothing
, _jiResolution = Nothing
, _jiAspectRatio = Nothing
, _jiEncryption = Nothing
, _jiKey = Nothing
, _jiDetectedProperties = Nothing
, _jiContainer = Nothing
, _jiInterlaced = Nothing
}
| 295 |
jobInput =
JobInput'
{ _jiFrameRate = Nothing
, _jiResolution = Nothing
, _jiAspectRatio = Nothing
, _jiEncryption = Nothing
, _jiKey = Nothing
, _jiDetectedProperties = Nothing
, _jiContainer = Nothing
, _jiInterlaced = Nothing
}
| 270 | true | true | 0 | 7 | 144 | 90 | 60 | 30 | null | null |
hiratara/hs-rtb-bidder
|
src/Web/RTBBidder/Protocol/Adx/BidRequest/Device/ScreenOrientation.hs
|
bsd-3-clause
|
toMaybe'Enum 1 = Prelude'.Just PORTRAIT
| 39 |
toMaybe'Enum 1 = Prelude'.Just PORTRAIT
| 39 |
toMaybe'Enum 1 = Prelude'.Just PORTRAIT
| 39 | false | false | 1 | 6 | 4 | 17 | 6 | 11 | null | null |
elieux/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
isOneShot _other = False
| 25 |
isOneShot _other = False
| 25 |
isOneShot _other = False
| 25 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
ariep/psqueues
|
src/Data/HashPSQ/Internal.hs
|
bsd-3-clause
|
toList :: (Hashable k, Ord k, Ord p) => HashPSQ k p v -> [(k, p, v)]
toList (HashPSQ ipsq) =
[ (k', p', x')
| (_, p, (B k x opsq)) <- IntPSQ.toList ipsq
, (k', p', x') <- (k, p, x) : OrdPSQ.toList opsq
]
| 227 |
toList :: (Hashable k, Ord k, Ord p) => HashPSQ k p v -> [(k, p, v)]
toList (HashPSQ ipsq) =
[ (k', p', x')
| (_, p, (B k x opsq)) <- IntPSQ.toList ipsq
, (k', p', x') <- (k, p, x) : OrdPSQ.toList opsq
]
| 227 |
toList (HashPSQ ipsq) =
[ (k', p', x')
| (_, p, (B k x opsq)) <- IntPSQ.toList ipsq
, (k', p', x') <- (k, p, x) : OrdPSQ.toList opsq
]
| 158 | false | true | 0 | 10 | 70 | 143 | 79 | 64 | null | null |
ComputationWithBoundedResources/ara-inference
|
src/Data/Rewriting/ARA/ByInferenceRules/ConstraintSolver/SMT/IO.hs
|
mit
|
solveSMTProblem :: Bool -> Bool -> FilePath -> StateT SMTProblem IO (M.Map String Int)
solveSMTProblem shift keepFiles tempDir = do
-- ensure to drop double listed vars. We expect vars being a superset of varsDeclOnly
dropDeclOnlyVarsFromVars
ass <- gets (^. assertions)
assStr <- gets (^. assertionsStr)
ifs <- gets (^. ifs)
log <- getLogic
decls <- getDecls
vs <- fmap S.elems (gets (^. vars))
getVals <- getValues
let txt = log +++ decls +++ assertVarsGeq0 vs +++ ifAsserts ifs +++
asserts ass +++ assertsStr assStr +++ outro +++ getVals
-- create the temporary files
(pName, pHandle) <- liftIO (openTempFile tempDir "SMTP")
(sName, sHandle) <- liftIO (openTempFile tempDir "SMTS")
-- write to the temporary file
liftIO (hPutStrLn pHandle (T.unpack txt))
-- close the files
liftIO (hClose pHandle)
liftIO (hClose sHandle)
-- execute binary and read in solution
bin <- gets (^. programName)
args <- gets (^. programOptions)
let args' = unwords (map T.unpack args)
-- Cmd.system
_ <- liftIO (Cmd.system $
T.unpack bin ++ " " ++ args' ++ " " ++ pName ++ " > " ++ sName)
solStr <- liftIO (readFile sName)
unless keepFiles
(liftIO (void (Cmd.system ("rm " ++ pName ++ " " ++ sName ))))
solParser <- gets (^. parseFunction)
case parse solParser sName solStr of
Left err -> throw $ UnsolveableException (show err)
Right xs -> return (M.fromList xs)
--
-- IO.hs ends here
| 1,476 |
solveSMTProblem :: Bool -> Bool -> FilePath -> StateT SMTProblem IO (M.Map String Int)
solveSMTProblem shift keepFiles tempDir = do
-- ensure to drop double listed vars. We expect vars being a superset of varsDeclOnly
dropDeclOnlyVarsFromVars
ass <- gets (^. assertions)
assStr <- gets (^. assertionsStr)
ifs <- gets (^. ifs)
log <- getLogic
decls <- getDecls
vs <- fmap S.elems (gets (^. vars))
getVals <- getValues
let txt = log +++ decls +++ assertVarsGeq0 vs +++ ifAsserts ifs +++
asserts ass +++ assertsStr assStr +++ outro +++ getVals
-- create the temporary files
(pName, pHandle) <- liftIO (openTempFile tempDir "SMTP")
(sName, sHandle) <- liftIO (openTempFile tempDir "SMTS")
-- write to the temporary file
liftIO (hPutStrLn pHandle (T.unpack txt))
-- close the files
liftIO (hClose pHandle)
liftIO (hClose sHandle)
-- execute binary and read in solution
bin <- gets (^. programName)
args <- gets (^. programOptions)
let args' = unwords (map T.unpack args)
-- Cmd.system
_ <- liftIO (Cmd.system $
T.unpack bin ++ " " ++ args' ++ " " ++ pName ++ " > " ++ sName)
solStr <- liftIO (readFile sName)
unless keepFiles
(liftIO (void (Cmd.system ("rm " ++ pName ++ " " ++ sName ))))
solParser <- gets (^. parseFunction)
case parse solParser sName solStr of
Left err -> throw $ UnsolveableException (show err)
Right xs -> return (M.fromList xs)
--
-- IO.hs ends here
| 1,476 |
solveSMTProblem shift keepFiles tempDir = do
-- ensure to drop double listed vars. We expect vars being a superset of varsDeclOnly
dropDeclOnlyVarsFromVars
ass <- gets (^. assertions)
assStr <- gets (^. assertionsStr)
ifs <- gets (^. ifs)
log <- getLogic
decls <- getDecls
vs <- fmap S.elems (gets (^. vars))
getVals <- getValues
let txt = log +++ decls +++ assertVarsGeq0 vs +++ ifAsserts ifs +++
asserts ass +++ assertsStr assStr +++ outro +++ getVals
-- create the temporary files
(pName, pHandle) <- liftIO (openTempFile tempDir "SMTP")
(sName, sHandle) <- liftIO (openTempFile tempDir "SMTS")
-- write to the temporary file
liftIO (hPutStrLn pHandle (T.unpack txt))
-- close the files
liftIO (hClose pHandle)
liftIO (hClose sHandle)
-- execute binary and read in solution
bin <- gets (^. programName)
args <- gets (^. programOptions)
let args' = unwords (map T.unpack args)
-- Cmd.system
_ <- liftIO (Cmd.system $
T.unpack bin ++ " " ++ args' ++ " " ++ pName ++ " > " ++ sName)
solStr <- liftIO (readFile sName)
unless keepFiles
(liftIO (void (Cmd.system ("rm " ++ pName ++ " " ++ sName ))))
solParser <- gets (^. parseFunction)
case parse solParser sName solStr of
Left err -> throw $ UnsolveableException (show err)
Right xs -> return (M.fromList xs)
--
-- IO.hs ends here
| 1,389 | false | true | 0 | 18 | 337 | 515 | 247 | 268 | null | null |
rawlep/MML
|
sourceCode/LINreg2.hs
|
mit
|
-------------------------------------------------------
foldl'Rnf :: (NFData a) => (a -> b -> a) -> a -> [b] -> a
foldl'Rnf f z xs = lgo z xs
where
lgo z [] = z
lgo z (x:xs) = lgo z' xs
where
z' = rnf (f z x) `pseq` (f z x)
------ standardise by subtracting the mean and dividing by the standard deviation
| 375 |
foldl'Rnf :: (NFData a) => (a -> b -> a) -> a -> [b] -> a
foldl'Rnf f z xs = lgo z xs
where
lgo z [] = z
lgo z (x:xs) = lgo z' xs
where
z' = rnf (f z x) `pseq` (f z x)
------ standardise by subtracting the mean and dividing by the standard deviation
| 317 |
foldl'Rnf f z xs = lgo z xs
where
lgo z [] = z
lgo z (x:xs) = lgo z' xs
where
z' = rnf (f z x) `pseq` (f z x)
------ standardise by subtracting the mean and dividing by the standard deviation
| 259 | true | true | 0 | 12 | 130 | 128 | 67 | 61 | null | null |
mzini/qlogic
|
Qlogic/MemoizedFormula.hs
|
gpl-3.0
|
cachedLiteral :: (Solver s l, Monad s, Ord arg) => arg -> Memo arg s l (L l)
cachedLiteral arg = do st <- State.get
let ls = lits st
l <- Memo $ lift freshLit;
case Map.insertLookupWithKey (\ _ _ old -> old) arg l ls of
(Just old, _) -> return $ Old old
(Nothing, ls') -> do { State.put st{lits = Map.insert arg l ls};
return $ Fresh l;
}
| 552 |
cachedLiteral :: (Solver s l, Monad s, Ord arg) => arg -> Memo arg s l (L l)
cachedLiteral arg = do st <- State.get
let ls = lits st
l <- Memo $ lift freshLit;
case Map.insertLookupWithKey (\ _ _ old -> old) arg l ls of
(Just old, _) -> return $ Old old
(Nothing, ls') -> do { State.put st{lits = Map.insert arg l ls};
return $ Fresh l;
}
| 552 |
cachedLiteral arg = do st <- State.get
let ls = lits st
l <- Memo $ lift freshLit;
case Map.insertLookupWithKey (\ _ _ old -> old) arg l ls of
(Just old, _) -> return $ Old old
(Nothing, ls') -> do { State.put st{lits = Map.insert arg l ls};
return $ Fresh l;
}
| 475 | false | true | 0 | 16 | 286 | 195 | 97 | 98 | null | null |
Gabriel439/Haskell-Dhall-Library
|
dhall-docs/src/Dhall/Docs/Html.hs
|
bsd-3-clause
|
indexToHtml
:: Path Rel Dir -- ^ Index directory
-> [(Path Rel File, Maybe (Expr Void Import))] -- ^ Generated files in that directory
-> [Path Rel Dir] -- ^ Generated directories in that directory
-> DocParams -- ^ Parameters for the documentation
-> Html ()
indexToHtml indexDir files dirs params@DocParams{..} = doctypehtml_ $ do
headContents htmlTitle params
body_ $ do
navBar params
mainContainer $ do
setPageTitle params Index breadcrumbs
copyToClipboardButton clipboardText
br_ []
Control.Monad.unless (null files) $ do
h3_ "Exported files: "
ul_ $ mconcat $ map listFile files
Control.Monad.unless (null dirs) $ do
h3_ "Exported packages: "
ul_ $ mconcat $ map listDir dirs
where
listFile :: (Path Rel File, Maybe (Expr Void Import)) -> Html ()
listFile (file, maybeType) =
let fileRef = toUnixPath $ Path.fromRelFile file
itemText = toUnixPath $ tryToTakeExt file
in li_ $ do
a_ [href_ fileRef] $ toHtml itemText
Data.Foldable.forM_ maybeType $ \typeExpr -> do
span_ [class_ "of-type-token"] ":"
span_ [class_ "dhall-type source-code"] $ renderCodeSnippet characterSet TypeAnnotation typeExpr
listDir :: Path Rel Dir -> Html ()
listDir dir =
let dirPath = toUnixPath $ Path.fromRelDir dir in
li_ $ a_ [href_ (dirPath <> "index.html")] $ toHtml dirPath
tryToTakeExt :: Path Rel File -> FilePath
tryToTakeExt file = Path.fromRelFile $ case Path.splitExtension file of
Nothing -> file
Just (f, _) -> f
breadcrumbs = relPathToBreadcrumb indexDir
htmlTitle = breadCrumbsToText breadcrumbs
clipboardText = fold baseImportUrl <> htmlTitle
| 1,963 |
indexToHtml
:: Path Rel Dir -- ^ Index directory
-> [(Path Rel File, Maybe (Expr Void Import))] -- ^ Generated files in that directory
-> [Path Rel Dir] -- ^ Generated directories in that directory
-> DocParams -- ^ Parameters for the documentation
-> Html ()
indexToHtml indexDir files dirs params@DocParams{..} = doctypehtml_ $ do
headContents htmlTitle params
body_ $ do
navBar params
mainContainer $ do
setPageTitle params Index breadcrumbs
copyToClipboardButton clipboardText
br_ []
Control.Monad.unless (null files) $ do
h3_ "Exported files: "
ul_ $ mconcat $ map listFile files
Control.Monad.unless (null dirs) $ do
h3_ "Exported packages: "
ul_ $ mconcat $ map listDir dirs
where
listFile :: (Path Rel File, Maybe (Expr Void Import)) -> Html ()
listFile (file, maybeType) =
let fileRef = toUnixPath $ Path.fromRelFile file
itemText = toUnixPath $ tryToTakeExt file
in li_ $ do
a_ [href_ fileRef] $ toHtml itemText
Data.Foldable.forM_ maybeType $ \typeExpr -> do
span_ [class_ "of-type-token"] ":"
span_ [class_ "dhall-type source-code"] $ renderCodeSnippet characterSet TypeAnnotation typeExpr
listDir :: Path Rel Dir -> Html ()
listDir dir =
let dirPath = toUnixPath $ Path.fromRelDir dir in
li_ $ a_ [href_ (dirPath <> "index.html")] $ toHtml dirPath
tryToTakeExt :: Path Rel File -> FilePath
tryToTakeExt file = Path.fromRelFile $ case Path.splitExtension file of
Nothing -> file
Just (f, _) -> f
breadcrumbs = relPathToBreadcrumb indexDir
htmlTitle = breadCrumbsToText breadcrumbs
clipboardText = fold baseImportUrl <> htmlTitle
| 1,963 |
indexToHtml indexDir files dirs params@DocParams{..} = doctypehtml_ $ do
headContents htmlTitle params
body_ $ do
navBar params
mainContainer $ do
setPageTitle params Index breadcrumbs
copyToClipboardButton clipboardText
br_ []
Control.Monad.unless (null files) $ do
h3_ "Exported files: "
ul_ $ mconcat $ map listFile files
Control.Monad.unless (null dirs) $ do
h3_ "Exported packages: "
ul_ $ mconcat $ map listDir dirs
where
listFile :: (Path Rel File, Maybe (Expr Void Import)) -> Html ()
listFile (file, maybeType) =
let fileRef = toUnixPath $ Path.fromRelFile file
itemText = toUnixPath $ tryToTakeExt file
in li_ $ do
a_ [href_ fileRef] $ toHtml itemText
Data.Foldable.forM_ maybeType $ \typeExpr -> do
span_ [class_ "of-type-token"] ":"
span_ [class_ "dhall-type source-code"] $ renderCodeSnippet characterSet TypeAnnotation typeExpr
listDir :: Path Rel Dir -> Html ()
listDir dir =
let dirPath = toUnixPath $ Path.fromRelDir dir in
li_ $ a_ [href_ (dirPath <> "index.html")] $ toHtml dirPath
tryToTakeExt :: Path Rel File -> FilePath
tryToTakeExt file = Path.fromRelFile $ case Path.splitExtension file of
Nothing -> file
Just (f, _) -> f
breadcrumbs = relPathToBreadcrumb indexDir
htmlTitle = breadCrumbsToText breadcrumbs
clipboardText = fold baseImportUrl <> htmlTitle
| 1,589 | false | true | 23 | 18 | 654 | 532 | 258 | 274 | null | null |
vedgar/mlr
|
2016 Kolokvij/LS.hs
|
unlicense
|
or_c = binary (||)
| 18 |
or_c = binary (||)
| 18 |
or_c = binary (||)
| 18 | false | false | 1 | 5 | 3 | 15 | 6 | 9 | null | null |
WesternU2016/HaskellCrypto
|
readFile.hs
|
gpl-3.0
|
main4 :: FilePath -> IO ()
main4 fp = do
str <- readString fp
putStr str
| 95 |
main4 :: FilePath -> IO ()
main4 fp = do
str <- readString fp
putStr str
| 90 |
main4 fp = do
str <- readString fp
putStr str
| 63 | false | true | 0 | 9 | 38 | 43 | 18 | 25 | null | null |
OS2World/DEV-UTIL-HUGS
|
libraries/Graphics/Rendering/OpenGL/GL/PixelRectangles.hs
|
bsd-3-clause
|
pixelStorei :: GetPName -> PixelStore -> StateVar GLint
pixelStorei pn ps =
makeStateVar
(getInteger1 id pn)
(glPixelStorei (marshalPixelStore ps))
| 162 |
pixelStorei :: GetPName -> PixelStore -> StateVar GLint
pixelStorei pn ps =
makeStateVar
(getInteger1 id pn)
(glPixelStorei (marshalPixelStore ps))
| 162 |
pixelStorei pn ps =
makeStateVar
(getInteger1 id pn)
(glPixelStorei (marshalPixelStore ps))
| 106 | false | true | 0 | 9 | 33 | 52 | 25 | 27 | null | null |
lukexi/stack
|
src/Path/IO.hs
|
bsd-3-clause
|
resolveFile :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Path Abs File)
resolveFile x y =
do result <- resolveFileMaybe x y
case result of
Nothing ->
throwM $
ResolveFileFailed x y fp
where fp = toFilePath x FP.</> y
Just fp -> return fp
-- Internal helper to define resolveDirMaybe and resolveFileMaybe in one
| 377 |
resolveFile :: (MonadIO m, MonadThrow m) => Path Abs Dir -> FilePath -> m (Path Abs File)
resolveFile x y =
do result <- resolveFileMaybe x y
case result of
Nothing ->
throwM $
ResolveFileFailed x y fp
where fp = toFilePath x FP.</> y
Just fp -> return fp
-- Internal helper to define resolveDirMaybe and resolveFileMaybe in one
| 377 |
resolveFile x y =
do result <- resolveFileMaybe x y
case result of
Nothing ->
throwM $
ResolveFileFailed x y fp
where fp = toFilePath x FP.</> y
Just fp -> return fp
-- Internal helper to define resolveDirMaybe and resolveFileMaybe in one
| 287 | false | true | 0 | 14 | 108 | 125 | 58 | 67 | null | null |
ekmett/wxHaskell
|
wxcore/src/haskell/Graphics/UI/WXCore/WxcDefs.hs
|
lgpl-2.1
|
wxLANGUAGE_AFAR :: Int
wxLANGUAGE_AFAR = 3
| 42 |
wxLANGUAGE_AFAR :: Int
wxLANGUAGE_AFAR = 3
| 42 |
wxLANGUAGE_AFAR = 3
| 19 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
dorchard/gram_lang
|
frontend/src/Language/Granule/Checker/Monad.hs
|
bsd-3-clause
|
peekChecker :: Checker a -> Checker (CheckerResult a, Checker ())
peekChecker k = do
checkerState <- get
(result, localState) <- liftIO $ runChecker checkerState k
pure (result, put localState)
| 199 |
peekChecker :: Checker a -> Checker (CheckerResult a, Checker ())
peekChecker k = do
checkerState <- get
(result, localState) <- liftIO $ runChecker checkerState k
pure (result, put localState)
| 199 |
peekChecker k = do
checkerState <- get
(result, localState) <- liftIO $ runChecker checkerState k
pure (result, put localState)
| 133 | false | true | 0 | 9 | 34 | 82 | 39 | 43 | null | null |
Ralith/tisp
|
src/Tisp/Parse.hs
|
bsd-3-clause
|
parse (Token r@(SourceRange startLoc endLoc) RParen : ts) = Just (Tree r $ TreeError startLoc "unmatched right parenthesis", endLoc, ts)
| 136 |
parse (Token r@(SourceRange startLoc endLoc) RParen : ts) = Just (Tree r $ TreeError startLoc "unmatched right parenthesis", endLoc, ts)
| 136 |
parse (Token r@(SourceRange startLoc endLoc) RParen : ts) = Just (Tree r $ TreeError startLoc "unmatched right parenthesis", endLoc, ts)
| 136 | false | false | 0 | 10 | 19 | 57 | 28 | 29 | null | null |
haroldcarr/rdf-triple-browser
|
experiments/haskell-threepenny-gui-experiments/src/CRUD2.hs
|
apache-2.0
|
mkSPOPanel :: String -> UI Element
mkSPOPanel spoType = mdo
let bad = ("NOT SUPPOSED TO HAPPEN", Bound (UNode (T.pack "BAD")))
decide :: DB DI -> String
decide db0 | dbSize db0 > 1 = spoType
| otherwise = fst $ fromMaybe bad (dbLookup 0 db0)
dataItem :: Behavior (Maybe DI) -> UI Element
dataItem _ = do
entry1 <- UI.entry $ decide <$> bDB
element entry1 # set style [("width", "800px")]
return $ getElement entry1
-- GUI elements
sparqlEndpointURL <- UI.input # set (attr "size") "175" # set (attr "type") "text"
# set (attr "value") "http://localhost:3030/ds/query"
submitBtn <- UI.button #+ [string "Do It!"]
addToLBBtn <- UI.button #+ [string "Add To List Box"]
clearBtn <- UI.button #+ [string "*"]
lbSelection <- dataItem bLBSelectionDI
listBox <- UI.listBox bLBItems bLBSelection bDisplayDI
element listBox # set (attr "size") "20" # set style [("width","800px")]
-- events and behaviors
let eAddToLB :: Event ()
eAddToLB = UI.click addToLBBtn
eLBSelection :: Event (Maybe DBKey)
eLBSelection = rumors $ UI.userSelection listBox
(eFillLB, hFillLB) <- liftIO newEvent
let query :: String -> Maybe DBKey -> UI ()
query url mk = do
(r,_,_) <- liftIO $ doRDFQuery url mk bDB
liftIO $ hFillLB r
return ()
queryNothing :: () -> UI ()
queryNothing _ = do
sparql <- get value sparqlEndpointURL
query sparql Nothing
on UI.click submitBtn queryNothing
on UI.click clearBtn queryNothing
onEvent eLBSelection $ \mk -> do
sparql <- get value sparqlEndpointURL
query sparql mk
-- database
let dbFill :: [(String,BindingValue)] -> DB DI -> DB DI
dbFill ss _ = foldr dbCreate dbEmpty ss
dbAddToLB :: DB DI -> DB DI
dbAddToLB (DB newkey db0) = DB newkey $ Map.map (\(x,y) -> (x ++ "xx", y)) db0
-- bDB :: Behavior (DB DI)
bDB <- accumB dbEmpty $ concatenate <$> unions
[ dbFill <$> eFillLB
, dbAddToLB <$ eAddToLB
]
-- selection
-- bLBSelection :: Behavior (Maybe DBKey)
bLBSelection <- stepper Nothing eLBSelection `hcDebug` "stepper"
let bLookup :: Behavior (DBKey -> Maybe DI)
bLookup = flip dbLookup <$> bDB
bDisplayDI :: Behavior (DBKey -> UI Element)
bDisplayDI = (UI.string .) <$> (maybe "" showDI .) <$> bLookup
bLBItems :: Behavior [DBKey]
bLBItems = dbKeys <$> bDB
bLBSelectionDI :: Behavior (Maybe DI)
bLBSelectionDI = (=<<) <$> bLookup <*> bLBSelection
-- GUI layout
grid [ [ row [ element sparqlEndpointURL, element submitBtn, element addToLBBtn ] ]
, [ row [ element clearBtn, element lbSelection ] ]
, [ element listBox ]
]
------------------------------------------------------------------------------
-- DB Model
| 3,103 |
mkSPOPanel :: String -> UI Element
mkSPOPanel spoType = mdo
let bad = ("NOT SUPPOSED TO HAPPEN", Bound (UNode (T.pack "BAD")))
decide :: DB DI -> String
decide db0 | dbSize db0 > 1 = spoType
| otherwise = fst $ fromMaybe bad (dbLookup 0 db0)
dataItem :: Behavior (Maybe DI) -> UI Element
dataItem _ = do
entry1 <- UI.entry $ decide <$> bDB
element entry1 # set style [("width", "800px")]
return $ getElement entry1
-- GUI elements
sparqlEndpointURL <- UI.input # set (attr "size") "175" # set (attr "type") "text"
# set (attr "value") "http://localhost:3030/ds/query"
submitBtn <- UI.button #+ [string "Do It!"]
addToLBBtn <- UI.button #+ [string "Add To List Box"]
clearBtn <- UI.button #+ [string "*"]
lbSelection <- dataItem bLBSelectionDI
listBox <- UI.listBox bLBItems bLBSelection bDisplayDI
element listBox # set (attr "size") "20" # set style [("width","800px")]
-- events and behaviors
let eAddToLB :: Event ()
eAddToLB = UI.click addToLBBtn
eLBSelection :: Event (Maybe DBKey)
eLBSelection = rumors $ UI.userSelection listBox
(eFillLB, hFillLB) <- liftIO newEvent
let query :: String -> Maybe DBKey -> UI ()
query url mk = do
(r,_,_) <- liftIO $ doRDFQuery url mk bDB
liftIO $ hFillLB r
return ()
queryNothing :: () -> UI ()
queryNothing _ = do
sparql <- get value sparqlEndpointURL
query sparql Nothing
on UI.click submitBtn queryNothing
on UI.click clearBtn queryNothing
onEvent eLBSelection $ \mk -> do
sparql <- get value sparqlEndpointURL
query sparql mk
-- database
let dbFill :: [(String,BindingValue)] -> DB DI -> DB DI
dbFill ss _ = foldr dbCreate dbEmpty ss
dbAddToLB :: DB DI -> DB DI
dbAddToLB (DB newkey db0) = DB newkey $ Map.map (\(x,y) -> (x ++ "xx", y)) db0
-- bDB :: Behavior (DB DI)
bDB <- accumB dbEmpty $ concatenate <$> unions
[ dbFill <$> eFillLB
, dbAddToLB <$ eAddToLB
]
-- selection
-- bLBSelection :: Behavior (Maybe DBKey)
bLBSelection <- stepper Nothing eLBSelection `hcDebug` "stepper"
let bLookup :: Behavior (DBKey -> Maybe DI)
bLookup = flip dbLookup <$> bDB
bDisplayDI :: Behavior (DBKey -> UI Element)
bDisplayDI = (UI.string .) <$> (maybe "" showDI .) <$> bLookup
bLBItems :: Behavior [DBKey]
bLBItems = dbKeys <$> bDB
bLBSelectionDI :: Behavior (Maybe DI)
bLBSelectionDI = (=<<) <$> bLookup <*> bLBSelection
-- GUI layout
grid [ [ row [ element sparqlEndpointURL, element submitBtn, element addToLBBtn ] ]
, [ row [ element clearBtn, element lbSelection ] ]
, [ element listBox ]
]
------------------------------------------------------------------------------
-- DB Model
| 3,103 |
mkSPOPanel spoType = mdo
let bad = ("NOT SUPPOSED TO HAPPEN", Bound (UNode (T.pack "BAD")))
decide :: DB DI -> String
decide db0 | dbSize db0 > 1 = spoType
| otherwise = fst $ fromMaybe bad (dbLookup 0 db0)
dataItem :: Behavior (Maybe DI) -> UI Element
dataItem _ = do
entry1 <- UI.entry $ decide <$> bDB
element entry1 # set style [("width", "800px")]
return $ getElement entry1
-- GUI elements
sparqlEndpointURL <- UI.input # set (attr "size") "175" # set (attr "type") "text"
# set (attr "value") "http://localhost:3030/ds/query"
submitBtn <- UI.button #+ [string "Do It!"]
addToLBBtn <- UI.button #+ [string "Add To List Box"]
clearBtn <- UI.button #+ [string "*"]
lbSelection <- dataItem bLBSelectionDI
listBox <- UI.listBox bLBItems bLBSelection bDisplayDI
element listBox # set (attr "size") "20" # set style [("width","800px")]
-- events and behaviors
let eAddToLB :: Event ()
eAddToLB = UI.click addToLBBtn
eLBSelection :: Event (Maybe DBKey)
eLBSelection = rumors $ UI.userSelection listBox
(eFillLB, hFillLB) <- liftIO newEvent
let query :: String -> Maybe DBKey -> UI ()
query url mk = do
(r,_,_) <- liftIO $ doRDFQuery url mk bDB
liftIO $ hFillLB r
return ()
queryNothing :: () -> UI ()
queryNothing _ = do
sparql <- get value sparqlEndpointURL
query sparql Nothing
on UI.click submitBtn queryNothing
on UI.click clearBtn queryNothing
onEvent eLBSelection $ \mk -> do
sparql <- get value sparqlEndpointURL
query sparql mk
-- database
let dbFill :: [(String,BindingValue)] -> DB DI -> DB DI
dbFill ss _ = foldr dbCreate dbEmpty ss
dbAddToLB :: DB DI -> DB DI
dbAddToLB (DB newkey db0) = DB newkey $ Map.map (\(x,y) -> (x ++ "xx", y)) db0
-- bDB :: Behavior (DB DI)
bDB <- accumB dbEmpty $ concatenate <$> unions
[ dbFill <$> eFillLB
, dbAddToLB <$ eAddToLB
]
-- selection
-- bLBSelection :: Behavior (Maybe DBKey)
bLBSelection <- stepper Nothing eLBSelection `hcDebug` "stepper"
let bLookup :: Behavior (DBKey -> Maybe DI)
bLookup = flip dbLookup <$> bDB
bDisplayDI :: Behavior (DBKey -> UI Element)
bDisplayDI = (UI.string .) <$> (maybe "" showDI .) <$> bLookup
bLBItems :: Behavior [DBKey]
bLBItems = dbKeys <$> bDB
bLBSelectionDI :: Behavior (Maybe DI)
bLBSelectionDI = (=<<) <$> bLookup <*> bLBSelection
-- GUI layout
grid [ [ row [ element sparqlEndpointURL, element submitBtn, element addToLBBtn ] ]
, [ row [ element clearBtn, element lbSelection ] ]
, [ element listBox ]
]
------------------------------------------------------------------------------
-- DB Model
| 3,068 | false | true | 0 | 17 | 991 | 996 | 484 | 512 | null | null |
Bodigrim/arithmoi
|
Math/NumberTheory/Recurrences/Bilinear.hs
|
mit
|
-- | Infinite zero-based table of <https://en.wikipedia.org/wiki/Stirling_numbers_of_the_second_kind Stirling numbers of the second kind>.
--
-- >>> take 5 (map (take 5) stirling2)
-- [[1],[0,1],[0,1,1],[0,1,3,1],[0,1,7,6,1]]
--
-- Complexity: @stirling2 !! n !! k@ is O(n ln n) bits long, its computation
-- takes O(k n^2 ln n) time and forces thunks @stirling2 !! i !! j@ for @0 <= i <= n@ and @max(0, k - n + i) <= j <= k@.
--
-- One could also consider 'Math.Combinat.Numbers.stirling2nd' from <http://hackage.haskell.org/package/combinat combinat> package to compute stand-alone values.
stirling2 :: (Num a, Enum a) => [[a]]
stirling2 = iterate f [1]
where
f xs = 0 : zipIndexedListWithTail (\k x y -> x + k * y) 1 xs 0
| 731 |
stirling2 :: (Num a, Enum a) => [[a]]
stirling2 = iterate f [1]
where
f xs = 0 : zipIndexedListWithTail (\k x y -> x + k * y) 1 xs 0
| 139 |
stirling2 = iterate f [1]
where
f xs = 0 : zipIndexedListWithTail (\k x y -> x + k * y) 1 xs 0
| 101 | true | true | 0 | 10 | 125 | 92 | 53 | 39 | null | null |
CloudI/CloudI
|
src/api/haskell/external/binary-0.8.7.0/src/Data/Binary/Get.hs
|
mit
|
-- ^ The decoder has successfully finished. Except for the
-- output value you also get any unused input as well as the
-- number of bytes consumed.
-- | Run a 'Get' monad. See 'Decoder' for what to do next, like providing
-- input, handling decoder errors and to get the output value.
-- Hint: Use the helper functions 'pushChunk', 'pushChunks' and
-- 'pushEndOfInput'.
runGetIncremental :: Get a -> Decoder a
runGetIncremental = calculateOffset . I.runGetIncremental
| 497 |
runGetIncremental :: Get a -> Decoder a
runGetIncremental = calculateOffset . I.runGetIncremental
| 97 |
runGetIncremental = calculateOffset . I.runGetIncremental
| 57 | true | true | 0 | 6 | 105 | 34 | 20 | 14 | null | null |
x456/binary
|
src/Data/Binary/Get/Internal.hs
|
bsd-3-clause
|
-- | Test whether all input has been consumed, i.e. there are no remaining
-- undecoded bytes.
isEmpty :: Get Bool
isEmpty = C $ \inp ks ->
if B.null inp
then prompt inp (ks inp True) (\inp' -> ks inp' False)
else ks inp False
| 242 |
isEmpty :: Get Bool
isEmpty = C $ \inp ks ->
if B.null inp
then prompt inp (ks inp True) (\inp' -> ks inp' False)
else ks inp False
| 147 |
isEmpty = C $ \inp ks ->
if B.null inp
then prompt inp (ks inp True) (\inp' -> ks inp' False)
else ks inp False
| 127 | true | true | 0 | 11 | 61 | 73 | 38 | 35 | null | null |
thewoolleyman/haskellbook
|
11/15/eric/BinaryTree.hs
|
unlicense
|
testInorder :: IO ()
testInorder =
if inorder testTree == [1, 2, 3] then
print "Test passed"
else
error "Test failed"
| 129 |
testInorder :: IO ()
testInorder =
if inorder testTree == [1, 2, 3] then
print "Test passed"
else
error "Test failed"
| 129 |
testInorder =
if inorder testTree == [1, 2, 3] then
print "Test passed"
else
error "Test failed"
| 108 | false | true | 0 | 7 | 32 | 52 | 25 | 27 | null | null |
emilaxelsson/ag-graph
|
bench/Bench.hs
|
bsd-3-clause
|
bench' str f arg = rnf arg `seq` bench str (nf f arg)
| 53 |
bench' str f arg = rnf arg `seq` bench str (nf f arg)
| 53 |
bench' str f arg = rnf arg `seq` bench str (nf f arg)
| 53 | false | false | 0 | 8 | 12 | 35 | 17 | 18 | null | null |
freels/haskell-project
|
Init.hs
|
mit
|
gsub from to [] = []
| 49 |
gsub from to [] = []
| 49 |
gsub from to [] = []
| 49 | false | false | 0 | 6 | 34 | 17 | 8 | 9 | null | null |
keenbug/iexpr
|
Backends/Haskell/Compiler.hs
|
gpl-2.0
|
iExpr = iAppList `orTry` iAppTree `orTry` iString `orTry` iVariable
where
iAppList = liftA (foldl1 HSApp) $ mList (lMany iExpr)
iAppTree = liftA hsApp (mSimpleTree `orTry` mAppSepTree)
mSimpleTree = mTree iExpr (lMany iExpr)
mAppSepTree = mTreeSep' iExpr ":-" (lMany iExpr)
hsApp (func,args) = foldl HSApp func args
iString = liftA HSString $ mString mAny
iVariable = liftA HSVar mAnyAtom
| 417 |
iExpr = iAppList `orTry` iAppTree `orTry` iString `orTry` iVariable
where
iAppList = liftA (foldl1 HSApp) $ mList (lMany iExpr)
iAppTree = liftA hsApp (mSimpleTree `orTry` mAppSepTree)
mSimpleTree = mTree iExpr (lMany iExpr)
mAppSepTree = mTreeSep' iExpr ":-" (lMany iExpr)
hsApp (func,args) = foldl HSApp func args
iString = liftA HSString $ mString mAny
iVariable = liftA HSVar mAnyAtom
| 417 |
iExpr = iAppList `orTry` iAppTree `orTry` iString `orTry` iVariable
where
iAppList = liftA (foldl1 HSApp) $ mList (lMany iExpr)
iAppTree = liftA hsApp (mSimpleTree `orTry` mAppSepTree)
mSimpleTree = mTree iExpr (lMany iExpr)
mAppSepTree = mTreeSep' iExpr ":-" (lMany iExpr)
hsApp (func,args) = foldl HSApp func args
iString = liftA HSString $ mString mAny
iVariable = liftA HSVar mAnyAtom
| 417 | false | false | 6 | 9 | 86 | 152 | 80 | 72 | null | null |
kim/amazonka
|
amazonka-cloudfront/gen/Network/AWS/CloudFront/Types.hs
|
mpl-2.0
|
-- | The number of cache behaviors for this distribution.
cbQuantity :: Lens' CacheBehaviors Int
cbQuantity = lens _cbQuantity (\s a -> s { _cbQuantity = a })
| 158 |
cbQuantity :: Lens' CacheBehaviors Int
cbQuantity = lens _cbQuantity (\s a -> s { _cbQuantity = a })
| 100 |
cbQuantity = lens _cbQuantity (\s a -> s { _cbQuantity = a })
| 61 | true | true | 0 | 9 | 27 | 40 | 22 | 18 | null | null |
HIPERFIT/contracts
|
Haskell/QCHash.hs
|
mit
|
aR vs e = e
| 11 |
aR vs e = e
| 11 |
aR vs e = e
| 11 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
phaazon/OpenGLRaw
|
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
|
bsd-3-clause
|
gl_INTENSITY_SNORM :: GLenum
gl_INTENSITY_SNORM = 0x9013
| 56 |
gl_INTENSITY_SNORM :: GLenum
gl_INTENSITY_SNORM = 0x9013
| 56 |
gl_INTENSITY_SNORM = 0x9013
| 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ghorn/dynobud
|
dynobud-typevecs/src/Dyno/TypeVecs.hs
|
lgpl-3.0
|
reifyVector :: forall a r. V.Vector a -> (forall (n :: Nat). KnownNat n => Vec n a -> r) -> r
reifyVector v f = reifyNat (fromIntegral (V.length v))
$ \(Proxy :: Proxy (n::Nat)) -> f (devectorize v :: Vec n a)
| 227 |
reifyVector :: forall a r. V.Vector a -> (forall (n :: Nat). KnownNat n => Vec n a -> r) -> r
reifyVector v f = reifyNat (fromIntegral (V.length v))
$ \(Proxy :: Proxy (n::Nat)) -> f (devectorize v :: Vec n a)
| 227 |
reifyVector v f = reifyNat (fromIntegral (V.length v))
$ \(Proxy :: Proxy (n::Nat)) -> f (devectorize v :: Vec n a)
| 133 | false | true | 2 | 13 | 60 | 130 | 65 | 65 | null | null |
wouwouwou/2017_module_8
|
src/haskell/PP-project-2017/CodeGen.hs
|
apache-2.0
|
codeGen (ASTEnum _ _ _) _
= []
| 38 |
codeGen (ASTEnum _ _ _) _
= []
| 38 |
codeGen (ASTEnum _ _ _) _
= []
| 38 | false | false | 1 | 6 | 15 | 24 | 11 | 13 | null | null |
riottracker/modfile
|
src/Codec/Tracker/S3M/Instrument/Adlib.hs
|
bsd-3-clause
|
-- | Read an `AdlibSample` from the monad state.
getAdlibSample :: Get AdlibSample
getAdlibSample = label "S3M.Instrument.Adlib" $
AdlibSample <$> replicateM 3 getWord8 <*> replicateM 12 getWord8 <*> getWord8
<*> getWord8 <*> getWord16le <*> getWord32le
<*> replicateM 12 getWord8 <*> replicateM 28 getWord8 <*> replicateM 4 getWord8
| 408 |
getAdlibSample :: Get AdlibSample
getAdlibSample = label "S3M.Instrument.Adlib" $
AdlibSample <$> replicateM 3 getWord8 <*> replicateM 12 getWord8 <*> getWord8
<*> getWord8 <*> getWord16le <*> getWord32le
<*> replicateM 12 getWord8 <*> replicateM 28 getWord8 <*> replicateM 4 getWord8
| 359 |
getAdlibSample = label "S3M.Instrument.Adlib" $
AdlibSample <$> replicateM 3 getWord8 <*> replicateM 12 getWord8 <*> getWord8
<*> getWord8 <*> getWord16le <*> getWord32le
<*> replicateM 12 getWord8 <*> replicateM 28 getWord8 <*> replicateM 4 getWord8
| 325 | true | true | 0 | 15 | 121 | 83 | 39 | 44 | null | null |
YPBlib/NaiveFunGame_hs
|
econometrics/regression.hs
|
gpl-3.0
|
::(Fractional p)=>[p]->Maybe p
mean []=Nothing
| 46 |
::(Fractional p)=>[p]->Maybe p
mean []=Nothing
| 46 |
mean []=Nothing
| 15 | false | true | 0 | 9 | 4 | 37 | 18 | 19 | null | null |
scast/bigbrother
|
src/TypeChecking.hs
|
gpl-2.0
|
boperator "<=" Int32 Int32 = Just Bool
| 38 |
boperator "<=" Int32 Int32 = Just Bool
| 38 |
boperator "<=" Int32 Int32 = Just Bool
| 38 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
sgillespie/ghc
|
compiler/main/HscMain.hs
|
bsd-3-clause
|
markUnsafeInfer :: TcGblEnv -> WarningMessages -> Hsc TcGblEnv
markUnsafeInfer tcg_env whyUnsafe = do
dflags <- getDynFlags
when (wopt Opt_WarnUnsafe dflags)
(logWarnings $ unitBag $ makeIntoWarning (Reason Opt_WarnUnsafe) $
mkPlainWarnMsg dflags (warnUnsafeOnLoc dflags) (whyUnsafe' dflags))
liftIO $ writeIORef (tcg_safeInfer tcg_env) (False, whyUnsafe)
-- NOTE: Only wipe trust when not in an explicity safe haskell mode. Other
-- times inference may be on but we are in Trustworthy mode -- so we want
-- to record safe-inference failed but not wipe the trust dependencies.
case safeHaskell dflags == Sf_None of
True -> return $ tcg_env { tcg_imports = wiped_trust }
False -> return tcg_env
where
wiped_trust = (tcg_imports tcg_env) { imp_trust_pkgs = [] }
pprMod = ppr $ moduleName $ tcg_mod tcg_env
whyUnsafe' df = vcat [ quotes pprMod <+> text "has been inferred as unsafe!"
, text "Reason:"
, nest 4 $ (vcat $ badFlags df) $+$
(vcat $ pprErrMsgBagWithLoc whyUnsafe) $+$
(vcat $ badInsts $ tcg_insts tcg_env)
]
badFlags df = concat $ map (badFlag df) unsafeFlagsForInfer
badFlag df (str,loc,on,_)
| on df = [mkLocMessage SevOutput (loc df) $
text str <+> text "is not allowed in Safe Haskell"]
| otherwise = []
badInsts insts = concat $ map badInst insts
checkOverlap (NoOverlap _) = False
checkOverlap _ = True
badInst ins | checkOverlap (overlapMode (is_flag ins))
= [mkLocMessage SevOutput (nameSrcSpan $ getName $ is_dfun ins) $
ppr (overlapMode $ is_flag ins) <+>
text "overlap mode isn't allowed in Safe Haskell"]
| otherwise = []
-- | Figure out the final correct safe haskell mode
| 1,996 |
markUnsafeInfer :: TcGblEnv -> WarningMessages -> Hsc TcGblEnv
markUnsafeInfer tcg_env whyUnsafe = do
dflags <- getDynFlags
when (wopt Opt_WarnUnsafe dflags)
(logWarnings $ unitBag $ makeIntoWarning (Reason Opt_WarnUnsafe) $
mkPlainWarnMsg dflags (warnUnsafeOnLoc dflags) (whyUnsafe' dflags))
liftIO $ writeIORef (tcg_safeInfer tcg_env) (False, whyUnsafe)
-- NOTE: Only wipe trust when not in an explicity safe haskell mode. Other
-- times inference may be on but we are in Trustworthy mode -- so we want
-- to record safe-inference failed but not wipe the trust dependencies.
case safeHaskell dflags == Sf_None of
True -> return $ tcg_env { tcg_imports = wiped_trust }
False -> return tcg_env
where
wiped_trust = (tcg_imports tcg_env) { imp_trust_pkgs = [] }
pprMod = ppr $ moduleName $ tcg_mod tcg_env
whyUnsafe' df = vcat [ quotes pprMod <+> text "has been inferred as unsafe!"
, text "Reason:"
, nest 4 $ (vcat $ badFlags df) $+$
(vcat $ pprErrMsgBagWithLoc whyUnsafe) $+$
(vcat $ badInsts $ tcg_insts tcg_env)
]
badFlags df = concat $ map (badFlag df) unsafeFlagsForInfer
badFlag df (str,loc,on,_)
| on df = [mkLocMessage SevOutput (loc df) $
text str <+> text "is not allowed in Safe Haskell"]
| otherwise = []
badInsts insts = concat $ map badInst insts
checkOverlap (NoOverlap _) = False
checkOverlap _ = True
badInst ins | checkOverlap (overlapMode (is_flag ins))
= [mkLocMessage SevOutput (nameSrcSpan $ getName $ is_dfun ins) $
ppr (overlapMode $ is_flag ins) <+>
text "overlap mode isn't allowed in Safe Haskell"]
| otherwise = []
-- | Figure out the final correct safe haskell mode
| 1,996 |
markUnsafeInfer tcg_env whyUnsafe = do
dflags <- getDynFlags
when (wopt Opt_WarnUnsafe dflags)
(logWarnings $ unitBag $ makeIntoWarning (Reason Opt_WarnUnsafe) $
mkPlainWarnMsg dflags (warnUnsafeOnLoc dflags) (whyUnsafe' dflags))
liftIO $ writeIORef (tcg_safeInfer tcg_env) (False, whyUnsafe)
-- NOTE: Only wipe trust when not in an explicity safe haskell mode. Other
-- times inference may be on but we are in Trustworthy mode -- so we want
-- to record safe-inference failed but not wipe the trust dependencies.
case safeHaskell dflags == Sf_None of
True -> return $ tcg_env { tcg_imports = wiped_trust }
False -> return tcg_env
where
wiped_trust = (tcg_imports tcg_env) { imp_trust_pkgs = [] }
pprMod = ppr $ moduleName $ tcg_mod tcg_env
whyUnsafe' df = vcat [ quotes pprMod <+> text "has been inferred as unsafe!"
, text "Reason:"
, nest 4 $ (vcat $ badFlags df) $+$
(vcat $ pprErrMsgBagWithLoc whyUnsafe) $+$
(vcat $ badInsts $ tcg_insts tcg_env)
]
badFlags df = concat $ map (badFlag df) unsafeFlagsForInfer
badFlag df (str,loc,on,_)
| on df = [mkLocMessage SevOutput (loc df) $
text str <+> text "is not allowed in Safe Haskell"]
| otherwise = []
badInsts insts = concat $ map badInst insts
checkOverlap (NoOverlap _) = False
checkOverlap _ = True
badInst ins | checkOverlap (overlapMode (is_flag ins))
= [mkLocMessage SevOutput (nameSrcSpan $ getName $ is_dfun ins) $
ppr (overlapMode $ is_flag ins) <+>
text "overlap mode isn't allowed in Safe Haskell"]
| otherwise = []
-- | Figure out the final correct safe haskell mode
| 1,933 | false | true | 1 | 13 | 656 | 501 | 245 | 256 | null | null |
tjakway/ghcjvm
|
compiler/hsSyn/HsUtils.hs
|
bsd-3-clause
|
collect_bind :: Bool -> HsBindLR idL idR -> [idL] -> [idL]
collect_bind _ (PatBind { pat_lhs = p }) acc = collect_lpat p acc
| 134 |
collect_bind :: Bool -> HsBindLR idL idR -> [idL] -> [idL]
collect_bind _ (PatBind { pat_lhs = p }) acc = collect_lpat p acc
| 134 |
collect_bind _ (PatBind { pat_lhs = p }) acc = collect_lpat p acc
| 75 | false | true | 0 | 9 | 33 | 58 | 30 | 28 | null | null |
brendanhay/pagerduty
|
src/Network/PagerDuty/REST/Users/ContactMethods.hs
|
mpl-2.0
|
-- | Get details for a contact method.
--
-- @GET \/users\/\:user_id\/contact_methods\/\:id@
--
-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/contact_methods/show>
getContact :: UserId -> ContactId -> Request Empty s Contact
getContact u c = empty & path .~ contacts u % c
| 293 |
getContact :: UserId -> ContactId -> Request Empty s Contact
getContact u c = empty & path .~ contacts u % c
| 108 |
getContact u c = empty & path .~ contacts u % c
| 47 | true | true | 0 | 7 | 37 | 51 | 27 | 24 | null | null |
ghorn/rawesome
|
wtfviz/src/MultiCarousel.hs
|
lgpl-3.0
|
norm :: Floating a => V3 a -> a
norm (V3 x y z) = sqrt $ x*x + y*y + z*z
| 72 |
norm :: Floating a => V3 a -> a
norm (V3 x y z) = sqrt $ x*x + y*y + z*z
| 72 |
norm (V3 x y z) = sqrt $ x*x + y*y + z*z
| 40 | false | true | 0 | 10 | 21 | 62 | 30 | 32 | null | null |
ysgard/paladin
|
src/Main.hs
|
mit
|
createProject :: Project -> IO ()
createProject p = do
let context = mkGenericContext p
createDirectory $ projectName p
setCurrentDirectory $ projectName p
genFile context gitignoreRaw $ ".gitignore"
genFile context projectcabalRaw $ (projectName p) ++ ".cabal"
genFile context mainRaw $ "src" </> "Main.hs"
genFile context licenseRaw $ "LICENSE"
genFile context setupRaw $ "Setup.hs"
-- |Load a file from the scaffold, and then fill
-- the template with values provided
| 487 |
createProject :: Project -> IO ()
createProject p = do
let context = mkGenericContext p
createDirectory $ projectName p
setCurrentDirectory $ projectName p
genFile context gitignoreRaw $ ".gitignore"
genFile context projectcabalRaw $ (projectName p) ++ ".cabal"
genFile context mainRaw $ "src" </> "Main.hs"
genFile context licenseRaw $ "LICENSE"
genFile context setupRaw $ "Setup.hs"
-- |Load a file from the scaffold, and then fill
-- the template with values provided
| 487 |
createProject p = do
let context = mkGenericContext p
createDirectory $ projectName p
setCurrentDirectory $ projectName p
genFile context gitignoreRaw $ ".gitignore"
genFile context projectcabalRaw $ (projectName p) ++ ".cabal"
genFile context mainRaw $ "src" </> "Main.hs"
genFile context licenseRaw $ "LICENSE"
genFile context setupRaw $ "Setup.hs"
-- |Load a file from the scaffold, and then fill
-- the template with values provided
| 453 | false | true | 0 | 10 | 85 | 131 | 58 | 73 | null | null |
tonymorris/xsd
|
src/Text/XML/XSD.hs
|
bsd-3-clause
|
byte :: Text -> Either String Int8
byte = signed
| 48 |
byte :: Text -> Either String Int8
byte = signed
| 48 |
byte = signed
| 13 | false | true | 0 | 7 | 9 | 26 | 11 | 15 | null | null |
vito/atomo-old
|
Atomo/Primitive.hs
|
mit
|
isADouble _ = False
| 19 |
isADouble _ = False
| 19 |
isADouble _ = False
| 19 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
beni55/haste-compiler
|
src/Haste/CodeGen.hs
|
bsd-3-clause
|
genEx (StgConApp con args) = do
-- On 64 bit machines, GHC constructs small integers from Ints rather than
-- Int64, so we need to deal with it or be unable to reliably create Int64
-- or Integer values.
case (dataConNameModule con, args) of
(("S#", "GHC.Integer.Type"), [StgLitArg (MachInt n)]) | tooLarge n -> do
return $ mkInteger n
(("True", "GHC.Types"), []) -> do
return $ lit True
(("False", "GHC.Types"), []) -> do
return $ lit False
_ -> do
(tag, stricts) <- genDataCon con
(args', stricts') <- genArgsPair $ zip args stricts
-- Don't create unboxed tuples with a single element.
case (isNewtypeLikeCon con || isUnboxedTupleCon con, args') of
(True, [arg]) -> return $ evaluate arg (head stricts')
_ -> mkCon tag args' stricts'
where
mkInteger n =
array [litN 1, callForeign "I_fromBits" [array [lit lo, lit hi]]]
where
lo = n .&. 0xffffffff
hi = n `shiftR` 32
tooLarge n = n > 2147483647 || n < -2147483648
-- Always inline enum-likes, bools are true/false, not 1/0.
mkCon l _ _ | isEnumerationDataCon con = return l
mkCon tag as ss = return $ array (tag : zipWith evaluate as ss)
evaluate arg True = eval arg
evaluate arg _ = arg
| 1,315 |
genEx (StgConApp con args) = do
-- On 64 bit machines, GHC constructs small integers from Ints rather than
-- Int64, so we need to deal with it or be unable to reliably create Int64
-- or Integer values.
case (dataConNameModule con, args) of
(("S#", "GHC.Integer.Type"), [StgLitArg (MachInt n)]) | tooLarge n -> do
return $ mkInteger n
(("True", "GHC.Types"), []) -> do
return $ lit True
(("False", "GHC.Types"), []) -> do
return $ lit False
_ -> do
(tag, stricts) <- genDataCon con
(args', stricts') <- genArgsPair $ zip args stricts
-- Don't create unboxed tuples with a single element.
case (isNewtypeLikeCon con || isUnboxedTupleCon con, args') of
(True, [arg]) -> return $ evaluate arg (head stricts')
_ -> mkCon tag args' stricts'
where
mkInteger n =
array [litN 1, callForeign "I_fromBits" [array [lit lo, lit hi]]]
where
lo = n .&. 0xffffffff
hi = n `shiftR` 32
tooLarge n = n > 2147483647 || n < -2147483648
-- Always inline enum-likes, bools are true/false, not 1/0.
mkCon l _ _ | isEnumerationDataCon con = return l
mkCon tag as ss = return $ array (tag : zipWith evaluate as ss)
evaluate arg True = eval arg
evaluate arg _ = arg
| 1,315 |
genEx (StgConApp con args) = do
-- On 64 bit machines, GHC constructs small integers from Ints rather than
-- Int64, so we need to deal with it or be unable to reliably create Int64
-- or Integer values.
case (dataConNameModule con, args) of
(("S#", "GHC.Integer.Type"), [StgLitArg (MachInt n)]) | tooLarge n -> do
return $ mkInteger n
(("True", "GHC.Types"), []) -> do
return $ lit True
(("False", "GHC.Types"), []) -> do
return $ lit False
_ -> do
(tag, stricts) <- genDataCon con
(args', stricts') <- genArgsPair $ zip args stricts
-- Don't create unboxed tuples with a single element.
case (isNewtypeLikeCon con || isUnboxedTupleCon con, args') of
(True, [arg]) -> return $ evaluate arg (head stricts')
_ -> mkCon tag args' stricts'
where
mkInteger n =
array [litN 1, callForeign "I_fromBits" [array [lit lo, lit hi]]]
where
lo = n .&. 0xffffffff
hi = n `shiftR` 32
tooLarge n = n > 2147483647 || n < -2147483648
-- Always inline enum-likes, bools are true/false, not 1/0.
mkCon l _ _ | isEnumerationDataCon con = return l
mkCon tag as ss = return $ array (tag : zipWith evaluate as ss)
evaluate arg True = eval arg
evaluate arg _ = arg
| 1,315 | false | false | 13 | 18 | 377 | 461 | 217 | 244 | null | null |
kwibus/myLang
|
tests/TestModify.hs
|
bsd-3-clause
|
-- TODO fixname
reorder' :: [Int] -> M.LamTerm () () -> M.LamTerm () ()
reorder' = T.Tag . Reorder 0 . map Bound
| 112 |
reorder' :: [Int] -> M.LamTerm () () -> M.LamTerm () ()
reorder' = T.Tag . Reorder 0 . map Bound
| 96 |
reorder' = T.Tag . Reorder 0 . map Bound
| 40 | true | true | 0 | 8 | 22 | 61 | 30 | 31 | null | null |
Ornedan/dom3statusbot
|
GameInfo.hs
|
bsd-3-clause
|
nationName 40 = "MA Pangaea"
| 28 |
nationName 40 = "MA Pangaea"
| 28 |
nationName 40 = "MA Pangaea"
| 28 | false | false | 0 | 5 | 4 | 9 | 4 | 5 | null | null |
GaloisInc/halvm-ghc
|
compiler/basicTypes/VarEnv.hs
|
bsd-3-clause
|
lookupDVarEnv :: DVarEnv a -> Var -> Maybe a
lookupDVarEnv = lookupUDFM
| 71 |
lookupDVarEnv :: DVarEnv a -> Var -> Maybe a
lookupDVarEnv = lookupUDFM
| 71 |
lookupDVarEnv = lookupUDFM
| 26 | false | true | 0 | 7 | 11 | 25 | 12 | 13 | null | null |
phischu/fragnix
|
builtins/ghc-prim/GHC.Prim.hs
|
bsd-3-clause
|
-- | Read a vector from specified index of immutable array of scalars; offset is in scalar elements.
indexInt32ArrayAsInt32X4# :: ByteArray# -> Int# -> Int32X4#
indexInt32ArrayAsInt32X4# = indexInt32ArrayAsInt32X4#
| 216 |
indexInt32ArrayAsInt32X4# :: ByteArray# -> Int# -> Int32X4#
indexInt32ArrayAsInt32X4# = indexInt32ArrayAsInt32X4#
| 113 |
indexInt32ArrayAsInt32X4# = indexInt32ArrayAsInt32X4#
| 53 | true | true | 0 | 6 | 29 | 20 | 11 | 9 | null | null |
sdiehl/ghc
|
compiler/utils/TrieMap.hs
|
bsd-3-clause
|
lkMaybe :: (forall b. k -> m b -> Maybe b)
-> Maybe k -> MaybeMap m a -> Maybe a
lkMaybe _ Nothing = mm_nothing
| 121 |
lkMaybe :: (forall b. k -> m b -> Maybe b)
-> Maybe k -> MaybeMap m a -> Maybe a
lkMaybe _ Nothing = mm_nothing
| 121 |
lkMaybe _ Nothing = mm_nothing
| 32 | false | true | 0 | 10 | 35 | 61 | 29 | 32 | null | null |
waterret/PlotWithGnu-haskell
|
src/Main.hs
|
gpl-3.0
|
switchAction :: [String] -> IO ()
switchAction [lattr] = do
dataTable <- parseData <$> getContents
plotview [] "plot [] []" [(dataTable, lattr)]
| 152 |
switchAction :: [String] -> IO ()
switchAction [lattr] = do
dataTable <- parseData <$> getContents
plotview [] "plot [] []" [(dataTable, lattr)]
| 152 |
switchAction [lattr] = do
dataTable <- parseData <$> getContents
plotview [] "plot [] []" [(dataTable, lattr)]
| 118 | false | true | 0 | 9 | 29 | 61 | 31 | 30 | null | null |
binesiyu/ifl
|
ifpt-master/Utils.hs
|
mit
|
aLookup ::Eq a => ASSOC a b -> a -> b -> b
aLookup as a def = case L.lookup a as of
Just x -> x
Nothing -> def
| 115 |
aLookup ::Eq a => ASSOC a b -> a -> b -> b
aLookup as a def = case L.lookup a as of
Just x -> x
Nothing -> def
| 115 |
aLookup as a def = case L.lookup a as of
Just x -> x
Nothing -> def
| 72 | false | true | 3 | 8 | 34 | 68 | 32 | 36 | null | null |
andrewthad/persistent
|
persistent-test/CompositeTest.hs
|
mit
|
matchK :: (PersistField a, PersistEntity record) => Key record -> Either Text a
matchK = (\(pv:[]) -> fromPersistValue pv) . keyToValues
| 136 |
matchK :: (PersistField a, PersistEntity record) => Key record -> Either Text a
matchK = (\(pv:[]) -> fromPersistValue pv) . keyToValues
| 136 |
matchK = (\(pv:[]) -> fromPersistValue pv) . keyToValues
| 56 | false | true | 0 | 10 | 20 | 62 | 32 | 30 | null | null |
jystic/ssa-anf
|
src/ANF/SCCP.hs
|
bsd-3-clause
|
bindingsOfExpr :: Expr n -> [Binding n]
bindingsOfExpr expr = case expr of
Return _ -> []
Let _ _ e -> bindingsOfExpr e
LetRec bs e -> bs ++ bindingsOfExpr e
If _ th el -> bindingsOfExpr th ++ bindingsOfExpr el
------------------------------------------------------------------------
-- | Least upper bound of the abstract value.
| 357 |
bindingsOfExpr :: Expr n -> [Binding n]
bindingsOfExpr expr = case expr of
Return _ -> []
Let _ _ e -> bindingsOfExpr e
LetRec bs e -> bs ++ bindingsOfExpr e
If _ th el -> bindingsOfExpr th ++ bindingsOfExpr el
------------------------------------------------------------------------
-- | Least upper bound of the abstract value.
| 357 |
bindingsOfExpr expr = case expr of
Return _ -> []
Let _ _ e -> bindingsOfExpr e
LetRec bs e -> bs ++ bindingsOfExpr e
If _ th el -> bindingsOfExpr th ++ bindingsOfExpr el
------------------------------------------------------------------------
-- | Least upper bound of the abstract value.
| 317 | false | true | 0 | 9 | 79 | 101 | 47 | 54 | null | null |
rueshyna/gogol
|
gogol-bigquery/gen/Network/Google/BigQuery/Types/Product.hs
|
mpl-2.0
|
-- | [Output-only, Experimental] Describes execution plan for the query.
jQueryPlan :: Lens' JobStatistics2 [ExplainQueryStage]
jQueryPlan
= lens _jQueryPlan (\ s a -> s{_jQueryPlan = a}) .
_Default
. _Coerce
| 222 |
jQueryPlan :: Lens' JobStatistics2 [ExplainQueryStage]
jQueryPlan
= lens _jQueryPlan (\ s a -> s{_jQueryPlan = a}) .
_Default
. _Coerce
| 149 |
jQueryPlan
= lens _jQueryPlan (\ s a -> s{_jQueryPlan = a}) .
_Default
. _Coerce
| 94 | true | true | 0 | 11 | 43 | 53 | 28 | 25 | null | null |
futtetennista/IntroductionToFunctionalProgramming
|
PiH/src/Chapter8.hs
|
mit
|
value (Mul x y) =
value x * value y
| 37 |
value (Mul x y) =
value x * value y
| 37 |
value (Mul x y) =
value x * value y
| 37 | false | false | 0 | 7 | 11 | 27 | 12 | 15 | null | null |
klmerryn/courseography
|
app/Svg/Builder.hs
|
gpl-3.0
|
buildPathString :: [Point] -> String
buildPathString d = unwords $ map toString d
where
toString (a, b) = show a ++ "," ++ show b
-- * Intersection helpers
-- | Determines if a point is contained in a given rectangular region.
| 241 |
buildPathString :: [Point] -> String
buildPathString d = unwords $ map toString d
where
toString (a, b) = show a ++ "," ++ show b
-- * Intersection helpers
-- | Determines if a point is contained in a given rectangular region.
| 241 |
buildPathString d = unwords $ map toString d
where
toString (a, b) = show a ++ "," ++ show b
-- * Intersection helpers
-- | Determines if a point is contained in a given rectangular region.
| 204 | false | true | 0 | 7 | 56 | 69 | 33 | 36 | null | null |
bgamari/reftrack
|
RefTrack/ScrapeIds.hs
|
bsd-3-clause
|
arxivId = fmap (\a->ArxivRef $ ArxivId $ T.pack $ a !! 1) . listToMaybe . match re
where re = makeRegex ("arXiv:([[:digit:]]{4}\\.[[:digit:]]{4}v[[:digit:]]+)" :: String) :: Regex
| 181 |
arxivId = fmap (\a->ArxivRef $ ArxivId $ T.pack $ a !! 1) . listToMaybe . match re
where re = makeRegex ("arXiv:([[:digit:]]{4}\\.[[:digit:]]{4}v[[:digit:]]+)" :: String) :: Regex
| 181 |
arxivId = fmap (\a->ArxivRef $ ArxivId $ T.pack $ a !! 1) . listToMaybe . match re
where re = makeRegex ("arXiv:([[:digit:]]{4}\\.[[:digit:]]{4}v[[:digit:]]+)" :: String) :: Regex
| 181 | false | false | 0 | 13 | 27 | 66 | 34 | 32 | null | null |
jonpetterbergman/wai-snap
|
src/Snap/Internal/Http/Server/Date.hs
|
bsd-3-clause
|
updateState :: DateState -> IO ()
updateState (DateState dateString logString time) = do
(s1,s2,now) <- fetchTime
atomicModifyIORef dateString $ const (s1,())
atomicModifyIORef logString $ const (s2,())
atomicModifyIORef time $ const (now,())
-- force values in the iorefs to prevent thunk buildup
!_ <- readIORef dateString
!_ <- readIORef logString
!_ <- readIORef time
return ()
------------------------------------------------------------------------------
| 507 |
updateState :: DateState -> IO ()
updateState (DateState dateString logString time) = do
(s1,s2,now) <- fetchTime
atomicModifyIORef dateString $ const (s1,())
atomicModifyIORef logString $ const (s2,())
atomicModifyIORef time $ const (now,())
-- force values in the iorefs to prevent thunk buildup
!_ <- readIORef dateString
!_ <- readIORef logString
!_ <- readIORef time
return ()
------------------------------------------------------------------------------
| 507 |
updateState (DateState dateString logString time) = do
(s1,s2,now) <- fetchTime
atomicModifyIORef dateString $ const (s1,())
atomicModifyIORef logString $ const (s2,())
atomicModifyIORef time $ const (now,())
-- force values in the iorefs to prevent thunk buildup
!_ <- readIORef dateString
!_ <- readIORef logString
!_ <- readIORef time
return ()
------------------------------------------------------------------------------
| 473 | false | true | 0 | 11 | 102 | 160 | 73 | 87 | null | null |
typelead/epm
|
epm/Main.hs
|
bsd-3-clause
|
configureAction :: (ConfigFlags, ConfigExFlags)
-> [String] -> GlobalFlags -> IO ()
configureAction (configFlags, configExFlags) extraArgs globalFlags = do
let verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
(useSandbox, config) <- loadConfigOrSandboxConfig verbosity
globalFlags (configUserInstall configFlags)
let configFlags' = savedConfigureFlags config `mappend` configFlags
configExFlags' = savedConfigureExFlags config `mappend` configExFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAuxEx configFlags'
-- If we're working inside a sandbox and the user has set the -w option, we
-- may need to create a sandbox-local package DB for this compiler and add a
-- timestamp record for this compiler to the timestamp file.
let configFlags'' = case useSandbox of
NoSandbox -> configFlags'
(UseSandbox sandboxDir) -> setPackageDB sandboxDir
comp platform configFlags'
whenUsingSandbox useSandbox $ \sandboxDir -> do
initPackageDBIfNeeded verbosity configFlags'' comp conf
-- NOTE: We do not write the new sandbox package DB location to
-- 'cabal.sandbox.config' here because 'configure -w' must not affect
-- subsequent 'install' (for UI compatibility with non-sandboxed mode).
indexFile <- tryGetIndexFilePath config
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
maybeWithSandboxDirOnSearchPath useSandbox $
configure verbosity
(configPackageDB' configFlags'')
(globalRepos globalFlags')
comp platform conf configFlags'' configExFlags' extraArgs
| 1,804 |
configureAction :: (ConfigFlags, ConfigExFlags)
-> [String] -> GlobalFlags -> IO ()
configureAction (configFlags, configExFlags) extraArgs globalFlags = do
let verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
(useSandbox, config) <- loadConfigOrSandboxConfig verbosity
globalFlags (configUserInstall configFlags)
let configFlags' = savedConfigureFlags config `mappend` configFlags
configExFlags' = savedConfigureExFlags config `mappend` configExFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAuxEx configFlags'
-- If we're working inside a sandbox and the user has set the -w option, we
-- may need to create a sandbox-local package DB for this compiler and add a
-- timestamp record for this compiler to the timestamp file.
let configFlags'' = case useSandbox of
NoSandbox -> configFlags'
(UseSandbox sandboxDir) -> setPackageDB sandboxDir
comp platform configFlags'
whenUsingSandbox useSandbox $ \sandboxDir -> do
initPackageDBIfNeeded verbosity configFlags'' comp conf
-- NOTE: We do not write the new sandbox package DB location to
-- 'cabal.sandbox.config' here because 'configure -w' must not affect
-- subsequent 'install' (for UI compatibility with non-sandboxed mode).
indexFile <- tryGetIndexFilePath config
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
maybeWithSandboxDirOnSearchPath useSandbox $
configure verbosity
(configPackageDB' configFlags'')
(globalRepos globalFlags')
comp platform conf configFlags'' configExFlags' extraArgs
| 1,804 |
configureAction (configFlags, configExFlags) extraArgs globalFlags = do
let verbosity = fromFlagOrDefault normal (configVerbosity configFlags)
(useSandbox, config) <- loadConfigOrSandboxConfig verbosity
globalFlags (configUserInstall configFlags)
let configFlags' = savedConfigureFlags config `mappend` configFlags
configExFlags' = savedConfigureExFlags config `mappend` configExFlags
globalFlags' = savedGlobalFlags config `mappend` globalFlags
(comp, platform, conf) <- configCompilerAuxEx configFlags'
-- If we're working inside a sandbox and the user has set the -w option, we
-- may need to create a sandbox-local package DB for this compiler and add a
-- timestamp record for this compiler to the timestamp file.
let configFlags'' = case useSandbox of
NoSandbox -> configFlags'
(UseSandbox sandboxDir) -> setPackageDB sandboxDir
comp platform configFlags'
whenUsingSandbox useSandbox $ \sandboxDir -> do
initPackageDBIfNeeded verbosity configFlags'' comp conf
-- NOTE: We do not write the new sandbox package DB location to
-- 'cabal.sandbox.config' here because 'configure -w' must not affect
-- subsequent 'install' (for UI compatibility with non-sandboxed mode).
indexFile <- tryGetIndexFilePath config
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
maybeWithSandboxDirOnSearchPath useSandbox $
configure verbosity
(configPackageDB' configFlags'')
(globalRepos globalFlags')
comp platform conf configFlags'' configExFlags' extraArgs
| 1,704 | false | true | 0 | 14 | 419 | 305 | 153 | 152 | null | null |
dec9ue/jhc_copygc
|
src/Doc/Pretty.hs
|
gpl-2.0
|
x <$> y = x <> line <> y
| 32 |
x <$> y = x <> line <> y
| 32 |
x <$> y = x <> line <> y
| 32 | false | false | 2 | 6 | 16 | 20 | 9 | 11 | null | null |
toddmohney/json-api
|
example/src/Users/Actions/Index.hs
|
mit
|
toURL :: String -> URL
toURL = fromJust . importURL
| 51 |
toURL :: String -> URL
toURL = fromJust . importURL
| 51 |
toURL = fromJust . importURL
| 28 | false | true | 0 | 7 | 9 | 26 | 11 | 15 | null | null |
socrata-platform/ssync
|
src/main/haskell/SSync/PatchApplier.hs
|
apache-2.0
|
process :: (Monad m) => Word32 -> (Word32 -> m (Maybe ByteString)) -> ExceptT PatchException (HashT (ConduitM ByteString ByteString m)) ()
process blockSize chunkProvider =
consumeAndHash (getChunk blockSize) >>= \case
Just (Data bytes) ->
mapM_ (lift . lift . yield) (BSL.toChunks bytes) >> process blockSize chunkProvider
Just (Block num) ->
(lift . lift . lift) (chunkProvider num) >>= \case
Just bytes -> (lift . lift . yield) bytes >> process blockSize chunkProvider
Nothing -> throwError $ UnknownBlock num
Nothing ->
return ()
| 581 |
process :: (Monad m) => Word32 -> (Word32 -> m (Maybe ByteString)) -> ExceptT PatchException (HashT (ConduitM ByteString ByteString m)) ()
process blockSize chunkProvider =
consumeAndHash (getChunk blockSize) >>= \case
Just (Data bytes) ->
mapM_ (lift . lift . yield) (BSL.toChunks bytes) >> process blockSize chunkProvider
Just (Block num) ->
(lift . lift . lift) (chunkProvider num) >>= \case
Just bytes -> (lift . lift . yield) bytes >> process blockSize chunkProvider
Nothing -> throwError $ UnknownBlock num
Nothing ->
return ()
| 581 |
process blockSize chunkProvider =
consumeAndHash (getChunk blockSize) >>= \case
Just (Data bytes) ->
mapM_ (lift . lift . yield) (BSL.toChunks bytes) >> process blockSize chunkProvider
Just (Block num) ->
(lift . lift . lift) (chunkProvider num) >>= \case
Just bytes -> (lift . lift . yield) bytes >> process blockSize chunkProvider
Nothing -> throwError $ UnknownBlock num
Nothing ->
return ()
| 442 | false | true | 0 | 17 | 129 | 234 | 113 | 121 | null | null |
spinda/liquidhaskell
|
src/Language/Haskell/Liquid/Desugar710/Check.hs
|
bsd-3-clause
|
return_list :: DataCon -> Pat Name -> Bool
return_list id q = id == consDataCon && (is_nil q || is_list q)
| 106 |
return_list :: DataCon -> Pat Name -> Bool
return_list id q = id == consDataCon && (is_nil q || is_list q)
| 106 |
return_list id q = id == consDataCon && (is_nil q || is_list q)
| 63 | false | true | 0 | 8 | 20 | 48 | 23 | 25 | null | null |
tsahyt/clingo-haskell
|
src/Clingo/Internal/Utils.hs
|
mit
|
marshal1A :: (Storable a, MonadIO m, MonadThrow m)
=> (Ptr (Ptr a) -> Ptr CSize -> IO Raw.CBool) -> m [a]
marshal1A action = do
(res, as) <- liftIO $ alloca $ \ptr1 ->
alloca $ \ptr2 -> do
res <- action ptr1 ptr2
len <- peek ptr2
arrp <- peek ptr1
arr <- peekArray (fromIntegral len) arrp
return (res, arr)
checkAndThrow res
return as
| 430 |
marshal1A :: (Storable a, MonadIO m, MonadThrow m)
=> (Ptr (Ptr a) -> Ptr CSize -> IO Raw.CBool) -> m [a]
marshal1A action = do
(res, as) <- liftIO $ alloca $ \ptr1 ->
alloca $ \ptr2 -> do
res <- action ptr1 ptr2
len <- peek ptr2
arrp <- peek ptr1
arr <- peekArray (fromIntegral len) arrp
return (res, arr)
checkAndThrow res
return as
| 430 |
marshal1A action = do
(res, as) <- liftIO $ alloca $ \ptr1 ->
alloca $ \ptr2 -> do
res <- action ptr1 ptr2
len <- peek ptr2
arrp <- peek ptr1
arr <- peekArray (fromIntegral len) arrp
return (res, arr)
checkAndThrow res
return as
| 313 | false | true | 0 | 17 | 160 | 185 | 87 | 98 | null | null |
PolyglotSymposium/textual-game-hs
|
MoveSpec.hs
|
mit
|
main :: IO ()
main = hspec $ do
describe "Move left" $do
it "should return the coordinates with the column decremented" $do
moveLeft (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 0 3)
moveLeft (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 1 2)
describe "Move right" $do
it "should return the coordinates with the column incremented" $do
moveRight (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 2 3)
moveRight (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 3 2)
describe "Move up" $do
it "should return the coordinates with the row decremented" $do
moveUp (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 2)
moveUp (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 1)
describe "Move down" $do
it "should return the coordinates with the row incremented" $do
moveDown (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 4)
moveDown (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 3)
| 1,015 |
main :: IO ()
main = hspec $ do
describe "Move left" $do
it "should return the coordinates with the column decremented" $do
moveLeft (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 0 3)
moveLeft (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 1 2)
describe "Move right" $do
it "should return the coordinates with the column incremented" $do
moveRight (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 2 3)
moveRight (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 3 2)
describe "Move up" $do
it "should return the coordinates with the row decremented" $do
moveUp (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 2)
moveUp (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 1)
describe "Move down" $do
it "should return the coordinates with the row incremented" $do
moveDown (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 4)
moveDown (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 3)
| 1,014 |
main = hspec $ do
describe "Move left" $do
it "should return the coordinates with the column decremented" $do
moveLeft (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 0 3)
moveLeft (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 1 2)
describe "Move right" $do
it "should return the coordinates with the column incremented" $do
moveRight (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 2 3)
moveRight (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 3 2)
describe "Move up" $do
it "should return the coordinates with the row decremented" $do
moveUp (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 2)
moveUp (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 1)
describe "Move down" $do
it "should return the coordinates with the row incremented" $do
moveDown (ColumnAndRow 1 3) `shouldBe` (ColumnAndRow 1 4)
moveDown (ColumnAndRow 2 2) `shouldBe` (ColumnAndRow 2 3)
| 1,000 | false | true | 0 | 12 | 289 | 296 | 146 | 150 | null | null |
massysett/multiarg
|
lib/Multiarg/Types.hs
|
bsd-3-clause
|
-- | Creates a /short option name/. Any character other than a single
-- hyphen will succeed.
shortName :: Char -> Maybe ShortName
shortName '-' = Nothing
| 155 |
shortName :: Char -> Maybe ShortName
shortName '-' = Nothing
| 60 |
shortName '-' = Nothing
| 23 | true | true | 0 | 6 | 27 | 23 | 12 | 11 | null | null |
riwsky/wiwinwlh
|
src/hoas.hs
|
mit
|
id :: Expr (a -> a)
id = Lam (\x -> x)
| 38 |
id :: Expr (a -> a)
id = Lam (\x -> x)
| 38 |
id = Lam (\x -> x)
| 18 | false | true | 0 | 8 | 11 | 38 | 18 | 20 | null | null |
forsyde/forsyde-shallow
|
src/ForSyDe/Shallow/MoC/Synchronous/Lib.hs
|
bsd-3-clause
|
scanl3SY :: (a -> b -> c -> d -> a) -> a -> Signal b
-> Signal c -> Signal d -> Signal a
scanl3SY f mem xs ys zs = s'
where s' = zipWith4SY f (delaySY mem s') xs ys zs
-- | The process constructor 'scanldSY' is used to construct a finite
-- state machine process without output decoder. It takes an initial
-- value and a function for the next state decoder. The process
-- constructor behaves similar to the Haskell prelude function
-- 'scanlSY'. In contrast to the process constructor 'scanlSY' here
-- the output value is the current state and not the one of the next
-- state.
--
-- >>> scanldSY (+) 0 (signal [1,2,3,4])
-- {0,1,3,6,10}
| 652 |
scanl3SY :: (a -> b -> c -> d -> a) -> a -> Signal b
-> Signal c -> Signal d -> Signal a
scanl3SY f mem xs ys zs = s'
where s' = zipWith4SY f (delaySY mem s') xs ys zs
-- | The process constructor 'scanldSY' is used to construct a finite
-- state machine process without output decoder. It takes an initial
-- value and a function for the next state decoder. The process
-- constructor behaves similar to the Haskell prelude function
-- 'scanlSY'. In contrast to the process constructor 'scanlSY' here
-- the output value is the current state and not the one of the next
-- state.
--
-- >>> scanldSY (+) 0 (signal [1,2,3,4])
-- {0,1,3,6,10}
| 652 |
scanl3SY f mem xs ys zs = s'
where s' = zipWith4SY f (delaySY mem s') xs ys zs
-- | The process constructor 'scanldSY' is used to construct a finite
-- state machine process without output decoder. It takes an initial
-- value and a function for the next state decoder. The process
-- constructor behaves similar to the Haskell prelude function
-- 'scanlSY'. In contrast to the process constructor 'scanlSY' here
-- the output value is the current state and not the one of the next
-- state.
--
-- >>> scanldSY (+) 0 (signal [1,2,3,4])
-- {0,1,3,6,10}
| 554 | false | true | 0 | 10 | 136 | 110 | 58 | 52 | null | null |
bvdelft/parac2
|
src/Language/Java/Paragon/TypeCheck/Monad/old/TcCont.hs
|
bsd-3-clause
|
getThisT :: TcCont r TcType
getThisT = liftBase Base.getThisT
| 61 |
getThisT :: TcCont r TcType
getThisT = liftBase Base.getThisT
| 61 |
getThisT = liftBase Base.getThisT
| 33 | false | true | 0 | 6 | 8 | 21 | 10 | 11 | null | null |
ghcjs/ghcjs
|
src/Compiler/JMacro/Combinators.hs
|
mit
|
math_ :: Text -> [JExpr] -> JExpr
math_ op args = math .^ op .$ args
| 68 |
math_ :: Text -> [JExpr] -> JExpr
math_ op args = math .^ op .$ args
| 68 |
math_ op args = math .^ op .$ args
| 34 | false | true | 0 | 7 | 15 | 40 | 19 | 21 | null | null |
elben/typing-haskell-in-haskell
|
StaticPrelude.hs
|
bsd-3-clause
|
tIOResult = TCon (Tycon "IOResult" (Kfun Star Star))
| 52 |
tIOResult = TCon (Tycon "IOResult" (Kfun Star Star))
| 52 |
tIOResult = TCon (Tycon "IOResult" (Kfun Star Star))
| 52 | false | false | 0 | 9 | 7 | 25 | 12 | 13 | null | null |
FranklinChen/hugs98-plus-Sep2006
|
packages/HaXml/src/Text/XML/HaXml/Html/ParseLazy.hs
|
bsd-3-clause
|
report :: (String->HParser a) -> String -> Posn -> TokenT -> HParser a
report fail exp p t = fail ("Expected "++show exp++" but found "++show t
++"\n at "++show p)
| 191 |
report :: (String->HParser a) -> String -> Posn -> TokenT -> HParser a
report fail exp p t = fail ("Expected "++show exp++" but found "++show t
++"\n at "++show p)
| 191 |
report fail exp p t = fail ("Expected "++show exp++" but found "++show t
++"\n at "++show p)
| 120 | false | true | 0 | 12 | 58 | 88 | 41 | 47 | null | null |
OS2World/DEV-UTIL-HUGS
|
libraries/Graphics/UI/GLUT/Overlay.hs
|
bsd-3-clause
|
setHasOverlay :: Bool -> IO ()
setHasOverlay False = glutRemoveOverlay
| 70 |
setHasOverlay :: Bool -> IO ()
setHasOverlay False = glutRemoveOverlay
| 70 |
setHasOverlay False = glutRemoveOverlay
| 39 | false | true | 0 | 8 | 9 | 28 | 12 | 16 | null | null |
josefs/sbv
|
SBVTestSuite/TestSuite/Basics/AllSat.hs
|
bsd-3-clause
|
t2 :: IO AllSatResult
t2 = allSat $ do x <- free "x"
y <- free "y"
z <- free "z"
return $ x .== (y :: SQ) &&& z .== (z :: SQ)
| 176 |
t2 :: IO AllSatResult
t2 = allSat $ do x <- free "x"
y <- free "y"
z <- free "z"
return $ x .== (y :: SQ) &&& z .== (z :: SQ)
| 176 |
t2 = allSat $ do x <- free "x"
y <- free "y"
z <- free "z"
return $ x .== (y :: SQ) &&& z .== (z :: SQ)
| 154 | false | true | 0 | 11 | 84 | 79 | 38 | 41 | null | null |
verement/etamoo
|
src/MOO/Builtins/Objects.hs
|
bsd-3-clause
|
bf_set_verb_code = Builtin "set_verb_code" 3 (Just 3) [TObj, TAny, TLst]
TLst $ \[Obj object, verb_desc, Lst code] -> do
obj <- checkValid object
verb <- getVerb obj verb_desc
text <- builder2text . foldr addLine mempty <$>
maybe (raise E_TYPE) return (mapM strValue $ Lst.toList code)
unless (verbPermW verb) $ checkPermission (verbOwner verb)
checkProgrammer
vspace <- getVSpace
case parseProgram text of
Right program -> do
modifyVerb (object, obj) verb_desc $ \verb ->
return verb { verbProgram = vref' vspace program }
return emptyList
Left errors -> return $ fromListBy (Str . Str.fromString) errors
where addLine :: StrT -> Builder -> Builder
addLine line = mappend (Str.toBuilder line) . mappend newline
newline = TLB.singleton '\n' :: Builder
| 843 |
bf_set_verb_code = Builtin "set_verb_code" 3 (Just 3) [TObj, TAny, TLst]
TLst $ \[Obj object, verb_desc, Lst code] -> do
obj <- checkValid object
verb <- getVerb obj verb_desc
text <- builder2text . foldr addLine mempty <$>
maybe (raise E_TYPE) return (mapM strValue $ Lst.toList code)
unless (verbPermW verb) $ checkPermission (verbOwner verb)
checkProgrammer
vspace <- getVSpace
case parseProgram text of
Right program -> do
modifyVerb (object, obj) verb_desc $ \verb ->
return verb { verbProgram = vref' vspace program }
return emptyList
Left errors -> return $ fromListBy (Str . Str.fromString) errors
where addLine :: StrT -> Builder -> Builder
addLine line = mappend (Str.toBuilder line) . mappend newline
newline = TLB.singleton '\n' :: Builder
| 843 |
bf_set_verb_code = Builtin "set_verb_code" 3 (Just 3) [TObj, TAny, TLst]
TLst $ \[Obj object, verb_desc, Lst code] -> do
obj <- checkValid object
verb <- getVerb obj verb_desc
text <- builder2text . foldr addLine mempty <$>
maybe (raise E_TYPE) return (mapM strValue $ Lst.toList code)
unless (verbPermW verb) $ checkPermission (verbOwner verb)
checkProgrammer
vspace <- getVSpace
case parseProgram text of
Right program -> do
modifyVerb (object, obj) verb_desc $ \verb ->
return verb { verbProgram = vref' vspace program }
return emptyList
Left errors -> return $ fromListBy (Str . Str.fromString) errors
where addLine :: StrT -> Builder -> Builder
addLine line = mappend (Str.toBuilder line) . mappend newline
newline = TLB.singleton '\n' :: Builder
| 843 | false | false | 5 | 18 | 206 | 320 | 147 | 173 | null | null |
nukisman/elm-format-short
|
parser/src/Parse/Module.hs
|
bsd-3-clause
|
mergeCommentedMap :: Ord k => (v -> v -> v) -> Var.CommentedMap k v -> Var.CommentedMap k v -> Var.CommentedMap k v
mergeCommentedMap merge left right =
let
merge' (Commented pre1 a post1) (Commented pre2 b post2) =
Commented (pre1 ++ pre2) (merge a b) (post1 ++ post2)
in
unionWith merge' left right
| 332 |
mergeCommentedMap :: Ord k => (v -> v -> v) -> Var.CommentedMap k v -> Var.CommentedMap k v -> Var.CommentedMap k v
mergeCommentedMap merge left right =
let
merge' (Commented pre1 a post1) (Commented pre2 b post2) =
Commented (pre1 ++ pre2) (merge a b) (post1 ++ post2)
in
unionWith merge' left right
| 332 |
mergeCommentedMap merge left right =
let
merge' (Commented pre1 a post1) (Commented pre2 b post2) =
Commented (pre1 ++ pre2) (merge a b) (post1 ++ post2)
in
unionWith merge' left right
| 216 | false | true | 0 | 11 | 84 | 141 | 68 | 73 | null | null |
erantapaa/happstack-server
|
src/Happstack/Server/Validation.hs
|
bsd-3-clause
|
-- | Set the validator which should be used for this particular
-- 'Response' when validation is enabled.
--
-- Calling this function does not enable validation. That can only be
-- done by enabling the validation in the 'Conf' that is passed to
-- 'simpleHTTP'.
--
-- You do not need to call this function if the validator set in
-- 'Conf' does what you want already.
--
-- Example: (use 'noopValidator' instead of the default supplied by
-- 'validateConf')
--
-- > simpleHTTP validateConf $ ok . setValidator noopValidator =<< htmlPage
--
-- See also: 'validateConf', 'wdgHTMLValidator', 'noopValidator',
-- 'lazyProcValidator'.
setValidator :: (Response -> IO Response) -> Response -> Response
setValidator v r = r { rsValidator = Just v }
| 742 |
setValidator :: (Response -> IO Response) -> Response -> Response
setValidator v r = r { rsValidator = Just v }
| 111 |
setValidator v r = r { rsValidator = Just v }
| 45 | true | true | 0 | 8 | 122 | 67 | 41 | 26 | null | null |
diku-dk/futhark
|
src/Futhark/IR/Primitive.hs
|
isc
|
-- | Apply a 'BinOp' to an operand. Returns 'Nothing' if the
-- application is mistyped, or outside the domain (e.g. division by
-- zero).
doBinOp :: BinOp -> PrimValue -> PrimValue -> Maybe PrimValue
doBinOp Add {} = doIntBinOp doAdd
| 235 |
doBinOp :: BinOp -> PrimValue -> PrimValue -> Maybe PrimValue
doBinOp Add {} = doIntBinOp doAdd
| 95 |
doBinOp Add {} = doIntBinOp doAdd
| 33 | true | true | 0 | 8 | 41 | 39 | 20 | 19 | null | null |
pmiddend/networkie
|
src/Networkie/Server/ClientHandling.hs
|
gpl-2.0
|
clientWriteToServer :: ServerCommand -> ClientMainLoopState ()
clientWriteToServer c = do
toServerChan <- gets csToServerChan
writeChan toServerChan c
| 154 |
clientWriteToServer :: ServerCommand -> ClientMainLoopState ()
clientWriteToServer c = do
toServerChan <- gets csToServerChan
writeChan toServerChan c
| 154 |
clientWriteToServer c = do
toServerChan <- gets csToServerChan
writeChan toServerChan c
| 91 | false | true | 0 | 8 | 20 | 41 | 18 | 23 | null | null |
keithodulaigh/Hets
|
Common/Result.hs
|
gpl-2.0
|
prettySingleSourceRange :: [Pos] -> Doc
prettySingleSourceRange sp = let
mi = minimum sp
ma = maximum sp
in case compare mi ma of
EQ -> text (showPos ma "")
_ -> text $ showPos mi "-"
++ showPos ma {sourceName = ""} ""
| 265 |
prettySingleSourceRange :: [Pos] -> Doc
prettySingleSourceRange sp = let
mi = minimum sp
ma = maximum sp
in case compare mi ma of
EQ -> text (showPos ma "")
_ -> text $ showPos mi "-"
++ showPos ma {sourceName = ""} ""
| 265 |
prettySingleSourceRange sp = let
mi = minimum sp
ma = maximum sp
in case compare mi ma of
EQ -> text (showPos ma "")
_ -> text $ showPos mi "-"
++ showPos ma {sourceName = ""} ""
| 225 | false | true | 0 | 13 | 89 | 101 | 49 | 52 | null | null |
amccausl/Swish
|
Swish/HaskellRDF/RDFProofContext.hs
|
lgpl-2.1
|
rdfsa14 :: RDFFormula
rdfsa14 = makeFormula scopeRDFS "a14"
"rdf:predicate rdfs:range rdfs:Resource ."
| 113 |
rdfsa14 :: RDFFormula
rdfsa14 = makeFormula scopeRDFS "a14"
"rdf:predicate rdfs:range rdfs:Resource ."
| 113 |
rdfsa14 = makeFormula scopeRDFS "a14"
"rdf:predicate rdfs:range rdfs:Resource ."
| 91 | false | true | 0 | 5 | 22 | 19 | 9 | 10 | null | null |
wxwxwwxxx/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
parsePackageFlag :: (String -> PackageArg) -- type of argument
-> String -- string to parse
-> PackageFlag
parsePackageFlag constr str = case filter ((=="").snd) (readP_to_S parse str) of
[(r, "")] -> r
_ -> throwGhcException $ CmdLineError ("Can't parse package flag: " ++ str)
where parse = do
pkg <- tok $ munch1 (\c -> isAlphaNum c || c `elem` ":-_.")
( do _ <- tok $ string "with"
fmap (ExposePackage (constr pkg) . ModRenaming True) parseRns
<++ fmap (ExposePackage (constr pkg) . ModRenaming False) parseRns
<++ return (ExposePackage (constr pkg) (ModRenaming True [])))
parseRns = do _ <- tok $ R.char '('
rns <- tok $ sepBy parseItem (tok $ R.char ',')
_ <- tok $ R.char ')'
return rns
parseItem = do
orig <- tok $ parseModuleName
(do _ <- tok $ string "as"
new <- tok $ parseModuleName
return (orig, new)
+++
return (orig, orig))
tok m = m >>= \x -> skipSpaces >> return x
| 1,182 |
parsePackageFlag :: (String -> PackageArg) -- type of argument
-> String -- string to parse
-> PackageFlag
parsePackageFlag constr str = case filter ((=="").snd) (readP_to_S parse str) of
[(r, "")] -> r
_ -> throwGhcException $ CmdLineError ("Can't parse package flag: " ++ str)
where parse = do
pkg <- tok $ munch1 (\c -> isAlphaNum c || c `elem` ":-_.")
( do _ <- tok $ string "with"
fmap (ExposePackage (constr pkg) . ModRenaming True) parseRns
<++ fmap (ExposePackage (constr pkg) . ModRenaming False) parseRns
<++ return (ExposePackage (constr pkg) (ModRenaming True [])))
parseRns = do _ <- tok $ R.char '('
rns <- tok $ sepBy parseItem (tok $ R.char ',')
_ <- tok $ R.char ')'
return rns
parseItem = do
orig <- tok $ parseModuleName
(do _ <- tok $ string "as"
new <- tok $ parseModuleName
return (orig, new)
+++
return (orig, orig))
tok m = m >>= \x -> skipSpaces >> return x
| 1,182 |
parsePackageFlag constr str = case filter ((=="").snd) (readP_to_S parse str) of
[(r, "")] -> r
_ -> throwGhcException $ CmdLineError ("Can't parse package flag: " ++ str)
where parse = do
pkg <- tok $ munch1 (\c -> isAlphaNum c || c `elem` ":-_.")
( do _ <- tok $ string "with"
fmap (ExposePackage (constr pkg) . ModRenaming True) parseRns
<++ fmap (ExposePackage (constr pkg) . ModRenaming False) parseRns
<++ return (ExposePackage (constr pkg) (ModRenaming True [])))
parseRns = do _ <- tok $ R.char '('
rns <- tok $ sepBy parseItem (tok $ R.char ',')
_ <- tok $ R.char ')'
return rns
parseItem = do
orig <- tok $ parseModuleName
(do _ <- tok $ string "as"
new <- tok $ parseModuleName
return (orig, new)
+++
return (orig, orig))
tok m = m >>= \x -> skipSpaces >> return x
| 1,025 | false | true | 6 | 17 | 458 | 429 | 203 | 226 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.