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
jhartikainen/hs-language-php
Evaluator.hs
bsd-3-clause
exprVal _ = error "Value that are not literals must be evaluated first"
71
exprVal _ = error "Value that are not literals must be evaluated first"
71
exprVal _ = error "Value that are not literals must be evaluated first"
71
false
false
0
5
12
12
5
7
null
null
Michaelt293/Lipid-Haskell
src/Lipid/Parsers/UnknownSn/Glycerophospholipid.hs
gpl-3.0
pip2Delta :: QuasiQuoter pip2Delta = qQuoter pip2DeltaP
55
pip2Delta :: QuasiQuoter pip2Delta = qQuoter pip2DeltaP
55
pip2Delta = qQuoter pip2DeltaP
30
false
true
0
5
6
14
7
7
null
null
anton-dessiatov/stack
src/Stack/Ghci.hs
bsd-3-clause
parseMainIsTargets :: HasEnvConfig env => BuildOptsCLI -> Maybe Text -> RIO env (Maybe (Map PackageName Target)) parseMainIsTargets buildOptsCLI mtarget = forM mtarget $ \target -> do (_,_,targets) <- parseTargets AllowNoTargets buildOptsCLI { boptsCLITargets = [target] } return targets
306
parseMainIsTargets :: HasEnvConfig env => BuildOptsCLI -> Maybe Text -> RIO env (Maybe (Map PackageName Target)) parseMainIsTargets buildOptsCLI mtarget = forM mtarget $ \target -> do (_,_,targets) <- parseTargets AllowNoTargets buildOptsCLI { boptsCLITargets = [target] } return targets
306
parseMainIsTargets buildOptsCLI mtarget = forM mtarget $ \target -> do (_,_,targets) <- parseTargets AllowNoTargets buildOptsCLI { boptsCLITargets = [target] } return targets
193
false
true
0
13
56
103
51
52
null
null
jff/TeLLer
src/Arbitrary.hs
gpl-3.0
as :: Gen a -> (a -> b) -> Gen b as = flip fmap
47
as :: Gen a -> (a -> b) -> Gen b as = flip fmap
47
as = flip fmap
14
false
true
0
9
14
41
18
23
null
null
RobinKrom/interactive-brokers
library/API/IB/Util.hs
bsd-3-clause
stringToMaybe :: String -> Maybe String stringToMaybe s | null s = Nothing | otherwise = Just s
99
stringToMaybe :: String -> Maybe String stringToMaybe s | null s = Nothing | otherwise = Just s
99
stringToMaybe s | null s = Nothing | otherwise = Just s
59
false
true
1
8
21
40
18
22
null
null
Taketrung/HsPredictor
tests/TestSuites/HashCSVSpec.hs
mit
spec = fromHUnitTest $ TestList [ TestLabel ">>genHash" test_genHash , TestLabel ">>checkHash" test_checkHash ]
117
spec = fromHUnitTest $ TestList [ TestLabel ">>genHash" test_genHash , TestLabel ">>checkHash" test_checkHash ]
117
spec = fromHUnitTest $ TestList [ TestLabel ">>genHash" test_genHash , TestLabel ">>checkHash" test_checkHash ]
117
false
false
3
7
19
33
14
19
null
null
cbrghostrider/Hacking
HackerRank/FunctionalProgramming/Recursion/convexHull.hs
mit
distFinal = distance (head prms) (last prms)
44
distFinal = distance (head prms) (last prms)
44
distFinal = distance (head prms) (last prms)
44
false
false
0
7
6
23
11
12
null
null
tpltnt/Tidal
Sound/Tidal/Strategies.hs
gpl-3.0
{- scrumple :: Time -> Pattern a -> Pattern a -> Pattern a scrumple o p p' = p'' -- overlay p (o ~> p'') where p'' = Pattern $ \a -> concatMap (\((s,d), vs) -> map (\x -> ((s,d), snd x ) ) (arc p' (s,s)) ) (arc p a) -} --rev :: Pattern a -> Pattern a --rev p = Pattern $ \a -> concatMap -- (\a' -> mapFsts mirrorArc $ -- (arc p (mirrorArc a'))) -- (arcCycles a) --spreadf :: [Pattern a -> Pattern b] -> Pattern a -> Pattern b spreadf ts p = spread ($)
814
spreadf ts p = spread ($)
25
spreadf ts p = spread ($)
25
true
false
1
5
462
28
15
13
null
null
gafiatulin/codewars
src/6 kyu/Sumdignth.hs
mit
sumDigNthTerm :: Int -> [Int] -> Int -> Int sumDigNthTerm initval patternl nthterm = sum . map digitToInt . show . (!! pred nthterm) . scanl (+) initval . cycle $ patternl
171
sumDigNthTerm :: Int -> [Int] -> Int -> Int sumDigNthTerm initval patternl nthterm = sum . map digitToInt . show . (!! pred nthterm) . scanl (+) initval . cycle $ patternl
171
sumDigNthTerm initval patternl nthterm = sum . map digitToInt . show . (!! pred nthterm) . scanl (+) initval . cycle $ patternl
127
false
true
0
11
31
79
39
40
null
null
AndrewRademacher/stack
src/Stack/Ghci.hs
bsd-3-clause
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif {- Copied from Stack.Ide, may be useful in the future -- | Get options and target files for the given package info. getPackageOptsAndTargetFiles :: (MonadThrow m, MonadIO m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> GhciPkgInfo -> m ([FilePath], [FilePath]) getPackageOptsAndTargetFiles pwd pkg = do dist <- distDirFromDir (ghciPkgDir pkg) let autogen = autogenDir dist paths_foo <- liftM (autogen </>) (parseRelFile ("Paths_" ++ packageNameString (ghciPkgName pkg) ++ ".hs")) paths_foo_exists <- doesFileExist paths_foo let ghcOptions bio = bioOneWordOpts bio ++ bioOpts bio ++ bioPackageFlags bio ++ maybe [] (\cabalMacros -> ["-optP-include", "-optP" <> toFilePath cabalMacros]) (bioCabalMacros bio) return ( ("--dist-dir=" <> toFilePathNoTrailingSep dist) : map ("--ghc-option=" ++) (concatMap (ghcOptions . snd) (ghciPkgOpts pkg)) , mapMaybe (fmap toFilePath . stripDir pwd) (S.toList (ghciPkgCFiles pkg) <> S.toList (ghciPkgModFiles pkg) <> [paths_foo | paths_foo_exists])) -- | List load targets for a package target. targetsCmd :: Text -> GlobalOpts -> IO () targetsCmd target go@GlobalOpts{..} = withBuildConfig go $ do let boptsCli = defaultBuildOptsCLI { boptsCLITargets = [target] } (_realTargets,_,pkgs) <- ghciSetup (ideGhciOpts boptsCli) pwd <- getCurrentDir targets <- fmap (concat . snd . unzip) (mapM (getPackageOptsAndTargetFiles pwd) pkgs) forM_ targets (liftIO . putStrLn) -}
1,955
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif {- Copied from Stack.Ide, may be useful in the future -- | Get options and target files for the given package info. getPackageOptsAndTargetFiles :: (MonadThrow m, MonadIO m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> GhciPkgInfo -> m ([FilePath], [FilePath]) getPackageOptsAndTargetFiles pwd pkg = do dist <- distDirFromDir (ghciPkgDir pkg) let autogen = autogenDir dist paths_foo <- liftM (autogen </>) (parseRelFile ("Paths_" ++ packageNameString (ghciPkgName pkg) ++ ".hs")) paths_foo_exists <- doesFileExist paths_foo let ghcOptions bio = bioOneWordOpts bio ++ bioOpts bio ++ bioPackageFlags bio ++ maybe [] (\cabalMacros -> ["-optP-include", "-optP" <> toFilePath cabalMacros]) (bioCabalMacros bio) return ( ("--dist-dir=" <> toFilePathNoTrailingSep dist) : map ("--ghc-option=" ++) (concatMap (ghcOptions . snd) (ghciPkgOpts pkg)) , mapMaybe (fmap toFilePath . stripDir pwd) (S.toList (ghciPkgCFiles pkg) <> S.toList (ghciPkgModFiles pkg) <> [paths_foo | paths_foo_exists])) -- | List load targets for a package target. targetsCmd :: Text -> GlobalOpts -> IO () targetsCmd target go@GlobalOpts{..} = withBuildConfig go $ do let boptsCli = defaultBuildOptsCLI { boptsCLITargets = [target] } (_realTargets,_,pkgs) <- ghciSetup (ideGhciOpts boptsCli) pwd <- getCurrentDir targets <- fmap (concat . snd . unzip) (mapM (getPackageOptsAndTargetFiles pwd) pkgs) forM_ targets (liftIO . putStrLn) -}
1,955
setScriptPerms _ = do return () #else setScriptPerms fp = do liftIO $ Posix.setFileMode fp $ foldl1 Posix.unionFileModes [ Posix.ownerReadMode , Posix.ownerWriteMode , Posix.groupReadMode , Posix.otherReadMode ] #endif {- Copied from Stack.Ide, may be useful in the future -- | Get options and target files for the given package info. getPackageOptsAndTargetFiles :: (MonadThrow m, MonadIO m, MonadReader env m, HasEnvConfig env) => Path Abs Dir -> GhciPkgInfo -> m ([FilePath], [FilePath]) getPackageOptsAndTargetFiles pwd pkg = do dist <- distDirFromDir (ghciPkgDir pkg) let autogen = autogenDir dist paths_foo <- liftM (autogen </>) (parseRelFile ("Paths_" ++ packageNameString (ghciPkgName pkg) ++ ".hs")) paths_foo_exists <- doesFileExist paths_foo let ghcOptions bio = bioOneWordOpts bio ++ bioOpts bio ++ bioPackageFlags bio ++ maybe [] (\cabalMacros -> ["-optP-include", "-optP" <> toFilePath cabalMacros]) (bioCabalMacros bio) return ( ("--dist-dir=" <> toFilePathNoTrailingSep dist) : map ("--ghc-option=" ++) (concatMap (ghcOptions . snd) (ghciPkgOpts pkg)) , mapMaybe (fmap toFilePath . stripDir pwd) (S.toList (ghciPkgCFiles pkg) <> S.toList (ghciPkgModFiles pkg) <> [paths_foo | paths_foo_exists])) -- | List load targets for a package target. targetsCmd :: Text -> GlobalOpts -> IO () targetsCmd target go@GlobalOpts{..} = withBuildConfig go $ do let boptsCli = defaultBuildOptsCLI { boptsCLITargets = [target] } (_realTargets,_,pkgs) <- ghciSetup (ideGhciOpts boptsCli) pwd <- getCurrentDir targets <- fmap (concat . snd . unzip) (mapM (getPackageOptsAndTargetFiles pwd) pkgs) forM_ targets (liftIO . putStrLn) -}
1,955
false
false
0
8
546
20
10
10
null
null
olorin/amazonka
amazonka-ec2/gen/Network/AWS/EC2/RunInstances.hs
mpl-2.0
-- | If you set this parameter to 'true', you can\'t terminate the instance -- using the Amazon EC2 console, CLI, or API; otherwise, you can. If you -- set this parameter to 'true' and then later want to be able to terminate -- the instance, you must first change the value of the -- 'disableApiTermination' attribute to 'false' using -- ModifyInstanceAttribute. Alternatively, if you set -- 'InstanceInitiatedShutdownBehavior' to 'terminate', you can terminate -- the instance by running the shutdown command from the instance. -- -- Default: 'false' rDisableAPITermination :: Lens' RunInstances (Maybe Bool) rDisableAPITermination = lens _rDisableAPITermination (\ s a -> s{_rDisableAPITermination = a})
705
rDisableAPITermination :: Lens' RunInstances (Maybe Bool) rDisableAPITermination = lens _rDisableAPITermination (\ s a -> s{_rDisableAPITermination = a})
153
rDisableAPITermination = lens _rDisableAPITermination (\ s a -> s{_rDisableAPITermination = a})
95
true
true
0
9
104
55
34
21
null
null
stevedonnelly/haskell
code/Geometry/Line.hs
mit
projectionScalar = \line point -> let in (V.projectionScalar (direction line) (V.subtract point (point0 line)))
115
projectionScalar = \line point -> let in (V.projectionScalar (direction line) (V.subtract point (point0 line)))
115
projectionScalar = \line point -> let in (V.projectionScalar (direction line) (V.subtract point (point0 line)))
115
false
false
1
14
17
54
25
29
null
null
Physwf/physwf-haskell-lab
maximum.hs
apache-2.0
maximum' :: (Ord a) => [a] -> a maximum' [] = error "Cant apply to empty list!"
79
maximum' :: (Ord a) => [a] -> a maximum' [] = error "Cant apply to empty list!"
79
maximum' [] = error "Cant apply to empty list!"
47
false
true
0
7
16
35
18
17
null
null
cpdurham/accelerate-camera-sandbox
src/Fluid/Pipe.hs
bsd-3-clause
fromVectorSource :: Acc ((DensitySource, VelocitySource), DensityField, VelocityField) -> (Acc DensityField, Acc VelocityField) fromVectorSource input = let (sources,df,vf) = unlift input :: (Acc (DensitySource, VelocitySource), Acc DensityField, Acc VelocityField) (ds,vs) = unlift sources df' = inject ds df vf' = inject vs vf in (df',vf')
375
fromVectorSource :: Acc ((DensitySource, VelocitySource), DensityField, VelocityField) -> (Acc DensityField, Acc VelocityField) fromVectorSource input = let (sources,df,vf) = unlift input :: (Acc (DensitySource, VelocitySource), Acc DensityField, Acc VelocityField) (ds,vs) = unlift sources df' = inject ds df vf' = inject vs vf in (df',vf')
375
fromVectorSource input = let (sources,df,vf) = unlift input :: (Acc (DensitySource, VelocitySource), Acc DensityField, Acc VelocityField) (ds,vs) = unlift sources df' = inject ds df vf' = inject vs vf in (df',vf')
243
false
true
0
11
77
146
76
70
null
null
rbermani/ib-api
src/IB/Client/Exception.hs
gpl-3.0
excToPair FailSendCanHistData= (528, "Cancel Historical Data Sending Error - ")
79
excToPair FailSendCanHistData= (528, "Cancel Historical Data Sending Error - ")
79
excToPair FailSendCanHistData= (528, "Cancel Historical Data Sending Error - ")
79
false
false
0
5
9
16
8
8
null
null
Kagami/cirno
src/Network/XMPP/XML.hs
bsd-3-clause
getCData _ = Nothing
20
getCData _ = Nothing
20
getCData _ = Nothing
20
false
false
0
5
3
9
4
5
null
null
tpsinnem/Idris-dev
src/Idris/Core/ProofTerm.hs
bsd-3-clause
same (Just x) n = x == n
24
same (Just x) n = x == n
24
same (Just x) n = x == n
24
false
false
1
8
7
25
10
15
null
null
kmate/HaRe
old/testing/simplifyExpr/ListToMaybeIn1AST.hs
bsd-3-clause
listToMaybe :: [a] -> Maybe a listToMaybe [] = Nothing
56
listToMaybe :: [a] -> Maybe a listToMaybe [] = Nothing
54
listToMaybe [] = Nothing
24
false
true
0
6
11
30
14
16
null
null
gridaphobe/ghc
compiler/types/OptCoercion.hs
bsd-3-clause
etaTyConAppCo_maybe :: TyCon -> Coercion -> Maybe [Coercion] -- If possible, split a coercion -- g :: T s1 .. sn ~ T t1 .. tn -- into [ Nth 0 g :: s1~t1, ..., Nth (n-1) g :: sn~tn ] etaTyConAppCo_maybe tc (TyConAppCo _ tc2 cos2) = ASSERT( tc == tc2 ) Just cos2
268
etaTyConAppCo_maybe :: TyCon -> Coercion -> Maybe [Coercion] etaTyConAppCo_maybe tc (TyConAppCo _ tc2 cos2) = ASSERT( tc == tc2 ) Just cos2
141
etaTyConAppCo_maybe tc (TyConAppCo _ tc2 cos2) = ASSERT( tc == tc2 ) Just cos2
80
true
true
0
8
62
63
31
32
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/playpen/aeson/src/AesonTut.hs
unlicense
createPrivacy3 :: Parser String -> Parser Privacy3 createPrivacy3 x = x >>= \c -> case c of "EVERYONE" -> return Everyone3 "ALL_FRIENDS" -> return AllFriends3 "FRIENDS_OF_FRIENDS" -> return FriendsOfFriends3 "SELF" -> return Self3 _ -> error "Invalid privacy setting!"
422
createPrivacy3 :: Parser String -> Parser Privacy3 createPrivacy3 x = x >>= \c -> case c of "EVERYONE" -> return Everyone3 "ALL_FRIENDS" -> return AllFriends3 "FRIENDS_OF_FRIENDS" -> return FriendsOfFriends3 "SELF" -> return Self3 _ -> error "Invalid privacy setting!"
422
createPrivacy3 x = x >>= \c -> case c of "EVERYONE" -> return Everyone3 "ALL_FRIENDS" -> return AllFriends3 "FRIENDS_OF_FRIENDS" -> return FriendsOfFriends3 "SELF" -> return Self3 _ -> error "Invalid privacy setting!"
371
false
true
0
10
192
82
38
44
null
null
evanrinehart/lowgl
Graphics/GL/Low/Texture.hs
bsd-2-clause
setCubeMapFiltering :: Filtering -> IO () setCubeMapFiltering filt = do glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MIN_FILTER (toGL filt) glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MAG_FILTER (toGL filt) -- | Set the wrapping mode for the 2D texture currently bound to the 2D -- texture binding target.
315
setCubeMapFiltering :: Filtering -> IO () setCubeMapFiltering filt = do glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MIN_FILTER (toGL filt) glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MAG_FILTER (toGL filt) -- | Set the wrapping mode for the 2D texture currently bound to the 2D -- texture binding target.
315
setCubeMapFiltering filt = do glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MIN_FILTER (toGL filt) glTexParameteri GL_TEXTURE_CUBE_MAP GL_TEXTURE_MAG_FILTER (toGL filt) -- | Set the wrapping mode for the 2D texture currently bound to the 2D -- texture binding target.
273
false
true
0
10
43
61
28
33
null
null
thalerjonathan/phd
public/ArtIterating/code/haskell/PureAgentsSeq/src/SpacialGameMsg/SGModelMsg.hs
gpl-3.0
sgStateMsg :: SGAgent -> SGState -> SGAgent sgStateMsg a s = if ( allNeighboursTicked a'' ) then broadCastLocalPayoff a'' else a'' where lp = sgLocalPayoff (PA.state a) poIncrease = payoffWith a s newLp = lp + poIncrease a' = PA.updateState a (\s -> s { sgLocalPayoff = newLp }) a'' = tickNeighbourFlag a'
413
sgStateMsg :: SGAgent -> SGState -> SGAgent sgStateMsg a s = if ( allNeighboursTicked a'' ) then broadCastLocalPayoff a'' else a'' where lp = sgLocalPayoff (PA.state a) poIncrease = payoffWith a s newLp = lp + poIncrease a' = PA.updateState a (\s -> s { sgLocalPayoff = newLp }) a'' = tickNeighbourFlag a'
413
sgStateMsg a s = if ( allNeighboursTicked a'' ) then broadCastLocalPayoff a'' else a'' where lp = sgLocalPayoff (PA.state a) poIncrease = payoffWith a s newLp = lp + poIncrease a' = PA.updateState a (\s -> s { sgLocalPayoff = newLp }) a'' = tickNeighbourFlag a'
369
false
true
0
11
160
114
60
54
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/IAMAccessKey.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-iam-accesskey.html#cfn-iam-accesskey-username iamakUserName :: Lens' IAMAccessKey (Val Text) iamakUserName = lens _iAMAccessKeyUserName (\s a -> s { _iAMAccessKeyUserName = a })
259
iamakUserName :: Lens' IAMAccessKey (Val Text) iamakUserName = lens _iAMAccessKeyUserName (\s a -> s { _iAMAccessKeyUserName = a })
131
iamakUserName = lens _iAMAccessKeyUserName (\s a -> s { _iAMAccessKeyUserName = a })
84
true
true
0
9
21
46
25
21
null
null
cryptica/CodeEval
Challenges/84_BalancedSmileys/main.hs
gpl-3.0
processLine :: String -> String processLine line = if any (=="") $ parseLine line then "YES" else "NO"
106
processLine :: String -> String processLine line = if any (=="") $ parseLine line then "YES" else "NO"
106
processLine line = if any (=="") $ parseLine line then "YES" else "NO"
74
false
true
0
8
21
46
22
24
null
null
bkoropoff/Idris-dev
src/Idris/IdeMode.hs
bsd-3-clause
sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name)
130
sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name)
130
sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name)
130
false
false
0
9
15
50
24
26
null
null
projectorhq/haskell-liquid
test/Text/Liquid/ParserTests.hs
bsd-3-clause
case_elseClause2 = parseOnly elseClause "{%else%}" @?= Right Else
65
case_elseClause2 = parseOnly elseClause "{%else%}" @?= Right Else
65
case_elseClause2 = parseOnly elseClause "{%else%}" @?= Right Else
65
false
false
1
6
7
22
8
14
null
null
haskell/haddock
hypsrc-test/src/TemplateHaskellSplices.hs
bsd-2-clause
foo = id $(anExpression2)
25
foo = id $(anExpression2)
25
foo = id $(anExpression2)
25
false
false
0
7
3
13
6
7
null
null
vTurbine/ghc
compiler/basicTypes/VarSet.hs
bsd-3-clause
extendVarSet_C = addOneToUniqSet_C
35
extendVarSet_C = addOneToUniqSet_C
35
extendVarSet_C = addOneToUniqSet_C
35
false
false
0
4
3
6
3
3
null
null
CIFASIS/megadeth
Megadeth/Prim.hs
bsd-3-clause
tocheck :: [TyVarBndr] -> Name -> Type tocheck bndrs nm = let ns = map VarT $ paramNames bndrs in foldl AppT (ConT nm) ns
125
tocheck :: [TyVarBndr] -> Name -> Type tocheck bndrs nm = let ns = map VarT $ paramNames bndrs in foldl AppT (ConT nm) ns
125
tocheck bndrs nm = let ns = map VarT $ paramNames bndrs in foldl AppT (ConT nm) ns
86
false
true
0
10
28
66
30
36
null
null
Super-Fluid/heqet
Heqet/Input/Parse.hs
gpl-3.0
{- Transformation. -} pitch5toPitch :: Tree5 -> Tree6 pitch5toPitch (ParallelY muss) = ParallelY (map pitch5toPitch muss)
123
pitch5toPitch :: Tree5 -> Tree6 pitch5toPitch (ParallelY muss) = ParallelY (map pitch5toPitch muss)
99
pitch5toPitch (ParallelY muss) = ParallelY (map pitch5toPitch muss)
67
true
true
0
7
17
36
18
18
null
null
josefs/autosar
ARSim/arsim/AUTOSAR/ARSim.hs
bsd-3-clause
{- There are two ways to run the Simulink model. One way is to run the simulation - from Simulink directly (for example by using the MATLAB gui). In this case - it's the Simulink C stub that creates named pipes and launches the - Haskell AUTOSAR simulator (handled by simulateUsingExternal). - The second way is to run the Haskell 'driver', which sets up the - environment (the named pipes) and launches the Simulink model (simulateDriveExternal). - The Simulink C stub realizes that it should not set up the environment - by looking at the environment variable ARSIM_DRIVER. -} -- | Use this function to create a runnable @main@ for the simulator software -- when connecting with external software, i.e. Simulink. simulateUsingExternal :: External a => Bool -> AUTOSAR a -> TFGen -> IO (a, Trace) simulateUsingExternal useTasks sys rng = do args <- getArgs case args of [inFifo, outFifo] -> runWithFIFOs useTasks rng inFifo outFifo sys _ -> do logWrite $ "Wrong number of arguments. Proceeding with default " ++ "FIFOs." runWithFIFOs useTasks rng "/tmp/infifo" "/tmp/outfifo" sys -- | Run the simulation with external software (i.e. Simulink) by -- starting the external component from Haskell, and clean up afterwards.
1,289
simulateUsingExternal :: External a => Bool -> AUTOSAR a -> TFGen -> IO (a, Trace) simulateUsingExternal useTasks sys rng = do args <- getArgs case args of [inFifo, outFifo] -> runWithFIFOs useTasks rng inFifo outFifo sys _ -> do logWrite $ "Wrong number of arguments. Proceeding with default " ++ "FIFOs." runWithFIFOs useTasks rng "/tmp/infifo" "/tmp/outfifo" sys -- | Run the simulation with external software (i.e. Simulink) by -- starting the external component from Haskell, and clean up afterwards.
566
simulateUsingExternal useTasks sys rng = do args <- getArgs case args of [inFifo, outFifo] -> runWithFIFOs useTasks rng inFifo outFifo sys _ -> do logWrite $ "Wrong number of arguments. Proceeding with default " ++ "FIFOs." runWithFIFOs useTasks rng "/tmp/infifo" "/tmp/outfifo" sys -- | Run the simulation with external software (i.e. Simulink) by -- starting the external component from Haskell, and clean up afterwards.
483
true
true
0
13
268
122
61
61
null
null
kawu/french-tag
src/NLP/Partage4Xmg/Ensemble.hs
bsd-2-clause
getTrees :: Grammar -> Term -- ^ A wordform -> Morph.Ana -- ^ The analysis corresponding the wordform -- -> [(Tree Term, C.Comp CFS)] -> [(C.TreeID, Env.EnvM Val (FSTree Term Key))] getTrees gram term ana -- = mapMaybe process = map process . M.toList $ _getTrees gram ana where -- process tree = splitFSTree . fmap simplifyFS $ do process (tree, treeID) = (treeID,) . fmap simplify $ do -- let term = Morph.lemma ana converted <- withVarMap (convert tree) let fs = closeAVM $ G.XAVM { G.bot = Just (Morph.avm ana) , G.top = Nothing , G.reg = [] } anchor term (Morph.word ana) fs converted -- convert and close the given XMG AVM. closeAVM :: G.XAVM -> CFS Key Val closeAVM avm = maybe M.empty id . fst . Env.runEnvM $ do fs <- withVarMap $ convertXAVM Leaf avm FS.close fs -- -- | Convert an XMG-style AVM to a FS. -- convertAVM :: G.AVM -> E.StateT VarMap (Env.EnvM Val) (OFS Key)
1,016
getTrees :: Grammar -> Term -- ^ A wordform -> Morph.Ana -- ^ The analysis corresponding the wordform -- -> [(Tree Term, C.Comp CFS)] -> [(C.TreeID, Env.EnvM Val (FSTree Term Key))] getTrees gram term ana -- = mapMaybe process = map process . M.toList $ _getTrees gram ana where -- process tree = splitFSTree . fmap simplifyFS $ do process (tree, treeID) = (treeID,) . fmap simplify $ do -- let term = Morph.lemma ana converted <- withVarMap (convert tree) let fs = closeAVM $ G.XAVM { G.bot = Just (Morph.avm ana) , G.top = Nothing , G.reg = [] } anchor term (Morph.word ana) fs converted -- convert and close the given XMG AVM. closeAVM :: G.XAVM -> CFS Key Val closeAVM avm = maybe M.empty id . fst . Env.runEnvM $ do fs <- withVarMap $ convertXAVM Leaf avm FS.close fs -- -- | Convert an XMG-style AVM to a FS. -- convertAVM :: G.AVM -> E.StateT VarMap (Env.EnvM Val) (OFS Key)
1,016
getTrees gram term ana -- = mapMaybe process = map process . M.toList $ _getTrees gram ana where -- process tree = splitFSTree . fmap simplifyFS $ do process (tree, treeID) = (treeID,) . fmap simplify $ do -- let term = Morph.lemma ana converted <- withVarMap (convert tree) let fs = closeAVM $ G.XAVM { G.bot = Just (Morph.avm ana) , G.top = Nothing , G.reg = [] } anchor term (Morph.word ana) fs converted -- convert and close the given XMG AVM. closeAVM :: G.XAVM -> CFS Key Val closeAVM avm = maybe M.empty id . fst . Env.runEnvM $ do fs <- withVarMap $ convertXAVM Leaf avm FS.close fs -- -- | Convert an XMG-style AVM to a FS. -- convertAVM :: G.AVM -> E.StateT VarMap (Env.EnvM Val) (OFS Key)
814
false
true
10
18
298
257
134
123
null
null
jaalonso/I1M-Cod-Temas
src/Tema_7.hs
gpl-2.0
dosVecesSC f x = f (f x)
33
dosVecesSC f x = f (f x)
33
dosVecesSC f x = f (f x)
33
false
false
0
7
15
20
9
11
null
null
dbp/thistle
src/Lang.hs
isc
tc _ env (EDot e f) = case fst $ tc False env e of to@(TObject fs) -> case M.lookup f fs of Just t -> (t, env) Nothing -> error $ "tc: field " <> show f <> " not found on object: " <> show to t -> error $ "tc: got non-object in dot: " <> show t
291
tc _ env (EDot e f) = case fst $ tc False env e of to@(TObject fs) -> case M.lookup f fs of Just t -> (t, env) Nothing -> error $ "tc: field " <> show f <> " not found on object: " <> show to t -> error $ "tc: got non-object in dot: " <> show t
291
tc _ env (EDot e f) = case fst $ tc False env e of to@(TObject fs) -> case M.lookup f fs of Just t -> (t, env) Nothing -> error $ "tc: field " <> show f <> " not found on object: " <> show to t -> error $ "tc: got non-object in dot: " <> show t
291
false
false
1
14
107
125
59
66
null
null
rfranek/duckling
Duckling/Dimensions.hs
bsd-3-clause
langDimensions EN = ENDimensions.allDimensions
46
langDimensions EN = ENDimensions.allDimensions
46
langDimensions EN = ENDimensions.allDimensions
46
false
false
0
5
3
11
5
6
null
null
sdiehl/ghc
compiler/nativeGen/X86/Instr.hs
bsd-3-clause
x86_jumpDestsOfInstr :: Instr -> [BlockId] x86_jumpDestsOfInstr insn = case insn of JXX _ id -> [id] JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] _ -> []
229
x86_jumpDestsOfInstr :: Instr -> [BlockId] x86_jumpDestsOfInstr insn = case insn of JXX _ id -> [id] JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] _ -> []
228
x86_jumpDestsOfInstr insn = case insn of JXX _ id -> [id] JMP_TBL _ ids _ _ -> [id | Just (DestBlockId id) <- ids] _ -> []
169
false
true
0
13
95
88
42
46
null
null
gridaphobe/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
collectStmtsBinders :: [StmtLR idL idR body] -> [idL] collectStmtsBinders = concatMap collectStmtBinders
104
collectStmtsBinders :: [StmtLR idL idR body] -> [idL] collectStmtsBinders = concatMap collectStmtBinders
104
collectStmtsBinders = concatMap collectStmtBinders
50
false
true
0
7
11
31
16
15
null
null
huggaida/haskell-game
.stack-work/dist/x86_64-linux/Cabal-1.22.4.0/build/autogen/Paths_haskell_game.hs
bsd-3-clause
getDataFileName :: FilePath -> IO FilePath getDataFileName name = do dir <- getDataDir return (dir ++ "/" ++ name)
118
getDataFileName :: FilePath -> IO FilePath getDataFileName name = do dir <- getDataDir return (dir ++ "/" ++ name)
118
getDataFileName name = do dir <- getDataDir return (dir ++ "/" ++ name)
75
false
true
0
10
22
45
21
24
null
null
saltlang/compiler-toolbox
src/Control/Monad/Positions.hs
bsd-3-clause
fileInfo' :: Monad m => Filename -> (ReaderT Info m) FileInfo fileInfo' pos = liftM ((! pos) . fileInfoArray) ask
113
fileInfo' :: Monad m => Filename -> (ReaderT Info m) FileInfo fileInfo' pos = liftM ((! pos) . fileInfoArray) ask
113
fileInfo' pos = liftM ((! pos) . fileInfoArray) ask
51
false
true
0
10
19
56
27
29
null
null
rueshyna/gogol
gogol-android-publisher/gen/Network/Google/Resource/AndroidPublisher/InAppProducts/Update.hs
mpl-2.0
-- | Multipart request metadata. iapuPayload :: Lens' InAppProductsUpdate InAppProduct iapuPayload = lens _iapuPayload (\ s a -> s{_iapuPayload = a})
151
iapuPayload :: Lens' InAppProductsUpdate InAppProduct iapuPayload = lens _iapuPayload (\ s a -> s{_iapuPayload = a})
118
iapuPayload = lens _iapuPayload (\ s a -> s{_iapuPayload = a})
64
true
true
0
9
22
42
22
20
null
null
zhangjiji/real-world-haskell
ch14/Random.hs
mit
getTwoRandoms :: Random a => RandomState (a, a) getTwoRandoms = liftM2 (,) getRandom getRandom
94
getTwoRandoms :: Random a => RandomState (a, a) getTwoRandoms = liftM2 (,) getRandom getRandom
94
getTwoRandoms = liftM2 (,) getRandom getRandom
46
false
true
0
8
13
42
20
22
null
null
ihc/futhark
src/Futhark/Representation/ExplicitMemory/IndexFunction.hs
isc
rotate ixfun offsets = Rotate ixfun offsets
43
rotate ixfun offsets = Rotate ixfun offsets
43
rotate ixfun offsets = Rotate ixfun offsets
43
false
false
1
5
6
21
7
14
null
null
robdockins/edison
test/src/Data/Edison/Test/Bag.hs
mit
prop_member_count :: BagTest Int bag => bag Int -> Int -> bag Int -> Bool prop_member_count bag x xs = member x xs == (c > 0) && c == Prelude.length (Prelude.filter (== x) (toOrdList xs)) where c = count x xs ------------------------------------------------------- -- Coll operations
298
prop_member_count :: BagTest Int bag => bag Int -> Int -> bag Int -> Bool prop_member_count bag x xs = member x xs == (c > 0) && c == Prelude.length (Prelude.filter (== x) (toOrdList xs)) where c = count x xs ------------------------------------------------------- -- Coll operations
298
prop_member_count bag x xs = member x xs == (c > 0) && c == Prelude.length (Prelude.filter (== x) (toOrdList xs)) where c = count x xs ------------------------------------------------------- -- Coll operations
224
false
true
0
10
60
109
54
55
null
null
olsner/ghc
compiler/nativeGen/PprBase.hs
bsd-3-clause
-- ---------------------------------------------------------------------------- -- Printing section headers. -- -- If -split-section was specified, include the suffix label, otherwise just -- print the section type. For Darwin, where subsections-for-symbols are -- used instead, only print section type. -- -- For string literals, additional flags are specified to enable merging of -- identical strings in the linker. With -split-sections each string also gets -- a unique section to allow strings from unused code to be GC'd. pprSectionHeader :: Platform -> Section -> SDoc pprSectionHeader platform (Section t suffix) = case platformOS platform of OSAIX -> pprXcoffSectionHeader t OSDarwin -> pprDarwinSectionHeader t _ -> pprGNUSectionHeader t suffix
775
pprSectionHeader :: Platform -> Section -> SDoc pprSectionHeader platform (Section t suffix) = case platformOS platform of OSAIX -> pprXcoffSectionHeader t OSDarwin -> pprDarwinSectionHeader t _ -> pprGNUSectionHeader t suffix
246
pprSectionHeader platform (Section t suffix) = case platformOS platform of OSAIX -> pprXcoffSectionHeader t OSDarwin -> pprDarwinSectionHeader t _ -> pprGNUSectionHeader t suffix
198
true
true
0
8
123
78
42
36
null
null
olsner/ghc
testsuite/tests/programs/life_space_leak/Main.hs
bsd-3-clause
append3 :: L Int -> L Int -> L Int append3 N ys = ys
52
append3 :: L Int -> L Int -> L Int append3 N ys = ys
52
append3 N ys = ys
17
false
true
0
7
14
38
16
22
null
null
Purview/purview
src/Graphics/Forensics/Analyser.hs
gpl-3.0
-- | Reports something with a 'CriticalLevel' of importance reportCritical :: Text -> ReportData -> Analysis () reportCritical msg = reportEntry . ReportEntry CriticalLevel msg
176
reportCritical :: Text -> ReportData -> Analysis () reportCritical msg = reportEntry . ReportEntry CriticalLevel msg
116
reportCritical msg = reportEntry . ReportEntry CriticalLevel msg
64
true
true
0
8
24
37
18
19
null
null
mavenraven/github
samples/Pulls/ShowCommits.hs
bsd-3-clause
main = do possiblePullRequestCommits <- Github.pullRequestCommits "thoughtbot" "paperclip" 575 case possiblePullRequestCommits of (Left error) -> putStrLn $ "Error: " ++ (show error) (Right commits) -> putStrLn $ intercalate "\n" $ map formatCommit commits
277
main = do possiblePullRequestCommits <- Github.pullRequestCommits "thoughtbot" "paperclip" 575 case possiblePullRequestCommits of (Left error) -> putStrLn $ "Error: " ++ (show error) (Right commits) -> putStrLn $ intercalate "\n" $ map formatCommit commits
277
main = do possiblePullRequestCommits <- Github.pullRequestCommits "thoughtbot" "paperclip" 575 case possiblePullRequestCommits of (Left error) -> putStrLn $ "Error: " ++ (show error) (Right commits) -> putStrLn $ intercalate "\n" $ map formatCommit commits
277
false
false
0
12
53
83
39
44
null
null
janschulz/pandoc
src/Text/Pandoc/Readers/Markdown.hs
gpl-2.0
lhsCodeBlockBird :: MarkdownParser String lhsCodeBlockBird = lhsCodeBlockBirdWith '>'
85
lhsCodeBlockBird :: MarkdownParser String lhsCodeBlockBird = lhsCodeBlockBirdWith '>'
85
lhsCodeBlockBird = lhsCodeBlockBirdWith '>'
43
false
true
0
5
7
17
8
9
null
null
input-output-hk/pos-haskell-prototype
crypto/test/Test/Pos/Crypto/Json.hs
mit
-- Legacy JSON encoding where requiresNetworkMagic was -- encoded as "NMMustBeNothing" or "NMMustBeJust" golden_ProtocolMagic3AesonDec_NMMustBeJust :: Property golden_ProtocolMagic3AesonDec_NMMustBeJust = goldenTestJSONDec exampleProtocolMagic3 "test/golden/json/ProtocolMagic_Legacy_NMMustBeJust"
322
golden_ProtocolMagic3AesonDec_NMMustBeJust :: Property golden_ProtocolMagic3AesonDec_NMMustBeJust = goldenTestJSONDec exampleProtocolMagic3 "test/golden/json/ProtocolMagic_Legacy_NMMustBeJust"
216
golden_ProtocolMagic3AesonDec_NMMustBeJust = goldenTestJSONDec exampleProtocolMagic3 "test/golden/json/ProtocolMagic_Legacy_NMMustBeJust"
161
true
true
0
5
45
18
10
8
null
null
sdiehl/ghc
libraries/ghci/GHCi/ResolvedBCO.hs
bsd-3-clause
isLittleEndian = True
21
isLittleEndian = True
21
isLittleEndian = True
21
false
false
1
5
2
10
3
7
null
null
urbanslug/ghc
testsuite/tests/codeGen/should_run/T8103_A.hs
bsd-3-clause
foo :: Double# -> Double# -> Double# foo a b = (a +## b)
57
foo :: Double# -> Double# -> Double# foo a b = (a +## b)
57
foo a b = (a +## b)
19
false
true
0
8
14
37
17
20
null
null
dbp/karamaan-opaleye
Karamaan/Opaleye/Predicates.hs
bsd-3-clause
wireIs :: Wire a -> Literal -> PrimExpr wireIs = wireOp OpEq
60
wireIs :: Wire a -> Literal -> PrimExpr wireIs = wireOp OpEq
60
wireIs = wireOp OpEq
20
false
true
0
6
11
25
12
13
null
null
revnull/noisefunge
src/Language/NoiseFunge/Befunge/Process.hs
gpl-3.0
-- Convert a list of lines into a program array. The height will be the number -- of lines and the width will be the length of the longest line. makeProgArray :: [String] -> ProgArray makeProgArray strs = arr where rows = fromIntegral $ length strs cols = fromIntegral $ maximum $ fmap length strs bnds = ((0,0), (rows-1, cols-1)) arr = array bnds $ do (r, row) <- zip [0..] strs (c, char) <- zip [0..cols-1] (row ++ pad) return ((r,c), fromIntegral $ ord char) pad = repeat ' '
523
makeProgArray :: [String] -> ProgArray makeProgArray strs = arr where rows = fromIntegral $ length strs cols = fromIntegral $ maximum $ fmap length strs bnds = ((0,0), (rows-1, cols-1)) arr = array bnds $ do (r, row) <- zip [0..] strs (c, char) <- zip [0..cols-1] (row ++ pad) return ((r,c), fromIntegral $ ord char) pad = repeat ' '
378
makeProgArray strs = arr where rows = fromIntegral $ length strs cols = fromIntegral $ maximum $ fmap length strs bnds = ((0,0), (rows-1, cols-1)) arr = array bnds $ do (r, row) <- zip [0..] strs (c, char) <- zip [0..cols-1] (row ++ pad) return ((r,c), fromIntegral $ ord char) pad = repeat ' '
339
true
true
12
10
135
208
101
107
null
null
redelmann/haskell-unix-utilities
iconv/Main.hs
bsd-3-clause
options :: Parser Options options = Options <$> optional (strOption (short 'f' <> long "from-code" <> help "Specify the encoding of the input" <> metavar "encoding")) <*> optional (strOption (short 't' <> long "to-code" <> help "Specify the encoding of the output" <> metavar "encoding")) <*> arguments str (metavar "input files...")
489
options :: Parser Options options = Options <$> optional (strOption (short 'f' <> long "from-code" <> help "Specify the encoding of the input" <> metavar "encoding")) <*> optional (strOption (short 't' <> long "to-code" <> help "Specify the encoding of the output" <> metavar "encoding")) <*> arguments str (metavar "input files...")
489
options = Options <$> optional (strOption (short 'f' <> long "from-code" <> help "Specify the encoding of the input" <> metavar "encoding")) <*> optional (strOption (short 't' <> long "to-code" <> help "Specify the encoding of the output" <> metavar "encoding")) <*> arguments str (metavar "input files...")
463
false
true
0
15
206
109
50
59
null
null
pparkkin/eta
compiler/ETA/CodeGen/Bind.hs
bsd-3-clause
cgRhs recIds name (StgRhsClosure _ binderInfo fvs updateFlag _ args body) = mkRhsClosure name binderInfo nonVoidFvs updateFlag args body recIds where nonVoidFvs = nonVoidIds fvs
181
cgRhs recIds name (StgRhsClosure _ binderInfo fvs updateFlag _ args body) = mkRhsClosure name binderInfo nonVoidFvs updateFlag args body recIds where nonVoidFvs = nonVoidIds fvs
181
cgRhs recIds name (StgRhsClosure _ binderInfo fvs updateFlag _ args body) = mkRhsClosure name binderInfo nonVoidFvs updateFlag args body recIds where nonVoidFvs = nonVoidIds fvs
181
false
false
0
6
28
60
27
33
null
null
fmapfmapfmap/amazonka
amazonka-cloudformation/gen/Network/AWS/CloudFormation/Types/Product.hs
mpl-2.0
-- | Creates a value of 'Tag' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'tagValue' -- -- * 'tagKey' tag :: Tag tag = Tag' { _tagValue = Nothing , _tagKey = Nothing }
276
tag :: Tag tag = Tag' { _tagValue = Nothing , _tagKey = Nothing }
85
tag = Tag' { _tagValue = Nothing , _tagKey = Nothing }
70
true
true
0
6
72
32
22
10
null
null
Airtnp/Freshman_Simple_Haskell_Lib
Intro/TAPL/subtying.hs
mit
extendStore store v = (length store, store ++ [v])
50
extendStore store v = (length store, store ++ [v])
50
extendStore store v = (length store, store ++ [v])
50
false
false
0
7
8
27
14
13
null
null
samvher/translatethenews
app/TTN/Controller/Shared.hs
mit
-- | Get current time (use in validators in forms) now :: TTNAction ctx UTCTime now = liftIO getCurrentTime
107
now :: TTNAction ctx UTCTime now = liftIO getCurrentTime
56
now = liftIO getCurrentTime
27
true
true
0
6
18
26
11
15
null
null
brendanhay/gogol
gogol-datafusion/gen/Network/Google/Resource/DataFusion/Projects/Locations/Instances/Create.hs
mpl-2.0
-- | Multipart request metadata. plicPayload :: Lens' ProjectsLocationsInstancesCreate Instance plicPayload = lens _plicPayload (\ s a -> s{_plicPayload = a})
160
plicPayload :: Lens' ProjectsLocationsInstancesCreate Instance plicPayload = lens _plicPayload (\ s a -> s{_plicPayload = a})
127
plicPayload = lens _plicPayload (\ s a -> s{_plicPayload = a})
64
true
true
0
9
22
42
22
20
null
null
AaronFriel/eff-experiments
src/Data/Iota/Tagged/Eff1.hs
bsd-3-clause
-- E u q <*> E u' q' = E u (q |> (\f -> E u' (q' |> (Val . f)))) {- -- The opposite of admin, occasionally useful -- See the soft-cut for an example -- It is currently quite inefficient. There are better ways reflect :: VE a r -> Eff r a reflect (Val x) = return x reflect (E u) = Eff (\k -> E $ fmap (loop k) u) where loop :: (a -> VE w r) -> VE a r -> VE w r loop k (Val x) = k x loop k (E u) = E $ fmap (loop k) u -} -- ------------------------------------------------------------------------ -- The initial case, no effects -- The type of run ensures that all effects must be handled: -- only pure computations may be run. run :: Eff '[] w -> w run (Val x) = x
674
run :: Eff '[] w -> w run (Val x) = x
37
run (Val x) = x
15
true
true
0
9
158
45
23
22
null
null
pikajude/mono-traversable
src/Data/MinLen.hs
mit
-- | Returns all but the first element of a sequence, reducing its 'MinLen' by 1. -- -- Safe, only works on sequences wrapped in a @'MinLen' ('Succ' nat)@. -- -- ==== __Examples__ -- -- @ -- > let xs = 'toMinLen' [1,2,3] :: 'Maybe' ('MinLen' ('Succ' 'Zero') ['Int']) -- > 'fmap' 'tailML' xs -- 'Just' ('MinLen' {unMinLen = [2,3]}) -- @ tailML :: IsSequence seq => MinLen (Succ nat) seq -> MinLen nat seq tailML = MinLen . tailEx . unMinLen
439
tailML :: IsSequence seq => MinLen (Succ nat) seq -> MinLen nat seq tailML = MinLen . tailEx . unMinLen
103
tailML = MinLen . tailEx . unMinLen
35
true
true
0
9
81
57
33
24
null
null
holzensp/ghc
compiler/vectorise/Vectorise/Monad/Base.hs
bsd-3-clause
maybeV :: SDoc -> VM (Maybe a) -> VM a maybeV reason p = maybe (noV reason) return =<< p
88
maybeV :: SDoc -> VM (Maybe a) -> VM a maybeV reason p = maybe (noV reason) return =<< p
88
maybeV reason p = maybe (noV reason) return =<< p
49
false
true
0
10
19
57
25
32
null
null
hanshoglund/imitator
src/Music/Imitator/Util.hs
gpl-3.0
- | -- Synonym for 'fmap Char.toLower' toLowerString :: String -> String toLowerString = fmap Char.toLower
107
toLowerString :: String -> String toLowerString = fmap Char.toLower
67
toLowerString = fmap Char.toLower
33
true
true
1
8
16
29
13
16
null
null
ivokosir/gearh
test/renderResources.hs
mit
initialState :: State initialState = State 0 0 False
52
initialState :: State initialState = State 0 0 False
52
initialState = State 0 0 False
30
false
true
0
6
8
24
10
14
null
null
cglazner/ibd_stitch
src/Joint.hs
bsd-3-clause
doOnePostCons :: IntSet -> (Int, Int) -> (Int, Int) -> IntPartition -> IntPartition -> Constraint doOnePostCons ny x@(x1,x2) y@(y1,y2) pri prev = a <> b <> c <> d where (inx, iny) = over both (uncurry (equiv prev)) (x, y) (setx1, setx2) = over both ((intersection ny) . myfind pri) x (sety1, sety2) = over both (myfind prev) y a = if equiv pri x1 y1 || (iny && (equiv (pri) x1 y2) ) || (inx && (equiv pri x2 y1) ) then consY11 else checkIfForcedPri setx1 sety1 consY11 consN11 b = if not inx then if equiv pri x2 y1 || ( iny && (equiv pri x2 y2) ) then consY21 else checkIfForcedPri setx2 sety1 consY21 consN21 else checkIfForcedPri (setx1 `union` setx2) sety1 consY21 consN21 <> checkIfForcedPri (setx1 `union` setx2) sety2 consY12 consN12 c = if not iny then if equiv pri x1 y2 || (inx && (equiv pri x2 y2) ) then consY12 else checkIfForcedPri setx1 sety2 consY12 consN12 else mempty d = if not $ or [inx, iny] then if equiv pri x2 y2 then consY22 else checkIfForcedPri setx2 sety2 consY22 consN22 else mempty
1,266
doOnePostCons :: IntSet -> (Int, Int) -> (Int, Int) -> IntPartition -> IntPartition -> Constraint doOnePostCons ny x@(x1,x2) y@(y1,y2) pri prev = a <> b <> c <> d where (inx, iny) = over both (uncurry (equiv prev)) (x, y) (setx1, setx2) = over both ((intersection ny) . myfind pri) x (sety1, sety2) = over both (myfind prev) y a = if equiv pri x1 y1 || (iny && (equiv (pri) x1 y2) ) || (inx && (equiv pri x2 y1) ) then consY11 else checkIfForcedPri setx1 sety1 consY11 consN11 b = if not inx then if equiv pri x2 y1 || ( iny && (equiv pri x2 y2) ) then consY21 else checkIfForcedPri setx2 sety1 consY21 consN21 else checkIfForcedPri (setx1 `union` setx2) sety1 consY21 consN21 <> checkIfForcedPri (setx1 `union` setx2) sety2 consY12 consN12 c = if not iny then if equiv pri x1 y2 || (inx && (equiv pri x2 y2) ) then consY12 else checkIfForcedPri setx1 sety2 consY12 consN12 else mempty d = if not $ or [inx, iny] then if equiv pri x2 y2 then consY22 else checkIfForcedPri setx2 sety2 consY22 consN22 else mempty
1,266
doOnePostCons ny x@(x1,x2) y@(y1,y2) pri prev = a <> b <> c <> d where (inx, iny) = over both (uncurry (equiv prev)) (x, y) (setx1, setx2) = over both ((intersection ny) . myfind pri) x (sety1, sety2) = over both (myfind prev) y a = if equiv pri x1 y1 || (iny && (equiv (pri) x1 y2) ) || (inx && (equiv pri x2 y1) ) then consY11 else checkIfForcedPri setx1 sety1 consY11 consN11 b = if not inx then if equiv pri x2 y1 || ( iny && (equiv pri x2 y2) ) then consY21 else checkIfForcedPri setx2 sety1 consY21 consN21 else checkIfForcedPri (setx1 `union` setx2) sety1 consY21 consN21 <> checkIfForcedPri (setx1 `union` setx2) sety2 consY12 consN12 c = if not iny then if equiv pri x1 y2 || (inx && (equiv pri x2 y2) ) then consY12 else checkIfForcedPri setx1 sety2 consY12 consN12 else mempty d = if not $ or [inx, iny] then if equiv pri x2 y2 then consY22 else checkIfForcedPri setx2 sety2 consY22 consN22 else mempty
1,168
false
true
5
12
441
493
252
241
null
null
mightymoose/liquidhaskell
benchmarks/text-0.11.2.3/Data/Text/Lazy.hs
bsd-3-clause
{-@ init_go :: t:TextNE -> ts:Text -> {v:Text | ((ltlength v) = ((tlength t) + (ltlength ts) - 1))} @-} {-@ Decrease init_go 2 @-} init_go t (Chunk t' ts) = Chunk t (init_go t' ts)
194
init_go t (Chunk t' ts) = Chunk t (init_go t' ts)
49
init_go t (Chunk t' ts) = Chunk t (init_go t' ts)
49
true
false
0
7
49
34
17
17
null
null
rahulmutt/ghcvm
compiler/Eta/Types/CoAxiom.hs
bsd-3-clause
brListZipWith f (NextBranch a ta) (NextBranch b tb) = f a b : brListZipWith f ta tb
83
brListZipWith f (NextBranch a ta) (NextBranch b tb) = f a b : brListZipWith f ta tb
83
brListZipWith f (NextBranch a ta) (NextBranch b tb) = f a b : brListZipWith f ta tb
83
false
false
0
7
16
45
21
24
null
null
nushio3/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
gen1ClassKey = mkPreludeClassUnique 38
39
gen1ClassKey = mkPreludeClassUnique 38
39
gen1ClassKey = mkPreludeClassUnique 38
39
false
false
1
5
4
12
4
8
null
null
kowey/GenI
src/NLP/GenI/Simple/SimpleBuilder.hs
gpl-2.0
canAdjoin :: SimpleItem -> TagSite -> Maybe (TagSite, TagSite, Subst) canAdjoin aItem pSite = do -- let's go! let r = siRoot aItem -- auxiliary tree, eh? f <- siFoot aItem -- should really be an error if fails (anr_up', subst1) <- hush $ unifyFeat (tsUp r) (tsUp pSite) (anf_down, subst2) <- hush $ unifyFeat (replace subst1 $ tsDown f) (replace subst1 $ tsDown pSite) let -- combined substitution list and success condition subst12 = appendSubst subst1 subst2 anr = replace subst12 $ r { tsUp = anr_up' } -- resulting node based on the root node of the aux tree anf = replace subst12 $ f { tsDown = anf_down } -- resulting node based on the foot node of the aux tree return (anr, anf, subst12)
731
canAdjoin :: SimpleItem -> TagSite -> Maybe (TagSite, TagSite, Subst) canAdjoin aItem pSite = do -- let's go! let r = siRoot aItem -- auxiliary tree, eh? f <- siFoot aItem -- should really be an error if fails (anr_up', subst1) <- hush $ unifyFeat (tsUp r) (tsUp pSite) (anf_down, subst2) <- hush $ unifyFeat (replace subst1 $ tsDown f) (replace subst1 $ tsDown pSite) let -- combined substitution list and success condition subst12 = appendSubst subst1 subst2 anr = replace subst12 $ r { tsUp = anr_up' } -- resulting node based on the root node of the aux tree anf = replace subst12 $ f { tsDown = anf_down } -- resulting node based on the foot node of the aux tree return (anr, anf, subst12)
731
canAdjoin aItem pSite = do -- let's go! let r = siRoot aItem -- auxiliary tree, eh? f <- siFoot aItem -- should really be an error if fails (anr_up', subst1) <- hush $ unifyFeat (tsUp r) (tsUp pSite) (anf_down, subst2) <- hush $ unifyFeat (replace subst1 $ tsDown f) (replace subst1 $ tsDown pSite) let -- combined substitution list and success condition subst12 = appendSubst subst1 subst2 anr = replace subst12 $ r { tsUp = anr_up' } -- resulting node based on the root node of the aux tree anf = replace subst12 $ f { tsDown = anf_down } -- resulting node based on the foot node of the aux tree return (anr, anf, subst12)
661
false
true
0
13
164
220
111
109
null
null
rfranek/duckling
Duckling/Time/SV/Rules.hs
bsd-3-clause
ruleTheCycleBeforeTime :: Rule ruleTheCycleBeforeTime = Rule { name = "the <cycle> before <time>" , pattern = [ dimension TimeGrain , regex "(en|na|et)? f\x00f6re" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain (-1) td _ -> Nothing }
360
ruleTheCycleBeforeTime :: Rule ruleTheCycleBeforeTime = Rule { name = "the <cycle> before <time>" , pattern = [ dimension TimeGrain , regex "(en|na|et)? f\x00f6re" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain (-1) td _ -> Nothing }
360
ruleTheCycleBeforeTime = Rule { name = "the <cycle> before <time>" , pattern = [ dimension TimeGrain , regex "(en|na|et)? f\x00f6re" , dimension Time ] , prod = \tokens -> case tokens of (Token TimeGrain grain:_:Token Time td:_) -> tt $ cycleNthAfter False grain (-1) td _ -> Nothing }
329
false
true
0
16
95
117
61
56
null
null
sorpaas/munje
src/Munje/Parser.hs
mit
aExpression :: IParser Expression aExpression = choice [do girzu <- aGirzu return $ Right girzu, do bridi <- aBridi return $ Left bridi ]
280
aExpression :: IParser Expression aExpression = choice [do girzu <- aGirzu return $ Right girzu, do bridi <- aBridi return $ Left bridi ]
280
aExpression = choice [do girzu <- aGirzu return $ Right girzu, do bridi <- aBridi return $ Left bridi ]
246
false
true
0
10
166
57
26
31
null
null
olsner/ghc
compiler/nativeGen/PPC/CodeGen.hs
bsd-3-clause
condFltReg cond x y = condReg (condFltCode cond x y)
52
condFltReg cond x y = condReg (condFltCode cond x y)
52
condFltReg cond x y = condReg (condFltCode cond x y)
52
false
false
0
7
9
26
12
14
null
null
josercruz01/hsoptions
tests/unit/System/Console/HsOptionsTest.hs
apache-2.0
testConfFileHierarchy :: UnitTest testConfFileHierarchy = "Conf files include is recursive" `unitTest` do let flagData = makeFlagData [f2d userId, f2d userName] pr <- process flagData "--usingFile = tests/unit/ConfFiles/user_name.conf" assertFlagValueEquals pr userId 123 assertFlagValueEquals pr userName "batman" assertArgsEquals pr ["one", "two", "three"]
380
testConfFileHierarchy :: UnitTest testConfFileHierarchy = "Conf files include is recursive" `unitTest` do let flagData = makeFlagData [f2d userId, f2d userName] pr <- process flagData "--usingFile = tests/unit/ConfFiles/user_name.conf" assertFlagValueEquals pr userId 123 assertFlagValueEquals pr userName "batman" assertArgsEquals pr ["one", "two", "three"]
380
testConfFileHierarchy = "Conf files include is recursive" `unitTest` do let flagData = makeFlagData [f2d userId, f2d userName] pr <- process flagData "--usingFile = tests/unit/ConfFiles/user_name.conf" assertFlagValueEquals pr userId 123 assertFlagValueEquals pr userName "batman" assertArgsEquals pr ["one", "two", "three"]
346
false
true
0
13
61
90
43
47
null
null
peterson/lets-tree
src/Lets/BinomialHeap.hs
bsd-3-clause
size :: Ord a => BinHeap a -> Int size = length . toList
56
size :: Ord a => BinHeap a -> Int size = length . toList
56
size = length . toList
22
false
true
1
8
13
37
15
22
null
null
pirapira/hashprice
Util.hs
bsd-3-clause
rawBlockURL :: Hash -> String rawBlockURL h = "https://blockchain.info/rawblock/" ++ (unpack (unHash h))
104
rawBlockURL :: Hash -> String rawBlockURL h = "https://blockchain.info/rawblock/" ++ (unpack (unHash h))
104
rawBlockURL h = "https://blockchain.info/rawblock/" ++ (unpack (unHash h))
74
false
true
0
10
12
40
18
22
null
null
adarqui/ZTail-Lib
src/ZTail/TailTypes.hs
bsd-3-clause
tailErrMsg :: Tail -> String -> IO () tailErrMsg t msg = errMsg ("ztail " ++ tailName t ++ ": " ++ msg)
105
tailErrMsg :: Tail -> String -> IO () tailErrMsg t msg = errMsg ("ztail " ++ tailName t ++ ": " ++ msg)
105
tailErrMsg t msg = errMsg ("ztail " ++ tailName t ++ ": " ++ msg)
67
false
true
0
10
24
50
24
26
null
null
vigoos/Farrago-OS
aura-master/aura-master/src/Aura/Build.hs
gpl-2.0
build built ps@(p:_) = do notify $ buildPackages_1 pn (paths,rest) <- catch (withTempDir pn (build' ps)) (buildFail built ps) build (paths ++ built) rest where pn = baseNameOf p -- | Perform the actual build.
229
build built ps@(p:_) = do notify $ buildPackages_1 pn (paths,rest) <- catch (withTempDir pn (build' ps)) (buildFail built ps) build (paths ++ built) rest where pn = baseNameOf p -- | Perform the actual build.
229
build built ps@(p:_) = do notify $ buildPackages_1 pn (paths,rest) <- catch (withTempDir pn (build' ps)) (buildFail built ps) build (paths ++ built) rest where pn = baseNameOf p -- | Perform the actual build.
229
false
false
0
12
55
97
48
49
null
null
green-haskell/ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
-- | It is always safe to assume that an 'Id' has no lambda-bound variable information noOneShotInfo :: OneShotInfo noOneShotInfo = NoOneShotInfo
145
noOneShotInfo :: OneShotInfo noOneShotInfo = NoOneShotInfo
58
noOneShotInfo = NoOneShotInfo
29
true
true
0
4
21
12
7
5
null
null
graninas/Haskell-Algorithms
Tests/Maybe.hs
gpl-3.0
main''2 = printPhone $ getPhone "Alice"
39
main''2 = printPhone $ getPhone "Alice"
39
main''2 = printPhone $ getPhone "Alice"
39
false
false
0
6
5
13
6
7
null
null
fmapfmapfmap/amazonka
amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs
mpl-2.0
-- | Creates a value of 'ReservedInstanceLimitPrice' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'rilpAmount' -- -- * 'rilpCurrencyCode' reservedInstanceLimitPrice :: ReservedInstanceLimitPrice reservedInstanceLimitPrice = ReservedInstanceLimitPrice' { _rilpAmount = Nothing , _rilpCurrencyCode = Nothing }
415
reservedInstanceLimitPrice :: ReservedInstanceLimitPrice reservedInstanceLimitPrice = ReservedInstanceLimitPrice' { _rilpAmount = Nothing , _rilpCurrencyCode = Nothing }
189
reservedInstanceLimitPrice = ReservedInstanceLimitPrice' { _rilpAmount = Nothing , _rilpCurrencyCode = Nothing }
128
true
true
0
6
72
32
22
10
null
null
agrafix/typed-wire
test/TW/CodeGen/HaskellTest.hs
mit
runner :: FilePath -> (Module -> T.Text) -> (ModuleName -> FilePath) -> Module -> IO () runner baseDir mkModule mkFilename m = let moduleSrc = mkModule m moduleFp = baseDir </> mkFilename (m_name m) in do createDirectoryIfMissing True (takeDirectory moduleFp) T.writeFile moduleFp moduleSrc
316
runner :: FilePath -> (Module -> T.Text) -> (ModuleName -> FilePath) -> Module -> IO () runner baseDir mkModule mkFilename m = let moduleSrc = mkModule m moduleFp = baseDir </> mkFilename (m_name m) in do createDirectoryIfMissing True (takeDirectory moduleFp) T.writeFile moduleFp moduleSrc
316
runner baseDir mkModule mkFilename m = let moduleSrc = mkModule m moduleFp = baseDir </> mkFilename (m_name m) in do createDirectoryIfMissing True (takeDirectory moduleFp) T.writeFile moduleFp moduleSrc
228
false
true
0
12
68
113
54
59
null
null
ambiata/highlighting-kate
Text/Highlighting/Kate/Syntax/Doxygenlua.hs
gpl-2.0
parseRules ("DoxygenLua","SL_htmltag") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("DoxygenLua","SL_identifiers")) <|> (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_htmltag")) >> pDefault >>= withAttribute OtherTok))
443
parseRules ("DoxygenLua","SL_htmltag") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("DoxygenLua","SL_identifiers")) <|> (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_htmltag")) >> pDefault >>= withAttribute OtherTok))
443
parseRules ("DoxygenLua","SL_htmltag") = (((pDetect2Chars False '/' '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pDetectChar False '>' >>= withAttribute KeywordTok) >>~ (popContext)) <|> ((pRegExpr regex_'5cs'2a'3d'5cs'2a >>= withAttribute OtherTok) >>~ pushContext ("DoxygenLua","SL_identifiers")) <|> (currentContext >>= \x -> guard (x == ("DoxygenLua","SL_htmltag")) >> pDefault >>= withAttribute OtherTok))
443
false
false
0
15
63
151
79
72
null
null
lunaris/hindent
src/HIndent/Pretty.hs
bsd-3-clause
exp x@XChildTag{} = pretty' x
29
exp x@XChildTag{} = pretty' x
29
exp x@XChildTag{} = pretty' x
29
false
false
1
7
4
23
10
13
null
null
39aldo39/klfc
src/Xkb/Types.hs
gpl-3.0
printTypes ∷ (Logger m, MonadReader XkbConfig m) ⇒ Layout → m (Maybe String) printTypes = runMaybeT <<< prepareLayout >=> \layout → do types ← nub <$> concatMapM (getTypes ∘ (layout ⊕) ∘ variantToLayout) ((∅) : view _variants layout) guard (not (null types)) let virtualMods = S.unions (map __typeMods types) pure ∘ unlines $ [ "// Generated by KLFC " ⊕ versionStr , "// https://github.com/39aldo39/klfc" , "" , "default xkb_types \"basic\" {" ] ⧺ printVirtualMods (filter isVirtualModifier (S.toList virtualMods)) ⧺ concatMap printType types ⧺ [ "};" ] where isVirtualModifier = (∈ [M.AltGr, M.Extend, M.Win, M.NumLock]) printVirtualMods [] = [""] printVirtualMods xs = [ "" , " virtual_modifiers " ⊕ intercalate "," (mapMaybe (`lookup` modifierAndTypeModifier) xs) ⊕ ";" , "" ]
908
printTypes ∷ (Logger m, MonadReader XkbConfig m) ⇒ Layout → m (Maybe String) printTypes = runMaybeT <<< prepareLayout >=> \layout → do types ← nub <$> concatMapM (getTypes ∘ (layout ⊕) ∘ variantToLayout) ((∅) : view _variants layout) guard (not (null types)) let virtualMods = S.unions (map __typeMods types) pure ∘ unlines $ [ "// Generated by KLFC " ⊕ versionStr , "// https://github.com/39aldo39/klfc" , "" , "default xkb_types \"basic\" {" ] ⧺ printVirtualMods (filter isVirtualModifier (S.toList virtualMods)) ⧺ concatMap printType types ⧺ [ "};" ] where isVirtualModifier = (∈ [M.AltGr, M.Extend, M.Win, M.NumLock]) printVirtualMods [] = [""] printVirtualMods xs = [ "" , " virtual_modifiers " ⊕ intercalate "," (mapMaybe (`lookup` modifierAndTypeModifier) xs) ⊕ ";" , "" ]
908
printTypes = runMaybeT <<< prepareLayout >=> \layout → do types ← nub <$> concatMapM (getTypes ∘ (layout ⊕) ∘ variantToLayout) ((∅) : view _variants layout) guard (not (null types)) let virtualMods = S.unions (map __typeMods types) pure ∘ unlines $ [ "// Generated by KLFC " ⊕ versionStr , "// https://github.com/39aldo39/klfc" , "" , "default xkb_types \"basic\" {" ] ⧺ printVirtualMods (filter isVirtualModifier (S.toList virtualMods)) ⧺ concatMap printType types ⧺ [ "};" ] where isVirtualModifier = (∈ [M.AltGr, M.Extend, M.Win, M.NumLock]) printVirtualMods [] = [""] printVirtualMods xs = [ "" , " virtual_modifiers " ⊕ intercalate "," (mapMaybe (`lookup` modifierAndTypeModifier) xs) ⊕ ";" , "" ]
831
false
true
0
17
247
294
155
139
null
null
urv/fixhs
src/Data/FIX/Spec/FIX43.hs
lgpl-2.1
tLiquidityIndType :: FIXTag tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
172
tLiquidityIndType :: FIXTag tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
172
tLiquidityIndType = FIXTag { tName = "LiquidityIndType" , tnum = 409 , tparser = toFIXInt , arbitraryValue = FIXInt <$> arbitrary }
144
false
true
0
8
37
45
26
19
null
null
ben-schulz/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
runIdeModeCommand h id orig fn modes (IdeMode.ErrString e) = do ist <- getIState let out = displayS . renderPretty 1.0 60 $ pprintErr ist e msg = (IdeMode.SymbolAtom "ok", IdeMode.StringAtom $ out "") runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id
276
runIdeModeCommand h id orig fn modes (IdeMode.ErrString e) = do ist <- getIState let out = displayS . renderPretty 1.0 60 $ pprintErr ist e msg = (IdeMode.SymbolAtom "ok", IdeMode.StringAtom $ out "") runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id
276
runIdeModeCommand h id orig fn modes (IdeMode.ErrString e) = do ist <- getIState let out = displayS . renderPretty 1.0 60 $ pprintErr ist e msg = (IdeMode.SymbolAtom "ok", IdeMode.StringAtom $ out "") runIO . hPutStrLn h $ IdeMode.convSExp "return" msg id
276
false
false
0
12
62
109
51
58
null
null
susanctu/Haskell-In-Memory-DB
src/Server.hs
mit
bStRep = typeOf(B.empty)
24
bStRep = typeOf(B.empty)
24
bStRep = typeOf(B.empty)
24
false
false
1
7
2
18
7
11
null
null
phischu/fragnix
builtins/base/GHC.IO.Handle.Text.hs
bsd-3-clause
hGetChar :: Handle -> IO Char hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,997
hGetChar :: Handle -> IO Char hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,997
hGetChar handle = wantReadableHandle_ "hGetChar" handle $ \handle_@Handle__{..} -> do -- buffering mode makes no difference: we just read whatever is available -- from the device (blocking only if there is nothing available), and then -- return the first character. -- See [note Buffered Reading] in GHC.IO.Handle.Types buf0 <- readIORef haCharBuffer buf1 <- if isEmptyBuffer buf0 then readTextDevice handle_ buf0 else return buf0 (c1,i) <- readCharBuf (bufRaw buf1) (bufL buf1) let buf2 = bufferAdjustL i buf1 if haInputNL == CRLF && c1 == '\r' then do mbuf3 <- if isEmptyBuffer buf2 then maybeFillReadBuffer handle_ buf2 else return (Just buf2) case mbuf3 of -- EOF, so just return the '\r' we have Nothing -> do writeIORef haCharBuffer buf2 return '\r' Just buf3 -> do (c2,i2) <- readCharBuf (bufRaw buf2) (bufL buf2) if c2 == '\n' then do writeIORef haCharBuffer (bufferAdjustL i2 buf3) return '\n' else do -- not a \r\n sequence, so just return the \r writeIORef haCharBuffer buf3 return '\r' else do writeIORef haCharBuffer buf2 return c1 -- --------------------------------------------------------------------------- -- hGetLine -- | Computation 'hGetLine' @hdl@ reads a line from the file or -- channel managed by @hdl@. -- -- This operation may fail with: -- -- * 'isEOFError' if the end of file is encountered when reading -- the /first/ character of the line. -- -- If 'hGetLine' encounters end-of-file at any other point while reading -- in a line, it is treated as a line terminator and the (partial) -- line is returned.
1,967
false
true
0
22
683
329
162
167
null
null
paulolieuthier/criterion
Criterion/Types.hs
bsd-2-clause
whnf :: (a -> b) -> a -> Benchmarkable whnf = pureFunc id
57
whnf :: (a -> b) -> a -> Benchmarkable whnf = pureFunc id
57
whnf = pureFunc id
18
false
true
0
8
12
36
16
20
null
null
HIPERFIT/futhark
src/Futhark/Optimise/Simplify/Rules/Simple.hs
isc
simplifyReshapeReplicate :: SimpleRule rep simplifyReshapeReplicate defOf seType (Reshape newshape v) | Just (BasicOp (Replicate _ se), v_cs) <- defOf v, Just oldshape <- arrayShape <$> seType se, shapeDims oldshape `isSuffixOf` newDims newshape = let new = take (length newshape - shapeRank oldshape) $ newDims newshape in Just (Replicate (Shape new) se, v_cs)
402
simplifyReshapeReplicate :: SimpleRule rep simplifyReshapeReplicate defOf seType (Reshape newshape v) | Just (BasicOp (Replicate _ se), v_cs) <- defOf v, Just oldshape <- arrayShape <$> seType se, shapeDims oldshape `isSuffixOf` newDims newshape = let new = take (length newshape - shapeRank oldshape) $ newDims newshape in Just (Replicate (Shape new) se, v_cs)
402
simplifyReshapeReplicate defOf seType (Reshape newshape v) | Just (BasicOp (Replicate _ se), v_cs) <- defOf v, Just oldshape <- arrayShape <$> seType se, shapeDims oldshape `isSuffixOf` newDims newshape = let new = take (length newshape - shapeRank oldshape) $ newDims newshape in Just (Replicate (Shape new) se, v_cs)
359
false
true
0
14
92
150
70
80
null
null
andorp/bead
test/Test/Property/EntityGen.hs
bsd-3-clause
roleGen = elements [Student, GroupAdmin, CourseAdmin, Admin]
60
roleGen = elements [Student, GroupAdmin, CourseAdmin, Admin]
60
roleGen = elements [Student, GroupAdmin, CourseAdmin, Admin]
60
false
false
1
5
6
24
12
12
null
null
sergv/vector
Data/Vector.hs
bsd-3-clause
izipWithM_ = G.izipWithM_
25
izipWithM_ = G.izipWithM_
25
izipWithM_ = G.izipWithM_
25
false
false
0
5
2
8
4
4
null
null
byteally/dbrecord-opaleye
src/Opaleye/DBRecord.hs
bsd-3-clause
query :: forall db tab flds opFlds. ( Table db (tab Hask) , Default ColumnMaker (HList Identity opFlds) (HList Identity opFlds) , flds ~ (OriginalTableFields (tab Hask)) , opFlds ~ GetOpFields Op flds , TabProps2 db tab flds , Generic (tab Op) , GRecToType Identity (Rep (tab Op)) opFlds ) => Tab db tab -> Query (tab Op) query tab = let cols = getTableHFields (Proxy @db) (Proxy @(tab Hask)) in queryTable (O.Table (T.unpack $ getConst $ getTableName @db @(tab Hask)) (tabProps2 tab cols)) >>^ recToType
572
query :: forall db tab flds opFlds. ( Table db (tab Hask) , Default ColumnMaker (HList Identity opFlds) (HList Identity opFlds) , flds ~ (OriginalTableFields (tab Hask)) , opFlds ~ GetOpFields Op flds , TabProps2 db tab flds , Generic (tab Op) , GRecToType Identity (Rep (tab Op)) opFlds ) => Tab db tab -> Query (tab Op) query tab = let cols = getTableHFields (Proxy @db) (Proxy @(tab Hask)) in queryTable (O.Table (T.unpack $ getConst $ getTableName @db @(tab Hask)) (tabProps2 tab cols)) >>^ recToType
572
query tab = let cols = getTableHFields (Proxy @db) (Proxy @(tab Hask)) in queryTable (O.Table (T.unpack $ getConst $ getTableName @db @(tab Hask)) (tabProps2 tab cols)) >>^ recToType
186
false
true
0
14
153
256
126
130
null
null
lamdu/lamdu
src/Lamdu/GUI/Monad.hs
gpl-3.0
readGuiAnchors :: MonadReader (Askable env i o) m => m (Anchors.GuiAnchors i o) readGuiAnchors = Lens.view aGuiAnchors
118
readGuiAnchors :: MonadReader (Askable env i o) m => m (Anchors.GuiAnchors i o) readGuiAnchors = Lens.view aGuiAnchors
118
readGuiAnchors = Lens.view aGuiAnchors
38
false
true
0
9
16
48
23
25
null
null
hucal/SCMinHS
Scheme/Eval.hs
bsd-3-clause
evalExpr env fname s = liftIO $ runErrorT (readLisp fname s >>= eval env) >>= return . either errToLisp id
114
evalExpr env fname s = liftIO $ runErrorT (readLisp fname s >>= eval env) >>= return . either errToLisp id
114
evalExpr env fname s = liftIO $ runErrorT (readLisp fname s >>= eval env) >>= return . either errToLisp id
114
false
false
0
11
27
48
22
26
null
null
spechub/Hets
Static/DGTranslation.hs
gpl-2.0
{- | get the maximal sublogic of a graph. each DGraph and each node will be tested, in order to find the maximal sublogic of th Graph. All edges and nodes will be searched also in the meantime, so as to test, whether the GMorphism of edges is homogeneous, and the logics of nodes are equal. -} getDGLogic :: LibEnv -> Result G_sublogics getDGLogic libEnv = mapM (getSublogicFromDGraph libEnv) (Map.keys libEnv) >>= combineSublogics
444
getDGLogic :: LibEnv -> Result G_sublogics getDGLogic libEnv = mapM (getSublogicFromDGraph libEnv) (Map.keys libEnv) >>= combineSublogics
145
getDGLogic libEnv = mapM (getSublogicFromDGraph libEnv) (Map.keys libEnv) >>= combineSublogics
102
true
true
2
8
85
52
24
28
null
null
fmthoma/ghc
utils/ghc-cabal/Main.hs
bsd-3-clause
generate :: FilePath -> FilePath -> String -> [String] -> IO () generate directory distdir dll0Modules config_args = withCurrentDirectory directory $ do let verbosity = normal -- XXX We shouldn't just configure with the default flags -- XXX And this, and thus the "getPersistBuildConfig distdir" below, -- aren't going to work when the deps aren't built yet withArgs (["configure", "--distdir", distdir] ++ config_args) runDefaultMain lbi0 <- getPersistBuildConfig distdir let lbi = mangleLbi directory distdir lbi0 pd0 = localPkgDescr lbi writePersistBuildConfig distdir lbi hooked_bi <- if (buildType pd0 == Just Configure) || (buildType pd0 == Just Custom) then do maybe_infoFile <- defaultHookedPackageDesc case maybe_infoFile of Nothing -> return emptyHookedBuildInfo Just infoFile -> readHookedBuildInfo verbosity infoFile else return emptyHookedBuildInfo let pd = updatePackageDescription hooked_bi pd0 -- generate Paths_<pkg>.hs and cabal-macros.h writeAutogenFiles verbosity pd lbi -- generate inplace-pkg-config withLibLBI pd lbi $ \lib clbi -> do cwd <- getCurrentDirectory let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace") let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir pd ipid lib lbi clbi final_ipi = installedPkgInfo { Installed.installedPackageId = ipid, Installed.haddockHTMLs = [] } content = Installed.showInstalledPackageInfo final_ipi ++ "\n" writeFileAtomic (distdir </> "inplace-pkg-config") (BS.pack $ toUTF8 content) let comp = compiler lbi libBiModules lib = (libBuildInfo lib, libModules lib) exeBiModules exe = (buildInfo exe, ModuleName.main : exeModules exe) biModuless = (maybeToList $ fmap libBiModules $ library pd) ++ (map exeBiModules $ executables pd) buildableBiModuless = filter isBuildable biModuless where isBuildable (bi', _) = buildable bi' (bi, modules) = case buildableBiModuless of [] -> error "No buildable component found" [biModules] -> biModules _ -> error ("XXX ghc-cabal can't handle " ++ "more than one buildinfo yet") -- XXX Another Just... Just ghcProg = lookupProgram ghcProgram (withPrograms lbi) dep_pkgs = PackageIndex.topologicalOrder (packageHacks (installedPkgs lbi)) forDeps f = concatMap f dep_pkgs -- copied from Distribution.Simple.PreProcess.ppHsc2Hs packageHacks = case compilerFlavor (compiler lbi) of GHC -> hackRtsPackage _ -> id -- We don't link in the actual Haskell libraries of our -- dependencies, so the -u flags in the ldOptions of the rts -- package mean linking fails on OS X (it's ld is a tad -- stricter than gnu ld). Thus we remove the ldOptions for -- GHC's rts package: hackRtsPackage index = case PackageIndex.lookupPackageName index (PackageName "rts") of [(_,[rts])] -> PackageIndex.insert rts{ Installed.ldOptions = [], Installed.libraryDirs = filter (not . ("gcc-lib" `isSuffixOf`)) (Installed.libraryDirs rts)} index -- GHC <= 6.12 had $topdir/gcc-lib in their -- library-dirs for the rts package, which causes -- problems when we try to use the in-tree mingw, -- due to accidentally picking up the incompatible -- libraries there. So we filter out gcc-lib from -- the RTS's library-dirs here. _ -> error "No (or multiple) ghc rts package is registered!!" dep_ids = map snd (externalPackageDeps lbi) deps = map display dep_ids dep_keys | packageKeySupported comp = map (display . Installed.packageKey . fromMaybe (error "ghc-cabal: dep_keys failed") . PackageIndex.lookupInstalledPackageId (installedPkgs lbi) . fst) . externalPackageDeps $ lbi | otherwise = deps depNames = map (display . packageName) dep_ids transitive_dep_ids = map Installed.sourcePackageId dep_pkgs transitiveDeps = map display transitive_dep_ids transitiveDepKeys | packageKeySupported comp = map (display . Installed.packageKey) dep_pkgs | otherwise = transitiveDeps transitiveDepNames = map (display . packageName) transitive_dep_ids libraryDirs = forDeps Installed.libraryDirs -- The mkLibraryRelDir function is a bit of a hack. -- Ideally it should be handled in the makefiles instead. mkLibraryRelDir "rts" = "rts/dist/build" mkLibraryRelDir "ghc" = "compiler/stage2/build" mkLibraryRelDir "Cabal" = "libraries/Cabal/Cabal/dist-install/build" mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules otherMods = map display (otherModules bi) allMods = mods ++ otherMods let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), variablePrefix ++ "_PACKAGE_KEY = " ++ display (pkgKey lbi), -- copied from mkComponentsLocalBuildInfo variablePrefix ++ "_LIB_NAME = " ++ packageKeyLibraryName (package pd) (pkgKey lbi), variablePrefix ++ "_MODULES = " ++ unwords mods, variablePrefix ++ "_HIDDEN_MODULES = " ++ unwords otherMods, variablePrefix ++ "_SYNOPSIS =" ++ synopsis pd, variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi), variablePrefix ++ "_DEPS = " ++ unwords deps, variablePrefix ++ "_DEP_KEYS = " ++ unwords dep_keys, variablePrefix ++ "_DEP_NAMES = " ++ unwords depNames, variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords transitiveDeps, variablePrefix ++ "_TRANSITIVE_DEP_KEYS = " ++ unwords transitiveDepKeys, variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames, variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi), variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi), variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi), variablePrefix ++ "_EXTRA_LIBRARIES = " ++ unwords (extraLibs bi), variablePrefix ++ "_EXTRA_LIBDIRS = " ++ unwords (extraLibDirs bi), variablePrefix ++ "_C_SRCS = " ++ unwords (cSources bi), variablePrefix ++ "_CMM_SRCS := $(addprefix cbits/,$(notdir $(wildcard " ++ directory ++ "/cbits/*.cmm)))", variablePrefix ++ "_DATA_FILES = " ++ unwords (dataFiles pd), -- XXX This includes things it shouldn't, like: -- -odir dist-bootstrapping/build variablePrefix ++ "_HC_OPTS = " ++ escape (unwords ( programDefaultArgs ghcProg ++ hcOptions GHC bi ++ languageToFlags (compiler lbi) (defaultLanguage bi) ++ extensionsToFlags (compiler lbi) (usedExtensions bi) ++ programOverrideArgs ghcProg)), variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi), variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi), variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", -- Sometimes we need to modify the automatically-generated package-data.mk -- bindings in a special way for the GHC build system, so allow that here: "$(eval $(" ++ directory ++ "_PACKAGE_MAGIC))" ] writeFile (distdir ++ "/package-data.mk") $ unlines xs writeFileUtf8 (distdir ++ "/haddock-prologue.txt") $ if null (description pd) then synopsis pd else description pd unless (null dll0Modules) $ do let dll0Mods = words dll0Modules dllMods = allMods \\ dll0Mods dllModSets = map unwords [dll0Mods, dllMods] writeFile (distdir ++ "/dll-split") $ unlines dllModSets where escape = foldr (\c xs -> if c == '#' then '\\':'#':xs else c:xs) [] wrap = mapM wrap1 wrap1 s | null s = die ["Wrapping empty value"] | '\'' `elem` s = die ["Single quote in value to be wrapped:", s] -- We want to be able to assume things like <space><quote> is the -- start of a value, so check there are no spaces in confusing -- positions | head s == ' ' = die ["Leading space in value to be wrapped:", s] | last s == ' ' = die ["Trailing space in value to be wrapped:", s] | otherwise = return ("\'" ++ s ++ "\'") mkSearchPath = intercalate [searchPathSeparator] boolToYesNo True = "YES" boolToYesNo False = "NO" -- | Version of 'writeFile' that always uses UTF8 encoding writeFileUtf8 f txt = withFile f WriteMode $ \hdl -> do hSetEncoding hdl utf8 hPutStr hdl txt
11,254
generate :: FilePath -> FilePath -> String -> [String] -> IO () generate directory distdir dll0Modules config_args = withCurrentDirectory directory $ do let verbosity = normal -- XXX We shouldn't just configure with the default flags -- XXX And this, and thus the "getPersistBuildConfig distdir" below, -- aren't going to work when the deps aren't built yet withArgs (["configure", "--distdir", distdir] ++ config_args) runDefaultMain lbi0 <- getPersistBuildConfig distdir let lbi = mangleLbi directory distdir lbi0 pd0 = localPkgDescr lbi writePersistBuildConfig distdir lbi hooked_bi <- if (buildType pd0 == Just Configure) || (buildType pd0 == Just Custom) then do maybe_infoFile <- defaultHookedPackageDesc case maybe_infoFile of Nothing -> return emptyHookedBuildInfo Just infoFile -> readHookedBuildInfo verbosity infoFile else return emptyHookedBuildInfo let pd = updatePackageDescription hooked_bi pd0 -- generate Paths_<pkg>.hs and cabal-macros.h writeAutogenFiles verbosity pd lbi -- generate inplace-pkg-config withLibLBI pd lbi $ \lib clbi -> do cwd <- getCurrentDirectory let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace") let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir pd ipid lib lbi clbi final_ipi = installedPkgInfo { Installed.installedPackageId = ipid, Installed.haddockHTMLs = [] } content = Installed.showInstalledPackageInfo final_ipi ++ "\n" writeFileAtomic (distdir </> "inplace-pkg-config") (BS.pack $ toUTF8 content) let comp = compiler lbi libBiModules lib = (libBuildInfo lib, libModules lib) exeBiModules exe = (buildInfo exe, ModuleName.main : exeModules exe) biModuless = (maybeToList $ fmap libBiModules $ library pd) ++ (map exeBiModules $ executables pd) buildableBiModuless = filter isBuildable biModuless where isBuildable (bi', _) = buildable bi' (bi, modules) = case buildableBiModuless of [] -> error "No buildable component found" [biModules] -> biModules _ -> error ("XXX ghc-cabal can't handle " ++ "more than one buildinfo yet") -- XXX Another Just... Just ghcProg = lookupProgram ghcProgram (withPrograms lbi) dep_pkgs = PackageIndex.topologicalOrder (packageHacks (installedPkgs lbi)) forDeps f = concatMap f dep_pkgs -- copied from Distribution.Simple.PreProcess.ppHsc2Hs packageHacks = case compilerFlavor (compiler lbi) of GHC -> hackRtsPackage _ -> id -- We don't link in the actual Haskell libraries of our -- dependencies, so the -u flags in the ldOptions of the rts -- package mean linking fails on OS X (it's ld is a tad -- stricter than gnu ld). Thus we remove the ldOptions for -- GHC's rts package: hackRtsPackage index = case PackageIndex.lookupPackageName index (PackageName "rts") of [(_,[rts])] -> PackageIndex.insert rts{ Installed.ldOptions = [], Installed.libraryDirs = filter (not . ("gcc-lib" `isSuffixOf`)) (Installed.libraryDirs rts)} index -- GHC <= 6.12 had $topdir/gcc-lib in their -- library-dirs for the rts package, which causes -- problems when we try to use the in-tree mingw, -- due to accidentally picking up the incompatible -- libraries there. So we filter out gcc-lib from -- the RTS's library-dirs here. _ -> error "No (or multiple) ghc rts package is registered!!" dep_ids = map snd (externalPackageDeps lbi) deps = map display dep_ids dep_keys | packageKeySupported comp = map (display . Installed.packageKey . fromMaybe (error "ghc-cabal: dep_keys failed") . PackageIndex.lookupInstalledPackageId (installedPkgs lbi) . fst) . externalPackageDeps $ lbi | otherwise = deps depNames = map (display . packageName) dep_ids transitive_dep_ids = map Installed.sourcePackageId dep_pkgs transitiveDeps = map display transitive_dep_ids transitiveDepKeys | packageKeySupported comp = map (display . Installed.packageKey) dep_pkgs | otherwise = transitiveDeps transitiveDepNames = map (display . packageName) transitive_dep_ids libraryDirs = forDeps Installed.libraryDirs -- The mkLibraryRelDir function is a bit of a hack. -- Ideally it should be handled in the makefiles instead. mkLibraryRelDir "rts" = "rts/dist/build" mkLibraryRelDir "ghc" = "compiler/stage2/build" mkLibraryRelDir "Cabal" = "libraries/Cabal/Cabal/dist-install/build" mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules otherMods = map display (otherModules bi) allMods = mods ++ otherMods let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), variablePrefix ++ "_PACKAGE_KEY = " ++ display (pkgKey lbi), -- copied from mkComponentsLocalBuildInfo variablePrefix ++ "_LIB_NAME = " ++ packageKeyLibraryName (package pd) (pkgKey lbi), variablePrefix ++ "_MODULES = " ++ unwords mods, variablePrefix ++ "_HIDDEN_MODULES = " ++ unwords otherMods, variablePrefix ++ "_SYNOPSIS =" ++ synopsis pd, variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi), variablePrefix ++ "_DEPS = " ++ unwords deps, variablePrefix ++ "_DEP_KEYS = " ++ unwords dep_keys, variablePrefix ++ "_DEP_NAMES = " ++ unwords depNames, variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords transitiveDeps, variablePrefix ++ "_TRANSITIVE_DEP_KEYS = " ++ unwords transitiveDepKeys, variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames, variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi), variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi), variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi), variablePrefix ++ "_EXTRA_LIBRARIES = " ++ unwords (extraLibs bi), variablePrefix ++ "_EXTRA_LIBDIRS = " ++ unwords (extraLibDirs bi), variablePrefix ++ "_C_SRCS = " ++ unwords (cSources bi), variablePrefix ++ "_CMM_SRCS := $(addprefix cbits/,$(notdir $(wildcard " ++ directory ++ "/cbits/*.cmm)))", variablePrefix ++ "_DATA_FILES = " ++ unwords (dataFiles pd), -- XXX This includes things it shouldn't, like: -- -odir dist-bootstrapping/build variablePrefix ++ "_HC_OPTS = " ++ escape (unwords ( programDefaultArgs ghcProg ++ hcOptions GHC bi ++ languageToFlags (compiler lbi) (defaultLanguage bi) ++ extensionsToFlags (compiler lbi) (usedExtensions bi) ++ programOverrideArgs ghcProg)), variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi), variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi), variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", -- Sometimes we need to modify the automatically-generated package-data.mk -- bindings in a special way for the GHC build system, so allow that here: "$(eval $(" ++ directory ++ "_PACKAGE_MAGIC))" ] writeFile (distdir ++ "/package-data.mk") $ unlines xs writeFileUtf8 (distdir ++ "/haddock-prologue.txt") $ if null (description pd) then synopsis pd else description pd unless (null dll0Modules) $ do let dll0Mods = words dll0Modules dllMods = allMods \\ dll0Mods dllModSets = map unwords [dll0Mods, dllMods] writeFile (distdir ++ "/dll-split") $ unlines dllModSets where escape = foldr (\c xs -> if c == '#' then '\\':'#':xs else c:xs) [] wrap = mapM wrap1 wrap1 s | null s = die ["Wrapping empty value"] | '\'' `elem` s = die ["Single quote in value to be wrapped:", s] -- We want to be able to assume things like <space><quote> is the -- start of a value, so check there are no spaces in confusing -- positions | head s == ' ' = die ["Leading space in value to be wrapped:", s] | last s == ' ' = die ["Trailing space in value to be wrapped:", s] | otherwise = return ("\'" ++ s ++ "\'") mkSearchPath = intercalate [searchPathSeparator] boolToYesNo True = "YES" boolToYesNo False = "NO" -- | Version of 'writeFile' that always uses UTF8 encoding writeFileUtf8 f txt = withFile f WriteMode $ \hdl -> do hSetEncoding hdl utf8 hPutStr hdl txt
11,254
generate directory distdir dll0Modules config_args = withCurrentDirectory directory $ do let verbosity = normal -- XXX We shouldn't just configure with the default flags -- XXX And this, and thus the "getPersistBuildConfig distdir" below, -- aren't going to work when the deps aren't built yet withArgs (["configure", "--distdir", distdir] ++ config_args) runDefaultMain lbi0 <- getPersistBuildConfig distdir let lbi = mangleLbi directory distdir lbi0 pd0 = localPkgDescr lbi writePersistBuildConfig distdir lbi hooked_bi <- if (buildType pd0 == Just Configure) || (buildType pd0 == Just Custom) then do maybe_infoFile <- defaultHookedPackageDesc case maybe_infoFile of Nothing -> return emptyHookedBuildInfo Just infoFile -> readHookedBuildInfo verbosity infoFile else return emptyHookedBuildInfo let pd = updatePackageDescription hooked_bi pd0 -- generate Paths_<pkg>.hs and cabal-macros.h writeAutogenFiles verbosity pd lbi -- generate inplace-pkg-config withLibLBI pd lbi $ \lib clbi -> do cwd <- getCurrentDirectory let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace") let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir pd ipid lib lbi clbi final_ipi = installedPkgInfo { Installed.installedPackageId = ipid, Installed.haddockHTMLs = [] } content = Installed.showInstalledPackageInfo final_ipi ++ "\n" writeFileAtomic (distdir </> "inplace-pkg-config") (BS.pack $ toUTF8 content) let comp = compiler lbi libBiModules lib = (libBuildInfo lib, libModules lib) exeBiModules exe = (buildInfo exe, ModuleName.main : exeModules exe) biModuless = (maybeToList $ fmap libBiModules $ library pd) ++ (map exeBiModules $ executables pd) buildableBiModuless = filter isBuildable biModuless where isBuildable (bi', _) = buildable bi' (bi, modules) = case buildableBiModuless of [] -> error "No buildable component found" [biModules] -> biModules _ -> error ("XXX ghc-cabal can't handle " ++ "more than one buildinfo yet") -- XXX Another Just... Just ghcProg = lookupProgram ghcProgram (withPrograms lbi) dep_pkgs = PackageIndex.topologicalOrder (packageHacks (installedPkgs lbi)) forDeps f = concatMap f dep_pkgs -- copied from Distribution.Simple.PreProcess.ppHsc2Hs packageHacks = case compilerFlavor (compiler lbi) of GHC -> hackRtsPackage _ -> id -- We don't link in the actual Haskell libraries of our -- dependencies, so the -u flags in the ldOptions of the rts -- package mean linking fails on OS X (it's ld is a tad -- stricter than gnu ld). Thus we remove the ldOptions for -- GHC's rts package: hackRtsPackage index = case PackageIndex.lookupPackageName index (PackageName "rts") of [(_,[rts])] -> PackageIndex.insert rts{ Installed.ldOptions = [], Installed.libraryDirs = filter (not . ("gcc-lib" `isSuffixOf`)) (Installed.libraryDirs rts)} index -- GHC <= 6.12 had $topdir/gcc-lib in their -- library-dirs for the rts package, which causes -- problems when we try to use the in-tree mingw, -- due to accidentally picking up the incompatible -- libraries there. So we filter out gcc-lib from -- the RTS's library-dirs here. _ -> error "No (or multiple) ghc rts package is registered!!" dep_ids = map snd (externalPackageDeps lbi) deps = map display dep_ids dep_keys | packageKeySupported comp = map (display . Installed.packageKey . fromMaybe (error "ghc-cabal: dep_keys failed") . PackageIndex.lookupInstalledPackageId (installedPkgs lbi) . fst) . externalPackageDeps $ lbi | otherwise = deps depNames = map (display . packageName) dep_ids transitive_dep_ids = map Installed.sourcePackageId dep_pkgs transitiveDeps = map display transitive_dep_ids transitiveDepKeys | packageKeySupported comp = map (display . Installed.packageKey) dep_pkgs | otherwise = transitiveDeps transitiveDepNames = map (display . packageName) transitive_dep_ids libraryDirs = forDeps Installed.libraryDirs -- The mkLibraryRelDir function is a bit of a hack. -- Ideally it should be handled in the makefiles instead. mkLibraryRelDir "rts" = "rts/dist/build" mkLibraryRelDir "ghc" = "compiler/stage2/build" mkLibraryRelDir "Cabal" = "libraries/Cabal/Cabal/dist-install/build" mkLibraryRelDir l = "libraries/" ++ l ++ "/dist-install/build" libraryRelDirs = map mkLibraryRelDir transitiveDepNames wrappedIncludeDirs <- wrap $ forDeps Installed.includeDirs wrappedLibraryDirs <- wrap libraryDirs let variablePrefix = directory ++ '_':distdir mods = map display modules otherMods = map display (otherModules bi) allMods = mods ++ otherMods let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), variablePrefix ++ "_PACKAGE_KEY = " ++ display (pkgKey lbi), -- copied from mkComponentsLocalBuildInfo variablePrefix ++ "_LIB_NAME = " ++ packageKeyLibraryName (package pd) (pkgKey lbi), variablePrefix ++ "_MODULES = " ++ unwords mods, variablePrefix ++ "_HIDDEN_MODULES = " ++ unwords otherMods, variablePrefix ++ "_SYNOPSIS =" ++ synopsis pd, variablePrefix ++ "_HS_SRC_DIRS = " ++ unwords (hsSourceDirs bi), variablePrefix ++ "_DEPS = " ++ unwords deps, variablePrefix ++ "_DEP_KEYS = " ++ unwords dep_keys, variablePrefix ++ "_DEP_NAMES = " ++ unwords depNames, variablePrefix ++ "_TRANSITIVE_DEPS = " ++ unwords transitiveDeps, variablePrefix ++ "_TRANSITIVE_DEP_KEYS = " ++ unwords transitiveDepKeys, variablePrefix ++ "_TRANSITIVE_DEP_NAMES = " ++ unwords transitiveDepNames, variablePrefix ++ "_INCLUDE_DIRS = " ++ unwords (includeDirs bi), variablePrefix ++ "_INCLUDES = " ++ unwords (includes bi), variablePrefix ++ "_INSTALL_INCLUDES = " ++ unwords (installIncludes bi), variablePrefix ++ "_EXTRA_LIBRARIES = " ++ unwords (extraLibs bi), variablePrefix ++ "_EXTRA_LIBDIRS = " ++ unwords (extraLibDirs bi), variablePrefix ++ "_C_SRCS = " ++ unwords (cSources bi), variablePrefix ++ "_CMM_SRCS := $(addprefix cbits/,$(notdir $(wildcard " ++ directory ++ "/cbits/*.cmm)))", variablePrefix ++ "_DATA_FILES = " ++ unwords (dataFiles pd), -- XXX This includes things it shouldn't, like: -- -odir dist-bootstrapping/build variablePrefix ++ "_HC_OPTS = " ++ escape (unwords ( programDefaultArgs ghcProg ++ hcOptions GHC bi ++ languageToFlags (compiler lbi) (defaultLanguage bi) ++ extensionsToFlags (compiler lbi) (usedExtensions bi) ++ programOverrideArgs ghcProg)), variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi), variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi), variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), variablePrefix ++ "_DEP_INCLUDE_DIRS_SINGLE_QUOTED = " ++ unwords wrappedIncludeDirs, variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), variablePrefix ++ "_DEP_LIB_DIRS_SINGLE_QUOTED = " ++ unwords wrappedLibraryDirs, variablePrefix ++ "_DEP_LIB_DIRS_SEARCHPATH = " ++ mkSearchPath libraryDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS = " ++ unwords libraryRelDirs, variablePrefix ++ "_DEP_LIB_REL_DIRS_SEARCHPATH = " ++ mkSearchPath libraryRelDirs, variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions), variablePrefix ++ "_BUILD_GHCI_LIB = " ++ boolToYesNo (withGHCiLib lbi), "", -- Sometimes we need to modify the automatically-generated package-data.mk -- bindings in a special way for the GHC build system, so allow that here: "$(eval $(" ++ directory ++ "_PACKAGE_MAGIC))" ] writeFile (distdir ++ "/package-data.mk") $ unlines xs writeFileUtf8 (distdir ++ "/haddock-prologue.txt") $ if null (description pd) then synopsis pd else description pd unless (null dll0Modules) $ do let dll0Mods = words dll0Modules dllMods = allMods \\ dll0Mods dllModSets = map unwords [dll0Mods, dllMods] writeFile (distdir ++ "/dll-split") $ unlines dllModSets where escape = foldr (\c xs -> if c == '#' then '\\':'#':xs else c:xs) [] wrap = mapM wrap1 wrap1 s | null s = die ["Wrapping empty value"] | '\'' `elem` s = die ["Single quote in value to be wrapped:", s] -- We want to be able to assume things like <space><quote> is the -- start of a value, so check there are no spaces in confusing -- positions | head s == ' ' = die ["Leading space in value to be wrapped:", s] | last s == ' ' = die ["Trailing space in value to be wrapped:", s] | otherwise = return ("\'" ++ s ++ "\'") mkSearchPath = intercalate [searchPathSeparator] boolToYesNo True = "YES" boolToYesNo False = "NO" -- | Version of 'writeFile' that always uses UTF8 encoding writeFileUtf8 f txt = withFile f WriteMode $ \hdl -> do hSetEncoding hdl utf8 hPutStr hdl txt
11,190
false
true
17
21
3,934
2,169
1,086
1,083
null
null
bgamari/pandoc
src/Text/Pandoc/Readers/LaTeX.hs
gpl-2.0
macron 'o' = "ō"
16
macron 'o' = "ō"
16
macron 'o' = "ō"
16
false
false
1
5
3
13
4
9
null
null
spechub/Hets
TPTP/Parser.hs
gpl-2.0
-- <thf_subtype> ::= <thf_atom> <subtype_sign> <thf_atom> thf_subtype :: CharParser st THF_subtype thf_subtype = parserTrace "thf_subtype" ((do c1 <- try (thf_atom << subtype_sign) c2 <- thf_atom return $ THF_subtype c1 c2) <?> "thf_subtype" )
262
thf_subtype :: CharParser st THF_subtype thf_subtype = parserTrace "thf_subtype" ((do c1 <- try (thf_atom << subtype_sign) c2 <- thf_atom return $ THF_subtype c1 c2) <?> "thf_subtype" )
195
thf_subtype = parserTrace "thf_subtype" ((do c1 <- try (thf_atom << subtype_sign) c2 <- thf_atom return $ THF_subtype c1 c2) <?> "thf_subtype" )
154
true
true
0
14
51
68
33
35
null
null
MarcoSero/Norvigs-Spelling-Corrector
src/Spelling.hs
mit
edits1 :: B.ByteString -> WordSet edits1 w = S.fromList $ deletes ++ transposes ++ replaces ++ inserts where splits :: [(B.ByteString, B.ByteString)] splits = [ B.splitAt n w | n <- [0 .. B.length w - 1] ] deletes :: [B.ByteString] deletes = map (\(a, b) -> B.concat[a, B.tail b]) splits transposes :: [B.ByteString] transposes = [ B.concat [a, B.tail b, b, B.drop 2 b] | (a, b) <- splits ] replaces :: [B.ByteString] replaces = [ B.concat [a, B.singleton c, B.tail b] | (a, b) <- splits, c <- alphabet] inserts :: [B.ByteString] inserts = [ B.concat [a, B.singleton c, b] | (a,b) <- splits, c <- alphabet]
740
edits1 :: B.ByteString -> WordSet edits1 w = S.fromList $ deletes ++ transposes ++ replaces ++ inserts where splits :: [(B.ByteString, B.ByteString)] splits = [ B.splitAt n w | n <- [0 .. B.length w - 1] ] deletes :: [B.ByteString] deletes = map (\(a, b) -> B.concat[a, B.tail b]) splits transposes :: [B.ByteString] transposes = [ B.concat [a, B.tail b, b, B.drop 2 b] | (a, b) <- splits ] replaces :: [B.ByteString] replaces = [ B.concat [a, B.singleton c, B.tail b] | (a, b) <- splits, c <- alphabet] inserts :: [B.ByteString] inserts = [ B.concat [a, B.singleton c, b] | (a,b) <- splits, c <- alphabet]
740
edits1 w = S.fromList $ deletes ++ transposes ++ replaces ++ inserts where splits :: [(B.ByteString, B.ByteString)] splits = [ B.splitAt n w | n <- [0 .. B.length w - 1] ] deletes :: [B.ByteString] deletes = map (\(a, b) -> B.concat[a, B.tail b]) splits transposes :: [B.ByteString] transposes = [ B.concat [a, B.tail b, b, B.drop 2 b] | (a, b) <- splits ] replaces :: [B.ByteString] replaces = [ B.concat [a, B.singleton c, B.tail b] | (a, b) <- splits, c <- alphabet] inserts :: [B.ByteString] inserts = [ B.concat [a, B.singleton c, b] | (a,b) <- splits, c <- alphabet]
706
false
true
2
11
242
369
187
182
null
null