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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
djeik/goto | test/Spec.hs | mit | getTestSources :: FilePath -> IO [(String, String)]
getTestSources sourcesDir = getGoFiles >>= mapM readWithPath where
getGoFiles = filter isGoFile <$> getSourcePaths
isGoFile = (==) ".go" . takeExtension
getSourcePaths = getDirectoryContents sourcesDir
readWithPath p = (,) <$> pure (sourcesDir </> p) <*> readFile (sourcesDir </> p) | 350 | getTestSources :: FilePath -> IO [(String, String)]
getTestSources sourcesDir = getGoFiles >>= mapM readWithPath where
getGoFiles = filter isGoFile <$> getSourcePaths
isGoFile = (==) ".go" . takeExtension
getSourcePaths = getDirectoryContents sourcesDir
readWithPath p = (,) <$> pure (sourcesDir </> p) <*> readFile (sourcesDir </> p) | 350 | getTestSources sourcesDir = getGoFiles >>= mapM readWithPath where
getGoFiles = filter isGoFile <$> getSourcePaths
isGoFile = (==) ".go" . takeExtension
getSourcePaths = getDirectoryContents sourcesDir
readWithPath p = (,) <$> pure (sourcesDir </> p) <*> readFile (sourcesDir </> p) | 298 | false | true | 0 | 11 | 60 | 112 | 58 | 54 | null | null |
Heather/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | highestFC Placeholder = Nothing | 43 | highestFC Placeholder = Nothing | 43 | highestFC Placeholder = Nothing | 43 | false | false | 0 | 5 | 15 | 9 | 4 | 5 | null | null |
simhu/cubical | Eval.hs | mit | faceName :: Name -> Side -> Name
faceName 0 _ = 0 | 65 | faceName :: Name -> Side -> Name
faceName 0 _ = 0 | 65 | faceName 0 _ = 0 | 32 | false | true | 0 | 8 | 27 | 30 | 13 | 17 | null | null |
frontrowed/stratosphere | library-gen/Stratosphere/Resources/ServiceCatalogLaunchTemplateConstraint.hs | mit | -- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-servicecatalog-launchtemplateconstraint.html#cfn-servicecatalog-launchtemplateconstraint-acceptlanguage
scltcAcceptLanguage :: Lens' ServiceCatalogLaunchTemplateConstraint (Maybe (Val Text))
scltcAcceptLanguage = lens _serviceCatalogLaunchTemplateConstraintAcceptLanguage (\s a -> s { _serviceCatalogLaunchTemplateConstraintAcceptLanguage = a }) | 425 | scltcAcceptLanguage :: Lens' ServiceCatalogLaunchTemplateConstraint (Maybe (Val Text))
scltcAcceptLanguage = lens _serviceCatalogLaunchTemplateConstraintAcceptLanguage (\s a -> s { _serviceCatalogLaunchTemplateConstraintAcceptLanguage = a }) | 241 | scltcAcceptLanguage = lens _serviceCatalogLaunchTemplateConstraintAcceptLanguage (\s a -> s { _serviceCatalogLaunchTemplateConstraintAcceptLanguage = a }) | 154 | true | true | 0 | 9 | 22 | 52 | 28 | 24 | null | null |
ctford/Idris-Elba-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | induction tm ctxt env _ = do fail "Can't do induction here" | 59 | induction tm ctxt env _ = do fail "Can't do induction here" | 59 | induction tm ctxt env _ = do fail "Can't do induction here" | 59 | false | false | 0 | 7 | 11 | 25 | 9 | 16 | null | null |
phadej/range-set-list | tests/Map.hs | mit | toRSet (AIntersection a b) = RSet.intersection (toRSet a) (toRSet b) | 69 | toRSet (AIntersection a b) = RSet.intersection (toRSet a) (toRSet b) | 69 | toRSet (AIntersection a b) = RSet.intersection (toRSet a) (toRSet b) | 69 | false | false | 0 | 7 | 10 | 37 | 17 | 20 | null | null |
ocramz/monad-bayes | test/TestTrace.hs | mit | -- extractNormal :: Cache Double -> Maybe Double
-- extractNormal (Cache (Continuous (Normal _ _)) x) = Just (realToFrac x)
-- extractNormal _ = Nothing
--
-- extractInt :: Cache Double -> Maybe Int
-- extractInt (Cache (Discrete _) x) = Just (fromIntegral x)
-- extractInt _ = Nothing
discreteWeights :: Fractional a => [a]
discreteWeights = [0.0001, 0.9999] | 360 | discreteWeights :: Fractional a => [a]
discreteWeights = [0.0001, 0.9999] | 73 | discreteWeights = [0.0001, 0.9999] | 34 | true | true | 0 | 6 | 59 | 34 | 22 | 12 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Projects/SetCommonInstanceMetadata.hs | mpl-2.0 | -- | Project ID for this request.
pscimProject :: Lens' ProjectsSetCommonInstanceMetadata Text
pscimProject
= lens _pscimProject (\ s a -> s{_pscimProject = a}) | 162 | pscimProject :: Lens' ProjectsSetCommonInstanceMetadata Text
pscimProject
= lens _pscimProject (\ s a -> s{_pscimProject = a}) | 128 | pscimProject
= lens _pscimProject (\ s a -> s{_pscimProject = a}) | 67 | true | true | 1 | 9 | 24 | 46 | 22 | 24 | null | null |
ardumont/category-theory-lab | app/Main.hs | gpl-3.0 | n FS = X6 | 10 | n FS = X6 | 10 | n FS = X6 | 10 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
urbanslug/ghc | testsuite/tests/partial-sigs/should_compile/ExtraConstraints3.hs | bsd-3-clause | (=<<) :: _ => _
(=<<) = (P.=<<) | 31 | (=<<) :: _ => _
(=<<) = (P.=<<) | 31 | (=<<) = (P.=<<) | 15 | false | true | 0 | 7 | 7 | 31 | 16 | 15 | null | null |
shlevy/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp _ [res] UnsafeFreezeArrayArrayOp [arg]
= emit $ catAGraphs
[ setInfo arg (CmmLit (CmmLabel mkMAP_FROZEN0_infoLabel)),
mkAssign (CmmLocal res) arg ] | 174 | emitPrimOp _ [res] UnsafeFreezeArrayArrayOp [arg]
= emit $ catAGraphs
[ setInfo arg (CmmLit (CmmLabel mkMAP_FROZEN0_infoLabel)),
mkAssign (CmmLocal res) arg ] | 174 | emitPrimOp _ [res] UnsafeFreezeArrayArrayOp [arg]
= emit $ catAGraphs
[ setInfo arg (CmmLit (CmmLabel mkMAP_FROZEN0_infoLabel)),
mkAssign (CmmLocal res) arg ] | 174 | false | false | 3 | 11 | 35 | 68 | 31 | 37 | null | null |
sherwoodwang/wxHaskell | wx/src/Graphics/UI/WX/Menu.hs | lgpl-2.1 | menuRadioItem :: Menu a -> [Prop (MenuItem ())] -> IO (MenuItem ())
menuRadioItem menu props
= menuItemKind menu wxITEM_RADIO ([checked := True] ++ props) | 156 | menuRadioItem :: Menu a -> [Prop (MenuItem ())] -> IO (MenuItem ())
menuRadioItem menu props
= menuItemKind menu wxITEM_RADIO ([checked := True] ++ props) | 156 | menuRadioItem menu props
= menuItemKind menu wxITEM_RADIO ([checked := True] ++ props) | 88 | false | true | 0 | 11 | 25 | 73 | 36 | 37 | null | null |
m00nlight/99-problems | miscellaneous/sieveArray.hs | bsd-3-clause | run2 f n = length (f n) | 23 | run2 f n = length (f n) | 23 | run2 f n = length (f n) | 23 | false | false | 1 | 7 | 6 | 24 | 9 | 15 | null | null |
svenssonjoel/EmbArBB | Samples/sobel.hs | bsd-3-clause | gx :: Exp Word8 -> Exp Float
gx x = foldl (+) 0
$ P.zipWith (*) [toFloat (getNeighbor2D x a b) / 255
| (a,b) <- s1] coeffs | 151 | gx :: Exp Word8 -> Exp Float
gx x = foldl (+) 0
$ P.zipWith (*) [toFloat (getNeighbor2D x a b) / 255
| (a,b) <- s1] coeffs | 149 | gx x = foldl (+) 0
$ P.zipWith (*) [toFloat (getNeighbor2D x a b) / 255
| (a,b) <- s1] coeffs | 120 | false | true | 0 | 11 | 56 | 80 | 41 | 39 | null | null |
ssaavedra/liquidhaskell | tests/todo/InlineMeasure.hs | bsd-3-clause | {-@ measure mmax @-}
mmax :: (Int, Int) -> Int
mmax (x,y) = if x > y then x else y | 88 | mmax :: (Int, Int) -> Int
mmax (x,y) = if x > y then x else y | 67 | mmax (x,y) = if x > y then x else y | 35 | true | true | 0 | 6 | 26 | 43 | 25 | 18 | null | null |
gbaz/cabal | cabal-install/Distribution/Client/Install.hs | bsd-3-clause | reportPlanningFailure :: Verbosity -> InstallArgs -> InstallContext -> String
-> IO ()
reportPlanningFailure verbosity
(_, _, comp, platform, _, _, _
,_, configFlags, _, installFlags, _)
(_, sourcePkgDb, _, _, pkgSpecifiers, _)
message = do
when reportFailure $ do
-- Only create reports for explicitly named packages
let pkgids = filter
(SourcePackageIndex.elemByPackageId (packageIndex sourcePkgDb)) $
mapMaybe theSpecifiedPackage pkgSpecifiers
buildReports = BuildReports.fromPlanningFailure platform
(compilerId comp) pkgids
(configConfigurationsFlags configFlags)
when (not (null buildReports)) $
info verbosity $
"Solver failure will be reported for "
++ intercalate "," (map display pkgids)
-- Save reports
BuildReports.storeLocal (compilerInfo comp)
(fromNubList $ installSummaryFile installFlags)
buildReports platform
-- Save solver log
case logFile of
Nothing -> return ()
Just template -> forM_ pkgids $ \pkgid ->
let env = initialPathTemplateEnv pkgid dummyIpid
(compilerInfo comp) platform
path = fromPathTemplate $ substPathTemplate env template
in writeFile path message
where
reportFailure = fromFlag (installReportPlanningFailure installFlags)
logFile = flagToMaybe (installLogFile installFlags)
-- A IPID is calculated from the transitive closure of
-- dependencies, but when the solver fails we don't have that.
-- So we fail.
dummyIpid = error "reportPlanningFailure: installed package ID not available"
-- | If a 'PackageSpecifier' refers to a single package, return Just that
-- package. | 1,818 | reportPlanningFailure :: Verbosity -> InstallArgs -> InstallContext -> String
-> IO ()
reportPlanningFailure verbosity
(_, _, comp, platform, _, _, _
,_, configFlags, _, installFlags, _)
(_, sourcePkgDb, _, _, pkgSpecifiers, _)
message = do
when reportFailure $ do
-- Only create reports for explicitly named packages
let pkgids = filter
(SourcePackageIndex.elemByPackageId (packageIndex sourcePkgDb)) $
mapMaybe theSpecifiedPackage pkgSpecifiers
buildReports = BuildReports.fromPlanningFailure platform
(compilerId comp) pkgids
(configConfigurationsFlags configFlags)
when (not (null buildReports)) $
info verbosity $
"Solver failure will be reported for "
++ intercalate "," (map display pkgids)
-- Save reports
BuildReports.storeLocal (compilerInfo comp)
(fromNubList $ installSummaryFile installFlags)
buildReports platform
-- Save solver log
case logFile of
Nothing -> return ()
Just template -> forM_ pkgids $ \pkgid ->
let env = initialPathTemplateEnv pkgid dummyIpid
(compilerInfo comp) platform
path = fromPathTemplate $ substPathTemplate env template
in writeFile path message
where
reportFailure = fromFlag (installReportPlanningFailure installFlags)
logFile = flagToMaybe (installLogFile installFlags)
-- A IPID is calculated from the transitive closure of
-- dependencies, but when the solver fails we don't have that.
-- So we fail.
dummyIpid = error "reportPlanningFailure: installed package ID not available"
-- | If a 'PackageSpecifier' refers to a single package, return Just that
-- package. | 1,818 | reportPlanningFailure verbosity
(_, _, comp, platform, _, _, _
,_, configFlags, _, installFlags, _)
(_, sourcePkgDb, _, _, pkgSpecifiers, _)
message = do
when reportFailure $ do
-- Only create reports for explicitly named packages
let pkgids = filter
(SourcePackageIndex.elemByPackageId (packageIndex sourcePkgDb)) $
mapMaybe theSpecifiedPackage pkgSpecifiers
buildReports = BuildReports.fromPlanningFailure platform
(compilerId comp) pkgids
(configConfigurationsFlags configFlags)
when (not (null buildReports)) $
info verbosity $
"Solver failure will be reported for "
++ intercalate "," (map display pkgids)
-- Save reports
BuildReports.storeLocal (compilerInfo comp)
(fromNubList $ installSummaryFile installFlags)
buildReports platform
-- Save solver log
case logFile of
Nothing -> return ()
Just template -> forM_ pkgids $ \pkgid ->
let env = initialPathTemplateEnv pkgid dummyIpid
(compilerInfo comp) platform
path = fromPathTemplate $ substPathTemplate env template
in writeFile path message
where
reportFailure = fromFlag (installReportPlanningFailure installFlags)
logFile = flagToMaybe (installLogFile installFlags)
-- A IPID is calculated from the transitive closure of
-- dependencies, but when the solver fails we don't have that.
-- So we fail.
dummyIpid = error "reportPlanningFailure: installed package ID not available"
-- | If a 'PackageSpecifier' refers to a single package, return Just that
-- package. | 1,709 | false | true | 0 | 21 | 506 | 375 | 191 | 184 | null | null |
higgsd/euler | hs/43.hs | bsd-2-clause | sumAll = sum $ map (fromDigits.reverse) $
genDigits [] [0..9] (1:1:1:primeSieve 1000) | 94 | sumAll = sum $ map (fromDigits.reverse) $
genDigits [] [0..9] (1:1:1:primeSieve 1000) | 94 | sumAll = sum $ map (fromDigits.reverse) $
genDigits [] [0..9] (1:1:1:primeSieve 1000) | 94 | false | false | 0 | 10 | 20 | 54 | 27 | 27 | null | null |
facebookincubator/duckling | Duckling/Ordinal/ML/Corpus.hs | bsd-3-clause | corpus :: Corpus
corpus = (context, testOptions, allExamples) | 61 | corpus :: Corpus
corpus = (context, testOptions, allExamples) | 61 | corpus = (context, testOptions, allExamples) | 44 | false | true | 0 | 6 | 7 | 27 | 13 | 14 | null | null |
kseo/fp | src/FP/Function.hs | bsd-3-clause | divide :: Object -> Object
divide (SequenceObject [AtomObject (NumberAtom x), AtomObject (NumberAtom y)]) =
if y == 0
then Bottom
else makeNumber $ x `div` y | 175 | divide :: Object -> Object
divide (SequenceObject [AtomObject (NumberAtom x), AtomObject (NumberAtom y)]) =
if y == 0
then Bottom
else makeNumber $ x `div` y | 175 | divide (SequenceObject [AtomObject (NumberAtom x), AtomObject (NumberAtom y)]) =
if y == 0
then Bottom
else makeNumber $ x `div` y | 148 | false | true | 0 | 11 | 43 | 70 | 37 | 33 | null | null |
phaazon/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Tokens.hs | bsd-3-clause | gl_TEXTURE_2D_ARRAY_EXT :: GLenum
gl_TEXTURE_2D_ARRAY_EXT = 0x8C1A | 66 | gl_TEXTURE_2D_ARRAY_EXT :: GLenum
gl_TEXTURE_2D_ARRAY_EXT = 0x8C1A | 66 | gl_TEXTURE_2D_ARRAY_EXT = 0x8C1A | 32 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
rayl/gedcom-tools | Main.hs | bsd-3-clause | rENDL = chk "ENDL" | 18 | rENDL = chk "ENDL" | 18 | rENDL = chk "ENDL" | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
rad1al/hutton_exercises | ch11.hs | gpl-2.0 | -- clear screen --
cls :: IO ()
cls = putStr "\ESC[2J" | 54 | cls :: IO ()
cls = putStr "\ESC[2J" | 35 | cls = putStr "\ESC[2J" | 22 | true | true | 0 | 7 | 11 | 26 | 11 | 15 | null | null |
skeskinen/FTGL | Graphics/Rendering/FTGL.hs | bsd-2-clause | marshalTextAlignment :: TextAlignment -> CInt
marshalTextAlignment AlignLeft = 0 | 80 | marshalTextAlignment :: TextAlignment -> CInt
marshalTextAlignment AlignLeft = 0 | 80 | marshalTextAlignment AlignLeft = 0 | 34 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
pbl64k/HackerRank-Contests | 2014-06-20-FP/BoleynSalary/bs.accepted.hs | bsd-2-clause | ordr cs acc n = Fld.foldr (\x acc -> ordr cs acc x) (n : acc) (cs ! n) | 70 | ordr cs acc n = Fld.foldr (\x acc -> ordr cs acc x) (n : acc) (cs ! n) | 70 | ordr cs acc n = Fld.foldr (\x acc -> ordr cs acc x) (n : acc) (cs ! n) | 70 | false | false | 0 | 8 | 18 | 53 | 27 | 26 | null | null |
scvalex/daemonize-doublefork | System/Posix/Daemon.hs | gpl-3.0 | -- | Double-fork to create a well behaved daemon. If PIDFILE is
-- given, check/set pidfile; if we cannot obtain a lock on the file,
-- another process is already using it, so fail. The program is
-- started with @SIGHUP@ masked; HANDLER is invoked on @SIGHUP@.
--
-- See: <http://www.enderunix.org/docs/eng/daemon.php>
--
-- Note: All unnecessary fds should be close before calling this.
--
-- HANDLER is meant to allow the daemon to shutdown cleanly. It could
-- simply be:
--
-- @
-- handler = return ()
-- @
--
-- or something more elaborate like the following, which allows one to
-- perform some actions before re-raising the signal and killing the
-- daemon:
--
-- @
-- handler = do
-- putStrLn "Stopping daemon..."
-- raiseSignal sigTERM
-- @
--
startDaemon :: FilePath -- ^ PIDFILE
-> IO () -- ^ HANDLER
-> IO () -- ^ PROGRAM
-> IO ()
startDaemon pidFile handler program = do
checkRunning
_ <- forkProcess p -- fork first child...
exitImmediately ExitSuccess -- ...and exit
where
p = do
_ <- createSession -- create a new session and make
-- this process its leader; see
-- setsid(2)
_ <- forkProcess p' -- fork second child...
return ()
p' = do
remapFds -- remap standard fds
-- files created by server should be at most rwxr-x---
_ <- setFileCreationMask $ unionFileModes otherModes groupWriteMode
changeWorkingDirectory "/" -- chdir
_ <- installHandler sigHUP (Catch handler) Nothing
setRunning -- lock file
program -- run the daemon
remapFds = do
devnull <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
mapM_ (dupTo devnull) [stdInput, stdOutput, stdError]
closeFd devnull
checkRunning = do
fe <- doesFileExist pidFile
when fe $ do
fd <- openFd pidFile WriteOnly Nothing defaultFileFlags
ml <- getLock fd (ReadLock, AbsoluteSeek, 0, 0)
closeFd fd
case ml of
Just (pid, _) -> fail (show pid ++ " already running")
Nothing -> return ()
setRunning = do
fd <- createFile pidFile 777
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
pid <- getProcessID
_ <- fdWrite fd (show pid)
return ()
-- | Stop the daemon identified by PIDFILE by sending it @SIGHUP@. If
-- the process was daemonized with 'startDaemon', the handler
-- specified there will be invoked first. Return the pid of the
-- process that was killed; if PIDFILE does not exist, return
-- 'Nothing'. | 2,775 | startDaemon :: FilePath -- ^ PIDFILE
-> IO () -- ^ HANDLER
-> IO () -- ^ PROGRAM
-> IO ()
startDaemon pidFile handler program = do
checkRunning
_ <- forkProcess p -- fork first child...
exitImmediately ExitSuccess -- ...and exit
where
p = do
_ <- createSession -- create a new session and make
-- this process its leader; see
-- setsid(2)
_ <- forkProcess p' -- fork second child...
return ()
p' = do
remapFds -- remap standard fds
-- files created by server should be at most rwxr-x---
_ <- setFileCreationMask $ unionFileModes otherModes groupWriteMode
changeWorkingDirectory "/" -- chdir
_ <- installHandler sigHUP (Catch handler) Nothing
setRunning -- lock file
program -- run the daemon
remapFds = do
devnull <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
mapM_ (dupTo devnull) [stdInput, stdOutput, stdError]
closeFd devnull
checkRunning = do
fe <- doesFileExist pidFile
when fe $ do
fd <- openFd pidFile WriteOnly Nothing defaultFileFlags
ml <- getLock fd (ReadLock, AbsoluteSeek, 0, 0)
closeFd fd
case ml of
Just (pid, _) -> fail (show pid ++ " already running")
Nothing -> return ()
setRunning = do
fd <- createFile pidFile 777
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
pid <- getProcessID
_ <- fdWrite fd (show pid)
return ()
-- | Stop the daemon identified by PIDFILE by sending it @SIGHUP@. If
-- the process was daemonized with 'startDaemon', the handler
-- specified there will be invoked first. Return the pid of the
-- process that was killed; if PIDFILE does not exist, return
-- 'Nothing'. | 2,006 | startDaemon pidFile handler program = do
checkRunning
_ <- forkProcess p -- fork first child...
exitImmediately ExitSuccess -- ...and exit
where
p = do
_ <- createSession -- create a new session and make
-- this process its leader; see
-- setsid(2)
_ <- forkProcess p' -- fork second child...
return ()
p' = do
remapFds -- remap standard fds
-- files created by server should be at most rwxr-x---
_ <- setFileCreationMask $ unionFileModes otherModes groupWriteMode
changeWorkingDirectory "/" -- chdir
_ <- installHandler sigHUP (Catch handler) Nothing
setRunning -- lock file
program -- run the daemon
remapFds = do
devnull <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
mapM_ (dupTo devnull) [stdInput, stdOutput, stdError]
closeFd devnull
checkRunning = do
fe <- doesFileExist pidFile
when fe $ do
fd <- openFd pidFile WriteOnly Nothing defaultFileFlags
ml <- getLock fd (ReadLock, AbsoluteSeek, 0, 0)
closeFd fd
case ml of
Just (pid, _) -> fail (show pid ++ " already running")
Nothing -> return ()
setRunning = do
fd <- createFile pidFile 777
setLock fd (WriteLock, AbsoluteSeek, 0, 0)
pid <- getProcessID
_ <- fdWrite fd (show pid)
return ()
-- | Stop the daemon identified by PIDFILE by sending it @SIGHUP@. If
-- the process was daemonized with 'startDaemon', the handler
-- specified there will be invoked first. Return the pid of the
-- process that was killed; if PIDFILE does not exist, return
-- 'Nothing'. | 1,850 | true | true | 5 | 16 | 890 | 455 | 224 | 231 | null | null |
kadena-io/pact | src-tool/Pact/Analyze/Feature.hs | bsd-3-clause | -- Pattern synonyms for matching on symbol names
symIs :: Feature -> Text -> Bool
symIs feat sym = symbol feat == sym | 118 | symIs :: Feature -> Text -> Bool
symIs feat sym = symbol feat == sym | 68 | symIs feat sym = symbol feat == sym | 35 | true | true | 0 | 8 | 23 | 38 | 17 | 21 | null | null |
PipocaQuemada/ermine | src/Ermine/Parser/Resolver.hs | bsd-2-clause | fixityTypeGlobals :: Module -> HashMap Text Global
fixityTypeGlobals = fixityGlobals TypeLevel | 94 | fixityTypeGlobals :: Module -> HashMap Text Global
fixityTypeGlobals = fixityGlobals TypeLevel | 94 | fixityTypeGlobals = fixityGlobals TypeLevel | 43 | false | true | 0 | 7 | 10 | 28 | 12 | 16 | null | null |
joehillen/aura | src/Aura/Pkgbuild/Base.hs | gpl-3.0 | depends :: Namespace -> [String]
depends = flip value "depends" | 63 | depends :: Namespace -> [String]
depends = flip value "depends" | 63 | depends = flip value "depends" | 30 | false | true | 0 | 6 | 9 | 23 | 12 | 11 | null | null |
conal/hermit | src/HERMIT/Libraries/Int.hs | bsd-2-clause | {-
Defines the following lemmas:
forall n m. (m == n) = (n == m)
forall n m. (m < n ) = (n > m)
forall n m. (m <= n) = (n >= m)
forall n m. (m >= n) = (n < m)
forall n m. (m <= n) = False => (m == n) = False
forall n m. (m == n) = True => (m <= n) = True
forall n m. (min n m) = (min m n)
forall n m. (max n m) = (max m n)
forall n m. (min n m <= n) = True
forall n m. (max n m >= n) = True
-}
lemmas :: LemmaLibrary
lemmas = do
intTy <- findTypeT "Prelude.Int"
nId <- constT $ newIdH "n" intTy
mId <- constT $ newIdH "m" intTy
let n = varToCoreExpr nId
m = varToCoreExpr mId
#if __GLASGOW_HASKELL__ > 710
appTo i e = return $ mkCoreApp (text "appTo") (varToCoreExpr i) e
#else
appTo i e = return $ mkCoreApp (varToCoreExpr i) e
#endif
appToInt i = appTo i (Type intTy)
appToDict e = do
let (aTys, _) = splitFunTys (exprType e)
case aTys of
#if __GLASGOW_HASKELL__ > 710
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp (text "appToDict") e)
#else
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp e)
#endif
_ -> fail "first argument is not a dictionary."
appMN e = mkCoreApps e [m,n]
appNM e = mkCoreApps e [n,m]
mkEL l r = mkL (Equiv l r)
mkL cl = Lemma (mkForall [mId,nId] cl) BuiltIn NotUsed
mkIL nm al ar cl cr = mkL (Impl nm (Equiv al ar) (Equiv cl cr))
eqE <- findIdT "Data.Eq.==" >>= appToInt >>= appToDict
gtE <- findIdT "Data.Ord.>" >>= appToInt >>= appToDict
ltE <- findIdT "Data.Ord.<" >>= appToInt >>= appToDict
gteE <- findIdT "Data.Ord.>=" >>= appToInt >>= appToDict
lteE <- findIdT "Data.Ord.<=" >>= appToInt >>= appToDict
minE <- findIdT "Data.Ord.min" >>= appToInt >>= appToDict
maxE <- findIdT "Data.Ord.max" >>= appToInt >>= appToDict
trueE <- varToCoreExpr <$> findIdT "Data.Bool.True"
falseE <- varToCoreExpr <$> findIdT "Data.Bool.False"
return $ M.fromList
[ ("EqCommutativeInt", mkEL (appMN eqE) (appNM eqE))
, ("LtGtInt", mkEL (appMN ltE) (appNM gtE))
, ("LteGteInt", mkEL (appMN lteE) (appNM gteE))
, ("GteLtInt", mkEL (appMN gteE) (appNM ltE))
, ("LteFalseImpliesEqFalseInt", mkIL "LteFalse" (appMN lteE) falseE (appMN eqE) falseE)
, ("EqTrueImpliesLteTrueInt", mkIL "EqTrue" (appMN eqE) trueE (appMN lteE) trueE)
, ("MinCommutativeInt", mkEL (appMN minE) (appNM minE))
, ("MaxCommutativeInt", mkEL (appMN maxE) (appNM maxE))
, ("MinLteInt", mkEL (mkCoreApps lteE [appNM minE, n]) trueE)
, ("MaxGteInt", mkEL (mkCoreApps gteE [appNM maxE, n]) trueE)
] | 2,841 | lemmas :: LemmaLibrary
lemmas = do
intTy <- findTypeT "Prelude.Int"
nId <- constT $ newIdH "n" intTy
mId <- constT $ newIdH "m" intTy
let n = varToCoreExpr nId
m = varToCoreExpr mId
#if __GLASGOW_HASKELL__ > 710
appTo i e = return $ mkCoreApp (text "appTo") (varToCoreExpr i) e
#else
appTo i e = return $ mkCoreApp (varToCoreExpr i) e
#endif
appToInt i = appTo i (Type intTy)
appToDict e = do
let (aTys, _) = splitFunTys (exprType e)
case aTys of
#if __GLASGOW_HASKELL__ > 710
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp (text "appToDict") e)
#else
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp e)
#endif
_ -> fail "first argument is not a dictionary."
appMN e = mkCoreApps e [m,n]
appNM e = mkCoreApps e [n,m]
mkEL l r = mkL (Equiv l r)
mkL cl = Lemma (mkForall [mId,nId] cl) BuiltIn NotUsed
mkIL nm al ar cl cr = mkL (Impl nm (Equiv al ar) (Equiv cl cr))
eqE <- findIdT "Data.Eq.==" >>= appToInt >>= appToDict
gtE <- findIdT "Data.Ord.>" >>= appToInt >>= appToDict
ltE <- findIdT "Data.Ord.<" >>= appToInt >>= appToDict
gteE <- findIdT "Data.Ord.>=" >>= appToInt >>= appToDict
lteE <- findIdT "Data.Ord.<=" >>= appToInt >>= appToDict
minE <- findIdT "Data.Ord.min" >>= appToInt >>= appToDict
maxE <- findIdT "Data.Ord.max" >>= appToInt >>= appToDict
trueE <- varToCoreExpr <$> findIdT "Data.Bool.True"
falseE <- varToCoreExpr <$> findIdT "Data.Bool.False"
return $ M.fromList
[ ("EqCommutativeInt", mkEL (appMN eqE) (appNM eqE))
, ("LtGtInt", mkEL (appMN ltE) (appNM gtE))
, ("LteGteInt", mkEL (appMN lteE) (appNM gteE))
, ("GteLtInt", mkEL (appMN gteE) (appNM ltE))
, ("LteFalseImpliesEqFalseInt", mkIL "LteFalse" (appMN lteE) falseE (appMN eqE) falseE)
, ("EqTrueImpliesLteTrueInt", mkIL "EqTrue" (appMN eqE) trueE (appMN lteE) trueE)
, ("MinCommutativeInt", mkEL (appMN minE) (appNM minE))
, ("MaxCommutativeInt", mkEL (appMN maxE) (appNM maxE))
, ("MinLteInt", mkEL (mkCoreApps lteE [appNM minE, n]) trueE)
, ("MaxGteInt", mkEL (mkCoreApps gteE [appNM maxE, n]) trueE)
] | 2,425 | lemmas = do
intTy <- findTypeT "Prelude.Int"
nId <- constT $ newIdH "n" intTy
mId <- constT $ newIdH "m" intTy
let n = varToCoreExpr nId
m = varToCoreExpr mId
#if __GLASGOW_HASKELL__ > 710
appTo i e = return $ mkCoreApp (text "appTo") (varToCoreExpr i) e
#else
appTo i e = return $ mkCoreApp (varToCoreExpr i) e
#endif
appToInt i = appTo i (Type intTy)
appToDict e = do
let (aTys, _) = splitFunTys (exprType e)
case aTys of
#if __GLASGOW_HASKELL__ > 710
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp (text "appToDict") e)
#else
(ty:_) | isDictTy ty -> return ty >>> buildDictionaryT >>> arr (mkCoreApp e)
#endif
_ -> fail "first argument is not a dictionary."
appMN e = mkCoreApps e [m,n]
appNM e = mkCoreApps e [n,m]
mkEL l r = mkL (Equiv l r)
mkL cl = Lemma (mkForall [mId,nId] cl) BuiltIn NotUsed
mkIL nm al ar cl cr = mkL (Impl nm (Equiv al ar) (Equiv cl cr))
eqE <- findIdT "Data.Eq.==" >>= appToInt >>= appToDict
gtE <- findIdT "Data.Ord.>" >>= appToInt >>= appToDict
ltE <- findIdT "Data.Ord.<" >>= appToInt >>= appToDict
gteE <- findIdT "Data.Ord.>=" >>= appToInt >>= appToDict
lteE <- findIdT "Data.Ord.<=" >>= appToInt >>= appToDict
minE <- findIdT "Data.Ord.min" >>= appToInt >>= appToDict
maxE <- findIdT "Data.Ord.max" >>= appToInt >>= appToDict
trueE <- varToCoreExpr <$> findIdT "Data.Bool.True"
falseE <- varToCoreExpr <$> findIdT "Data.Bool.False"
return $ M.fromList
[ ("EqCommutativeInt", mkEL (appMN eqE) (appNM eqE))
, ("LtGtInt", mkEL (appMN ltE) (appNM gtE))
, ("LteGteInt", mkEL (appMN lteE) (appNM gteE))
, ("GteLtInt", mkEL (appMN gteE) (appNM ltE))
, ("LteFalseImpliesEqFalseInt", mkIL "LteFalse" (appMN lteE) falseE (appMN eqE) falseE)
, ("EqTrueImpliesLteTrueInt", mkIL "EqTrue" (appMN eqE) trueE (appMN lteE) trueE)
, ("MinCommutativeInt", mkEL (appMN minE) (appNM minE))
, ("MaxCommutativeInt", mkEL (appMN maxE) (appNM maxE))
, ("MinLteInt", mkEL (mkCoreApps lteE [appNM minE, n]) trueE)
, ("MaxGteInt", mkEL (mkCoreApps gteE [appNM maxE, n]) trueE)
] | 2,402 | true | true | 0 | 21 | 849 | 812 | 403 | 409 | null | null |
nominolo/haddock2 | tests/unit-tests/parsetests.hs | bsd-2-clause | tests :: [ParseTest]
tests = [
ParseTest {
input = "foobar"
, result = Just $ DocParagraph $ DocString "foobar\n"
}
, ParseTest {
input = "foobar\n\nghci> fib 10\n55"
, result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]])
}
, ParseTest {
input = "foobar\nghci> fib 10\n55"
, result = Nothing -- parse error
}
, ParseTest {
input = "foobar\n\n> some code"
, result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n")))
}
, ParseTest {
input = "foobar\n> some code"
, result = Nothing -- parse error
}
] | 692 | tests :: [ParseTest]
tests = [
ParseTest {
input = "foobar"
, result = Just $ DocParagraph $ DocString "foobar\n"
}
, ParseTest {
input = "foobar\n\nghci> fib 10\n55"
, result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]])
}
, ParseTest {
input = "foobar\nghci> fib 10\n55"
, result = Nothing -- parse error
}
, ParseTest {
input = "foobar\n\n> some code"
, result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n")))
}
, ParseTest {
input = "foobar\n> some code"
, result = Nothing -- parse error
}
] | 692 | tests = [
ParseTest {
input = "foobar"
, result = Just $ DocParagraph $ DocString "foobar\n"
}
, ParseTest {
input = "foobar\n\nghci> fib 10\n55"
, result = Just $ DocAppend (DocParagraph $ DocString "foobar\n") (DocExamples $ [Example "fib 10" ["55"]])
}
, ParseTest {
input = "foobar\nghci> fib 10\n55"
, result = Nothing -- parse error
}
, ParseTest {
input = "foobar\n\n> some code"
, result = Just (DocAppend (DocParagraph (DocString "foobar\n")) (DocCodeBlock (DocString " some code\n")))
}
, ParseTest {
input = "foobar\n> some code"
, result = Nothing -- parse error
}
] | 671 | false | true | 0 | 15 | 193 | 191 | 107 | 84 | null | null |
mettekou/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | srcSpanFirstCharacter (RealSrcSpan span) = RealSrcSpan $ mkRealSrcSpan loc1 loc2
where
loc1@(SrcLoc f l c) = realSrcSpanStart span
loc2 = SrcLoc f l (c+1)
{-
************************************************************************
* *
\subsection[SrcSpan-predicates]{Predicates}
* *
************************************************************************
-}
-- | Test if a 'SrcSpan' is "good", i.e. has precise location information | 581 | srcSpanFirstCharacter (RealSrcSpan span) = RealSrcSpan $ mkRealSrcSpan loc1 loc2
where
loc1@(SrcLoc f l c) = realSrcSpanStart span
loc2 = SrcLoc f l (c+1)
{-
************************************************************************
* *
\subsection[SrcSpan-predicates]{Predicates}
* *
************************************************************************
-}
-- | Test if a 'SrcSpan' is "good", i.e. has precise location information | 581 | srcSpanFirstCharacter (RealSrcSpan span) = RealSrcSpan $ mkRealSrcSpan loc1 loc2
where
loc1@(SrcLoc f l c) = realSrcSpanStart span
loc2 = SrcLoc f l (c+1)
{-
************************************************************************
* *
\subsection[SrcSpan-predicates]{Predicates}
* *
************************************************************************
-}
-- | Test if a 'SrcSpan' is "good", i.e. has precise location information | 581 | false | false | 2 | 8 | 193 | 78 | 35 | 43 | null | null |
headprogrammingczar/cabal | Cabal/Distribution/PackageDescription/Configuration.hs | bsd-3-clause | mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a
mapTreeConstrs f = mapCondTree id f id | 101 | mapTreeConstrs :: (c -> d) -> CondTree v c a -> CondTree v d a
mapTreeConstrs f = mapCondTree id f id | 101 | mapTreeConstrs f = mapCondTree id f id | 38 | false | true | 0 | 8 | 21 | 54 | 25 | 29 | null | null |
zerobuzz/servant | servant-server/test/Servant/ServerSpec.hs | bsd-3-clause | captureSpec :: Spec
captureSpec = do
describe "Servant.API.Capture" $ do
with (return (serve captureApi captureServer)) $ do
it "can capture parts of the 'pathInfo'" $ do
response <- get "/2"
liftIO $ decode' (simpleBody response) `shouldBe` Just tweety
it "returns 400 if the decoding fails" $ do
get "/notAnInt" `shouldRespondWith` 400
with (return (serve
(Proxy :: Proxy (Capture "captured" String :> Raw))
(\ "captured" request_ respond ->
respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
it "strips the captured path snippet from pathInfo" $ do
get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
-- }}}
------------------------------------------------------------------------------
-- * captureAllSpec {{{
------------------------------------------------------------------------------ | 930 | captureSpec :: Spec
captureSpec = do
describe "Servant.API.Capture" $ do
with (return (serve captureApi captureServer)) $ do
it "can capture parts of the 'pathInfo'" $ do
response <- get "/2"
liftIO $ decode' (simpleBody response) `shouldBe` Just tweety
it "returns 400 if the decoding fails" $ do
get "/notAnInt" `shouldRespondWith` 400
with (return (serve
(Proxy :: Proxy (Capture "captured" String :> Raw))
(\ "captured" request_ respond ->
respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
it "strips the captured path snippet from pathInfo" $ do
get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
-- }}}
------------------------------------------------------------------------------
-- * captureAllSpec {{{
------------------------------------------------------------------------------ | 930 | captureSpec = do
describe "Servant.API.Capture" $ do
with (return (serve captureApi captureServer)) $ do
it "can capture parts of the 'pathInfo'" $ do
response <- get "/2"
liftIO $ decode' (simpleBody response) `shouldBe` Just tweety
it "returns 400 if the decoding fails" $ do
get "/notAnInt" `shouldRespondWith` 400
with (return (serve
(Proxy :: Proxy (Capture "captured" String :> Raw))
(\ "captured" request_ respond ->
respond $ responseLBS ok200 [] (cs $ show $ pathInfo request_)))) $ do
it "strips the captured path snippet from pathInfo" $ do
get "/captured/foo" `shouldRespondWith` (fromString (show ["foo" :: String]))
-- }}}
------------------------------------------------------------------------------
-- * captureAllSpec {{{
------------------------------------------------------------------------------ | 910 | false | true | 0 | 22 | 197 | 240 | 117 | 123 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | action_207 (54#) = happyGoto action_359 | 39 | action_207 (54#) = happyGoto action_359 | 39 | action_207 (54#) = happyGoto action_359 | 39 | false | false | 0 | 6 | 4 | 15 | 7 | 8 | null | null |
Lupino/dispatch-article | src/Article/Router/Helper.hs | bsd-3-clause | articles :: (HasMySQL u, HasOtherEnv Cache u) => ActionH u w (ListResult Article)
articles = articles' s t
where s = flip' getArticleList $ desc "id"
t = countArticle | 176 | articles :: (HasMySQL u, HasOtherEnv Cache u) => ActionH u w (ListResult Article)
articles = articles' s t
where s = flip' getArticleList $ desc "id"
t = countArticle | 176 | articles = articles' s t
where s = flip' getArticleList $ desc "id"
t = countArticle | 94 | false | true | 1 | 8 | 38 | 70 | 34 | 36 | null | null |
gcross/LogicGrowsOnTrees | LogicGrowsOnTrees/tests/test-nqueens.hs | bsd-2-clause | remdups :: (Eq a) => [a] -> [a] -- {{{
remdups [] = [] | 56 | remdups :: (Eq a) => [a] -> [a]
remdups [] = [] | 49 | remdups [] = [] | 17 | true | true | 0 | 7 | 15 | 38 | 21 | 17 | null | null |
danchoi/sqltmpl | Main.hs | mit | escapeStringLiteral [] = [] | 27 | escapeStringLiteral [] = [] | 27 | escapeStringLiteral [] = [] | 27 | false | false | 0 | 6 | 3 | 13 | 6 | 7 | null | null |
WSCU/JSEuterpea | Euterpea Examples/Basics.hs | gpl-3.0 | rumSnare = rhythm " * * " (e acousticSnare)
| 47 | drumSnare = rhythm " * * " (e acousticSnare) | 47 | drumSnare = rhythm " * * " (e acousticSnare) | 47 | false | false | 1 | 7 | 12 | 20 | 8 | 12 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/GHC/Unicode.hs | bsd-3-clause | toTitle c = chr (fromIntegral (towtitle (fromIntegral (ord c)))) | 64 | toTitle c = chr (fromIntegral (towtitle (fromIntegral (ord c)))) | 64 | toTitle c = chr (fromIntegral (towtitle (fromIntegral (ord c)))) | 64 | false | false | 1 | 13 | 8 | 40 | 17 | 23 | null | null |
brendanhay/gogol | gogol-dataproc/gen/Network/Google/Dataproc/Types/Product.hs | mpl-2.0 | -- | Specifies the format of the policy.Valid values are 0, 1, and 3.
-- Requests that specify an invalid value are rejected.Any operation that
-- affects conditional role bindings must specify version 3. This
-- requirement applies to the following operations: Getting a policy that
-- includes a conditional role binding Adding a conditional role binding to
-- a policy Changing a conditional role binding in a policy Removing any
-- role binding, with or without a condition, from a policy that includes
-- conditionsImportant: If you use IAM Conditions, you must include the
-- etag field whenever you call setIamPolicy. If you omit this field, then
-- IAM allows you to overwrite a version 3 policy with a version 1 policy,
-- and all of the conditions in the version 3 policy are lost.If a policy
-- does not include any conditions, operations on that policy may specify
-- any valid version or leave the field unset.To learn which resources
-- support conditions in their IAM policies, see the IAM documentation
-- (https:\/\/cloud.google.com\/iam\/help\/conditions\/resource-policies).
pVersion :: Lens' Policy (Maybe Int32)
pVersion
= lens _pVersion (\ s a -> s{_pVersion = a}) .
mapping _Coerce | 1,212 | pVersion :: Lens' Policy (Maybe Int32)
pVersion
= lens _pVersion (\ s a -> s{_pVersion = a}) .
mapping _Coerce | 118 | pVersion
= lens _pVersion (\ s a -> s{_pVersion = a}) .
mapping _Coerce | 79 | true | true | 0 | 10 | 202 | 69 | 42 | 27 | null | null |
utky/budget | app/Main.hs | bsd-3-clause | parseDatapath :: [String] -> String
parseDatapath [] = ":memory:" | 80 | parseDatapath :: [String] -> String
parseDatapath [] = ":memory:" | 80 | parseDatapath [] = ":memory:" | 44 | false | true | 0 | 6 | 23 | 23 | 12 | 11 | null | null |
vito/atomo | src/Atomo/Kernel/Expression.hs | bsd-3-clause | load :: VM ()
load = do
[p|`Block new: (es: List)|] =::: [e|`Block new: es arguments: []|]
[p|`Block new: (es: List) arguments: (as: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
as <- getList [e|as|] >>=
mapM (\e -> findExpression e >>= toPattern' . fromExpression)
return (Expression (EBlock Nothing as (map fromExpression es)))
[p|`List new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (EList Nothing (map fromExpression es)))
[p|`Tuple new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (ETuple Nothing (map fromExpression es)))
[p|`Match new: (branches: List) on: (value: Expression)|] =: do
bs <- getList [e|branches|]
let pats = map (fromExpression . head . fromTuple) bs
exprs = map (fromExpression . (!! 1) . fromTuple) bs
ps <- mapM toRolePattern' pats
Expression value <- here "value" >>= findExpression
return (Expression (EMatch Nothing value (zip ps exprs)))
[p|`Set new: (pattern: Expression) to: (value: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "value" >>= findExpression
p <- toPattern' pat
return (Expression $ ESet Nothing p e)
[p|`Define new: (pattern: Expression) as: (expr: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "expr" >>= findExpression
p <- toDefinePattern' pat
return (Expression $ EDefine Nothing p e)
[p|`Dispatch new: (name: Particle) to: (targets: List) &optionals: []|] =: do
Particle name <- here "name" >>= findParticle
ts <- getList [e|targets|] >>= mapM findExpression
os <- getList [e|optionals|] >>= mapM fromValue
let opts = map (\(Particle (Single { mName = n }), Expression e) -> option n e) os
case name of
Single { mName = n } ->
return $ Expression (EDispatch Nothing (single' n (fromExpression (head ts)) opts))
Keyword { mNames = ns } ->
return $ Expression (EDispatch Nothing (keyword' ns (map fromExpression ts) opts))
[p|`DefineDynamic new: (name: Expression) as: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ EDefineDynamic Nothing n r
[p|`SetDynamic new: (name: Expression) to: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ ESetDynamic Nothing n r
[p|`GetDynamic new: (name: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
return . Expression $ EGetDynamic Nothing n
[p|`NewDynamic new: (bindings: List) do: (expr: Expression)|] =: do
ns <- getList [e|bindings map: @from|]
>>= mapM findExpression
>>= mapM (toName . fromExpression)
exprs <- liftM (map fromExpression) $ getList [e|bindings map: @to|] >>= mapM findExpression
Expression e <- here "expr" >>= findExpression
return . Expression $ ENewDynamic Nothing (zip ns exprs) e
[p|(s: String) parse-expressions|] =:
getString [e|s|] >>= liftM (list . map Expression) . parseInput
[p|top evaluate: (e: Expression)|] =: do
t <- here "top"
Expression e <- here "e" >>= findExpression
withTop t (eval e)
[p|(e: Expression) expand|] =: do
Expression e <- here "e" >>= findExpression
liftM Expression $ macroExpand e
[p|(e: Expression) pretty-expression|] =: do
Expression e <- here "e" >>= findExpression
toValue (pretty e)
[p|(e: Expression) location|] =: do
Expression e <- here "e" >>= findExpression
case eLocation e of
Nothing -> return (particle "none")
Just s -> return $ keyParticleN ["name", "line", "column"]
[ string (sourceName s)
, Integer (fromIntegral (sourceLine s))
, Integer (fromIntegral (sourceColumn s))
]
[p|(e: Expression) type|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword {} } ->
return (keyParticleN ["dispatch"] [particle "keyword"])
EDispatch { eMessage = Single {} } ->
return (keyParticleN ["dispatch"] [particle "single"])
EDefine {} -> return (particle "define")
ESet {} -> return (particle "set")
EOperator {} -> return (particle "operator")
EPrimitive {} -> return (particle "primitive")
EBlock {} -> return (particle "block")
EVM {} -> return (particle "vm")
EList {} -> return (particle "list")
ETuple {} -> return (particle "tuple")
EMacro {} -> return (particle "macro")
EForMacro {} -> return (particle "for-macro")
ETop {} -> return (particle "top")
EQuote {} -> return (particle "quote")
EUnquote {} -> return (particle "unquote")
EParticle { eParticle = Keyword {} } ->
return (keyParticleN ["particle"] [particle "keyword"])
EParticle { eParticle = Single {} } ->
return (keyParticleN ["particle"] [particle "single"])
ENewDynamic {} -> return (particle "new-dynamic")
ESetDynamic {} -> return (particle "set-dynamic")
EDefineDynamic {} -> return (particle "define-dynamic")
EGetDynamic {} -> return (particle "get-dynamic")
EMacroQuote {} -> return (particle "macro-quote")
EMatch {} -> return (particle "match")
[p|(e: Expression) target|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Single { mTarget = t } } ->
return (Expression t)
EMatch { eTarget = t } ->
return (Expression t)
_ -> raise ["no-target-for"] [Expression e]
[p|(e: Expression) targets|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mTargets = ts } } ->
return (list (map Expression ts))
EDispatch { eMessage = Single { mTarget = t } } ->
return $ list [Expression t]
_ -> raise ["no-targets-for"] [Expression e]
[p|(e: Expression) optionals|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = m } ->
liftM list $
mapM (\(Option _ n v) -> toValue (particle n, Expression v))
(mOptionals m)
_ -> raise ["no-optionals-for"] [Expression e]
[p|(e: Expression) name|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Single { mName = n }) ->
return (string n)
EDispatch { eMessage = Single { mName = n } } ->
return (string n)
EMacroQuote { eName = n } ->
return (string n)
_ -> raise ["no-name-for"] [Expression e]
[p|(e: Expression) names|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Keyword { mNames = ns }) ->
return (list (map string ns))
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (list (map string ns))
_ -> raise ["no-names-for"] [Expression e]
[p|(e: Expression) particle|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (keyParticle ns (replicate (fromIntegral $ length ns + 1) Nothing))
EDispatch { eMessage = Single { mName = n } } ->
return (particle n)
_ -> raise ["no-particle-for"] [Expression e]
[p|(e: Expression) values|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle { eParticle = Keyword { mTargets = mes } } ->
return . list $
map
(maybe (particle "none") (keyParticleN ["ok"] . (:[]) . Expression))
mes
_ -> raise ["no-values-for"] [Expression e]
[p|(e: Expression) contents|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eContents = es } ->
return (list (map Expression es))
EList { eContents = es } ->
return (list (map Expression es))
ETuple { eContents = es } ->
return (list (map Expression es))
EMacroQuote { eRaw = r } ->
return (string r)
EMatch { eBranches = bs } ->
liftM list (mapM toValue bs)
_ -> raise ["no-contents-for"] [Expression e]
[p|(e: Expression) flags|] =: do
Expression e <- here "e" >>= findExpression
case e of
EMacroQuote { eFlags = fs } ->
return (list (map Character fs))
_ -> raise ["no-flags-for"] [Expression e]
[p|(e: Expression) arguments|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eArguments = as } ->
return (list (map Pattern as))
_ -> raise ["no-arguments-for"] [Expression e]
[p|(e: Expression) pattern|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { ePattern = p } -> return (Pattern p)
EDefine { emPattern = p } -> return (Pattern (PMessage p))
EMacro { emPattern = p } -> return (Pattern (PMessage p))
_ -> raise ["no-pattern-for"] [Expression e]
[p|(e: Expression) expression|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { eExpr = e } -> return (Expression e)
EDefine { eExpr = e } -> return (Expression e)
EMacro { eExpr = e } -> return (Expression e)
EForMacro { eExpr = e } -> return (Expression e)
EQuote { eExpr = e } -> return (Expression e)
EUnquote { eExpr = e } -> return (Expression e)
_ -> raise ["no-expression-for"] [Expression e]
[p|(e: Expression) associativity|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eAssoc = ALeft } ->
return (particle "left")
EOperator { eAssoc = ARight } ->
return (particle "right")
_ -> raise ["no-associativity-for"] [Expression e]
[p|(e: Expression) precedence|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { ePrec = p } ->
return (Integer p)
_ -> raise ["no-precedence-for"] [Expression e]
[p|(e: Expression) operators|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eNames = ns } ->
return (list (map (\n -> keyParticle [n] [Nothing, Nothing]) ns))
_ -> raise ["no-operators-for"] [Expression e] | 11,615 | load :: VM ()
load = do
[p|`Block new: (es: List)|] =::: [e|`Block new: es arguments: []|]
[p|`Block new: (es: List) arguments: (as: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
as <- getList [e|as|] >>=
mapM (\e -> findExpression e >>= toPattern' . fromExpression)
return (Expression (EBlock Nothing as (map fromExpression es)))
[p|`List new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (EList Nothing (map fromExpression es)))
[p|`Tuple new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (ETuple Nothing (map fromExpression es)))
[p|`Match new: (branches: List) on: (value: Expression)|] =: do
bs <- getList [e|branches|]
let pats = map (fromExpression . head . fromTuple) bs
exprs = map (fromExpression . (!! 1) . fromTuple) bs
ps <- mapM toRolePattern' pats
Expression value <- here "value" >>= findExpression
return (Expression (EMatch Nothing value (zip ps exprs)))
[p|`Set new: (pattern: Expression) to: (value: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "value" >>= findExpression
p <- toPattern' pat
return (Expression $ ESet Nothing p e)
[p|`Define new: (pattern: Expression) as: (expr: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "expr" >>= findExpression
p <- toDefinePattern' pat
return (Expression $ EDefine Nothing p e)
[p|`Dispatch new: (name: Particle) to: (targets: List) &optionals: []|] =: do
Particle name <- here "name" >>= findParticle
ts <- getList [e|targets|] >>= mapM findExpression
os <- getList [e|optionals|] >>= mapM fromValue
let opts = map (\(Particle (Single { mName = n }), Expression e) -> option n e) os
case name of
Single { mName = n } ->
return $ Expression (EDispatch Nothing (single' n (fromExpression (head ts)) opts))
Keyword { mNames = ns } ->
return $ Expression (EDispatch Nothing (keyword' ns (map fromExpression ts) opts))
[p|`DefineDynamic new: (name: Expression) as: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ EDefineDynamic Nothing n r
[p|`SetDynamic new: (name: Expression) to: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ ESetDynamic Nothing n r
[p|`GetDynamic new: (name: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
return . Expression $ EGetDynamic Nothing n
[p|`NewDynamic new: (bindings: List) do: (expr: Expression)|] =: do
ns <- getList [e|bindings map: @from|]
>>= mapM findExpression
>>= mapM (toName . fromExpression)
exprs <- liftM (map fromExpression) $ getList [e|bindings map: @to|] >>= mapM findExpression
Expression e <- here "expr" >>= findExpression
return . Expression $ ENewDynamic Nothing (zip ns exprs) e
[p|(s: String) parse-expressions|] =:
getString [e|s|] >>= liftM (list . map Expression) . parseInput
[p|top evaluate: (e: Expression)|] =: do
t <- here "top"
Expression e <- here "e" >>= findExpression
withTop t (eval e)
[p|(e: Expression) expand|] =: do
Expression e <- here "e" >>= findExpression
liftM Expression $ macroExpand e
[p|(e: Expression) pretty-expression|] =: do
Expression e <- here "e" >>= findExpression
toValue (pretty e)
[p|(e: Expression) location|] =: do
Expression e <- here "e" >>= findExpression
case eLocation e of
Nothing -> return (particle "none")
Just s -> return $ keyParticleN ["name", "line", "column"]
[ string (sourceName s)
, Integer (fromIntegral (sourceLine s))
, Integer (fromIntegral (sourceColumn s))
]
[p|(e: Expression) type|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword {} } ->
return (keyParticleN ["dispatch"] [particle "keyword"])
EDispatch { eMessage = Single {} } ->
return (keyParticleN ["dispatch"] [particle "single"])
EDefine {} -> return (particle "define")
ESet {} -> return (particle "set")
EOperator {} -> return (particle "operator")
EPrimitive {} -> return (particle "primitive")
EBlock {} -> return (particle "block")
EVM {} -> return (particle "vm")
EList {} -> return (particle "list")
ETuple {} -> return (particle "tuple")
EMacro {} -> return (particle "macro")
EForMacro {} -> return (particle "for-macro")
ETop {} -> return (particle "top")
EQuote {} -> return (particle "quote")
EUnquote {} -> return (particle "unquote")
EParticle { eParticle = Keyword {} } ->
return (keyParticleN ["particle"] [particle "keyword"])
EParticle { eParticle = Single {} } ->
return (keyParticleN ["particle"] [particle "single"])
ENewDynamic {} -> return (particle "new-dynamic")
ESetDynamic {} -> return (particle "set-dynamic")
EDefineDynamic {} -> return (particle "define-dynamic")
EGetDynamic {} -> return (particle "get-dynamic")
EMacroQuote {} -> return (particle "macro-quote")
EMatch {} -> return (particle "match")
[p|(e: Expression) target|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Single { mTarget = t } } ->
return (Expression t)
EMatch { eTarget = t } ->
return (Expression t)
_ -> raise ["no-target-for"] [Expression e]
[p|(e: Expression) targets|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mTargets = ts } } ->
return (list (map Expression ts))
EDispatch { eMessage = Single { mTarget = t } } ->
return $ list [Expression t]
_ -> raise ["no-targets-for"] [Expression e]
[p|(e: Expression) optionals|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = m } ->
liftM list $
mapM (\(Option _ n v) -> toValue (particle n, Expression v))
(mOptionals m)
_ -> raise ["no-optionals-for"] [Expression e]
[p|(e: Expression) name|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Single { mName = n }) ->
return (string n)
EDispatch { eMessage = Single { mName = n } } ->
return (string n)
EMacroQuote { eName = n } ->
return (string n)
_ -> raise ["no-name-for"] [Expression e]
[p|(e: Expression) names|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Keyword { mNames = ns }) ->
return (list (map string ns))
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (list (map string ns))
_ -> raise ["no-names-for"] [Expression e]
[p|(e: Expression) particle|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (keyParticle ns (replicate (fromIntegral $ length ns + 1) Nothing))
EDispatch { eMessage = Single { mName = n } } ->
return (particle n)
_ -> raise ["no-particle-for"] [Expression e]
[p|(e: Expression) values|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle { eParticle = Keyword { mTargets = mes } } ->
return . list $
map
(maybe (particle "none") (keyParticleN ["ok"] . (:[]) . Expression))
mes
_ -> raise ["no-values-for"] [Expression e]
[p|(e: Expression) contents|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eContents = es } ->
return (list (map Expression es))
EList { eContents = es } ->
return (list (map Expression es))
ETuple { eContents = es } ->
return (list (map Expression es))
EMacroQuote { eRaw = r } ->
return (string r)
EMatch { eBranches = bs } ->
liftM list (mapM toValue bs)
_ -> raise ["no-contents-for"] [Expression e]
[p|(e: Expression) flags|] =: do
Expression e <- here "e" >>= findExpression
case e of
EMacroQuote { eFlags = fs } ->
return (list (map Character fs))
_ -> raise ["no-flags-for"] [Expression e]
[p|(e: Expression) arguments|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eArguments = as } ->
return (list (map Pattern as))
_ -> raise ["no-arguments-for"] [Expression e]
[p|(e: Expression) pattern|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { ePattern = p } -> return (Pattern p)
EDefine { emPattern = p } -> return (Pattern (PMessage p))
EMacro { emPattern = p } -> return (Pattern (PMessage p))
_ -> raise ["no-pattern-for"] [Expression e]
[p|(e: Expression) expression|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { eExpr = e } -> return (Expression e)
EDefine { eExpr = e } -> return (Expression e)
EMacro { eExpr = e } -> return (Expression e)
EForMacro { eExpr = e } -> return (Expression e)
EQuote { eExpr = e } -> return (Expression e)
EUnquote { eExpr = e } -> return (Expression e)
_ -> raise ["no-expression-for"] [Expression e]
[p|(e: Expression) associativity|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eAssoc = ALeft } ->
return (particle "left")
EOperator { eAssoc = ARight } ->
return (particle "right")
_ -> raise ["no-associativity-for"] [Expression e]
[p|(e: Expression) precedence|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { ePrec = p } ->
return (Integer p)
_ -> raise ["no-precedence-for"] [Expression e]
[p|(e: Expression) operators|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eNames = ns } ->
return (list (map (\n -> keyParticle [n] [Nothing, Nothing]) ns))
_ -> raise ["no-operators-for"] [Expression e] | 11,615 | load = do
[p|`Block new: (es: List)|] =::: [e|`Block new: es arguments: []|]
[p|`Block new: (es: List) arguments: (as: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
as <- getList [e|as|] >>=
mapM (\e -> findExpression e >>= toPattern' . fromExpression)
return (Expression (EBlock Nothing as (map fromExpression es)))
[p|`List new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (EList Nothing (map fromExpression es)))
[p|`Tuple new: (es: List)|] =: do
es <- getList [e|es|] >>= mapM findExpression
return (Expression (ETuple Nothing (map fromExpression es)))
[p|`Match new: (branches: List) on: (value: Expression)|] =: do
bs <- getList [e|branches|]
let pats = map (fromExpression . head . fromTuple) bs
exprs = map (fromExpression . (!! 1) . fromTuple) bs
ps <- mapM toRolePattern' pats
Expression value <- here "value" >>= findExpression
return (Expression (EMatch Nothing value (zip ps exprs)))
[p|`Set new: (pattern: Expression) to: (value: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "value" >>= findExpression
p <- toPattern' pat
return (Expression $ ESet Nothing p e)
[p|`Define new: (pattern: Expression) as: (expr: Expression)|] =: do
Expression pat <- here "pattern" >>= findExpression
Expression e <- here "expr" >>= findExpression
p <- toDefinePattern' pat
return (Expression $ EDefine Nothing p e)
[p|`Dispatch new: (name: Particle) to: (targets: List) &optionals: []|] =: do
Particle name <- here "name" >>= findParticle
ts <- getList [e|targets|] >>= mapM findExpression
os <- getList [e|optionals|] >>= mapM fromValue
let opts = map (\(Particle (Single { mName = n }), Expression e) -> option n e) os
case name of
Single { mName = n } ->
return $ Expression (EDispatch Nothing (single' n (fromExpression (head ts)) opts))
Keyword { mNames = ns } ->
return $ Expression (EDispatch Nothing (keyword' ns (map fromExpression ts) opts))
[p|`DefineDynamic new: (name: Expression) as: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ EDefineDynamic Nothing n r
[p|`SetDynamic new: (name: Expression) to: (root: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
Expression r <- here "root" >>= findExpression
return . Expression $ ESetDynamic Nothing n r
[p|`GetDynamic new: (name: Expression)|] =: do
n <- here "name" >>= findExpression >>= toName . fromExpression
return . Expression $ EGetDynamic Nothing n
[p|`NewDynamic new: (bindings: List) do: (expr: Expression)|] =: do
ns <- getList [e|bindings map: @from|]
>>= mapM findExpression
>>= mapM (toName . fromExpression)
exprs <- liftM (map fromExpression) $ getList [e|bindings map: @to|] >>= mapM findExpression
Expression e <- here "expr" >>= findExpression
return . Expression $ ENewDynamic Nothing (zip ns exprs) e
[p|(s: String) parse-expressions|] =:
getString [e|s|] >>= liftM (list . map Expression) . parseInput
[p|top evaluate: (e: Expression)|] =: do
t <- here "top"
Expression e <- here "e" >>= findExpression
withTop t (eval e)
[p|(e: Expression) expand|] =: do
Expression e <- here "e" >>= findExpression
liftM Expression $ macroExpand e
[p|(e: Expression) pretty-expression|] =: do
Expression e <- here "e" >>= findExpression
toValue (pretty e)
[p|(e: Expression) location|] =: do
Expression e <- here "e" >>= findExpression
case eLocation e of
Nothing -> return (particle "none")
Just s -> return $ keyParticleN ["name", "line", "column"]
[ string (sourceName s)
, Integer (fromIntegral (sourceLine s))
, Integer (fromIntegral (sourceColumn s))
]
[p|(e: Expression) type|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword {} } ->
return (keyParticleN ["dispatch"] [particle "keyword"])
EDispatch { eMessage = Single {} } ->
return (keyParticleN ["dispatch"] [particle "single"])
EDefine {} -> return (particle "define")
ESet {} -> return (particle "set")
EOperator {} -> return (particle "operator")
EPrimitive {} -> return (particle "primitive")
EBlock {} -> return (particle "block")
EVM {} -> return (particle "vm")
EList {} -> return (particle "list")
ETuple {} -> return (particle "tuple")
EMacro {} -> return (particle "macro")
EForMacro {} -> return (particle "for-macro")
ETop {} -> return (particle "top")
EQuote {} -> return (particle "quote")
EUnquote {} -> return (particle "unquote")
EParticle { eParticle = Keyword {} } ->
return (keyParticleN ["particle"] [particle "keyword"])
EParticle { eParticle = Single {} } ->
return (keyParticleN ["particle"] [particle "single"])
ENewDynamic {} -> return (particle "new-dynamic")
ESetDynamic {} -> return (particle "set-dynamic")
EDefineDynamic {} -> return (particle "define-dynamic")
EGetDynamic {} -> return (particle "get-dynamic")
EMacroQuote {} -> return (particle "macro-quote")
EMatch {} -> return (particle "match")
[p|(e: Expression) target|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Single { mTarget = t } } ->
return (Expression t)
EMatch { eTarget = t } ->
return (Expression t)
_ -> raise ["no-target-for"] [Expression e]
[p|(e: Expression) targets|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mTargets = ts } } ->
return (list (map Expression ts))
EDispatch { eMessage = Single { mTarget = t } } ->
return $ list [Expression t]
_ -> raise ["no-targets-for"] [Expression e]
[p|(e: Expression) optionals|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = m } ->
liftM list $
mapM (\(Option _ n v) -> toValue (particle n, Expression v))
(mOptionals m)
_ -> raise ["no-optionals-for"] [Expression e]
[p|(e: Expression) name|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Single { mName = n }) ->
return (string n)
EDispatch { eMessage = Single { mName = n } } ->
return (string n)
EMacroQuote { eName = n } ->
return (string n)
_ -> raise ["no-name-for"] [Expression e]
[p|(e: Expression) names|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle _ (Keyword { mNames = ns }) ->
return (list (map string ns))
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (list (map string ns))
_ -> raise ["no-names-for"] [Expression e]
[p|(e: Expression) particle|] =: do
Expression e <- here "e" >>= findExpression
case e of
EDispatch { eMessage = Keyword { mNames = ns } } ->
return (keyParticle ns (replicate (fromIntegral $ length ns + 1) Nothing))
EDispatch { eMessage = Single { mName = n } } ->
return (particle n)
_ -> raise ["no-particle-for"] [Expression e]
[p|(e: Expression) values|] =: do
Expression e <- here "e" >>= findExpression
case e of
EParticle { eParticle = Keyword { mTargets = mes } } ->
return . list $
map
(maybe (particle "none") (keyParticleN ["ok"] . (:[]) . Expression))
mes
_ -> raise ["no-values-for"] [Expression e]
[p|(e: Expression) contents|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eContents = es } ->
return (list (map Expression es))
EList { eContents = es } ->
return (list (map Expression es))
ETuple { eContents = es } ->
return (list (map Expression es))
EMacroQuote { eRaw = r } ->
return (string r)
EMatch { eBranches = bs } ->
liftM list (mapM toValue bs)
_ -> raise ["no-contents-for"] [Expression e]
[p|(e: Expression) flags|] =: do
Expression e <- here "e" >>= findExpression
case e of
EMacroQuote { eFlags = fs } ->
return (list (map Character fs))
_ -> raise ["no-flags-for"] [Expression e]
[p|(e: Expression) arguments|] =: do
Expression e <- here "e" >>= findExpression
case e of
EBlock { eArguments = as } ->
return (list (map Pattern as))
_ -> raise ["no-arguments-for"] [Expression e]
[p|(e: Expression) pattern|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { ePattern = p } -> return (Pattern p)
EDefine { emPattern = p } -> return (Pattern (PMessage p))
EMacro { emPattern = p } -> return (Pattern (PMessage p))
_ -> raise ["no-pattern-for"] [Expression e]
[p|(e: Expression) expression|] =: do
Expression e <- here "e" >>= findExpression
case e of
ESet { eExpr = e } -> return (Expression e)
EDefine { eExpr = e } -> return (Expression e)
EMacro { eExpr = e } -> return (Expression e)
EForMacro { eExpr = e } -> return (Expression e)
EQuote { eExpr = e } -> return (Expression e)
EUnquote { eExpr = e } -> return (Expression e)
_ -> raise ["no-expression-for"] [Expression e]
[p|(e: Expression) associativity|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eAssoc = ALeft } ->
return (particle "left")
EOperator { eAssoc = ARight } ->
return (particle "right")
_ -> raise ["no-associativity-for"] [Expression e]
[p|(e: Expression) precedence|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { ePrec = p } ->
return (Integer p)
_ -> raise ["no-precedence-for"] [Expression e]
[p|(e: Expression) operators|] =: do
Expression e <- here "e" >>= findExpression
case e of
EOperator { eNames = ns } ->
return (list (map (\n -> keyParticle [n] [Nothing, Nothing]) ns))
_ -> raise ["no-operators-for"] [Expression e] | 11,601 | false | true | 0 | 22 | 3,920 | 3,851 | 1,911 | 1,940 | null | null |
ekr/tamarin-prover | lib/theory/src/Theory/Tools/Wellformedness.hs | gpl-3.0 | multRestrictedReport :: OpenTheory -> WfErrorReport
multRestrictedReport thy = do
ru <- theoryRules thy
(,) "multiplication restriction of rules" <$>
case restrictedFailures ru of
([],[]) -> []
(mults, unbounds) ->
return $
(text "The following rule is not multiplication restricted:")
$-$ (nest 2 (prettyProtoRuleE ru))
$-$ (text "")
$-$ (text "After replacing reducible function symbols in lhs with variables:")
$-$ (nest 2 $ prettyProtoRuleE (abstractRule ru))
$-$ (text "")
$-$ (if null mults then mempty
else nest 2 $ (text "Terms with multiplication: ") <-> (prettyLNTermList mults))
$-$ (if null unbounds then mempty
else nest 2 $ (text "Variables that occur only in rhs: ") <-> (prettyVarList unbounds))
where
abstractRule ru@(Rule i lhs acts rhs) =
(`evalFreshAvoiding` ru) . (`evalBindT` noBindings) $ do
Rule i <$> mapM (traverse abstractTerm) lhs
<*> mapM (traverse replaceAbstracted) acts
<*> mapM (traverse replaceAbstracted) rhs
abstractTerm (viewTerm -> FApp o args) | o `S.member` irreducible =
fApp o <$> mapM abstractTerm args
abstractTerm (viewTerm -> Lit l) = return $ lit l
abstractTerm t = varTerm <$> importBinding (`LVar` sortOfLNTerm t) t "x"
replaceAbstracted t = do
b <- lookupBinding t
case b of
Just v -> return $ varTerm v
Nothing ->
case viewTerm t of
FApp o args ->
fApp o <$> mapM replaceAbstracted args
Lit l -> return $ lit l
restrictedFailures ru = (mults, unbound ruAbstr \\ unbound ru)
where
ruAbstr = abstractRule ru
mults = [ mt | Fact _ ts <- get rConcs ru, t <- ts, mt <- multTerms t ]
multTerms t@(viewTerm -> FApp (AC Mult) _) = [t]
multTerms (viewTerm -> FApp _ as) = concatMap multTerms as
multTerms _ = []
unbound ru = [v | v <- frees (get rConcs ru) \\ frees (get rPrems ru)
, lvarSort v /= LSortPub ]
irreducible = irreducibleFunSyms $ get (sigpMaudeSig . thySignature) thy
-- | Check that all rules are multipliation restricted. Compared
-- to the definition in the paper we are slightly more lenient.
-- We also accept a rule that is an instance of a multiplication
-- restricted rule.
-- 1. Consistently abstract terms with outermost reducible function symbols
-- occuring in lhs with fresh variables in rule.
-- 2. check vars(rhs) subset of vars(lhs) u V_Pub for abstracted rule for abstracted variables.
-- 3. check that * does not occur in rhs of abstracted rule. | 2,855 | multRestrictedReport :: OpenTheory -> WfErrorReport
multRestrictedReport thy = do
ru <- theoryRules thy
(,) "multiplication restriction of rules" <$>
case restrictedFailures ru of
([],[]) -> []
(mults, unbounds) ->
return $
(text "The following rule is not multiplication restricted:")
$-$ (nest 2 (prettyProtoRuleE ru))
$-$ (text "")
$-$ (text "After replacing reducible function symbols in lhs with variables:")
$-$ (nest 2 $ prettyProtoRuleE (abstractRule ru))
$-$ (text "")
$-$ (if null mults then mempty
else nest 2 $ (text "Terms with multiplication: ") <-> (prettyLNTermList mults))
$-$ (if null unbounds then mempty
else nest 2 $ (text "Variables that occur only in rhs: ") <-> (prettyVarList unbounds))
where
abstractRule ru@(Rule i lhs acts rhs) =
(`evalFreshAvoiding` ru) . (`evalBindT` noBindings) $ do
Rule i <$> mapM (traverse abstractTerm) lhs
<*> mapM (traverse replaceAbstracted) acts
<*> mapM (traverse replaceAbstracted) rhs
abstractTerm (viewTerm -> FApp o args) | o `S.member` irreducible =
fApp o <$> mapM abstractTerm args
abstractTerm (viewTerm -> Lit l) = return $ lit l
abstractTerm t = varTerm <$> importBinding (`LVar` sortOfLNTerm t) t "x"
replaceAbstracted t = do
b <- lookupBinding t
case b of
Just v -> return $ varTerm v
Nothing ->
case viewTerm t of
FApp o args ->
fApp o <$> mapM replaceAbstracted args
Lit l -> return $ lit l
restrictedFailures ru = (mults, unbound ruAbstr \\ unbound ru)
where
ruAbstr = abstractRule ru
mults = [ mt | Fact _ ts <- get rConcs ru, t <- ts, mt <- multTerms t ]
multTerms t@(viewTerm -> FApp (AC Mult) _) = [t]
multTerms (viewTerm -> FApp _ as) = concatMap multTerms as
multTerms _ = []
unbound ru = [v | v <- frees (get rConcs ru) \\ frees (get rPrems ru)
, lvarSort v /= LSortPub ]
irreducible = irreducibleFunSyms $ get (sigpMaudeSig . thySignature) thy
-- | Check that all rules are multipliation restricted. Compared
-- to the definition in the paper we are slightly more lenient.
-- We also accept a rule that is an instance of a multiplication
-- restricted rule.
-- 1. Consistently abstract terms with outermost reducible function symbols
-- occuring in lhs with fresh variables in rule.
-- 2. check vars(rhs) subset of vars(lhs) u V_Pub for abstracted rule for abstracted variables.
-- 3. check that * does not occur in rhs of abstracted rule. | 2,855 | multRestrictedReport thy = do
ru <- theoryRules thy
(,) "multiplication restriction of rules" <$>
case restrictedFailures ru of
([],[]) -> []
(mults, unbounds) ->
return $
(text "The following rule is not multiplication restricted:")
$-$ (nest 2 (prettyProtoRuleE ru))
$-$ (text "")
$-$ (text "After replacing reducible function symbols in lhs with variables:")
$-$ (nest 2 $ prettyProtoRuleE (abstractRule ru))
$-$ (text "")
$-$ (if null mults then mempty
else nest 2 $ (text "Terms with multiplication: ") <-> (prettyLNTermList mults))
$-$ (if null unbounds then mempty
else nest 2 $ (text "Variables that occur only in rhs: ") <-> (prettyVarList unbounds))
where
abstractRule ru@(Rule i lhs acts rhs) =
(`evalFreshAvoiding` ru) . (`evalBindT` noBindings) $ do
Rule i <$> mapM (traverse abstractTerm) lhs
<*> mapM (traverse replaceAbstracted) acts
<*> mapM (traverse replaceAbstracted) rhs
abstractTerm (viewTerm -> FApp o args) | o `S.member` irreducible =
fApp o <$> mapM abstractTerm args
abstractTerm (viewTerm -> Lit l) = return $ lit l
abstractTerm t = varTerm <$> importBinding (`LVar` sortOfLNTerm t) t "x"
replaceAbstracted t = do
b <- lookupBinding t
case b of
Just v -> return $ varTerm v
Nothing ->
case viewTerm t of
FApp o args ->
fApp o <$> mapM replaceAbstracted args
Lit l -> return $ lit l
restrictedFailures ru = (mults, unbound ruAbstr \\ unbound ru)
where
ruAbstr = abstractRule ru
mults = [ mt | Fact _ ts <- get rConcs ru, t <- ts, mt <- multTerms t ]
multTerms t@(viewTerm -> FApp (AC Mult) _) = [t]
multTerms (viewTerm -> FApp _ as) = concatMap multTerms as
multTerms _ = []
unbound ru = [v | v <- frees (get rConcs ru) \\ frees (get rPrems ru)
, lvarSort v /= LSortPub ]
irreducible = irreducibleFunSyms $ get (sigpMaudeSig . thySignature) thy
-- | Check that all rules are multipliation restricted. Compared
-- to the definition in the paper we are slightly more lenient.
-- We also accept a rule that is an instance of a multiplication
-- restricted rule.
-- 1. Consistently abstract terms with outermost reducible function symbols
-- occuring in lhs with fresh variables in rule.
-- 2. check vars(rhs) subset of vars(lhs) u V_Pub for abstracted rule for abstracted variables.
-- 3. check that * does not occur in rhs of abstracted rule. | 2,803 | false | true | 0 | 21 | 926 | 762 | 380 | 382 | null | null |
osa1/Idris-dev | src/Idris/IdrisDoc.hs | bsd-3-clause | extractPTermNames (PInferRef _ _ n) = [n] | 42 | extractPTermNames (PInferRef _ _ n) = [n] | 42 | extractPTermNames (PInferRef _ _ n) = [n] | 42 | false | false | 0 | 7 | 7 | 22 | 11 | 11 | null | null |
vdweegen/UvA-Software_Testing | Lab6/Bauke/Lecture6.hs | gpl-3.0 | decipher :: Integer -> Integer
decipher = decode secret bound | 61 | decipher :: Integer -> Integer
decipher = decode secret bound | 61 | decipher = decode secret bound | 30 | false | true | 0 | 5 | 9 | 20 | 10 | 10 | null | null |
amccausl/Swish | Swish/HaskellRDF/RDFRulesetTest.hs | lgpl-2.1 | u_p1 = Res (makeScopedName "" "http://example.org/" "p1") | 58 | u_p1 = Res (makeScopedName "" "http://example.org/" "p1") | 58 | u_p1 = Res (makeScopedName "" "http://example.org/" "p1") | 58 | false | false | 1 | 7 | 7 | 23 | 9 | 14 | null | null |
joelburget/haste-compiler | src/Data/JSTarget/Print.hs | bsd-3-clause | neg (BinOp Neq a b) = Just $ BinOp Eq a b | 41 | neg (BinOp Neq a b) = Just $ BinOp Eq a b | 41 | neg (BinOp Neq a b) = Just $ BinOp Eq a b | 41 | false | false | 2 | 6 | 11 | 32 | 14 | 18 | null | null |
andrewthad/vinyl-vectors | src/Data/Vector/Vinyl/Default/NonEmpty/Monomorphic.hs | bsd-3-clause | -- | /O(n)/ Right fold (function applied to each element and its index)
ifoldr :: G.Vector Vector (Rec Identity rs)
=> (Int -> Rec Identity rs -> r -> r) -> r -> Vector (Rec Identity rs) -> r
ifoldr = G.ifoldr | 211 | ifoldr :: G.Vector Vector (Rec Identity rs)
=> (Int -> Rec Identity rs -> r -> r) -> r -> Vector (Rec Identity rs) -> r
ifoldr = G.ifoldr | 139 | ifoldr = G.ifoldr | 17 | true | true | 4 | 8 | 43 | 80 | 38 | 42 | null | null |
avieth/diplomacy | Diplomacy/SVGMap.hs | bsd-3-clause | provinceElement (Normal Rome) = S.polygon ! A.points "247,442 248,447 256,458 271,464 279,458 280,455 279,451 274,447 263,434 250,438" | 134 | provinceElement (Normal Rome) = S.polygon ! A.points "247,442 248,447 256,458 271,464 279,458 280,455 279,451 274,447 263,434 250,438" | 134 | provinceElement (Normal Rome) = S.polygon ! A.points "247,442 248,447 256,458 271,464 279,458 280,455 279,451 274,447 263,434 250,438" | 134 | false | false | 0 | 7 | 16 | 27 | 12 | 15 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2016/M08/D25/Solution.hs | mit | -- actually, the concept of 'monthly' can get messy. We'll handle this manually
-- for now, but ...
addMonth :: Day -> Day
addMonth (toGregorian -> (yr, m, d)) =
let (yrp, newm) = m `divMod` 12
in fromGregorian (yr + fromIntegral yrp) (newm + 1) d | 255 | addMonth :: Day -> Day
addMonth (toGregorian -> (yr, m, d)) =
let (yrp, newm) = m `divMod` 12
in fromGregorian (yr + fromIntegral yrp) (newm + 1) d | 154 | addMonth (toGregorian -> (yr, m, d)) =
let (yrp, newm) = m `divMod` 12
in fromGregorian (yr + fromIntegral yrp) (newm + 1) d | 131 | true | true | 0 | 10 | 54 | 84 | 46 | 38 | null | null |
JustinUnger/haskell-book | ch9/ch9-ex.hs | mit | squishMap :: (a -> [b]) -> [a] -> [b]
squishMap _ [] = [] | 57 | squishMap :: (a -> [b]) -> [a] -> [b]
squishMap _ [] = [] | 57 | squishMap _ [] = [] | 19 | false | true | 0 | 9 | 13 | 50 | 25 | 25 | null | null |
taylor1791/adventofcode | 2015/src/Day14.hs | bsd-2-clause | -- Part 1
leadingDeer :: Time -> [(String, [(Rate, Period)])] -> (String, Distance)
leadingDeer time = maximumBy (\(_, x) (_, y) -> compare x y) . map (fmap (distance time)) | 174 | leadingDeer :: Time -> [(String, [(Rate, Period)])] -> (String, Distance)
leadingDeer time = maximumBy (\(_, x) (_, y) -> compare x y) . map (fmap (distance time)) | 163 | leadingDeer time = maximumBy (\(_, x) (_, y) -> compare x y) . map (fmap (distance time)) | 89 | true | true | 0 | 10 | 30 | 96 | 54 | 42 | null | null |
Hara-Laboratory/subleq-mips | TestRFix2.hs | gpl-3.0 | prop_Addrh :: SubleqUWord -> SubleqUWord -> SubleqUWord -> Bool
prop_Addrh rd rt rs = [rs'] == [rs] && rt' == (rs Bit..&. 0x2) `shift` (-1) && rd' == rs `shift` (-2)
where
d = fromIntegral rd
t = fromIntegral rt
s = fromIntegral rs
[rd', rt', rs'] = map fromIntegral $ executeSubroutine "addrhTest" $ map fromIntegral [rd, rt, rs] | 358 | prop_Addrh :: SubleqUWord -> SubleqUWord -> SubleqUWord -> Bool
prop_Addrh rd rt rs = [rs'] == [rs] && rt' == (rs Bit..&. 0x2) `shift` (-1) && rd' == rs `shift` (-2)
where
d = fromIntegral rd
t = fromIntegral rt
s = fromIntegral rs
[rd', rt', rs'] = map fromIntegral $ executeSubroutine "addrhTest" $ map fromIntegral [rd, rt, rs] | 358 | prop_Addrh rd rt rs = [rs'] == [rs] && rt' == (rs Bit..&. 0x2) `shift` (-1) && rd' == rs `shift` (-2)
where
d = fromIntegral rd
t = fromIntegral rt
s = fromIntegral rs
[rd', rt', rs'] = map fromIntegral $ executeSubroutine "addrhTest" $ map fromIntegral [rd, rt, rs] | 294 | false | true | 0 | 12 | 86 | 156 | 84 | 72 | null | null |
lynchronan/haskoin-crypto | src/Haskoin/Crypto/ECDSA.hs | unlicense | verifyMessage h (Signature r s) q =
case getAffine p of
Nothing -> False
-- 4.1.4.7 / 4.1.4.8
(Just (x,_)) -> (toFieldN x) == r
where
-- 4.1.4.2 / 4.1.4.3
e = toFieldN h
-- 4.1.4.4
s' = inverseN s
u1 = e*s'
u2 = r*s'
-- 4.1.4.5 (u1*G + u2*q)
p = shamirsTrick u1 curveG u2 (runPublicKey q) | 393 | verifyMessage h (Signature r s) q =
case getAffine p of
Nothing -> False
-- 4.1.4.7 / 4.1.4.8
(Just (x,_)) -> (toFieldN x) == r
where
-- 4.1.4.2 / 4.1.4.3
e = toFieldN h
-- 4.1.4.4
s' = inverseN s
u1 = e*s'
u2 = r*s'
-- 4.1.4.5 (u1*G + u2*q)
p = shamirsTrick u1 curveG u2 (runPublicKey q) | 393 | verifyMessage h (Signature r s) q =
case getAffine p of
Nothing -> False
-- 4.1.4.7 / 4.1.4.8
(Just (x,_)) -> (toFieldN x) == r
where
-- 4.1.4.2 / 4.1.4.3
e = toFieldN h
-- 4.1.4.4
s' = inverseN s
u1 = e*s'
u2 = r*s'
-- 4.1.4.5 (u1*G + u2*q)
p = shamirsTrick u1 curveG u2 (runPublicKey q) | 393 | false | false | 4 | 10 | 163 | 127 | 64 | 63 | null | null |
christiaanb/ghc | compiler/hsSyn/HsBinds.hs | bsd-3-clause | noSpecPrags :: TcSpecPrags
noSpecPrags = SpecPrags [] | 53 | noSpecPrags :: TcSpecPrags
noSpecPrags = SpecPrags [] | 53 | noSpecPrags = SpecPrags [] | 26 | false | true | 0 | 6 | 6 | 23 | 9 | 14 | null | null |
rybak/powers | Test.hs | mit | simpleWorld = [[ 2, 4, 0, 0], emptyRow, emptyRow, emptyRow] | 59 | simpleWorld = [[ 2, 4, 0, 0], emptyRow, emptyRow, emptyRow] | 59 | simpleWorld = [[ 2, 4, 0, 0], emptyRow, emptyRow, emptyRow] | 59 | false | false | 0 | 6 | 9 | 30 | 19 | 11 | null | null |
AlexanderPankiv/ghc | compiler/cmm/PprC.hs | bsd-3-clause | te_Reg _ = return () | 31 | te_Reg _ = return () | 31 | te_Reg _ = return () | 31 | false | false | 0 | 5 | 15 | 15 | 6 | 9 | null | null |
reckbo/ppl | pipeline-lib/MABS.hs | bsd-3-clause | register :: FilePath
-> FilePath
-> (FilePath,FilePath)
-> FilePath
-> Action FilePath
register antsPath outdir (moving, movingMask) fixed
= let outMask = outdir </> (intercalate "-" ["Mask"
,takeBaseName movingMask
,"in"
,takeBaseName moving]) <.> "nii.gz"
in withTempDir $ \tmpdir -> do
let tmpwarp = tmpdir </> "warp.nii.gz" | 513 | register :: FilePath
-> FilePath
-> (FilePath,FilePath)
-> FilePath
-> Action FilePath
register antsPath outdir (moving, movingMask) fixed
= let outMask = outdir </> (intercalate "-" ["Mask"
,takeBaseName movingMask
,"in"
,takeBaseName moving]) <.> "nii.gz"
in withTempDir $ \tmpdir -> do
let tmpwarp = tmpdir </> "warp.nii.gz" | 513 | register antsPath outdir (moving, movingMask) fixed
= let outMask = outdir </> (intercalate "-" ["Mask"
,takeBaseName movingMask
,"in"
,takeBaseName moving]) <.> "nii.gz"
in withTempDir $ \tmpdir -> do
let tmpwarp = tmpdir </> "warp.nii.gz" | 390 | false | true | 0 | 14 | 231 | 118 | 61 | 57 | null | null |
mydaum/cabal | Cabal/Distribution/Simple/Haddock.hs | bsd-3-clause | haddock pkg_descr lbi suffixes flags' = do
let verbosity = flag haddockVerbosity
comp = compiler lbi
platform = hostPlatform lbi
flags = case haddockTarget of
ForDevelopment -> flags'
ForHackage -> flags'
{ haddockHoogle = Flag True
, haddockHtml = Flag True
, haddockHtmlLocation = Flag (pkg_url ++ "/docs")
, haddockContents = Flag (toPathTemplate pkg_url)
, haddockHscolour = Flag True
}
pkg_url = "/package/$pkg-$version"
flag f = fromFlag $ f flags
tmpFileOpts = defaultTempFileOptions
{ optKeepTempFiles = flag haddockKeepTempFiles }
htmlTemplate = fmap toPathTemplate . flagToMaybe . haddockHtmlLocation
$ flags
haddockTarget =
fromFlagOrDefault ForDevelopment (haddockForHackage flags')
(haddockProg, version, _) <-
requireProgramVersion verbosity haddockProgram
(orLaterVersion (mkVersion [2,0])) (withPrograms lbi)
-- various sanity checks
when ( flag haddockHoogle
&& version < mkVersion [2,2]) $
die' verbosity "haddock 2.0 and 2.1 do not support the --hoogle flag."
haddockGhcVersionStr <- getProgramOutput verbosity haddockProg
["--ghc-version"]
case (simpleParse haddockGhcVersionStr, compilerCompatVersion GHC comp) of
(Nothing, _) -> die' verbosity "Could not get GHC version from Haddock"
(_, Nothing) -> die' verbosity "Could not get GHC version from compiler"
(Just haddockGhcVersion, Just ghcVersion)
| haddockGhcVersion == ghcVersion -> return ()
| otherwise -> die' verbosity $
"Haddock's internal GHC version must match the configured "
++ "GHC version.\n"
++ "The GHC version is " ++ display ghcVersion ++ " but "
++ "haddock is using GHC version " ++ display haddockGhcVersion
-- the tools match the requests, we can proceed
when (flag haddockHscolour) $
hscolour' (warn verbosity) haddockTarget pkg_descr lbi suffixes
(defaultHscolourFlags `mappend` haddockToHscolour flags)
libdirArgs <- getGhcLibDir verbosity lbi
let commonArgs = mconcat
[ libdirArgs
, fromFlags (haddockTemplateEnv lbi (packageId pkg_descr)) flags
, fromPackageDescription haddockTarget pkg_descr ]
withAllComponentsInBuildOrder pkg_descr lbi $ \component clbi -> do
componentInitialBuildSteps (flag haddockDistPref) pkg_descr lbi clbi verbosity
preprocessComponent pkg_descr component lbi clbi False verbosity suffixes
let
doExe com = case (compToExe com) of
Just exe -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
exeArgs <- fromExecutable verbosity tmp lbi clbi htmlTemplate
version exe
let exeArgs' = commonArgs `mappend` exeArgs
runHaddock verbosity tmpFileOpts comp platform
haddockProg exeArgs'
Nothing -> do
warn (fromFlag $ haddockVerbosity flags)
"Unsupported component, skipping..."
return ()
-- We define 'smsg' once and then reuse it inside the case, so that
-- we don't say we are running Haddock when we actually aren't
-- (e.g., Haddock is not run on non-libraries)
smsg :: IO ()
smsg = setupMessage' verbosity "Running Haddock on" (packageId pkg_descr)
(componentLocalName clbi) (maybeComponentInstantiatedWith clbi)
case component of
CLib lib -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
libArgs <- fromLibrary verbosity tmp lbi clbi htmlTemplate
version lib
let libArgs' = commonArgs `mappend` libArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CFLib flib -> when (flag haddockForeignLibs) $ do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
flibArgs <- fromForeignLib verbosity tmp lbi clbi htmlTemplate
version flib
let libArgs' = commonArgs `mappend` flibArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CExe _ -> when (flag haddockExecutables) $ smsg >> doExe component
CTest _ -> when (flag haddockTestSuites) $ smsg >> doExe component
CBench _ -> when (flag haddockBenchmarks) $ smsg >> doExe component
for_ (extraDocFiles pkg_descr) $ \ fpath -> do
files <- matchFileGlob fpath
for_ files $ copyFileTo verbosity (unDir $ argOutputDir commonArgs)
-- ------------------------------------------------------------------------------
-- Contributions to HaddockArgs (see also Doctest.hs for very similar code). | 5,146 | haddock pkg_descr lbi suffixes flags' = do
let verbosity = flag haddockVerbosity
comp = compiler lbi
platform = hostPlatform lbi
flags = case haddockTarget of
ForDevelopment -> flags'
ForHackage -> flags'
{ haddockHoogle = Flag True
, haddockHtml = Flag True
, haddockHtmlLocation = Flag (pkg_url ++ "/docs")
, haddockContents = Flag (toPathTemplate pkg_url)
, haddockHscolour = Flag True
}
pkg_url = "/package/$pkg-$version"
flag f = fromFlag $ f flags
tmpFileOpts = defaultTempFileOptions
{ optKeepTempFiles = flag haddockKeepTempFiles }
htmlTemplate = fmap toPathTemplate . flagToMaybe . haddockHtmlLocation
$ flags
haddockTarget =
fromFlagOrDefault ForDevelopment (haddockForHackage flags')
(haddockProg, version, _) <-
requireProgramVersion verbosity haddockProgram
(orLaterVersion (mkVersion [2,0])) (withPrograms lbi)
-- various sanity checks
when ( flag haddockHoogle
&& version < mkVersion [2,2]) $
die' verbosity "haddock 2.0 and 2.1 do not support the --hoogle flag."
haddockGhcVersionStr <- getProgramOutput verbosity haddockProg
["--ghc-version"]
case (simpleParse haddockGhcVersionStr, compilerCompatVersion GHC comp) of
(Nothing, _) -> die' verbosity "Could not get GHC version from Haddock"
(_, Nothing) -> die' verbosity "Could not get GHC version from compiler"
(Just haddockGhcVersion, Just ghcVersion)
| haddockGhcVersion == ghcVersion -> return ()
| otherwise -> die' verbosity $
"Haddock's internal GHC version must match the configured "
++ "GHC version.\n"
++ "The GHC version is " ++ display ghcVersion ++ " but "
++ "haddock is using GHC version " ++ display haddockGhcVersion
-- the tools match the requests, we can proceed
when (flag haddockHscolour) $
hscolour' (warn verbosity) haddockTarget pkg_descr lbi suffixes
(defaultHscolourFlags `mappend` haddockToHscolour flags)
libdirArgs <- getGhcLibDir verbosity lbi
let commonArgs = mconcat
[ libdirArgs
, fromFlags (haddockTemplateEnv lbi (packageId pkg_descr)) flags
, fromPackageDescription haddockTarget pkg_descr ]
withAllComponentsInBuildOrder pkg_descr lbi $ \component clbi -> do
componentInitialBuildSteps (flag haddockDistPref) pkg_descr lbi clbi verbosity
preprocessComponent pkg_descr component lbi clbi False verbosity suffixes
let
doExe com = case (compToExe com) of
Just exe -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
exeArgs <- fromExecutable verbosity tmp lbi clbi htmlTemplate
version exe
let exeArgs' = commonArgs `mappend` exeArgs
runHaddock verbosity tmpFileOpts comp platform
haddockProg exeArgs'
Nothing -> do
warn (fromFlag $ haddockVerbosity flags)
"Unsupported component, skipping..."
return ()
-- We define 'smsg' once and then reuse it inside the case, so that
-- we don't say we are running Haddock when we actually aren't
-- (e.g., Haddock is not run on non-libraries)
smsg :: IO ()
smsg = setupMessage' verbosity "Running Haddock on" (packageId pkg_descr)
(componentLocalName clbi) (maybeComponentInstantiatedWith clbi)
case component of
CLib lib -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
libArgs <- fromLibrary verbosity tmp lbi clbi htmlTemplate
version lib
let libArgs' = commonArgs `mappend` libArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CFLib flib -> when (flag haddockForeignLibs) $ do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
flibArgs <- fromForeignLib verbosity tmp lbi clbi htmlTemplate
version flib
let libArgs' = commonArgs `mappend` flibArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CExe _ -> when (flag haddockExecutables) $ smsg >> doExe component
CTest _ -> when (flag haddockTestSuites) $ smsg >> doExe component
CBench _ -> when (flag haddockBenchmarks) $ smsg >> doExe component
for_ (extraDocFiles pkg_descr) $ \ fpath -> do
files <- matchFileGlob fpath
for_ files $ copyFileTo verbosity (unDir $ argOutputDir commonArgs)
-- ------------------------------------------------------------------------------
-- Contributions to HaddockArgs (see also Doctest.hs for very similar code). | 5,146 | haddock pkg_descr lbi suffixes flags' = do
let verbosity = flag haddockVerbosity
comp = compiler lbi
platform = hostPlatform lbi
flags = case haddockTarget of
ForDevelopment -> flags'
ForHackage -> flags'
{ haddockHoogle = Flag True
, haddockHtml = Flag True
, haddockHtmlLocation = Flag (pkg_url ++ "/docs")
, haddockContents = Flag (toPathTemplate pkg_url)
, haddockHscolour = Flag True
}
pkg_url = "/package/$pkg-$version"
flag f = fromFlag $ f flags
tmpFileOpts = defaultTempFileOptions
{ optKeepTempFiles = flag haddockKeepTempFiles }
htmlTemplate = fmap toPathTemplate . flagToMaybe . haddockHtmlLocation
$ flags
haddockTarget =
fromFlagOrDefault ForDevelopment (haddockForHackage flags')
(haddockProg, version, _) <-
requireProgramVersion verbosity haddockProgram
(orLaterVersion (mkVersion [2,0])) (withPrograms lbi)
-- various sanity checks
when ( flag haddockHoogle
&& version < mkVersion [2,2]) $
die' verbosity "haddock 2.0 and 2.1 do not support the --hoogle flag."
haddockGhcVersionStr <- getProgramOutput verbosity haddockProg
["--ghc-version"]
case (simpleParse haddockGhcVersionStr, compilerCompatVersion GHC comp) of
(Nothing, _) -> die' verbosity "Could not get GHC version from Haddock"
(_, Nothing) -> die' verbosity "Could not get GHC version from compiler"
(Just haddockGhcVersion, Just ghcVersion)
| haddockGhcVersion == ghcVersion -> return ()
| otherwise -> die' verbosity $
"Haddock's internal GHC version must match the configured "
++ "GHC version.\n"
++ "The GHC version is " ++ display ghcVersion ++ " but "
++ "haddock is using GHC version " ++ display haddockGhcVersion
-- the tools match the requests, we can proceed
when (flag haddockHscolour) $
hscolour' (warn verbosity) haddockTarget pkg_descr lbi suffixes
(defaultHscolourFlags `mappend` haddockToHscolour flags)
libdirArgs <- getGhcLibDir verbosity lbi
let commonArgs = mconcat
[ libdirArgs
, fromFlags (haddockTemplateEnv lbi (packageId pkg_descr)) flags
, fromPackageDescription haddockTarget pkg_descr ]
withAllComponentsInBuildOrder pkg_descr lbi $ \component clbi -> do
componentInitialBuildSteps (flag haddockDistPref) pkg_descr lbi clbi verbosity
preprocessComponent pkg_descr component lbi clbi False verbosity suffixes
let
doExe com = case (compToExe com) of
Just exe -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
exeArgs <- fromExecutable verbosity tmp lbi clbi htmlTemplate
version exe
let exeArgs' = commonArgs `mappend` exeArgs
runHaddock verbosity tmpFileOpts comp platform
haddockProg exeArgs'
Nothing -> do
warn (fromFlag $ haddockVerbosity flags)
"Unsupported component, skipping..."
return ()
-- We define 'smsg' once and then reuse it inside the case, so that
-- we don't say we are running Haddock when we actually aren't
-- (e.g., Haddock is not run on non-libraries)
smsg :: IO ()
smsg = setupMessage' verbosity "Running Haddock on" (packageId pkg_descr)
(componentLocalName clbi) (maybeComponentInstantiatedWith clbi)
case component of
CLib lib -> do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
libArgs <- fromLibrary verbosity tmp lbi clbi htmlTemplate
version lib
let libArgs' = commonArgs `mappend` libArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CFLib flib -> when (flag haddockForeignLibs) $ do
withTempDirectoryEx verbosity tmpFileOpts (buildDir lbi) "tmp" $
\tmp -> do
smsg
flibArgs <- fromForeignLib verbosity tmp lbi clbi htmlTemplate
version flib
let libArgs' = commonArgs `mappend` flibArgs
runHaddock verbosity tmpFileOpts comp platform haddockProg libArgs'
CExe _ -> when (flag haddockExecutables) $ smsg >> doExe component
CTest _ -> when (flag haddockTestSuites) $ smsg >> doExe component
CBench _ -> when (flag haddockBenchmarks) $ smsg >> doExe component
for_ (extraDocFiles pkg_descr) $ \ fpath -> do
files <- matchFileGlob fpath
for_ files $ copyFileTo verbosity (unDir $ argOutputDir commonArgs)
-- ------------------------------------------------------------------------------
-- Contributions to HaddockArgs (see also Doctest.hs for very similar code). | 5,146 | false | false | 0 | 26 | 1,608 | 1,139 | 547 | 592 | null | null |
wjzz/GoStat | src/Server.hs | bsd-3-clause | fetchLang :: ServerPart Messages
fetchLang = do
langStr <- look "lang" `mplus` (return "pl")
return $ case langStr of
"pl" -> pl
_ -> eng | 169 | fetchLang :: ServerPart Messages
fetchLang = do
langStr <- look "lang" `mplus` (return "pl")
return $ case langStr of
"pl" -> pl
_ -> eng | 169 | fetchLang = do
langStr <- look "lang" `mplus` (return "pl")
return $ case langStr of
"pl" -> pl
_ -> eng | 136 | false | true | 0 | 10 | 56 | 59 | 29 | 30 | null | null |
facebookincubator/duckling | Duckling/Time/ZH/Rules.hs | bsd-3-clause | ruleHalfAfterpastNoonmidnight :: Rule
ruleHalfAfterpastNoonmidnight = Rule
{ name = "half after|past noon|midnight"
, pattern =
[ Predicate isMidnightOrNoon
, regex "过"
, regex "半"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
} | 386 | ruleHalfAfterpastNoonmidnight :: Rule
ruleHalfAfterpastNoonmidnight = Rule
{ name = "half after|past noon|midnight"
, pattern =
[ Predicate isMidnightOrNoon
, regex "过"
, regex "半"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
} | 386 | ruleHalfAfterpastNoonmidnight = Rule
{ name = "half after|past noon|midnight"
, pattern =
[ Predicate isMidnightOrNoon
, regex "过"
, regex "半"
]
, prod = \tokens -> case tokens of
(Token Time TimeData {TTime.form = Just (TTime.TimeOfDay (Just hours) _)}:
_) -> tt $ hourMinute True hours 30
_ -> Nothing
} | 348 | false | true | 0 | 22 | 97 | 127 | 66 | 61 | null | null |
taruti/diagrams-cairo-raster | site/site.hs | bsd-3-clause | tmplCtx :: Context String
tmplCtx =
dateField "date" "%Y-%m-%d" <>
defaultContext | 89 | tmplCtx :: Context String
tmplCtx =
dateField "date" "%Y-%m-%d" <>
defaultContext | 89 | tmplCtx =
dateField "date" "%Y-%m-%d" <>
defaultContext | 63 | false | true | 1 | 6 | 18 | 28 | 11 | 17 | null | null |
evgenim/tm | src/TM/Time.hs | gpl-3.0 | hour = 60 * 60 | 16 | hour = 60 * 60 | 16 | hour = 60 * 60 | 16 | false | false | 2 | 5 | 6 | 15 | 5 | 10 | null | null |
gallais/potpourri | haskell/hsubst/Context.hs | gpl-3.0 | wkSubstTm :: Subst a b c d -> Subst a (Maybe b) c (Maybe d)
wkSubstTm (SubstDa v u) = SubstDa v (wkTy u) | 104 | wkSubstTm :: Subst a b c d -> Subst a (Maybe b) c (Maybe d)
wkSubstTm (SubstDa v u) = SubstDa v (wkTy u) | 104 | wkSubstTm (SubstDa v u) = SubstDa v (wkTy u) | 44 | false | true | 0 | 8 | 23 | 67 | 32 | 35 | null | null |
keithodulaigh/Hets | Fpl/Sign.hs | gpl-2.0 | addBools :: OpMap -> OpMap
addBools = addOpTo falseC boolType . addOpTo trueC boolType | 86 | addBools :: OpMap -> OpMap
addBools = addOpTo falseC boolType . addOpTo trueC boolType | 86 | addBools = addOpTo falseC boolType . addOpTo trueC boolType | 59 | false | true | 0 | 6 | 13 | 29 | 14 | 15 | null | null |
shlevy/ghc | compiler/basicTypes/IdInfo.hs | bsd-3-clause | isEmptyRuleInfo :: RuleInfo -> Bool
isEmptyRuleInfo (RuleInfo rs _) = null rs | 77 | isEmptyRuleInfo :: RuleInfo -> Bool
isEmptyRuleInfo (RuleInfo rs _) = null rs | 77 | isEmptyRuleInfo (RuleInfo rs _) = null rs | 41 | false | true | 0 | 7 | 11 | 29 | 14 | 15 | null | null |
brendanhay/gogol | gogol-spanner/gen/Network/Google/Resource/Spanner/Projects/Instances/Backups/Get.hs | mpl-2.0 | -- | V1 error format.
pibgXgafv :: Lens' ProjectsInstancesBackupsGet (Maybe Xgafv)
pibgXgafv
= lens _pibgXgafv (\ s a -> s{_pibgXgafv = a}) | 141 | pibgXgafv :: Lens' ProjectsInstancesBackupsGet (Maybe Xgafv)
pibgXgafv
= lens _pibgXgafv (\ s a -> s{_pibgXgafv = a}) | 119 | pibgXgafv
= lens _pibgXgafv (\ s a -> s{_pibgXgafv = a}) | 58 | true | true | 1 | 9 | 23 | 50 | 25 | 25 | null | null |
andrzejgorski/pascalis | source/MonadsFunctions.hs | bsd-3-clause | getLine_IO :: MRSIO String
getLine_IO = lift $ lift $ getLine | 61 | getLine_IO :: MRSIO String
getLine_IO = lift $ lift $ getLine | 61 | getLine_IO = lift $ lift $ getLine | 34 | false | true | 4 | 6 | 10 | 30 | 12 | 18 | null | null |
dysinger/amazonka | amazonka-opsworks/gen/Network/AWS/OpsWorks/CreateApp.hs | mpl-2.0 | -- | The app virtual host settings, with multiple domains separated by commas. For
-- example: ''www.example.com, example.com''
caDomains :: Lens' CreateApp [Text]
caDomains = lens _caDomains (\s a -> s { _caDomains = a }) . _List | 230 | caDomains :: Lens' CreateApp [Text]
caDomains = lens _caDomains (\s a -> s { _caDomains = a }) . _List | 102 | caDomains = lens _caDomains (\s a -> s { _caDomains = a }) . _List | 66 | true | true | 0 | 10 | 37 | 48 | 27 | 21 | null | null |
shlevy/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | mkWpLams :: [Var] -> HsWrapper
mkWpLams ids = mk_co_lam_fn WpEvLam ids | 70 | mkWpLams :: [Var] -> HsWrapper
mkWpLams ids = mk_co_lam_fn WpEvLam ids | 70 | mkWpLams ids = mk_co_lam_fn WpEvLam ids | 39 | false | true | 0 | 6 | 10 | 26 | 13 | 13 | null | null |
elieux/ghc | compiler/basicTypes/RdrName.hs | bsd-3-clause | mkParent :: Name -> AvailInfo -> Parent
mkParent _ (Avail NotPatSyn _) = NoParent | 91 | mkParent :: Name -> AvailInfo -> Parent
mkParent _ (Avail NotPatSyn _) = NoParent | 91 | mkParent _ (Avail NotPatSyn _) = NoParent | 51 | false | true | 0 | 7 | 23 | 32 | 16 | 16 | null | null |
brendanhay/gogol | gogol-games/gen/Network/Google/Resource/Games/Snapshots/Get.hs | mpl-2.0 | -- | OAuth access token.
snaAccessToken :: Lens' SnapshotsGet (Maybe Text)
snaAccessToken
= lens _snaAccessToken
(\ s a -> s{_snaAccessToken = a}) | 154 | snaAccessToken :: Lens' SnapshotsGet (Maybe Text)
snaAccessToken
= lens _snaAccessToken
(\ s a -> s{_snaAccessToken = a}) | 129 | snaAccessToken
= lens _snaAccessToken
(\ s a -> s{_snaAccessToken = a}) | 79 | true | true | 0 | 9 | 29 | 48 | 25 | 23 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Data/Unicode/DecomposeChar.hs | mit | decomposeChar '\x2F801' = "\x4E38" | 34 | decomposeChar '\x2F801' = "\x4E38" | 34 | decomposeChar '\x2F801' = "\x4E38" | 34 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
scottgw/language-eiffel | Language/Eiffel/Parser/Typ.hs | bsd-3-clause | attTyp :: Parser Typ
attTyp = keyword TokAttached >> (likeTyp <|> baseTyp) | 74 | attTyp :: Parser Typ
attTyp = keyword TokAttached >> (likeTyp <|> baseTyp) | 74 | attTyp = keyword TokAttached >> (likeTyp <|> baseTyp) | 53 | false | true | 1 | 8 | 11 | 32 | 14 | 18 | null | null |
jtdaugherty/vty | src/Graphics/Vty/Attributes.hs | bsd-3-clause | hasStyle :: Style -> Style -> Bool
hasStyle s bitMask = ( s .&. bitMask ) /= 0 | 78 | hasStyle :: Style -> Style -> Bool
hasStyle s bitMask = ( s .&. bitMask ) /= 0 | 78 | hasStyle s bitMask = ( s .&. bitMask ) /= 0 | 43 | false | true | 0 | 8 | 17 | 41 | 19 | 22 | null | null |
haskoin/haskoin | src/Haskoin/Script/SigHash.hs | unlicense | -- | Is the SIGHASH_ANYONECANPAY flag set?
hasAnyoneCanPayFlag :: SigHash -> Bool
hasAnyoneCanPayFlag = (/= 0) . (.&. sigHashAnyoneCanPay) | 138 | hasAnyoneCanPayFlag :: SigHash -> Bool
hasAnyoneCanPayFlag = (/= 0) . (.&. sigHashAnyoneCanPay) | 95 | hasAnyoneCanPayFlag = (/= 0) . (.&. sigHashAnyoneCanPay) | 56 | true | true | 0 | 6 | 18 | 28 | 17 | 11 | null | null |
supermario/stack | src/Stack/Types/Config.hs | bsd-3-clause | minimalEnvSettings :: EnvSettings
minimalEnvSettings =
EnvSettings
{ esIncludeLocals = False
, esIncludeGhcPackagePath = False
, esStackExe = False
, esLocaleUtf8 = False
} | 196 | minimalEnvSettings :: EnvSettings
minimalEnvSettings =
EnvSettings
{ esIncludeLocals = False
, esIncludeGhcPackagePath = False
, esStackExe = False
, esLocaleUtf8 = False
} | 196 | minimalEnvSettings =
EnvSettings
{ esIncludeLocals = False
, esIncludeGhcPackagePath = False
, esStackExe = False
, esLocaleUtf8 = False
} | 162 | false | true | 0 | 6 | 46 | 37 | 23 | 14 | null | null |
stephenjbarr/gradebot | Gradebot.hs | mit | indivQuestionReport :: QFeedback -> GMap -> String
indivQuestionReport = makeCodeReport_Q | 89 | indivQuestionReport :: QFeedback -> GMap -> String
indivQuestionReport = makeCodeReport_Q | 89 | indivQuestionReport = makeCodeReport_Q | 38 | false | true | 0 | 6 | 9 | 19 | 10 | 9 | null | null |
tensorflow/haskell | tensorflow-records/tests/Main.hs | apache-2.0 | -- There's no (Arbitrary BL.ByteString), so pack it from a list of chunks.
propEncodeDecodeInverse :: [[Word8]] -> Bool
propEncodeDecodeInverse s =
let bs = BL.fromChunks . fmap B.pack $ s
in runGet getTFRecord (runPut (putTFRecord bs)) == Right bs | 257 | propEncodeDecodeInverse :: [[Word8]] -> Bool
propEncodeDecodeInverse s =
let bs = BL.fromChunks . fmap B.pack $ s
in runGet getTFRecord (runPut (putTFRecord bs)) == Right bs | 182 | propEncodeDecodeInverse s =
let bs = BL.fromChunks . fmap B.pack $ s
in runGet getTFRecord (runPut (putTFRecord bs)) == Right bs | 137 | true | true | 0 | 12 | 47 | 79 | 38 | 41 | null | null |
willprice/camle-compiler | src/Language/Camle/JouetteBackend.hs | mit | modifyCode :: (Code -> Code) -> ASMGen ()
modifyCode fn = modify $ \s -> s { code = fn $ code s } | 97 | modifyCode :: (Code -> Code) -> ASMGen ()
modifyCode fn = modify $ \s -> s { code = fn $ code s } | 97 | modifyCode fn = modify $ \s -> s { code = fn $ code s } | 55 | false | true | 0 | 10 | 23 | 54 | 28 | 26 | null | null |
pharpend/puffytools | ptk/Ptk/Journal/ListEntries.hs | bsd-3-clause | slugType :: Type Slug
slugType = Type {parser = \s -> mkSlugEither (pack s)
,name = "JOURNAL_SLUG"
,defaultValue = Nothing} | 155 | slugType :: Type Slug
slugType = Type {parser = \s -> mkSlugEither (pack s)
,name = "JOURNAL_SLUG"
,defaultValue = Nothing} | 155 | slugType = Type {parser = \s -> mkSlugEither (pack s)
,name = "JOURNAL_SLUG"
,defaultValue = Nothing} | 133 | false | true | 0 | 10 | 51 | 48 | 27 | 21 | null | null |
tjakway/ghcjvm | utils/genprimopcode/Main.hs | bsd-3-clause | ppType (TyApp (TyCon "Char#") []) = "charPrimTy" | 54 | ppType (TyApp (TyCon "Char#") []) = "charPrimTy" | 54 | ppType (TyApp (TyCon "Char#") []) = "charPrimTy" | 54 | false | false | 0 | 8 | 12 | 26 | 12 | 14 | null | null |
wavewave/madgraph-auto-dataset | src/HEP/Automation/MadGraph/Dataset/Set20110713set5.hs | gpl-3.0 | webdavdir :: WebDAVRemoteDir
webdavdir = WebDAVRemoteDir "paper3/ttbar_TEV_sm_big" | 83 | webdavdir :: WebDAVRemoteDir
webdavdir = WebDAVRemoteDir "paper3/ttbar_TEV_sm_big" | 82 | webdavdir = WebDAVRemoteDir "paper3/ttbar_TEV_sm_big" | 53 | false | true | 0 | 5 | 7 | 14 | 7 | 7 | null | null |
kallisti-dev/hs-webdriver | src/Test/WebDriver/Common/Keys.hs | bsd-3-clause | numpad5 :: Text
numpad5 = "\xe01f" | 34 | numpad5 :: Text
numpad5 = "\xe01f" | 34 | numpad5 = "\xe01f" | 18 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
sdiehl/ghc | compiler/utils/Pretty.hs | bsd-3-clause | -- | Apply 'hang' to the arguments if the first 'Doc' is not empty.
hangNotEmpty :: Doc -> Int -> Doc -> Doc
hangNotEmpty d1 n d2 = if isEmpty d1
then d2
else hang d1 n d2 | 217 | hangNotEmpty :: Doc -> Int -> Doc -> Doc
hangNotEmpty d1 n d2 = if isEmpty d1
then d2
else hang d1 n d2 | 149 | hangNotEmpty d1 n d2 = if isEmpty d1
then d2
else hang d1 n d2 | 108 | true | true | 0 | 7 | 83 | 49 | 25 | 24 | null | null |
ananthakumaran/webify | src/Font.hs | mit | parseNameRecord :: B.ByteString -> Int -> Get NameRecord
parseNameRecord font storageOffset = do
platformId <- getUShort
encodingId <- getUShort
languageId <- getUShort
nameId <- getUShort
strLength <- getUShort
strOffset <- getUShort
let str = decoder platformId encodingId $ substr
(fromIntegral ((fromIntegral storageOffset :: Int) + fromIntegral strOffset)) (fromIntegral strLength) font
return NameRecord{..}
where
decoder 3 _ = decodeUtf16BE
decoder 2 _ = decodeUtf16BE
decoder 1 _ = decodeUtf8With ignore
decoder 0 _ = decodeUtf16BE
decoder _ _ = decodeUtf16BE | 617 | parseNameRecord :: B.ByteString -> Int -> Get NameRecord
parseNameRecord font storageOffset = do
platformId <- getUShort
encodingId <- getUShort
languageId <- getUShort
nameId <- getUShort
strLength <- getUShort
strOffset <- getUShort
let str = decoder platformId encodingId $ substr
(fromIntegral ((fromIntegral storageOffset :: Int) + fromIntegral strOffset)) (fromIntegral strLength) font
return NameRecord{..}
where
decoder 3 _ = decodeUtf16BE
decoder 2 _ = decodeUtf16BE
decoder 1 _ = decodeUtf8With ignore
decoder 0 _ = decodeUtf16BE
decoder _ _ = decodeUtf16BE | 617 | parseNameRecord font storageOffset = do
platformId <- getUShort
encodingId <- getUShort
languageId <- getUShort
nameId <- getUShort
strLength <- getUShort
strOffset <- getUShort
let str = decoder platformId encodingId $ substr
(fromIntegral ((fromIntegral storageOffset :: Int) + fromIntegral strOffset)) (fromIntegral strLength) font
return NameRecord{..}
where
decoder 3 _ = decodeUtf16BE
decoder 2 _ = decodeUtf16BE
decoder 1 _ = decodeUtf8With ignore
decoder 0 _ = decodeUtf16BE
decoder _ _ = decodeUtf16BE | 560 | false | true | 1 | 17 | 128 | 207 | 92 | 115 | null | null |
ivanperez-keera/SoOSiM-ui | src/Graphics/Diagrams/Types.hs | bsd-3-clause | makeColor :: Float -> Float -> Float -> Float -> Color
makeColor = G.makeColor | 78 | makeColor :: Float -> Float -> Float -> Float -> Color
makeColor = G.makeColor | 78 | makeColor = G.makeColor | 23 | false | true | 0 | 8 | 13 | 29 | 15 | 14 | null | null |
pogin503/vbautil | atcoder/beg078/beg078b.hs | mit | solve :: Int -> Int -> Int -> Int -> Int
solve x y z acc =
if quot x ((y + z) * acc + z) == 1 && mod x ((y + z) * acc + z) < y + z
then acc
else solve x y z (acc + 1) | 172 | solve :: Int -> Int -> Int -> Int -> Int
solve x y z acc =
if quot x ((y + z) * acc + z) == 1 && mod x ((y + z) * acc + z) < y + z
then acc
else solve x y z (acc + 1) | 172 | solve x y z acc =
if quot x ((y + z) * acc + z) == 1 && mod x ((y + z) * acc + z) < y + z
then acc
else solve x y z (acc + 1) | 131 | false | true | 0 | 15 | 58 | 122 | 63 | 59 | null | null |
mietek/stack | src/Stack/Docker.hs | bsd-3-clause | pull :: (MonadLogger m,MonadIO m,MonadThrow m) => Config -> m ()
pull config =
do envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
pwd <- getWorkingDir
pullImage pwd envOverride docker (dockerImage docker)
where docker = configDocker config
-- | Pull Docker image from registry. | 334 | pull :: (MonadLogger m,MonadIO m,MonadThrow m) => Config -> m ()
pull config =
do envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
pwd <- getWorkingDir
pullImage pwd envOverride docker (dockerImage docker)
where docker = configDocker config
-- | Pull Docker image from registry. | 334 | pull config =
do envOverride <- getEnvOverride (configPlatform config)
checkDockerVersion envOverride
pwd <- getWorkingDir
pullImage pwd envOverride docker (dockerImage docker)
where docker = configDocker config
-- | Pull Docker image from registry. | 269 | false | true | 0 | 10 | 62 | 103 | 48 | 55 | null | null |
a143753/AOJ | 1137.hs | apache-2.0 | dec2str' dec ((s,v):ts) =
let n = dec `div` v
r = dec `mod` v
c = case n of
0 -> ""
1 -> [s]
otherwise -> (show n) ++ [s]
in
c ++ (dec2str' r ts) | 201 | dec2str' dec ((s,v):ts) =
let n = dec `div` v
r = dec `mod` v
c = case n of
0 -> ""
1 -> [s]
otherwise -> (show n) ++ [s]
in
c ++ (dec2str' r ts) | 201 | dec2str' dec ((s,v):ts) =
let n = dec `div` v
r = dec `mod` v
c = case n of
0 -> ""
1 -> [s]
otherwise -> (show n) ++ [s]
in
c ++ (dec2str' r ts) | 201 | false | false | 0 | 14 | 93 | 107 | 58 | 49 | null | null |
ingemaradahl/bilder | src/TypeChecker/Renamer/Utils.hs | lgpl-3.0 | pushAlias ∷ TCM ()
pushAlias = modify (\st → st { aliases = Map.empty:aliases st}) | 82 | pushAlias ∷ TCM ()
pushAlias = modify (\st → st { aliases = Map.empty:aliases st}) | 82 | pushAlias = modify (\st → st { aliases = Map.empty:aliases st}) | 63 | false | true | 0 | 11 | 14 | 50 | 24 | 26 | null | null |
keera-studios/hsQt | Qtc/Enums/Gui/QKeySequence.hs | bsd-2-clause | eRedo :: StandardKey
eRedo
= ieStandardKey $ 12 | 49 | eRedo :: StandardKey
eRedo
= ieStandardKey $ 12 | 49 | eRedo
= ieStandardKey $ 12 | 28 | false | true | 0 | 6 | 9 | 22 | 9 | 13 | null | null |
tgdavies/codeworld | funblocks-client/src/Blocks/Types.hs | apache-2.0 | txtLowercase = standardFunction "txtLowercase" "lowercase" Nothing [typeText, typeText]
["TEXT"] colorText "The text in lowercase" | 146 | txtLowercase = standardFunction "txtLowercase" "lowercase" Nothing [typeText, typeText]
["TEXT"] colorText "The text in lowercase" | 146 | txtLowercase = standardFunction "txtLowercase" "lowercase" Nothing [typeText, typeText]
["TEXT"] colorText "The text in lowercase" | 146 | false | false | 1 | 6 | 29 | 36 | 16 | 20 | null | null |
nazrhom/vcs-clojure | src/Oracle/DiffOracle.hs | bsd-3-clause | buildDelInsMap :: [GroupDiffAction] -> DelInsMap
buildDelInsMap [] = (M.empty, M.empty) | 97 | buildDelInsMap :: [GroupDiffAction] -> DelInsMap
buildDelInsMap [] = (M.empty, M.empty) | 97 | buildDelInsMap [] = (M.empty, M.empty) | 48 | false | true | 0 | 6 | 19 | 33 | 18 | 15 | null | null |
databrary/databrary | src/View/Form.hs | agpl-3.0 | inputPassword :: Field
inputPassword ref _ = H.input
H.! HA.type_ "password"
H.! HA.id ref
H.! HA.name ref | 116 | inputPassword :: Field
inputPassword ref _ = H.input
H.! HA.type_ "password"
H.! HA.id ref
H.! HA.name ref | 116 | inputPassword ref _ = H.input
H.! HA.type_ "password"
H.! HA.id ref
H.! HA.name ref | 93 | false | true | 7 | 6 | 26 | 57 | 24 | 33 | null | null |
frantisekfarka/ghc-dsi | libraries/base/GHC/IO/Handle/Internals.hs | bsd-3-clause | ioe_EOF = ioException
(IOError Nothing EOF "" "" Nothing Nothing) | 68 | ioe_EOF = ioException
(IOError Nothing EOF "" "" Nothing Nothing) | 68 | ioe_EOF = ioException
(IOError Nothing EOF "" "" Nothing Nothing) | 68 | false | false | 0 | 7 | 12 | 25 | 12 | 13 | null | null |
tdeekens/tda452-code | Lab-3/Sudoku.hs | mit | candidates :: Sudoku -> Pos -> [Int]
candidates s (x, y) = [1..9] \\ [fromJust x | x <- (filter isJust fll)]
where
bs = blocks s
rc = bs!!x ++ bs!!(9+y)
b = bs!!( 17 + nthBlock (x `div` 3, y `div` 3) )
fll = (rc ++ b)
-- Helper function returning the block number of a given position | 306 | candidates :: Sudoku -> Pos -> [Int]
candidates s (x, y) = [1..9] \\ [fromJust x | x <- (filter isJust fll)]
where
bs = blocks s
rc = bs!!x ++ bs!!(9+y)
b = bs!!( 17 + nthBlock (x `div` 3, y `div` 3) )
fll = (rc ++ b)
-- Helper function returning the block number of a given position | 306 | candidates s (x, y) = [1..9] \\ [fromJust x | x <- (filter isJust fll)]
where
bs = blocks s
rc = bs!!x ++ bs!!(9+y)
b = bs!!( 17 + nthBlock (x `div` 3, y `div` 3) )
fll = (rc ++ b)
-- Helper function returning the block number of a given position | 269 | false | true | 12 | 10 | 83 | 174 | 83 | 91 | null | null |
AugustusHuang/hs-learning | elementary.hs | mit | -- take'
take' :: Int -> [a] -> [a]
take' n _
| n <= 0 = [] | 60 | take' :: Int -> [a] -> [a]
take' n _
| n <= 0 = [] | 51 | take' n _
| n <= 0 = [] | 24 | true | true | 0 | 9 | 18 | 49 | 23 | 26 | null | null |
anton-k/sharc-timbre | src/Sharc/Instruments/ViolinPizzicato.hs | bsd-3-clause | note7 :: Note
note7 = Note
(Pitch 293.665 50 "d4")
8
(Range
(NoteRange
(NoteRangeAmplitude 7341.62 25 0.33)
(NoteRangeHarmonicFreq 1 293.66))
(NoteRange
(NoteRangeAmplitude 293.66 1 8069.0)
(NoteRangeHarmonicFreq 37 10865.6)))
[Harmonic 1 (-2.778) 8069.0
,Harmonic 2 2.007 1555.4
,Harmonic 3 (-1.661) 83.68
,Harmonic 4 (-1.851) 90.12
,Harmonic 5 0.686 48.76
,Harmonic 6 (-1.538) 21.09
,Harmonic 7 2.672 134.03
,Harmonic 8 0.833 46.51
,Harmonic 9 (-3.1e-2) 30.3
,Harmonic 10 1.663 86.03
,Harmonic 11 0.389 25.94
,Harmonic 12 (-1.309) 6.45
,Harmonic 13 (-1.196) 1.64
,Harmonic 14 (-3.3e-2) 4.86
,Harmonic 15 (-0.432) 5.18
,Harmonic 16 1.308 2.75
,Harmonic 17 2.835 4.86
,Harmonic 18 2.074 2.52
,Harmonic 19 (-1.519) 2.4
,Harmonic 20 (-2.615) 3.3
,Harmonic 21 0.452 2.45
,Harmonic 22 8.2e-2 4.3
,Harmonic 23 (-0.416) 1.53
,Harmonic 24 (-0.188) 1.57
,Harmonic 25 3.074 0.33
,Harmonic 26 (-2.081) 1.1
,Harmonic 27 (-1.099) 1.71
,Harmonic 28 (-1.357) 1.64
,Harmonic 29 0.609 0.46
,Harmonic 30 (-0.591) 1.52
,Harmonic 31 0.203 1.29
,Harmonic 32 (-0.959) 1.33
,Harmonic 33 (-1.304) 0.61
,Harmonic 34 (-1.173) 0.68
,Harmonic 35 3.111 0.35
,Harmonic 36 (-1.013) 0.99
,Harmonic 37 (-1.069) 0.69] | 1,408 | note7 :: Note
note7 = Note
(Pitch 293.665 50 "d4")
8
(Range
(NoteRange
(NoteRangeAmplitude 7341.62 25 0.33)
(NoteRangeHarmonicFreq 1 293.66))
(NoteRange
(NoteRangeAmplitude 293.66 1 8069.0)
(NoteRangeHarmonicFreq 37 10865.6)))
[Harmonic 1 (-2.778) 8069.0
,Harmonic 2 2.007 1555.4
,Harmonic 3 (-1.661) 83.68
,Harmonic 4 (-1.851) 90.12
,Harmonic 5 0.686 48.76
,Harmonic 6 (-1.538) 21.09
,Harmonic 7 2.672 134.03
,Harmonic 8 0.833 46.51
,Harmonic 9 (-3.1e-2) 30.3
,Harmonic 10 1.663 86.03
,Harmonic 11 0.389 25.94
,Harmonic 12 (-1.309) 6.45
,Harmonic 13 (-1.196) 1.64
,Harmonic 14 (-3.3e-2) 4.86
,Harmonic 15 (-0.432) 5.18
,Harmonic 16 1.308 2.75
,Harmonic 17 2.835 4.86
,Harmonic 18 2.074 2.52
,Harmonic 19 (-1.519) 2.4
,Harmonic 20 (-2.615) 3.3
,Harmonic 21 0.452 2.45
,Harmonic 22 8.2e-2 4.3
,Harmonic 23 (-0.416) 1.53
,Harmonic 24 (-0.188) 1.57
,Harmonic 25 3.074 0.33
,Harmonic 26 (-2.081) 1.1
,Harmonic 27 (-1.099) 1.71
,Harmonic 28 (-1.357) 1.64
,Harmonic 29 0.609 0.46
,Harmonic 30 (-0.591) 1.52
,Harmonic 31 0.203 1.29
,Harmonic 32 (-0.959) 1.33
,Harmonic 33 (-1.304) 0.61
,Harmonic 34 (-1.173) 0.68
,Harmonic 35 3.111 0.35
,Harmonic 36 (-1.013) 0.99
,Harmonic 37 (-1.069) 0.69] | 1,408 | note7 = Note
(Pitch 293.665 50 "d4")
8
(Range
(NoteRange
(NoteRangeAmplitude 7341.62 25 0.33)
(NoteRangeHarmonicFreq 1 293.66))
(NoteRange
(NoteRangeAmplitude 293.66 1 8069.0)
(NoteRangeHarmonicFreq 37 10865.6)))
[Harmonic 1 (-2.778) 8069.0
,Harmonic 2 2.007 1555.4
,Harmonic 3 (-1.661) 83.68
,Harmonic 4 (-1.851) 90.12
,Harmonic 5 0.686 48.76
,Harmonic 6 (-1.538) 21.09
,Harmonic 7 2.672 134.03
,Harmonic 8 0.833 46.51
,Harmonic 9 (-3.1e-2) 30.3
,Harmonic 10 1.663 86.03
,Harmonic 11 0.389 25.94
,Harmonic 12 (-1.309) 6.45
,Harmonic 13 (-1.196) 1.64
,Harmonic 14 (-3.3e-2) 4.86
,Harmonic 15 (-0.432) 5.18
,Harmonic 16 1.308 2.75
,Harmonic 17 2.835 4.86
,Harmonic 18 2.074 2.52
,Harmonic 19 (-1.519) 2.4
,Harmonic 20 (-2.615) 3.3
,Harmonic 21 0.452 2.45
,Harmonic 22 8.2e-2 4.3
,Harmonic 23 (-0.416) 1.53
,Harmonic 24 (-0.188) 1.57
,Harmonic 25 3.074 0.33
,Harmonic 26 (-2.081) 1.1
,Harmonic 27 (-1.099) 1.71
,Harmonic 28 (-1.357) 1.64
,Harmonic 29 0.609 0.46
,Harmonic 30 (-0.591) 1.52
,Harmonic 31 0.203 1.29
,Harmonic 32 (-0.959) 1.33
,Harmonic 33 (-1.304) 0.61
,Harmonic 34 (-1.173) 0.68
,Harmonic 35 3.111 0.35
,Harmonic 36 (-1.013) 0.99
,Harmonic 37 (-1.069) 0.69] | 1,394 | false | true | 0 | 11 | 399 | 570 | 296 | 274 | null | null |
siddhanathan/yi | yi-language/src/Yi/Style.hs | gpl-2.0 | yellow = RGB 255 255 0 | 27 | yellow = RGB 255 255 0 | 27 | yellow = RGB 255 255 0 | 27 | false | false | 1 | 5 | 10 | 19 | 6 | 13 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.