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
mapinguari/SC_HS_Proxy
src/Proxy/Query/Unit.hs
mit
isWorker CritterRhynadon = False
32
isWorker CritterRhynadon = False
32
isWorker CritterRhynadon = False
32
false
false
0
5
3
9
4
5
null
null
harendra-kumar/asyncly
benchmark/StreamDOps.hs
bsd-3-clause
filterMap n = composeN n $ S.map (subtract 1) . S.filter (<= maxValue)
71
filterMap n = composeN n $ S.map (subtract 1) . S.filter (<= maxValue)
71
filterMap n = composeN n $ S.map (subtract 1) . S.filter (<= maxValue)
71
false
false
0
9
13
40
19
21
null
null
kadena-io/pact
src/Pact/Types/Util.hs
bsd-3-clause
-- | Text-y show tShow :: Show a => a -> Text tShow = pack . show
65
tShow :: Show a => a -> Text tShow = pack . show
48
tShow = pack . show
19
true
true
0
6
16
27
14
13
null
null
apyrgio/snf-ganeti
src/Ganeti/OpParams.hs
bsd-2-clause
pVmCapable :: Field pVmCapable = withDoc "Whether node can host instances" . optionalField $ booleanField "vm_capable"
122
pVmCapable :: Field pVmCapable = withDoc "Whether node can host instances" . optionalField $ booleanField "vm_capable"
122
pVmCapable = withDoc "Whether node can host instances" . optionalField $ booleanField "vm_capable"
102
false
true
0
7
19
25
12
13
null
null
lukemaurer/sequent-core
src/Language/SequentCore/OccurAnal.hs
bsd-3-clause
occurAnalyseJoin :: SeqCoreJoin -> SeqCoreJoin occurAnalyseJoin pk = snd (occAnalJoin env pk) where env = initOccEnv all_active_rules all_active_rules = \_ -> True {- %************************************************************************ %* * \subsection[OccurAnal-main]{Counting occurrences: main function} %* * %************************************************************************ Bindings ~~~~~~~~ -}
564
occurAnalyseJoin :: SeqCoreJoin -> SeqCoreJoin occurAnalyseJoin pk = snd (occAnalJoin env pk) where env = initOccEnv all_active_rules all_active_rules = \_ -> True {- %************************************************************************ %* * \subsection[OccurAnal-main]{Counting occurrences: main function} %* * %************************************************************************ Bindings ~~~~~~~~ -}
564
occurAnalyseJoin pk = snd (occAnalJoin env pk) where env = initOccEnv all_active_rules all_active_rules = \_ -> True {- %************************************************************************ %* * \subsection[OccurAnal-main]{Counting occurrences: main function} %* * %************************************************************************ Bindings ~~~~~~~~ -}
517
false
true
0
7
189
51
26
25
null
null
DanielSchiavini/ampersand
src/Database/Design/Ampersand/Input/ADL1/FilePos.hs
gpl-3.0
updatePos pos _ = addPos 1 pos
33
updatePos pos _ = addPos 1 pos
33
updatePos pos _ = addPos 1 pos
33
false
false
0
5
9
16
7
9
null
null
zlizta/PiSigma
src/Language/PiSigma/Lexer.hs
bsd-3-clause
semi :: Parser String semi = Token.semi tokenParser
88
semi :: Parser String semi = Token.semi tokenParser
88
semi = Token.semi tokenParser
53
false
true
0
6
44
19
9
10
null
null
icyfork/shellcheck
ShellCheck/Parser.hs
gpl-3.0
makeErrorFor parsecError = ParseNote (errorPos parsecError) ErrorC 1072 $ getStringFromParsec $ errorMessages parsecError
133
makeErrorFor parsecError = ParseNote (errorPos parsecError) ErrorC 1072 $ getStringFromParsec $ errorMessages parsecError
133
makeErrorFor parsecError = ParseNote (errorPos parsecError) ErrorC 1072 $ getStringFromParsec $ errorMessages parsecError
133
false
false
0
9
24
33
15
18
null
null
yesodweb/shakespeare
test/Text/CssSpec.hs
mit
caseCassiusSingleComment :: Assertion caseCassiusSingleComment = flip celper [cassius| /* this is a comment */ |] ""
152
caseCassiusSingleComment :: Assertion caseCassiusSingleComment = flip celper [cassius| /* this is a comment */ |] ""
152
caseCassiusSingleComment = flip celper [cassius| /* this is a comment */ |] ""
114
false
true
0
5
51
22
13
9
null
null
RefactoringTools/HaRe
old/testing/evalAddEvalMon/Scope3.hs
bsd-3-clause
b = f 76
8
b = f 76
8
b = f 76
8
false
false
1
5
3
12
4
8
null
null
sboosali/commands-spiros
config/Commands/Plugins/Spiros/Macros.hs
gpl-2.0
renderMagicSymbol = \case ColoredMagicSymbol x -> renderMagicColor x HybridMagicColor x y -> (renderMagicColor x) ++ (renderMagicColor y) GenericHybridMagicColor x -> "2" ++ renderMagicColor x LifeMagicColor x -> "P" ++ renderMagicColor x
250
renderMagicSymbol = \case ColoredMagicSymbol x -> renderMagicColor x HybridMagicColor x y -> (renderMagicColor x) ++ (renderMagicColor y) GenericHybridMagicColor x -> "2" ++ renderMagicColor x LifeMagicColor x -> "P" ++ renderMagicColor x
250
renderMagicSymbol = \case ColoredMagicSymbol x -> renderMagicColor x HybridMagicColor x y -> (renderMagicColor x) ++ (renderMagicColor y) GenericHybridMagicColor x -> "2" ++ renderMagicColor x LifeMagicColor x -> "P" ++ renderMagicColor x
250
false
false
0
10
42
79
36
43
null
null
prowdsponsor/mangopay
yesod-mangopay/app/Handler/Card.hs
bsd-3-clause
postCardR :: AnyUserId -> Handler Html postCardR uid=do ((result, _), _) <- runFormPost cardTokenForm mjcr<-lookupSession "cardReg" deleteSession "cardReg" case result of FormSuccess (Token dat)-> case mjcr of Nothing->do $(logError) $ "lookupSession->Nothing" setMessageI MsgErrorData redirect $ CardR uid Just jcr->do let ecr=eitherDecode $ fromChunks [TE.encodeUtf8 jcr] case ecr of Right cr->do _<-runYesodMPTToken $ modifyCardRegistration cr{crRegistrationData=Just dat} setMessageI MsgCardDone redirect $ CardsR uid Left err->do $(logError) $ pack err setMessageI MsgErrorData redirect $ CardR uid f ->do $(logError) $ pack $ show f setMessageI MsgErrorData redirect $ CardR uid -- | token for card registration
938
postCardR :: AnyUserId -> Handler Html postCardR uid=do ((result, _), _) <- runFormPost cardTokenForm mjcr<-lookupSession "cardReg" deleteSession "cardReg" case result of FormSuccess (Token dat)-> case mjcr of Nothing->do $(logError) $ "lookupSession->Nothing" setMessageI MsgErrorData redirect $ CardR uid Just jcr->do let ecr=eitherDecode $ fromChunks [TE.encodeUtf8 jcr] case ecr of Right cr->do _<-runYesodMPTToken $ modifyCardRegistration cr{crRegistrationData=Just dat} setMessageI MsgCardDone redirect $ CardsR uid Left err->do $(logError) $ pack err setMessageI MsgErrorData redirect $ CardR uid f ->do $(logError) $ pack $ show f setMessageI MsgErrorData redirect $ CardR uid -- | token for card registration
938
postCardR uid=do ((result, _), _) <- runFormPost cardTokenForm mjcr<-lookupSession "cardReg" deleteSession "cardReg" case result of FormSuccess (Token dat)-> case mjcr of Nothing->do $(logError) $ "lookupSession->Nothing" setMessageI MsgErrorData redirect $ CardR uid Just jcr->do let ecr=eitherDecode $ fromChunks [TE.encodeUtf8 jcr] case ecr of Right cr->do _<-runYesodMPTToken $ modifyCardRegistration cr{crRegistrationData=Just dat} setMessageI MsgCardDone redirect $ CardsR uid Left err->do $(logError) $ pack err setMessageI MsgErrorData redirect $ CardR uid f ->do $(logError) $ pack $ show f setMessageI MsgErrorData redirect $ CardR uid -- | token for card registration
899
false
true
0
26
313
293
129
164
null
null
beni55/haste-compiler
libraries/ghc-7.10/base/Text/Printf.hs
bsd-3-clause
errorShortFormat, errorMissingArgument, errorBadArgument :: a -- | Calls 'perror' to indicate that the format string ended -- early. -- -- @since 4.7.0.0 errorShortFormat = perror "formatting string ended prematurely"
217
errorShortFormat, errorMissingArgument, errorBadArgument :: a errorShortFormat = perror "formatting string ended prematurely"
125
errorShortFormat = perror "formatting string ended prematurely"
63
true
true
0
5
28
22
15
7
null
null
JakDar/lab6-project
src/Ex1.hs
bsd-3-clause
-- | Packs a type into Maybe context insertMaybe :: a -> Maybe a insertMaybe = Just
83
insertMaybe :: a -> Maybe a insertMaybe = Just
46
insertMaybe = Just
18
true
true
0
6
16
19
10
9
null
null
DanielSchiavini/ampersand
src/Database/Design/Ampersand/Input/ADL1/ParsingLib.hs
gpl-3.0
pComma :: AmpParser String pComma = pSpec ','
46
pComma :: AmpParser String pComma = pSpec ','
46
pComma = pSpec ','
19
false
true
0
5
8
17
8
9
null
null
gigavinyl/ordermage
src/Api/User.hs
mit
userServer :: Server UserApi userServer = getUsers :<|> getUserById
71
userServer :: Server UserApi userServer = getUsers :<|> getUserById
71
userServer = getUsers :<|> getUserById
42
false
true
0
5
12
18
9
9
null
null
alexander-at-github/eta
compiler/ETA/Main/DriverPipeline.hs
bsd-3-clause
compileOne :: HscEnv -> ModSummary -- ^ summary for module being compiled -> Int -- ^ module N ... -> Int -- ^ ... of M -> Maybe ModIface -- ^ old interface, if we have one -> Maybe Linkable -- ^ old linkable, if we have one -> SourceModified -> IO HomeModInfo -- ^ the complete HomeModInfo, if successful compileOne = compileOne' Nothing (Just batchMsg)
465
compileOne :: HscEnv -> ModSummary -- ^ summary for module being compiled -> Int -- ^ module N ... -> Int -- ^ ... of M -> Maybe ModIface -- ^ old interface, if we have one -> Maybe Linkable -- ^ old linkable, if we have one -> SourceModified -> IO HomeModInfo compileOne = compileOne' Nothing (Just batchMsg)
417
compileOne = compileOne' Nothing (Just batchMsg)
48
true
true
0
12
176
65
34
31
null
null
spechub/Hets
Common/Keywords.hs
gpl-2.0
whenS :: String whenS = "when"
30
whenS :: String whenS = "when"
30
whenS = "when"
14
false
true
0
6
5
18
7
11
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/YouTube/Types/Product.hs
mpl-2.0
-- | Creates a value of 'CaptionListResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cEtag' -- -- * 'cKind' -- -- * 'cItems' -- -- * 'cVisitorId' -- -- * 'cEventId' captionListResponse :: CaptionListResponse captionListResponse = CaptionListResponse' { _cEtag = Nothing , _cKind = "youtube#captionListResponse" , _cItems = Nothing , _cVisitorId = Nothing , _cEventId = Nothing }
505
captionListResponse :: CaptionListResponse captionListResponse = CaptionListResponse' { _cEtag = Nothing , _cKind = "youtube#captionListResponse" , _cItems = Nothing , _cVisitorId = Nothing , _cEventId = Nothing }
245
captionListResponse = CaptionListResponse' { _cEtag = Nothing , _cKind = "youtube#captionListResponse" , _cItems = Nothing , _cVisitorId = Nothing , _cEventId = Nothing }
198
true
true
0
6
108
56
40
16
null
null
joehillen/aura
src/Aura/Languages.hs
gpl-3.0
cleanABSTree_1 :: Language -> String cleanABSTree_1 = \case Japanese -> "ABS Treeの中身を削除?" Croatian -> "Obrisati cijelo ABS stablo?" German -> "Den gesamten ABS-Baum löschen?" Norwegian -> "Slett hele ABS-treet?" Italian -> "Cancellare l'intero albero ABS?" Portuguese -> "Remover a árvore ABS inteira?" French -> "Supprimer la totalité de l'arbre ABS ?" Russian -> "Удалить дерево ABS полностью?" Indonesia -> "Menghapus seluruh pohon ABS?" _ -> "Delete the entire ABS Tree?" -- NEEDS TRANSLATION
566
cleanABSTree_1 :: Language -> String cleanABSTree_1 = \case Japanese -> "ABS Treeの中身を削除?" Croatian -> "Obrisati cijelo ABS stablo?" German -> "Den gesamten ABS-Baum löschen?" Norwegian -> "Slett hele ABS-treet?" Italian -> "Cancellare l'intero albero ABS?" Portuguese -> "Remover a árvore ABS inteira?" French -> "Supprimer la totalité de l'arbre ABS ?" Russian -> "Удалить дерево ABS полностью?" Indonesia -> "Menghapus seluruh pohon ABS?" _ -> "Delete the entire ABS Tree?" -- NEEDS TRANSLATION
566
cleanABSTree_1 = \case Japanese -> "ABS Treeの中身を削除?" Croatian -> "Obrisati cijelo ABS stablo?" German -> "Den gesamten ABS-Baum löschen?" Norwegian -> "Slett hele ABS-treet?" Italian -> "Cancellare l'intero albero ABS?" Portuguese -> "Remover a árvore ABS inteira?" French -> "Supprimer la totalité de l'arbre ABS ?" Russian -> "Удалить дерево ABS полностью?" Indonesia -> "Menghapus seluruh pohon ABS?" _ -> "Delete the entire ABS Tree?" -- NEEDS TRANSLATION
529
false
true
0
8
142
85
41
44
null
null
bgamari/shaking-up-ghc
src/Settings/Default.hs
bsd-3-clause
defaultBuilderArgs :: Args defaultBuilderArgs = mconcat -- GHC-specific builders: [ alexBuilderArgs , ccBuilderArgs , configureBuilderArgs , deriveConstantsBuilderArgs , genPrimopCodeBuilderArgs , ghcBuilderArgs , ghcCabalBuilderArgs , ghcPkgBuilderArgs , haddockBuilderArgs , happyBuilderArgs , hsc2hsBuilderArgs , hsCppBuilderArgs , ldBuilderArgs , makeBuilderArgs , runTestBuilderArgs , xelatexBuilderArgs -- Generic builders from the Hadrian library: , builder (Ar Pack ) ? Hadrian.Builder.Ar.args Pack , builder (Ar Unpack ) ? Hadrian.Builder.Ar.args Unpack , builder (Sphinx Html ) ? Hadrian.Builder.Sphinx.args Html , builder (Sphinx Latex) ? Hadrian.Builder.Sphinx.args Latex , builder (Sphinx Man ) ? Hadrian.Builder.Sphinx.args Man , builder (Tar Create ) ? Hadrian.Builder.Tar.args Create , builder (Tar Extract ) ? Hadrian.Builder.Tar.args Extract ]
969
defaultBuilderArgs :: Args defaultBuilderArgs = mconcat -- GHC-specific builders: [ alexBuilderArgs , ccBuilderArgs , configureBuilderArgs , deriveConstantsBuilderArgs , genPrimopCodeBuilderArgs , ghcBuilderArgs , ghcCabalBuilderArgs , ghcPkgBuilderArgs , haddockBuilderArgs , happyBuilderArgs , hsc2hsBuilderArgs , hsCppBuilderArgs , ldBuilderArgs , makeBuilderArgs , runTestBuilderArgs , xelatexBuilderArgs -- Generic builders from the Hadrian library: , builder (Ar Pack ) ? Hadrian.Builder.Ar.args Pack , builder (Ar Unpack ) ? Hadrian.Builder.Ar.args Unpack , builder (Sphinx Html ) ? Hadrian.Builder.Sphinx.args Html , builder (Sphinx Latex) ? Hadrian.Builder.Sphinx.args Latex , builder (Sphinx Man ) ? Hadrian.Builder.Sphinx.args Man , builder (Tar Create ) ? Hadrian.Builder.Tar.args Create , builder (Tar Extract ) ? Hadrian.Builder.Tar.args Extract ]
969
defaultBuilderArgs = mconcat -- GHC-specific builders: [ alexBuilderArgs , ccBuilderArgs , configureBuilderArgs , deriveConstantsBuilderArgs , genPrimopCodeBuilderArgs , ghcBuilderArgs , ghcCabalBuilderArgs , ghcPkgBuilderArgs , haddockBuilderArgs , happyBuilderArgs , hsc2hsBuilderArgs , hsCppBuilderArgs , ldBuilderArgs , makeBuilderArgs , runTestBuilderArgs , xelatexBuilderArgs -- Generic builders from the Hadrian library: , builder (Ar Pack ) ? Hadrian.Builder.Ar.args Pack , builder (Ar Unpack ) ? Hadrian.Builder.Ar.args Unpack , builder (Sphinx Html ) ? Hadrian.Builder.Sphinx.args Html , builder (Sphinx Latex) ? Hadrian.Builder.Sphinx.args Latex , builder (Sphinx Man ) ? Hadrian.Builder.Sphinx.args Man , builder (Tar Create ) ? Hadrian.Builder.Tar.args Create , builder (Tar Extract ) ? Hadrian.Builder.Tar.args Extract ]
942
false
true
0
9
211
225
125
100
null
null
phaazon/linear
src/Linear/Matrix.hs
bsd-3-clause
-- |3x3 matrix inverse. -- -- >>> inv33 $ V3 (V3 1 2 4) (V3 4 2 2) (V3 1 1 1) -- Just (V3 (V3 0.0 0.5 (-1.0)) (V3 (-0.5) (-0.75) 3.5) (V3 0.5 0.25 (-1.5))) inv33 :: (Epsilon a, Floating a) => M33 a -> Maybe (M33 a) inv33 m@(V3 (V3 a b c) (V3 d e f) (V3 g h i)) | nearZero det = Nothing | otherwise = Just $ (1 / det) *!! V3 (V3 a' b' c') (V3 d' e' f') (V3 g' h' i') where a' = cofactor (e,f,h,i) b' = cofactor (c,b,i,h) c' = cofactor (b,c,e,f) d' = cofactor (f,d,i,g) e' = cofactor (a,c,g,i) f' = cofactor (c,a,f,d) g' = cofactor (d,e,g,h) h' = cofactor (b,a,h,g) i' = cofactor (a,b,d,e) cofactor (q,r,s,t) = det22 (V2 (V2 q r) (V2 s t)) det = det33 m
842
inv33 :: (Epsilon a, Floating a) => M33 a -> Maybe (M33 a) inv33 m@(V3 (V3 a b c) (V3 d e f) (V3 g h i)) | nearZero det = Nothing | otherwise = Just $ (1 / det) *!! V3 (V3 a' b' c') (V3 d' e' f') (V3 g' h' i') where a' = cofactor (e,f,h,i) b' = cofactor (c,b,i,h) c' = cofactor (b,c,e,f) d' = cofactor (f,d,i,g) e' = cofactor (a,c,g,i) f' = cofactor (c,a,f,d) g' = cofactor (d,e,g,h) h' = cofactor (b,a,h,g) i' = cofactor (a,b,d,e) cofactor (q,r,s,t) = det22 (V2 (V2 q r) (V2 s t)) det = det33 m
686
inv33 m@(V3 (V3 a b c) (V3 d e f) (V3 g h i)) | nearZero det = Nothing | otherwise = Just $ (1 / det) *!! V3 (V3 a' b' c') (V3 d' e' f') (V3 g' h' i') where a' = cofactor (e,f,h,i) b' = cofactor (c,b,i,h) c' = cofactor (b,c,e,f) d' = cofactor (f,d,i,g) e' = cofactor (a,c,g,i) f' = cofactor (c,a,f,d) g' = cofactor (d,e,g,h) h' = cofactor (b,a,h,g) i' = cofactor (a,b,d,e) cofactor (q,r,s,t) = det22 (V2 (V2 q r) (V2 s t)) det = det33 m
627
true
true
11
10
333
397
219
178
null
null
bmillwood/stepeval
src/Language/Haskell/Stepeval.hs
bsd-3-clause
funName (Match _ n _ _ _ _ : ms) = foldr match n ms where match (Match _ m _ _ _ _) n | m == n = n match m n = error $ "Match names don't? " ++ show (m, n) -- | Counts the number of patterns on the LHS of function equations. -- Error if the patterns have different numbers of arguments
291
funName (Match _ n _ _ _ _ : ms) = foldr match n ms where match (Match _ m _ _ _ _) n | m == n = n match m n = error $ "Match names don't? " ++ show (m, n) -- | Counts the number of patterns on the LHS of function equations. -- Error if the patterns have different numbers of arguments
291
funName (Match _ n _ _ _ _ : ms) = foldr match n ms where match (Match _ m _ _ _ _) n | m == n = n match m n = error $ "Match names don't? " ++ show (m, n) -- | Counts the number of patterns on the LHS of function equations. -- Error if the patterns have different numbers of arguments
291
false
false
0
8
73
104
51
53
null
null
jstolarek/ghc
compiler/main/DriverPipeline.hs
bsd-3-clause
runPhase (RealPhase LlvmLlc) input_fn dflags = do ver <- liftIO $ readIORef (llvmVersion dflags) let opt_lvl = max 0 (min 2 $ optLevel dflags) -- iOS requires external references to be loaded indirectly from the -- DATA segment or dyld traps at runtime writing into TEXT: see #7722 rmodel | platformOS (targetPlatform dflags) == OSiOS = "dynamic-no-pic" | gopt Opt_PIC dflags = "pic" | not (gopt Opt_Static dflags) = "dynamic-no-pic" | otherwise = "static" tbaa | ver < 29 = "" -- no tbaa in 2.8 and earlier | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true" | otherwise = "--enable-tbaa=false" -- hidden debugging flag '-dno-llvm-mangler' to skip mangling let next_phase = case gopt Opt_NoLlvmMangler dflags of False -> LlvmMangle True | gopt Opt_SplitObjs dflags -> Splitter True -> As False output_fn <- phaseOutputFilename next_phase -- AVX can cause LLVM 3.2 to generate a C-like frame pointer -- prelude, see #9391 when (ver == 32 && isAvxEnabled dflags) $ liftIO $ errorMsg dflags $ text "Note: LLVM 3.2 has known problems with AVX instructions (see trac #9391)" liftIO $ SysTools.runLlvmLlc dflags ([ SysTools.Option (llvmOpts !! opt_lvl), SysTools.Option $ "-relocation-model=" ++ rmodel, SysTools.FileOption "" input_fn, SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ [SysTools.Option tbaa] ++ map SysTools.Option fpOpts ++ map SysTools.Option abiOpts ++ map SysTools.Option sseOpts ++ map SysTools.Option (avxOpts ver) ++ map SysTools.Option avx512Opts ++ map SysTools.Option stackAlignOpts) return (RealPhase next_phase, output_fn) where -- Bug in LLVM at O3 on OSX. llvmOpts = if platformOS (targetPlatform dflags) == OSDarwin then ["-O1", "-O2", "-O2"] else ["-O1", "-O2", "-O3"] -- On ARMv7 using LLVM, LLVM fails to allocate floating point registers -- while compiling GHC source code. It's probably due to fact that it -- does not enable VFP by default. Let's do this manually here fpOpts = case platformArch (targetPlatform dflags) of ArchARM ARMv7 ext _ -> if (elem VFPv3 ext) then ["-mattr=+v7,+vfp3"] else if (elem VFPv3D16 ext) then ["-mattr=+v7,+vfp3,+d16"] else [] ArchARM ARMv6 ext _ -> if (elem VFPv2 ext) then ["-mattr=+v6,+vfp2"] else ["-mattr=+v6"] _ -> [] -- On Ubuntu/Debian with ARM hard float ABI, LLVM's llc still -- compiles into soft-float ABI. We need to explicitly set abi -- to hard abiOpts = case platformArch (targetPlatform dflags) of ArchARM _ _ HARD -> ["-float-abi=hard"] ArchARM _ _ _ -> [] _ -> [] sseOpts | isSse4_2Enabled dflags = ["-mattr=+sse42"] | isSse2Enabled dflags = ["-mattr=+sse2"] | isSseEnabled dflags = ["-mattr=+sse"] | otherwise = [] avxOpts ver | isAvx512fEnabled dflags = ["-mattr=+avx512f"] | isAvx2Enabled dflags = ["-mattr=+avx2"] | isAvxEnabled dflags = ["-mattr=+avx"] | ver == 32 = ["-mattr=-avx"] -- see #9391 | otherwise = [] avx512Opts = [ "-mattr=+avx512cd" | isAvx512cdEnabled dflags ] ++ [ "-mattr=+avx512er" | isAvx512erEnabled dflags ] ++ [ "-mattr=+avx512pf" | isAvx512pfEnabled dflags ] stackAlignOpts = case platformArch (targetPlatform dflags) of ArchX86_64 | isAvxEnabled dflags -> ["-stack-alignment=32"] _ -> [] ----------------------------------------------------------------------------- -- LlvmMangle phase
4,646
runPhase (RealPhase LlvmLlc) input_fn dflags = do ver <- liftIO $ readIORef (llvmVersion dflags) let opt_lvl = max 0 (min 2 $ optLevel dflags) -- iOS requires external references to be loaded indirectly from the -- DATA segment or dyld traps at runtime writing into TEXT: see #7722 rmodel | platformOS (targetPlatform dflags) == OSiOS = "dynamic-no-pic" | gopt Opt_PIC dflags = "pic" | not (gopt Opt_Static dflags) = "dynamic-no-pic" | otherwise = "static" tbaa | ver < 29 = "" -- no tbaa in 2.8 and earlier | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true" | otherwise = "--enable-tbaa=false" -- hidden debugging flag '-dno-llvm-mangler' to skip mangling let next_phase = case gopt Opt_NoLlvmMangler dflags of False -> LlvmMangle True | gopt Opt_SplitObjs dflags -> Splitter True -> As False output_fn <- phaseOutputFilename next_phase -- AVX can cause LLVM 3.2 to generate a C-like frame pointer -- prelude, see #9391 when (ver == 32 && isAvxEnabled dflags) $ liftIO $ errorMsg dflags $ text "Note: LLVM 3.2 has known problems with AVX instructions (see trac #9391)" liftIO $ SysTools.runLlvmLlc dflags ([ SysTools.Option (llvmOpts !! opt_lvl), SysTools.Option $ "-relocation-model=" ++ rmodel, SysTools.FileOption "" input_fn, SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ [SysTools.Option tbaa] ++ map SysTools.Option fpOpts ++ map SysTools.Option abiOpts ++ map SysTools.Option sseOpts ++ map SysTools.Option (avxOpts ver) ++ map SysTools.Option avx512Opts ++ map SysTools.Option stackAlignOpts) return (RealPhase next_phase, output_fn) where -- Bug in LLVM at O3 on OSX. llvmOpts = if platformOS (targetPlatform dflags) == OSDarwin then ["-O1", "-O2", "-O2"] else ["-O1", "-O2", "-O3"] -- On ARMv7 using LLVM, LLVM fails to allocate floating point registers -- while compiling GHC source code. It's probably due to fact that it -- does not enable VFP by default. Let's do this manually here fpOpts = case platformArch (targetPlatform dflags) of ArchARM ARMv7 ext _ -> if (elem VFPv3 ext) then ["-mattr=+v7,+vfp3"] else if (elem VFPv3D16 ext) then ["-mattr=+v7,+vfp3,+d16"] else [] ArchARM ARMv6 ext _ -> if (elem VFPv2 ext) then ["-mattr=+v6,+vfp2"] else ["-mattr=+v6"] _ -> [] -- On Ubuntu/Debian with ARM hard float ABI, LLVM's llc still -- compiles into soft-float ABI. We need to explicitly set abi -- to hard abiOpts = case platformArch (targetPlatform dflags) of ArchARM _ _ HARD -> ["-float-abi=hard"] ArchARM _ _ _ -> [] _ -> [] sseOpts | isSse4_2Enabled dflags = ["-mattr=+sse42"] | isSse2Enabled dflags = ["-mattr=+sse2"] | isSseEnabled dflags = ["-mattr=+sse"] | otherwise = [] avxOpts ver | isAvx512fEnabled dflags = ["-mattr=+avx512f"] | isAvx2Enabled dflags = ["-mattr=+avx2"] | isAvxEnabled dflags = ["-mattr=+avx"] | ver == 32 = ["-mattr=-avx"] -- see #9391 | otherwise = [] avx512Opts = [ "-mattr=+avx512cd" | isAvx512cdEnabled dflags ] ++ [ "-mattr=+avx512er" | isAvx512erEnabled dflags ] ++ [ "-mattr=+avx512pf" | isAvx512pfEnabled dflags ] stackAlignOpts = case platformArch (targetPlatform dflags) of ArchX86_64 | isAvxEnabled dflags -> ["-stack-alignment=32"] _ -> [] ----------------------------------------------------------------------------- -- LlvmMangle phase
4,646
runPhase (RealPhase LlvmLlc) input_fn dflags = do ver <- liftIO $ readIORef (llvmVersion dflags) let opt_lvl = max 0 (min 2 $ optLevel dflags) -- iOS requires external references to be loaded indirectly from the -- DATA segment or dyld traps at runtime writing into TEXT: see #7722 rmodel | platformOS (targetPlatform dflags) == OSiOS = "dynamic-no-pic" | gopt Opt_PIC dflags = "pic" | not (gopt Opt_Static dflags) = "dynamic-no-pic" | otherwise = "static" tbaa | ver < 29 = "" -- no tbaa in 2.8 and earlier | gopt Opt_LlvmTBAA dflags = "--enable-tbaa=true" | otherwise = "--enable-tbaa=false" -- hidden debugging flag '-dno-llvm-mangler' to skip mangling let next_phase = case gopt Opt_NoLlvmMangler dflags of False -> LlvmMangle True | gopt Opt_SplitObjs dflags -> Splitter True -> As False output_fn <- phaseOutputFilename next_phase -- AVX can cause LLVM 3.2 to generate a C-like frame pointer -- prelude, see #9391 when (ver == 32 && isAvxEnabled dflags) $ liftIO $ errorMsg dflags $ text "Note: LLVM 3.2 has known problems with AVX instructions (see trac #9391)" liftIO $ SysTools.runLlvmLlc dflags ([ SysTools.Option (llvmOpts !! opt_lvl), SysTools.Option $ "-relocation-model=" ++ rmodel, SysTools.FileOption "" input_fn, SysTools.Option "-o", SysTools.FileOption "" output_fn] ++ [SysTools.Option tbaa] ++ map SysTools.Option fpOpts ++ map SysTools.Option abiOpts ++ map SysTools.Option sseOpts ++ map SysTools.Option (avxOpts ver) ++ map SysTools.Option avx512Opts ++ map SysTools.Option stackAlignOpts) return (RealPhase next_phase, output_fn) where -- Bug in LLVM at O3 on OSX. llvmOpts = if platformOS (targetPlatform dflags) == OSDarwin then ["-O1", "-O2", "-O2"] else ["-O1", "-O2", "-O3"] -- On ARMv7 using LLVM, LLVM fails to allocate floating point registers -- while compiling GHC source code. It's probably due to fact that it -- does not enable VFP by default. Let's do this manually here fpOpts = case platformArch (targetPlatform dflags) of ArchARM ARMv7 ext _ -> if (elem VFPv3 ext) then ["-mattr=+v7,+vfp3"] else if (elem VFPv3D16 ext) then ["-mattr=+v7,+vfp3,+d16"] else [] ArchARM ARMv6 ext _ -> if (elem VFPv2 ext) then ["-mattr=+v6,+vfp2"] else ["-mattr=+v6"] _ -> [] -- On Ubuntu/Debian with ARM hard float ABI, LLVM's llc still -- compiles into soft-float ABI. We need to explicitly set abi -- to hard abiOpts = case platformArch (targetPlatform dflags) of ArchARM _ _ HARD -> ["-float-abi=hard"] ArchARM _ _ _ -> [] _ -> [] sseOpts | isSse4_2Enabled dflags = ["-mattr=+sse42"] | isSse2Enabled dflags = ["-mattr=+sse2"] | isSseEnabled dflags = ["-mattr=+sse"] | otherwise = [] avxOpts ver | isAvx512fEnabled dflags = ["-mattr=+avx512f"] | isAvx2Enabled dflags = ["-mattr=+avx2"] | isAvxEnabled dflags = ["-mattr=+avx"] | ver == 32 = ["-mattr=-avx"] -- see #9391 | otherwise = [] avx512Opts = [ "-mattr=+avx512cd" | isAvx512cdEnabled dflags ] ++ [ "-mattr=+avx512er" | isAvx512erEnabled dflags ] ++ [ "-mattr=+avx512pf" | isAvx512pfEnabled dflags ] stackAlignOpts = case platformArch (targetPlatform dflags) of ArchX86_64 | isAvxEnabled dflags -> ["-stack-alignment=32"] _ -> [] ----------------------------------------------------------------------------- -- LlvmMangle phase
4,646
false
false
0
20
1,911
897
441
456
null
null
TomHammersley/HaskellRenderer
app/src/Tests/ColourTest.hs
gpl-2.0
test_Luminance0 = TestCase (assertEqual "Luminance = 0" expected (luminance v1)) where v1 = Colour 0 0 0 0 expected = 0
135
test_Luminance0 = TestCase (assertEqual "Luminance = 0" expected (luminance v1)) where v1 = Colour 0 0 0 0 expected = 0
135
test_Luminance0 = TestCase (assertEqual "Luminance = 0" expected (luminance v1)) where v1 = Colour 0 0 0 0 expected = 0
135
false
false
3
8
36
60
23
37
null
null
zcleghern/hchess
src/ChessBoard.hs
mit
southOf :: Coord -> Coord -> Bool southOf (Coord _ y1) (Coord _ y2) = y1 > y2
77
southOf :: Coord -> Coord -> Bool southOf (Coord _ y1) (Coord _ y2) = y1 > y2
77
southOf (Coord _ y1) (Coord _ y2) = y1 > y2
43
false
true
0
10
17
50
23
27
null
null
NightRa/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
doOp v (LSLt (ATInt ITNative)) [l, r] = v ++ "INTOP(<," ++ creg l ++ ", " ++ creg r ++ ")"
90
doOp v (LSLt (ATInt ITNative)) [l, r] = v ++ "INTOP(<," ++ creg l ++ ", " ++ creg r ++ ")"
90
doOp v (LSLt (ATInt ITNative)) [l, r] = v ++ "INTOP(<," ++ creg l ++ ", " ++ creg r ++ ")"
90
false
false
0
9
21
57
28
29
null
null
themoritz/cabal
Cabal/Distribution/PackageDescription/PrettyPrint.hs
bsd-3-clause
ppCondition (CAnd c1 c2) = parens (hsep [ppCondition c1, text "&&" <+> ppCondition c2])
160
ppCondition (CAnd c1 c2) = parens (hsep [ppCondition c1, text "&&" <+> ppCondition c2])
160
ppCondition (CAnd c1 c2) = parens (hsep [ppCondition c1, text "&&" <+> ppCondition c2])
160
false
false
0
10
86
46
21
25
null
null
tjhunter/karps
haskell/test/Spark/Core/Internal/PathsSpec.hs
apache-2.0
gatherings :: [(String, [[String]])] -> M.Map VertexId [[VertexId]] gatherings [] = M.empty
91
gatherings :: [(String, [[String]])] -> M.Map VertexId [[VertexId]] gatherings [] = M.empty
91
gatherings [] = M.empty
23
false
true
0
9
11
50
28
22
null
null
tolysz/vector-algorithms
bench/Main.hs
bsd-3-clause
options :: [OptDescr OptionsT] options = [ Option ['A'] ["algorithm"] (ReqArg parseAlgo "ALGO") ("Specify an algorithm to be run. Options:\n" ++ algoOpts) , Option ['n'] ["num-elems"] (ReqArg parseN "INT") "Specify the size of arrays in algorithms." , Option ['k'] ["portion"] (ReqArg parseK "INT") "Specify the number of elements to partial sort/select in\nrelevant algorithms." , Option ['?','v'] ["help"] (NoArg $ \o -> Right $ o { usage = True }) "Show options." ] where allAlgos :: [Algorithm] allAlgos = [minBound .. maxBound] algoOpts = fmt allAlgos fmt (x:y:zs) = '\t' : pad (show x) ++ show y ++ "\n" ++ fmt zs fmt [x] = '\t' : show x ++ "\n" fmt [] = "" size = (" " ++) . maximumBy (comparing P.length) . map show $ allAlgos pad str = zipWith const (str ++ repeat ' ') size
944
options :: [OptDescr OptionsT] options = [ Option ['A'] ["algorithm"] (ReqArg parseAlgo "ALGO") ("Specify an algorithm to be run. Options:\n" ++ algoOpts) , Option ['n'] ["num-elems"] (ReqArg parseN "INT") "Specify the size of arrays in algorithms." , Option ['k'] ["portion"] (ReqArg parseK "INT") "Specify the number of elements to partial sort/select in\nrelevant algorithms." , Option ['?','v'] ["help"] (NoArg $ \o -> Right $ o { usage = True }) "Show options." ] where allAlgos :: [Algorithm] allAlgos = [minBound .. maxBound] algoOpts = fmt allAlgos fmt (x:y:zs) = '\t' : pad (show x) ++ show y ++ "\n" ++ fmt zs fmt [x] = '\t' : show x ++ "\n" fmt [] = "" size = (" " ++) . maximumBy (comparing P.length) . map show $ allAlgos pad str = zipWith const (str ++ repeat ' ') size
944
options = [ Option ['A'] ["algorithm"] (ReqArg parseAlgo "ALGO") ("Specify an algorithm to be run. Options:\n" ++ algoOpts) , Option ['n'] ["num-elems"] (ReqArg parseN "INT") "Specify the size of arrays in algorithms." , Option ['k'] ["portion"] (ReqArg parseK "INT") "Specify the number of elements to partial sort/select in\nrelevant algorithms." , Option ['?','v'] ["help"] (NoArg $ \o -> Right $ o { usage = True }) "Show options." ] where allAlgos :: [Algorithm] allAlgos = [minBound .. maxBound] algoOpts = fmt allAlgos fmt (x:y:zs) = '\t' : pad (show x) ++ show y ++ "\n" ++ fmt zs fmt [x] = '\t' : show x ++ "\n" fmt [] = "" size = (" " ++) . maximumBy (comparing P.length) . map show $ allAlgos pad str = zipWith const (str ++ repeat ' ') size
913
false
true
0
12
299
319
168
151
null
null
xrchz/ot
OpenTheory/Write.hs
gpl-3.0
-- |Run an article-writing action on the supplied destination. -- The article-writing state starts empty. evalWM :: WM a -> Handle -> IO a evalWM m h = evalWMState m h initialState
180
evalWM :: WM a -> Handle -> IO a evalWM m h = evalWMState m h initialState
74
evalWM m h = evalWMState m h initialState
41
true
true
0
7
31
39
19
20
null
null
Happstack/happstack-server
src/Happstack/Server/Internal/Types.hs
bsd-3-clause
continueHTTP :: Request -> Response -> Bool continueHTTP rq rs = (isHTTP1_0 rq && checkHeaderBS connectionC keepaliveC rq && (rsfLength (rsFlags rs) == ContentLength || isNoMessageBodyResponse rs)) || (isHTTP1_1 rq && not (checkHeaderBS connectionC closeC rq) && (rsfLength (rsFlags rs) /= NoContentLength || isNoMessageBodyResponse rs)) where isNoMessageBodyCode code = (code >= 100 && code <= 199) || code == 204 || code == 304 isNoMessageBodyResponse rs' = isNoMessageBodyCode (rsCode rs') && L.null (rsBody rs') -- | function to log access requests (see also: 'logMAccess') -- type LogAccess time = -- ( String -- ^ host -- -> String -- ^ user -- -> time -- ^ time -- -> String -- ^ requestLine -- -> Int -- ^ responseCode -- -> Integer -- ^ size -- -> String -- ^ referer -- -> String -- ^ userAgent -- -> IO ())
901
continueHTTP :: Request -> Response -> Bool continueHTTP rq rs = (isHTTP1_0 rq && checkHeaderBS connectionC keepaliveC rq && (rsfLength (rsFlags rs) == ContentLength || isNoMessageBodyResponse rs)) || (isHTTP1_1 rq && not (checkHeaderBS connectionC closeC rq) && (rsfLength (rsFlags rs) /= NoContentLength || isNoMessageBodyResponse rs)) where isNoMessageBodyCode code = (code >= 100 && code <= 199) || code == 204 || code == 304 isNoMessageBodyResponse rs' = isNoMessageBodyCode (rsCode rs') && L.null (rsBody rs') -- | function to log access requests (see also: 'logMAccess') -- type LogAccess time = -- ( String -- ^ host -- -> String -- ^ user -- -> time -- ^ time -- -> String -- ^ requestLine -- -> Int -- ^ responseCode -- -> Integer -- ^ size -- -> String -- ^ referer -- -> String -- ^ userAgent -- -> IO ())
901
continueHTTP rq rs = (isHTTP1_0 rq && checkHeaderBS connectionC keepaliveC rq && (rsfLength (rsFlags rs) == ContentLength || isNoMessageBodyResponse rs)) || (isHTTP1_1 rq && not (checkHeaderBS connectionC closeC rq) && (rsfLength (rsFlags rs) /= NoContentLength || isNoMessageBodyResponse rs)) where isNoMessageBodyCode code = (code >= 100 && code <= 199) || code == 204 || code == 304 isNoMessageBodyResponse rs' = isNoMessageBodyCode (rsCode rs') && L.null (rsBody rs') -- | function to log access requests (see also: 'logMAccess') -- type LogAccess time = -- ( String -- ^ host -- -> String -- ^ user -- -> time -- ^ time -- -> String -- ^ requestLine -- -> Int -- ^ responseCode -- -> Integer -- ^ size -- -> String -- ^ referer -- -> String -- ^ userAgent -- -> IO ())
857
false
true
0
13
224
211
107
104
null
null
matthewSorensen/weft
Robotics/Thingomatic/Setup.hs
gpl-3.0
zig::Double->Point2->[Point2] zig dx (x',dy) = zipWith (<+>) [(x,y)| x <- [0,dx..x'],y<-[0,0]] $ cycle [(0,0),(0,dy),(0,dy),(0,0)]
131
zig::Double->Point2->[Point2] zig dx (x',dy) = zipWith (<+>) [(x,y)| x <- [0,dx..x'],y<-[0,0]] $ cycle [(0,0),(0,dy),(0,dy),(0,0)]
131
zig dx (x',dy) = zipWith (<+>) [(x,y)| x <- [0,dx..x'],y<-[0,0]] $ cycle [(0,0),(0,dy),(0,dy),(0,0)]
101
false
true
0
10
14
122
72
50
null
null
jmitchell/Idris-dev
src/Idris/REPL.hs
bsd-3-clause
pprintDef :: Bool -> Name -> Idris [Doc OutputAnnotation] pprintDef asCore n = do ist <- getIState ctxt <- getContext let ambiguous = length (lookupNames n ctxt) > 1 patdefs = idris_patdefs ist tyinfo = idris_datatypes ist if asCore then return $ map (ppCoreDef ist) (lookupCtxtName n patdefs) else return $ map (ppDef ambiguous ist) (lookupCtxtName n patdefs) ++ map (ppTy ambiguous ist) (lookupCtxtName n tyinfo) ++ map (ppCon ambiguous ist) (filter (flip isDConName ctxt) (lookupNames n ctxt)) where ppCoreDef :: IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppCoreDef ist (n, (clauses, missing)) = case lookupTy n (tt_ctxt ist) of [] -> error "Attempted pprintDef of TT of thing that doesn't exist" (ty:_) -> prettyName True True [] n <+> colon <+> align (annotate (AnnTerm [] ty) (pprintTT [] ty)) <$> vsep (map (\(vars, lhs, rhs) -> pprintTTClause vars lhs rhs) clauses) ppDef :: Bool -> IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppDef amb ist (n, (clauses, missing)) = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <$> ppClauses ist (map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) clauses) <> ppMissing missing ppClauses ist [] = text "No clauses." ppClauses ist cs = vsep (map pp cs) where pp (vars, lhs, rhs) = let ppTm t = annotate (AnnTerm (zip vars (repeat False)) t) . pprintPTerm (ppOptionIst ist) (zip vars (repeat False)) [] (idris_infixes ist) . delab ist $ t in group $ ppTm lhs <+> text "=" <$> (group . align . hang 2 $ ppTm rhs) ppMissing _ = empty ppTy :: Bool -> IState -> (Name, TypeInfo) -> Doc OutputAnnotation ppTy amb ist (n, TI constructors isCodata _ _ _ _) = kwd key <+> prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <+> kwd "where" <$> indent 2 (vsep (map (ppCon False ist) constructors)) where key | isCodata = "codata" | otherwise = "data" kwd = annotate AnnKeyword . text ppCon amb ist n = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n)
2,586
pprintDef :: Bool -> Name -> Idris [Doc OutputAnnotation] pprintDef asCore n = do ist <- getIState ctxt <- getContext let ambiguous = length (lookupNames n ctxt) > 1 patdefs = idris_patdefs ist tyinfo = idris_datatypes ist if asCore then return $ map (ppCoreDef ist) (lookupCtxtName n patdefs) else return $ map (ppDef ambiguous ist) (lookupCtxtName n patdefs) ++ map (ppTy ambiguous ist) (lookupCtxtName n tyinfo) ++ map (ppCon ambiguous ist) (filter (flip isDConName ctxt) (lookupNames n ctxt)) where ppCoreDef :: IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppCoreDef ist (n, (clauses, missing)) = case lookupTy n (tt_ctxt ist) of [] -> error "Attempted pprintDef of TT of thing that doesn't exist" (ty:_) -> prettyName True True [] n <+> colon <+> align (annotate (AnnTerm [] ty) (pprintTT [] ty)) <$> vsep (map (\(vars, lhs, rhs) -> pprintTTClause vars lhs rhs) clauses) ppDef :: Bool -> IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppDef amb ist (n, (clauses, missing)) = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <$> ppClauses ist (map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) clauses) <> ppMissing missing ppClauses ist [] = text "No clauses." ppClauses ist cs = vsep (map pp cs) where pp (vars, lhs, rhs) = let ppTm t = annotate (AnnTerm (zip vars (repeat False)) t) . pprintPTerm (ppOptionIst ist) (zip vars (repeat False)) [] (idris_infixes ist) . delab ist $ t in group $ ppTm lhs <+> text "=" <$> (group . align . hang 2 $ ppTm rhs) ppMissing _ = empty ppTy :: Bool -> IState -> (Name, TypeInfo) -> Doc OutputAnnotation ppTy amb ist (n, TI constructors isCodata _ _ _ _) = kwd key <+> prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <+> kwd "where" <$> indent 2 (vsep (map (ppCon False ist) constructors)) where key | isCodata = "codata" | otherwise = "data" kwd = annotate AnnKeyword . text ppCon amb ist n = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n)
2,586
pprintDef asCore n = do ist <- getIState ctxt <- getContext let ambiguous = length (lookupNames n ctxt) > 1 patdefs = idris_patdefs ist tyinfo = idris_datatypes ist if asCore then return $ map (ppCoreDef ist) (lookupCtxtName n patdefs) else return $ map (ppDef ambiguous ist) (lookupCtxtName n patdefs) ++ map (ppTy ambiguous ist) (lookupCtxtName n tyinfo) ++ map (ppCon ambiguous ist) (filter (flip isDConName ctxt) (lookupNames n ctxt)) where ppCoreDef :: IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppCoreDef ist (n, (clauses, missing)) = case lookupTy n (tt_ctxt ist) of [] -> error "Attempted pprintDef of TT of thing that doesn't exist" (ty:_) -> prettyName True True [] n <+> colon <+> align (annotate (AnnTerm [] ty) (pprintTT [] ty)) <$> vsep (map (\(vars, lhs, rhs) -> pprintTTClause vars lhs rhs) clauses) ppDef :: Bool -> IState -> (Name, ([([(Name, Term)], Term, Term)], [PTerm])) -> Doc OutputAnnotation ppDef amb ist (n, (clauses, missing)) = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <$> ppClauses ist (map (\(ns, lhs, rhs) -> (map fst ns, lhs, rhs)) clauses) <> ppMissing missing ppClauses ist [] = text "No clauses." ppClauses ist cs = vsep (map pp cs) where pp (vars, lhs, rhs) = let ppTm t = annotate (AnnTerm (zip vars (repeat False)) t) . pprintPTerm (ppOptionIst ist) (zip vars (repeat False)) [] (idris_infixes ist) . delab ist $ t in group $ ppTm lhs <+> text "=" <$> (group . align . hang 2 $ ppTm rhs) ppMissing _ = empty ppTy :: Bool -> IState -> (Name, TypeInfo) -> Doc OutputAnnotation ppTy amb ist (n, TI constructors isCodata _ _ _ _) = kwd key <+> prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n) <+> kwd "where" <$> indent 2 (vsep (map (ppCon False ist) constructors)) where key | isCodata = "codata" | otherwise = "data" kwd = annotate AnnKeyword . text ppCon amb ist n = prettyName True amb [] n <+> colon <+> align (pprintDelabTy ist n)
2,528
false
true
56
15
921
958
498
460
null
null
vikraman/ghc
compiler/typecheck/TcRnTypes.hs
bsd-3-clause
-- | Get the role relevant for a 'CtEvidence' ctEvRole :: CtEvidence -> Role ctEvRole = eqRelRole . ctEvEqRel
109
ctEvRole :: CtEvidence -> Role ctEvRole = eqRelRole . ctEvEqRel
63
ctEvRole = eqRelRole . ctEvEqRel
32
true
true
1
7
18
28
12
16
null
null
AlexeyRaga/eta
compiler/ETA/Main/DynFlags.hs
bsd-3-clause
-- ----------------------------------------------------------------------------- -- Standard sets of warning options -- Note [Documenting warning flags] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- -- If you change the list of warning enabled by default -- please remember to update the User's Guide. The relevant file is: -- -- * docs/users_guide/using.xml standardWarnings :: [WarningFlag] standardWarnings -- see Note [Documenting warning flags] = [ Opt_WarnOverlappingPatterns, Opt_WarnWarningsDeprecations, Opt_WarnDeprecatedFlags, Opt_WarnTypedHoles, Opt_WarnPartialTypeSignatures, Opt_WarnUnrecognisedPragmas, Opt_WarnPointlessPragmas, Opt_WarnDuplicateConstraints, Opt_WarnDuplicateExports, Opt_WarnOverflowedLiterals, Opt_WarnEmptyEnumerations, Opt_WarnMissingFields, Opt_WarnMissingMethods, Opt_WarnWrongDoBind, Opt_WarnUnsupportedCallingConventions, Opt_WarnDodgyForeignImports, Opt_WarnInlineRuleShadowing, Opt_WarnAlternativeLayoutRuleTransitional, Opt_WarnUnsupportedLlvmVersion, Opt_WarnContextQuantification, Opt_WarnTabs ]
1,206
standardWarnings :: [WarningFlag] standardWarnings -- see Note [Documenting warning flags] = [ Opt_WarnOverlappingPatterns, Opt_WarnWarningsDeprecations, Opt_WarnDeprecatedFlags, Opt_WarnTypedHoles, Opt_WarnPartialTypeSignatures, Opt_WarnUnrecognisedPragmas, Opt_WarnPointlessPragmas, Opt_WarnDuplicateConstraints, Opt_WarnDuplicateExports, Opt_WarnOverflowedLiterals, Opt_WarnEmptyEnumerations, Opt_WarnMissingFields, Opt_WarnMissingMethods, Opt_WarnWrongDoBind, Opt_WarnUnsupportedCallingConventions, Opt_WarnDodgyForeignImports, Opt_WarnInlineRuleShadowing, Opt_WarnAlternativeLayoutRuleTransitional, Opt_WarnUnsupportedLlvmVersion, Opt_WarnContextQuantification, Opt_WarnTabs ]
851
standardWarnings -- see Note [Documenting warning flags] = [ Opt_WarnOverlappingPatterns, Opt_WarnWarningsDeprecations, Opt_WarnDeprecatedFlags, Opt_WarnTypedHoles, Opt_WarnPartialTypeSignatures, Opt_WarnUnrecognisedPragmas, Opt_WarnPointlessPragmas, Opt_WarnDuplicateConstraints, Opt_WarnDuplicateExports, Opt_WarnOverflowedLiterals, Opt_WarnEmptyEnumerations, Opt_WarnMissingFields, Opt_WarnMissingMethods, Opt_WarnWrongDoBind, Opt_WarnUnsupportedCallingConventions, Opt_WarnDodgyForeignImports, Opt_WarnInlineRuleShadowing, Opt_WarnAlternativeLayoutRuleTransitional, Opt_WarnUnsupportedLlvmVersion, Opt_WarnContextQuantification, Opt_WarnTabs ]
817
true
true
0
5
249
87
60
27
null
null
joshuaunderwood7/HaskeLinGeom
Piece.hs
gpl-3.0
transColor piece | color piece == Black = makeChessPiece White (rank piece) (location piece) | color piece == White = makeChessPiece Black (rank piece) (location piece) | otherwise = piece
201
transColor piece | color piece == Black = makeChessPiece White (rank piece) (location piece) | color piece == White = makeChessPiece Black (rank piece) (location piece) | otherwise = piece
201
transColor piece | color piece == Black = makeChessPiece White (rank piece) (location piece) | color piece == White = makeChessPiece Black (rank piece) (location piece) | otherwise = piece
201
false
false
0
9
42
93
41
52
null
null
bbangert/hermes-hs
test/HermesSpec.hs
mpl-2.0
main :: IO () main = hspec spec
31
main :: IO () main = hspec spec
31
main = hspec spec
17
false
true
1
6
7
22
9
13
null
null
mauroblanco/fpnla-examples
src-test/TestBase.hs
bsd-3-clause
arbitraryTransMatrix :: (Arbitrary e, Matrix m e) => TransType a -> Int -> Int -> Gen (TransType (m e)) arbitraryTransMatrix (NoTrans _) m n = liftA NoTrans $ arbitraryMatrix m n
178
arbitraryTransMatrix :: (Arbitrary e, Matrix m e) => TransType a -> Int -> Int -> Gen (TransType (m e)) arbitraryTransMatrix (NoTrans _) m n = liftA NoTrans $ arbitraryMatrix m n
178
arbitraryTransMatrix (NoTrans _) m n = liftA NoTrans $ arbitraryMatrix m n
74
false
true
0
13
30
83
40
43
null
null
nevvi/Declarative-D7012E
pre2/expr.hs
gpl-3.0
eval (Op "+" left right) env = eval left env + eval right env
61
eval (Op "+" left right) env = eval left env + eval right env
61
eval (Op "+" left right) env = eval left env + eval right env
61
false
false
1
8
13
37
16
21
null
null
pdarragh/HaskQuest
src/HaskQuest/Game/Objects/Room.hs
mit
emptyRoom :: Room emptyRoom = Room "Empty" "An empty room with no way out." [] []
81
emptyRoom :: Room emptyRoom = Room "Empty" "An empty room with no way out." [] []
81
emptyRoom = Room "Empty" "An empty room with no way out." [] []
63
false
true
0
6
15
30
13
17
null
null
minad/omega
mosaic/OmegaParser.hs
bsd-3-clause
integer = lexeme $ do ds <- many1 digit; return $ IntLit (read ds) -- TH helpers
81
integer = lexeme $ do ds <- many1 digit; return $ IntLit (read ds) -- TH helpers
81
integer = lexeme $ do ds <- many1 digit; return $ IntLit (read ds) -- TH helpers
81
false
false
3
11
17
43
18
25
null
null
eji/mix-kenall-geocode
src/cli/Main.hs
mit
parsedAreaNameToAreaName (AreaNameOpt s1 s2) = s1 ++ s2
55
parsedAreaNameToAreaName (AreaNameOpt s1 s2) = s1 ++ s2
55
parsedAreaNameToAreaName (AreaNameOpt s1 s2) = s1 ++ s2
55
false
false
0
7
7
21
10
11
null
null
siddhanathan/ghc
libraries/base/Data/List/NonEmpty.hs
bsd-3-clause
-- | The 'isPrefix' function returns @True@ if the first argument is -- a prefix of the second. isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool isPrefixOf [] _ = True
166
isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool isPrefixOf [] _ = True
70
isPrefixOf [] _ = True
22
true
true
0
8
33
41
21
20
null
null
mainland/nikola
src/Data/Array/Nikola/Language/Optimize/Occ.hs
bsd-3-clause
occsJoin :: Map Var Occ -> Map Var Occ -> Map Var Occ occsJoin occs1 occs2 = Map.unionWith occJoin occs1 occs2
110
occsJoin :: Map Var Occ -> Map Var Occ -> Map Var Occ occsJoin occs1 occs2 = Map.unionWith occJoin occs1 occs2
110
occsJoin occs1 occs2 = Map.unionWith occJoin occs1 occs2
56
false
true
0
7
20
48
22
26
null
null
ocean0yohsuke/Scheme
test/UnitTest.hs
bsd-3-clause
testCase_Scheme_LISP = (\t -> "Scheme" ~: "LISP" ~: t) |$> [ (show $ L.append NIL (CELL (INT 1) NIL)) ~?= "(1)" , (show $ L.append NIL NIL) ~?= "()" , (show $ L.append (CELL (INT 1) NIL) NIL) ~?= "(1)" , (show $ L.append (CELL (INT 1) NIL) (CELL (INT 2) NIL)) ~?= "(1 2)" , (show $ L.append (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL))) (CELL (INT 4) (CELL (INT 5) NIL))) ~?= "(1 2 3 4 5)" , (show $ L.toList (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL)))) ~?= "[1,2,3]" , (show $ L.fromList [INT 1, INT 2, INT 3]) ~?= "(1 2 3)" , (show $ L.mapM (\x -> Just x) (CELL (INT 1) NIL)) ~?= "Just (1)" --, (show $ L.mapM (\x -> Just x) (CELL (INT 1) (INT 2))) ~?= "Just (1 . 2)" , L.isList (NIL) ~?= True , L.isList (CELL (INT 1) NIL) ~?= True , L.isList (CELL (INT 1) (INT 1)) ~?= False , L.length (CELL (INT 1) NIL) ~?= 1 , (show $ L.mapM (\x -> Just x) (CELL (INT 1) (CELL (INT 2) NIL))) ~?= "Just (1 2)" ]
1,184
testCase_Scheme_LISP = (\t -> "Scheme" ~: "LISP" ~: t) |$> [ (show $ L.append NIL (CELL (INT 1) NIL)) ~?= "(1)" , (show $ L.append NIL NIL) ~?= "()" , (show $ L.append (CELL (INT 1) NIL) NIL) ~?= "(1)" , (show $ L.append (CELL (INT 1) NIL) (CELL (INT 2) NIL)) ~?= "(1 2)" , (show $ L.append (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL))) (CELL (INT 4) (CELL (INT 5) NIL))) ~?= "(1 2 3 4 5)" , (show $ L.toList (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL)))) ~?= "[1,2,3]" , (show $ L.fromList [INT 1, INT 2, INT 3]) ~?= "(1 2 3)" , (show $ L.mapM (\x -> Just x) (CELL (INT 1) NIL)) ~?= "Just (1)" --, (show $ L.mapM (\x -> Just x) (CELL (INT 1) (INT 2))) ~?= "Just (1 . 2)" , L.isList (NIL) ~?= True , L.isList (CELL (INT 1) NIL) ~?= True , L.isList (CELL (INT 1) (INT 1)) ~?= False , L.length (CELL (INT 1) NIL) ~?= 1 , (show $ L.mapM (\x -> Just x) (CELL (INT 1) (CELL (INT 2) NIL))) ~?= "Just (1 2)" ]
1,184
testCase_Scheme_LISP = (\t -> "Scheme" ~: "LISP" ~: t) |$> [ (show $ L.append NIL (CELL (INT 1) NIL)) ~?= "(1)" , (show $ L.append NIL NIL) ~?= "()" , (show $ L.append (CELL (INT 1) NIL) NIL) ~?= "(1)" , (show $ L.append (CELL (INT 1) NIL) (CELL (INT 2) NIL)) ~?= "(1 2)" , (show $ L.append (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL))) (CELL (INT 4) (CELL (INT 5) NIL))) ~?= "(1 2 3 4 5)" , (show $ L.toList (CELL (INT 1) (CELL (INT 2) (CELL (INT 3) NIL)))) ~?= "[1,2,3]" , (show $ L.fromList [INT 1, INT 2, INT 3]) ~?= "(1 2 3)" , (show $ L.mapM (\x -> Just x) (CELL (INT 1) NIL)) ~?= "Just (1)" --, (show $ L.mapM (\x -> Just x) (CELL (INT 1) (INT 2))) ~?= "Just (1 . 2)" , L.isList (NIL) ~?= True , L.isList (CELL (INT 1) NIL) ~?= True , L.isList (CELL (INT 1) (INT 1)) ~?= False , L.length (CELL (INT 1) NIL) ~?= 1 , (show $ L.mapM (\x -> Just x) (CELL (INT 1) (CELL (INT 2) NIL))) ~?= "Just (1 2)" ]
1,184
false
false
0
18
470
561
288
273
null
null
tsuraan/optimal-blocks
src/Algorithm/OptimalBlocks/BuzzHash.hs
bsd-3-clause
{- |A pre-calculated array of hashes of bytes. -} hs :: Vector Word64 hs = generate 256 fn where fn n = hashByteString 2 4 k0 k1 $ pack [toEnum n] k0 = 0x4a7330fae70f52e8 k1 = 0x919ea5953a9a1ec9
204
hs :: Vector Word64 hs = generate 256 fn where fn n = hashByteString 2 4 k0 k1 $ pack [toEnum n] k0 = 0x4a7330fae70f52e8 k1 = 0x919ea5953a9a1ec9
153
hs = generate 256 fn where fn n = hashByteString 2 4 k0 k1 $ pack [toEnum n] k0 = 0x4a7330fae70f52e8 k1 = 0x919ea5953a9a1ec9
133
true
true
0
8
46
63
31
32
null
null
FranklinChen/hugs98-plus-Sep2006
packages/GLUT/examples/BOGLGP/Chapter03/TrianglesQuads.hs
bsd-3-clause
-- draw grid of points showing dataset we are working with drawPoints :: IO () drawPoints = do pointSize $= 4 renderPrimitive Points $ for [ 0 .. 3 ] $ \x -> for [ 0 .. 3 ] $ \z -> vertex (Vertex3 x 0 z) -- draw grid as individual triangles
274
drawPoints :: IO () drawPoints = do pointSize $= 4 renderPrimitive Points $ for [ 0 .. 3 ] $ \x -> for [ 0 .. 3 ] $ \z -> vertex (Vertex3 x 0 z) -- draw grid as individual triangles
215
drawPoints = do pointSize $= 4 renderPrimitive Points $ for [ 0 .. 3 ] $ \x -> for [ 0 .. 3 ] $ \z -> vertex (Vertex3 x 0 z) -- draw grid as individual triangles
195
true
true
0
13
86
84
43
41
null
null
mydaum/cabal
Cabal/Distribution/Simple/Setup.hs
bsd-3-clause
showPackageDbList :: [Maybe PackageDB] -> [String] showPackageDbList = map showPackageDb where showPackageDb Nothing = "clear" showPackageDb (Just GlobalPackageDB) = "global" showPackageDb (Just UserPackageDB) = "user" showPackageDb (Just (SpecificPackageDB db)) = db
323
showPackageDbList :: [Maybe PackageDB] -> [String] showPackageDbList = map showPackageDb where showPackageDb Nothing = "clear" showPackageDb (Just GlobalPackageDB) = "global" showPackageDb (Just UserPackageDB) = "user" showPackageDb (Just (SpecificPackageDB db)) = db
323
showPackageDbList = map showPackageDb where showPackageDb Nothing = "clear" showPackageDb (Just GlobalPackageDB) = "global" showPackageDb (Just UserPackageDB) = "user" showPackageDb (Just (SpecificPackageDB db)) = db
272
false
true
0
8
86
97
44
53
null
null
jwiegley/hnix
src/Nix/Pretty.hs
bsd-3-clause
valueToExpr :: forall t f m . MonadDataContext f m => NValue t f m -> NExpr valueToExpr = iterNValue (\_ _ -> thk) phi where thk = Fix . NSym . pack $ "<CYCLE>" phi :: NValue' t f m NExpr -> NExpr phi (NVConstant' a ) = Fix $ NConstant a phi (NVStr' ns) = mkStr ns phi (NVList' l ) = Fix $ NList l phi (NVSet' s p ) = Fix $ NSet [ NamedVar (StaticKey k :| []) v (fromMaybe nullPos (M.lookup k p)) | (k, v) <- toList s ] phi (NVClosure' _ _ ) = Fix . NSym . pack $ "<closure>" phi (NVPath' p ) = Fix $ NLiteralPath p phi (NVBuiltin' name _) = Fix . NSym . pack $ "builtins." ++ name phi _ = error "Pattern synonyms foil completeness check" mkStr ns = Fix $ NStr $ DoubleQuoted [Plain (hackyStringIgnoreContext ns)]
789
valueToExpr :: forall t f m . MonadDataContext f m => NValue t f m -> NExpr valueToExpr = iterNValue (\_ _ -> thk) phi where thk = Fix . NSym . pack $ "<CYCLE>" phi :: NValue' t f m NExpr -> NExpr phi (NVConstant' a ) = Fix $ NConstant a phi (NVStr' ns) = mkStr ns phi (NVList' l ) = Fix $ NList l phi (NVSet' s p ) = Fix $ NSet [ NamedVar (StaticKey k :| []) v (fromMaybe nullPos (M.lookup k p)) | (k, v) <- toList s ] phi (NVClosure' _ _ ) = Fix . NSym . pack $ "<closure>" phi (NVPath' p ) = Fix $ NLiteralPath p phi (NVBuiltin' name _) = Fix . NSym . pack $ "builtins." ++ name phi _ = error "Pattern synonyms foil completeness check" mkStr ns = Fix $ NStr $ DoubleQuoted [Plain (hackyStringIgnoreContext ns)]
789
valueToExpr = iterNValue (\_ _ -> thk) phi where thk = Fix . NSym . pack $ "<CYCLE>" phi :: NValue' t f m NExpr -> NExpr phi (NVConstant' a ) = Fix $ NConstant a phi (NVStr' ns) = mkStr ns phi (NVList' l ) = Fix $ NList l phi (NVSet' s p ) = Fix $ NSet [ NamedVar (StaticKey k :| []) v (fromMaybe nullPos (M.lookup k p)) | (k, v) <- toList s ] phi (NVClosure' _ _ ) = Fix . NSym . pack $ "<closure>" phi (NVPath' p ) = Fix $ NLiteralPath p phi (NVBuiltin' name _) = Fix . NSym . pack $ "builtins." ++ name phi _ = error "Pattern synonyms foil completeness check" mkStr ns = Fix $ NStr $ DoubleQuoted [Plain (hackyStringIgnoreContext ns)]
713
false
true
3
11
227
377
177
200
null
null
the-real-blackh/hexpat
Text/XML/Expat/Cursor.hs
bsd-3-clause
removeGoUp :: MkElementClass n c => CursorG n c tag text -> Maybe (CursorG n c tag text) removeGoUp loc = case (parents loc) of [] -> Nothing (pls, v, prs):ps -> Just $ Cur { current = fromTag v (reverseL (lefts loc) `mplus` rights loc) , lefts = pls, rights = prs, parents = ps } -- | private: Gets the given element of a list. -- Also returns the preceding elements (reversed) and the following elements.
472
removeGoUp :: MkElementClass n c => CursorG n c tag text -> Maybe (CursorG n c tag text) removeGoUp loc = case (parents loc) of [] -> Nothing (pls, v, prs):ps -> Just $ Cur { current = fromTag v (reverseL (lefts loc) `mplus` rights loc) , lefts = pls, rights = prs, parents = ps } -- | private: Gets the given element of a list. -- Also returns the preceding elements (reversed) and the following elements.
472
removeGoUp loc = case (parents loc) of [] -> Nothing (pls, v, prs):ps -> Just $ Cur { current = fromTag v (reverseL (lefts loc) `mplus` rights loc) , lefts = pls, rights = prs, parents = ps } -- | private: Gets the given element of a list. -- Also returns the preceding elements (reversed) and the following elements.
383
false
true
0
16
143
146
78
68
null
null
facebookincubator/duckling
Duckling/Time/EL/Rules.hs
bsd-3-clause
ruleDayofmonthNonOrdinalNamedmonth :: Rule ruleDayofmonthNonOrdinalNamedmonth = Rule { name = "<day-of-month> (non-ordinal) <named-month>" , pattern = [ Predicate isDOMInteger , Predicate isAMonth ] , prod = \tokens -> case tokens of (Token Time td:token:_) -> Token Time <$> intersectDOM td token _ -> Nothing }
344
ruleDayofmonthNonOrdinalNamedmonth :: Rule ruleDayofmonthNonOrdinalNamedmonth = Rule { name = "<day-of-month> (non-ordinal) <named-month>" , pattern = [ Predicate isDOMInteger , Predicate isAMonth ] , prod = \tokens -> case tokens of (Token Time td:token:_) -> Token Time <$> intersectDOM td token _ -> Nothing }
344
ruleDayofmonthNonOrdinalNamedmonth = Rule { name = "<day-of-month> (non-ordinal) <named-month>" , pattern = [ Predicate isDOMInteger , Predicate isAMonth ] , prod = \tokens -> case tokens of (Token Time td:token:_) -> Token Time <$> intersectDOM td token _ -> Nothing }
301
false
true
0
14
75
96
50
46
null
null
rloewe/petulant-octo-wallhack
Repl.hs
mit
main :: IO () main = runMoreCode M.empty M.empty
48
main :: IO () main = runMoreCode M.empty M.empty
48
main = runMoreCode M.empty M.empty
34
false
true
0
6
8
25
12
13
null
null
alanz/hroq
src/Data/Concurrent/Queue/Roq/Mnesia.hs
bsd-3-clause
do_dirty_all_keys :: TableName -> Process [QKey] do_dirty_all_keys tableName = do logm $ "HroqMnesia.unimplemented dirty_all_keys:" ++ (show tableName) return [] -- ---------------------------------------------------------------------
239
do_dirty_all_keys :: TableName -> Process [QKey] do_dirty_all_keys tableName = do logm $ "HroqMnesia.unimplemented dirty_all_keys:" ++ (show tableName) return [] -- ---------------------------------------------------------------------
239
do_dirty_all_keys tableName = do logm $ "HroqMnesia.unimplemented dirty_all_keys:" ++ (show tableName) return [] -- ---------------------------------------------------------------------
190
false
true
0
9
25
50
24
26
null
null
dec9ue/jhc_copygc
src/FrontEnd/TypeSyns.hs
gpl-2.0
renameHsNames :: [HsName] -> SubTable -> ScopeSM ([HsName]) renameHsNames ns _ = return ns
90
renameHsNames :: [HsName] -> SubTable -> ScopeSM ([HsName]) renameHsNames ns _ = return ns
90
renameHsNames ns _ = return ns
30
false
true
0
9
13
39
20
19
null
null
PavelClaudiuStefan/FMI
An_3_Semestru_1/ProgramareDeclarativa/Laboratoare/Laborator2/PicturesSVG.hs
cc0-1.0
clear = Img $ Image (Name "images/clear.png") (50,50)
66
clear = Img $ Image (Name "images/clear.png") (50,50)
66
clear = Img $ Image (Name "images/clear.png") (50,50)
66
false
false
3
7
20
32
14
18
null
null
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Util/Stack.hs
bsd-2-clause
focusDownZ (Just (W.Stack f up _)) = Just $ W.Stack (last up) [] (reverse (init up) ++ [f])
91
focusDownZ (Just (W.Stack f up _)) = Just $ W.Stack (last up) [] (reverse (init up) ++ [f])
91
focusDownZ (Just (W.Stack f up _)) = Just $ W.Stack (last up) [] (reverse (init up) ++ [f])
91
false
false
0
11
17
68
33
35
null
null
danidiaz/lens
src/Control/Lens/Wrapped.hs
bsd-3-clause
getRecUpdError :: RecUpdError -> String getRecUpdError (RecUpdError x) = x
74
getRecUpdError :: RecUpdError -> String getRecUpdError (RecUpdError x) = x
74
getRecUpdError (RecUpdError x) = x
34
false
true
0
7
9
24
12
12
null
null
JamieBeverley/InnerEar
src/InnerEar/Exercises/FiveBandBoostCut.hs
gpl-3.0
renderAnswer _ db (src, dur) _ = buildSynth $ do let env = maybe (return EmptyGraph) (unitRectEnv (Millis 1)) dur synthSource src >> gain (Db $ -10) >> env >> destination maybeDelete (fmap (+Sec 0.2) dur)
210
renderAnswer _ db (src, dur) _ = buildSynth $ do let env = maybe (return EmptyGraph) (unitRectEnv (Millis 1)) dur synthSource src >> gain (Db $ -10) >> env >> destination maybeDelete (fmap (+Sec 0.2) dur)
210
renderAnswer _ db (src, dur) _ = buildSynth $ do let env = maybe (return EmptyGraph) (unitRectEnv (Millis 1)) dur synthSource src >> gain (Db $ -10) >> env >> destination maybeDelete (fmap (+Sec 0.2) dur)
210
false
false
2
16
41
116
53
63
null
null
sampou-org/pfad
Code/Code05.hs
bsd-3-clause
subs1 :: [A] -> [A] -> [Label A] subs1 xs ys = [(x ⊖ y, (i,j)) | (x,i) <- zip xs [1..], (y,j) <- zip ys [1..]]
115
subs1 :: [A] -> [A] -> [Label A] subs1 xs ys = [(x ⊖ y, (i,j)) | (x,i) <- zip xs [1..], (y,j) <- zip ys [1..]]
115
subs1 xs ys = [(x ⊖ y, (i,j)) | (x,i) <- zip xs [1..], (y,j) <- zip ys [1..]]
80
false
true
0
9
31
99
55
44
null
null
dsalisbury/xmobar
src/Plugins/Monitors/Disk.hs
bsd-3-clause
devTemplates :: [(String, String)] -> [(DevName, Path)] -> [(DevName, [Float])] -> [(String, [Float])] devTemplates disks mounted dat = map (\(d, p) -> (findTempl d p disks, findData d)) mounted where findData dev = case find ((==dev) . fst) dat of Nothing -> [0, 0, 0] Just (_, xs) -> xs
390
devTemplates :: [(String, String)] -> [(DevName, Path)] -> [(DevName, [Float])] -> [(String, [Float])] devTemplates disks mounted dat = map (\(d, p) -> (findTempl d p disks, findData d)) mounted where findData dev = case find ((==dev) . fst) dat of Nothing -> [0, 0, 0] Just (_, xs) -> xs
390
devTemplates disks mounted dat = map (\(d, p) -> (findTempl d p disks, findData d)) mounted where findData dev = case find ((==dev) . fst) dat of Nothing -> [0, 0, 0] Just (_, xs) -> xs
239
false
true
0
10
151
167
95
72
null
null
matterhorn-chat/matterhorn
src/Matterhorn/Draw/RichText/Flatten.hs
bsd-3-clause
flattenInlineSeq' :: SemEq a => FlattenEnv a -> Int -> Inlines -> (Int, Seq (Seq (FlattenedValue a))) flattenInlineSeq' env c is = (fsNameIndex finalState, fsCompletedLines finalState) where finalState = execState stBody initialState initialState = FlattenState { fsCompletedLines = mempty , fsCurLine = mempty , fsNameIndex = c } stBody = runReaderT body env body = do flattenInlines is pushFLine
641
flattenInlineSeq' :: SemEq a => FlattenEnv a -> Int -> Inlines -> (Int, Seq (Seq (FlattenedValue a))) flattenInlineSeq' env c is = (fsNameIndex finalState, fsCompletedLines finalState) where finalState = execState stBody initialState initialState = FlattenState { fsCompletedLines = mempty , fsCurLine = mempty , fsNameIndex = c } stBody = runReaderT body env body = do flattenInlines is pushFLine
641
flattenInlineSeq' env c is = (fsNameIndex finalState, fsCompletedLines finalState) where finalState = execState stBody initialState initialState = FlattenState { fsCompletedLines = mempty , fsCurLine = mempty , fsNameIndex = c } stBody = runReaderT body env body = do flattenInlines is pushFLine
467
false
true
3
14
302
138
69
69
null
null
brendanhay/gogol
gogol-drive/gen/Network/Google/Drive/Types/Product.hs
mpl-2.0
-- | Creates a value of 'AboutStorageQuota' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'asqUsageInDriveTrash' -- -- * 'asqLimit' -- -- * 'asqUsage' -- -- * 'asqUsageInDrive' aboutStorageQuota :: AboutStorageQuota aboutStorageQuota = AboutStorageQuota' { _asqUsageInDriveTrash = Nothing , _asqLimit = Nothing , _asqUsage = Nothing , _asqUsageInDrive = Nothing }
476
aboutStorageQuota :: AboutStorageQuota aboutStorageQuota = AboutStorageQuota' { _asqUsageInDriveTrash = Nothing , _asqLimit = Nothing , _asqUsage = Nothing , _asqUsageInDrive = Nothing }
212
aboutStorageQuota = AboutStorageQuota' { _asqUsageInDriveTrash = Nothing , _asqLimit = Nothing , _asqUsage = Nothing , _asqUsageInDrive = Nothing }
169
true
true
0
6
94
48
34
14
null
null
dterei/Scraps
haskell/SplitAt_LazyPatterns.hs
bsd-3-clause
splitAt_ :: Int -> [a] -> ([a], [a]) splitAt_ n xs | n <= 0 = ([], xs)
70
splitAt_ :: Int -> [a] -> ([a], [a]) splitAt_ n xs | n <= 0 = ([], xs)
70
splitAt_ n xs | n <= 0 = ([], xs)
33
false
true
0
10
17
63
32
31
null
null
ezyang/ghc
libraries/base/Data/OldList.hs
bsd-3-clause
inits :: [a] -> [[a]] inits = map toListSB . scanl' snocSB emptySB
102
inits :: [a] -> [[a]] inits = map toListSB . scanl' snocSB emptySB
102
inits = map toListSB . scanl' snocSB emptySB
62
false
true
0
7
48
36
19
17
null
null
Zolomon/edan40-functional-parsing
Parser.hs
mit
-- Parse for the requirement of a substring require :: String -> Parser String require w = accept w ! (err ("Program error: expecting " ++ w))
143
require :: String -> Parser String require w = accept w ! (err ("Program error: expecting " ++ w))
99
require w = accept w ! (err ("Program error: expecting " ++ w))
64
true
true
0
9
27
42
21
21
null
null
kindl/Hypatia
src/Compiler.hs
mit
toLuaS (Ret (Func vs sts)) = toLuaFun (text "return") vs sts
64
toLuaS (Ret (Func vs sts)) = toLuaFun (text "return") vs sts
64
toLuaS (Ret (Func vs sts)) = toLuaFun (text "return") vs sts
64
false
false
0
8
14
38
17
21
null
null
Helium4Haskell/helium
src/Helium/Parser/ParseLibrary.hs
gpl-3.0
lexHOLE :: HParser () lexHOLE = lexeme (LexResVarSym hole)
64
lexHOLE :: HParser () lexHOLE = lexeme (LexResVarSym hole)
63
lexHOLE = lexeme (LexResVarSym hole)
41
false
true
1
7
14
28
12
16
null
null
leepike/SmartCheck
qc-tests/Tests.hs
bsd-3-clause
main :: IO () main = do Q.quickCheck prop_getReplaceIdem Q.quickCheck prop_forestTreeEq --------------------------------------------------------------------------------
173
main :: IO () main = do Q.quickCheck prop_getReplaceIdem Q.quickCheck prop_forestTreeEq --------------------------------------------------------------------------------
173
main = do Q.quickCheck prop_getReplaceIdem Q.quickCheck prop_forestTreeEq --------------------------------------------------------------------------------
159
false
true
0
9
16
39
16
23
null
null
noraesae/euler
src/Problem55.hs
bsd-3-clause
reverseAdd :: Integer -> Integer reverseAdd n = n + (unDigits 10.reverse.digits 10) n
85
reverseAdd :: Integer -> Integer reverseAdd n = n + (unDigits 10.reverse.digits 10) n
85
reverseAdd n = n + (unDigits 10.reverse.digits 10) n
52
false
true
0
10
13
37
18
19
null
null
dec9ue/jhc_copygc
src/Grin/Grin.hs
gpl-2.0
findTyTy _ a | "@hole" `isPrefixOf` fromAtom a = return tyTy { tySlots = [], tyReturn = [TyNode] }
99
findTyTy _ a | "@hole" `isPrefixOf` fromAtom a = return tyTy { tySlots = [], tyReturn = [TyNode] }
99
findTyTy _ a | "@hole" `isPrefixOf` fromAtom a = return tyTy { tySlots = [], tyReturn = [TyNode] }
99
false
false
0
9
19
48
25
23
null
null
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14
src/RailEditor/Selection.hs
mit
getMaximum positions = (x,y) where (y,x) = maximum $ Prelude.map (\(x1,y1) -> (y1,x1)) positions
99
getMaximum positions = (x,y) where (y,x) = maximum $ Prelude.map (\(x1,y1) -> (y1,x1)) positions
99
getMaximum positions = (x,y) where (y,x) = maximum $ Prelude.map (\(x1,y1) -> (y1,x1)) positions
99
false
false
0
9
16
60
34
26
null
null
plumlife/cabal
Cabal/Distribution/PackageDescription/Configuration.hs
bsd-3-clause
constrainBy :: DependencyMap -- ^ Input map -> DependencyMap -- ^ Extra constraints -> DependencyMap constrainBy left extra = DependencyMap $ Map.foldWithKey tightenConstraint (unDependencyMap left) (unDependencyMap extra) where tightenConstraint n c l = case Map.lookup n l of Nothing -> l Just vr -> Map.insert n (intersectVersionRanges vr c) l -- | Collect up the targets in a TargetSet of tagged targets, storing the -- dependencies as we go.
565
constrainBy :: DependencyMap -- ^ Input map -> DependencyMap -- ^ Extra constraints -> DependencyMap constrainBy left extra = DependencyMap $ Map.foldWithKey tightenConstraint (unDependencyMap left) (unDependencyMap extra) where tightenConstraint n c l = case Map.lookup n l of Nothing -> l Just vr -> Map.insert n (intersectVersionRanges vr c) l -- | Collect up the targets in a TargetSet of tagged targets, storing the -- dependencies as we go.
565
constrainBy left extra = DependencyMap $ Map.foldWithKey tightenConstraint (unDependencyMap left) (unDependencyMap extra) where tightenConstraint n c l = case Map.lookup n l of Nothing -> l Just vr -> Map.insert n (intersectVersionRanges vr c) l -- | Collect up the targets in a TargetSet of tagged targets, storing the -- dependencies as we go.
438
false
true
2
10
187
118
56
62
null
null
aaronc/Idris-dev
src/Idris/Reflection.hs
bsd-3-clause
getArgs _ r = ([], r)
21
getArgs _ r = ([], r)
21
getArgs _ r = ([], r)
21
false
false
1
7
5
20
10
10
null
null
TomMD/ghc
compiler/types/FamInstEnv.hs
bsd-3-clause
normaliseType _env role ty@(LitTy {}) = (mkReflCo role ty, ty)
62
normaliseType _env role ty@(LitTy {}) = (mkReflCo role ty, ty)
62
normaliseType _env role ty@(LitTy {}) = (mkReflCo role ty, ty)
62
false
false
0
8
9
34
18
16
null
null
facebookincubator/duckling
Duckling/Time/UK/Rules.hs
bsd-3-clause
ruleThisnextDayofweek :: Rule ruleThisnextDayofweek = Rule { name = "this|next <day-of-week>" , pattern = [ regex "наступн(ого|а)" , Predicate isADayOfWeek ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> tt $ predNth 0 True td _ -> Nothing }
293
ruleThisnextDayofweek :: Rule ruleThisnextDayofweek = Rule { name = "this|next <day-of-week>" , pattern = [ regex "наступн(ого|а)" , Predicate isADayOfWeek ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> tt $ predNth 0 True td _ -> Nothing }
293
ruleThisnextDayofweek = Rule { name = "this|next <day-of-week>" , pattern = [ regex "наступн(ого|а)" , Predicate isADayOfWeek ] , prod = \tokens -> case tokens of (_:Token Time td:_) -> tt $ predNth 0 True td _ -> Nothing }
263
false
true
0
15
82
95
50
45
null
null
vito/atomo-old
Atomo/Internals.hs
mit
fromAString (AString s) = map fromAChar (fromAList s)
53
fromAString (AString s) = map fromAChar (fromAList s)
53
fromAString (AString s) = map fromAChar (fromAList s)
53
false
false
0
7
7
27
12
15
null
null
sleexyz/syzygy
src/Syzygy/Core.hs
bsd-3-clause
waitTil :: Integer -> IO () waitTil t = do now <- Clock.toNanoSecs <$> Clock.getTime Clock.Realtime let timeToWait = t - now threadDelay (fromIntegral $ (timeToWait `div` 1000))
183
waitTil :: Integer -> IO () waitTil t = do now <- Clock.toNanoSecs <$> Clock.getTime Clock.Realtime let timeToWait = t - now threadDelay (fromIntegral $ (timeToWait `div` 1000))
183
waitTil t = do now <- Clock.toNanoSecs <$> Clock.getTime Clock.Realtime let timeToWait = t - now threadDelay (fromIntegral $ (timeToWait `div` 1000))
155
false
true
0
11
33
78
38
40
null
null
iteloo/tsuru-sample
iteratee-0.8.9.6/Examples/Tiff.hs
bsd-3-clause
u32_to_float :: Word32 -> Double u32_to_float _x = -- unsigned 32-bit int -> IEEE float error "u32->float is not yet implemented"
145
u32_to_float :: Word32 -> Double u32_to_float _x = -- unsigned 32-bit int -> IEEE float error "u32->float is not yet implemented"
145
u32_to_float _x = -- unsigned 32-bit int -> IEEE float error "u32->float is not yet implemented"
112
false
true
0
5
36
22
11
11
null
null
tategakibunko/hml
Mahjong/Yaku.hs
gpl-2.0
yakuConflicts :: [(Yaku, [Yaku])] yakuConflicts = [(RYANPEKO, [CHITOITSU]), (ITTSU, [ITTSU_NAKI]), (CHANTA, [CHANTA_NAKI]), (SANSHOKU_DOJUN, [SANSHOKU_DOJUN_NAKI]), (SANSHOKU_DOKO, [SANSHOKU_DOKO_NAKI]), (JUNCHANTA, [CHANTA, CHANTA_NAKI, JUNCHANTA_NAKI]), (HONITSU, [HONITSU_NAKI]), (SHOSANGEN, [SANANKO, HONITSU] ++ [YAKUHAI_HAKU .. YAKUHAI_CHUN]), (HONROTO, [CHANTA, TOITOI]), (CHINITSU, [CHINITSU_NAKI]), (TUISO, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SHOSUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISANGEN, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SUANKO, [TUMO_AGARI, TOITOI, HONITSU, CHINITSU, HONROTO, SANSHOKU_DOKO]) ]
983
yakuConflicts :: [(Yaku, [Yaku])] yakuConflicts = [(RYANPEKO, [CHITOITSU]), (ITTSU, [ITTSU_NAKI]), (CHANTA, [CHANTA_NAKI]), (SANSHOKU_DOJUN, [SANSHOKU_DOJUN_NAKI]), (SANSHOKU_DOKO, [SANSHOKU_DOKO_NAKI]), (JUNCHANTA, [CHANTA, CHANTA_NAKI, JUNCHANTA_NAKI]), (HONITSU, [HONITSU_NAKI]), (SHOSANGEN, [SANANKO, HONITSU] ++ [YAKUHAI_HAKU .. YAKUHAI_CHUN]), (HONROTO, [CHANTA, TOITOI]), (CHINITSU, [CHINITSU_NAKI]), (TUISO, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SHOSUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISANGEN, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SUANKO, [TUMO_AGARI, TOITOI, HONITSU, CHINITSU, HONROTO, SANSHOKU_DOKO]) ]
983
yakuConflicts = [(RYANPEKO, [CHITOITSU]), (ITTSU, [ITTSU_NAKI]), (CHANTA, [CHANTA_NAKI]), (SANSHOKU_DOJUN, [SANSHOKU_DOJUN_NAKI]), (SANSHOKU_DOKO, [SANSHOKU_DOKO_NAKI]), (JUNCHANTA, [CHANTA, CHANTA_NAKI, JUNCHANTA_NAKI]), (HONITSU, [HONITSU_NAKI]), (SHOSANGEN, [SANANKO, HONITSU] ++ [YAKUHAI_HAKU .. YAKUHAI_CHUN]), (HONROTO, [CHANTA, TOITOI]), (CHINITSU, [CHINITSU_NAKI]), (TUISO, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SHOSUSHI, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (DAISANGEN, [TUMO_AGARI, SANANKO, HONITSU, CHANTA] ++ [YAKUHAI_TON .. YAKUHAI_PEI]), (SUANKO, [TUMO_AGARI, TOITOI, HONITSU, CHINITSU, HONROTO, SANSHOKU_DOKO]) ]
949
false
true
0
8
243
316
206
110
null
null
fffej/HS-Poker
LookupPatternMatch.hs
bsd-3-clause
getValueFromProduct 12987 = 2352
32
getValueFromProduct 12987 = 2352
32
getValueFromProduct 12987 = 2352
32
false
false
0
5
3
9
4
5
null
null
gereeter/bounded-intmap
src/Data/WordSet/Internal.hs
mit
(\\) :: WordSet -> WordSet -> WordSet (\\) = difference
55
(\\) :: WordSet -> WordSet -> WordSet (\\) = difference
55
(\\) = difference
17
false
true
0
6
9
23
14
9
null
null
hguenther/language-promela
Language/Promela/Pretty.hs
bsd-3-clause
prettyDeclarations :: [Declaration] -> Doc prettyDeclarations = hsep . punctuate semi . map prettyDeclaration
109
prettyDeclarations :: [Declaration] -> Doc prettyDeclarations = hsep . punctuate semi . map prettyDeclaration
109
prettyDeclarations = hsep . punctuate semi . map prettyDeclaration
66
false
true
0
7
13
32
16
16
null
null
sordina/Diagrams-AST
src/Diagrams/Gloss.hs
bsd-3-clause
{-| Gloss: data Picture - A 2D picture Constructors: Blank Polygon Path Line Path Circle Float ThickCircle Float Float Text String Bitmap Int Int ByteString Color Color Picture Translate Float Float Picture Rotate Float Picture Scale Float Float Picture Pictures [Picture] -} fromGloss :: G.Picture -> Image fromGloss (G.Blank) = Blank
394
fromGloss :: G.Picture -> Image fromGloss (G.Blank) = Blank
70
fromGloss (G.Blank) = Blank
38
true
true
0
7
109
26
14
12
null
null
IreneKnapp/Faction
libfaction/Distribution/PackageDescription.hs
bsd-3-clause
-- |If the package description has a library section, call the given -- function with the library build info as argument. withLib :: PackageDescription -> (Library -> IO ()) -> IO () withLib pkg_descr f = maybe (return ()) f (maybeHasLibs pkg_descr)
253
withLib :: PackageDescription -> (Library -> IO ()) -> IO () withLib pkg_descr f = maybe (return ()) f (maybeHasLibs pkg_descr)
130
withLib pkg_descr f = maybe (return ()) f (maybeHasLibs pkg_descr)
69
true
true
0
10
45
64
32
32
null
null
mstksg/hledger
hledger/Hledger/Cli/CliOptions.hs
gpl-3.0
-- | Parse raw option string values to the desired final data types. -- Any relative smart dates will be converted to fixed dates based on -- today's date. Parsing failures will raise an error. -- Also records the terminal width, if supported. rawOptsToCliOpts :: RawOpts -> IO CliOpts rawOptsToCliOpts rawopts = checkCliOpts <$> do ropts <- rawOptsToReportOpts rawopts mcolumns <- readMay <$> getEnvSafe "COLUMNS" mtermwidth <- #ifdef mingw32_HOST_OS return Nothing #else setupTermFromEnv >>= return . flip getCapability termColumns -- XXX Throws a SetupTermError if the terminfo database could not be read, should catch #endif let availablewidth = head $ catMaybes [mcolumns, mtermwidth, Just defaultWidth] return defcliopts { rawopts_ = rawopts ,command_ = stringopt "command" rawopts ,file_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "file" rawopts ,rules_file_ = maybestringopt "rules-file" rawopts ,output_file_ = maybestringopt "output-file" rawopts ,output_format_ = maybestringopt "output-format" rawopts ,alias_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "alias" rawopts ,debug_ = intopt "debug" rawopts ,ignore_assertions_ = boolopt "ignore-assertions" rawopts ,no_new_accounts_ = boolopt "no-new-accounts" rawopts -- add ,width_ = maybestringopt "width" rawopts ,available_width_ = availablewidth ,reportopts_ = ropts } -- | Do final validation of processed opts, raising an error if there is trouble.
1,722
rawOptsToCliOpts :: RawOpts -> IO CliOpts rawOptsToCliOpts rawopts = checkCliOpts <$> do ropts <- rawOptsToReportOpts rawopts mcolumns <- readMay <$> getEnvSafe "COLUMNS" mtermwidth <- #ifdef mingw32_HOST_OS return Nothing #else setupTermFromEnv >>= return . flip getCapability termColumns -- XXX Throws a SetupTermError if the terminfo database could not be read, should catch #endif let availablewidth = head $ catMaybes [mcolumns, mtermwidth, Just defaultWidth] return defcliopts { rawopts_ = rawopts ,command_ = stringopt "command" rawopts ,file_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "file" rawopts ,rules_file_ = maybestringopt "rules-file" rawopts ,output_file_ = maybestringopt "output-file" rawopts ,output_format_ = maybestringopt "output-format" rawopts ,alias_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "alias" rawopts ,debug_ = intopt "debug" rawopts ,ignore_assertions_ = boolopt "ignore-assertions" rawopts ,no_new_accounts_ = boolopt "no-new-accounts" rawopts -- add ,width_ = maybestringopt "width" rawopts ,available_width_ = availablewidth ,reportopts_ = ropts } -- | Do final validation of processed opts, raising an error if there is trouble.
1,478
rawOptsToCliOpts rawopts = checkCliOpts <$> do ropts <- rawOptsToReportOpts rawopts mcolumns <- readMay <$> getEnvSafe "COLUMNS" mtermwidth <- #ifdef mingw32_HOST_OS return Nothing #else setupTermFromEnv >>= return . flip getCapability termColumns -- XXX Throws a SetupTermError if the terminfo database could not be read, should catch #endif let availablewidth = head $ catMaybes [mcolumns, mtermwidth, Just defaultWidth] return defcliopts { rawopts_ = rawopts ,command_ = stringopt "command" rawopts ,file_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "file" rawopts ,rules_file_ = maybestringopt "rules-file" rawopts ,output_file_ = maybestringopt "output-file" rawopts ,output_format_ = maybestringopt "output-format" rawopts ,alias_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "alias" rawopts ,debug_ = intopt "debug" rawopts ,ignore_assertions_ = boolopt "ignore-assertions" rawopts ,no_new_accounts_ = boolopt "no-new-accounts" rawopts -- add ,width_ = maybestringopt "width" rawopts ,available_width_ = availablewidth ,reportopts_ = ropts } -- | Do final validation of processed opts, raising an error if there is trouble.
1,436
true
true
0
16
477
276
146
130
null
null
svenssonjoel/GCDObsidian
Obsidian/GCDObsidian/CodeGen/SPMDC.hs
bsd-3-clause
ppCExpr ppc (CExpr (CBinOp bop e1 e2 _)) = line "(" >> ppCExpr ppc e1 >> ppBinOp bop >> ppCExpr ppc e2 >> line ")"
291
ppCExpr ppc (CExpr (CBinOp bop e1 e2 _)) = line "(" >> ppCExpr ppc e1 >> ppBinOp bop >> ppCExpr ppc e2 >> line ")"
291
ppCExpr ppc (CExpr (CBinOp bop e1 e2 _)) = line "(" >> ppCExpr ppc e1 >> ppBinOp bop >> ppCExpr ppc e2 >> line ")"
291
false
false
0
9
201
66
29
37
null
null
bvdelft/paragon
src/Language/Java/Paragon/Interaction/Debugging.hs
bsd-3-clause
-- | Reports mile-stone steps for each compilation phase. Default when -- argument is omitted (verbosity >= 3). finePrint :: MonadBase m => String -> m () finePrint = verbosePrint 3
183
finePrint :: MonadBase m => String -> m () finePrint = verbosePrint 3
71
finePrint = verbosePrint 3
28
true
true
0
8
32
32
16
16
null
null
typelead/epm
Cabal/Distribution/PackageDescription/Parse.hs
bsd-3-clause
findIndentTabs :: String -> [(Int,Int)] findIndentTabs = concatMap checkLine . zip [1..] . lines where checkLine (lineno, l) = let (indent, _content) = span isSpace l tabCols = map fst . filter ((== '\t') . snd) . zip [0..] addLineNo = map (\col -> (lineno,col)) in addLineNo (tabCols indent) --test_findIndentTabs = findIndentTabs $ unlines $ -- [ "foo", " bar", " \t baz", "\t biz\t", "\t\t \t mib" ] -- | Dependencies plus module renamings. This is what users specify; however, -- renaming information is not used for dependency resolution.
639
findIndentTabs :: String -> [(Int,Int)] findIndentTabs = concatMap checkLine . zip [1..] . lines where checkLine (lineno, l) = let (indent, _content) = span isSpace l tabCols = map fst . filter ((== '\t') . snd) . zip [0..] addLineNo = map (\col -> (lineno,col)) in addLineNo (tabCols indent) --test_findIndentTabs = findIndentTabs $ unlines $ -- [ "foo", " bar", " \t baz", "\t biz\t", "\t\t \t mib" ] -- | Dependencies plus module renamings. This is what users specify; however, -- renaming information is not used for dependency resolution.
639
findIndentTabs = concatMap checkLine . zip [1..] . lines where checkLine (lineno, l) = let (indent, _content) = span isSpace l tabCols = map fst . filter ((== '\t') . snd) . zip [0..] addLineNo = map (\col -> (lineno,col)) in addLineNo (tabCols indent) --test_findIndentTabs = findIndentTabs $ unlines $ -- [ "foo", " bar", " \t baz", "\t biz\t", "\t\t \t mib" ] -- | Dependencies plus module renamings. This is what users specify; however, -- renaming information is not used for dependency resolution.
599
false
true
2
14
185
162
83
79
null
null
byorgey/Idris-dev
src/IRTS/CodegenC.hs
bsd-3-clause
irts_c (FInt ITNative) x = "GETINT(" ++ x ++ ")"
48
irts_c (FInt ITNative) x = "GETINT(" ++ x ++ ")"
48
irts_c (FInt ITNative) x = "GETINT(" ++ x ++ ")"
48
false
false
0
7
9
25
12
13
null
null
kaoskorobase/hsc3-server
tests/test.hs
gpl-2.0
tests :: [Test] tests = Sound.SC3.Server.Allocator.Range.Test.tests ++ Sound.SC3.Server.Allocator.Test.tests
113
tests :: [Test] tests = Sound.SC3.Server.Allocator.Range.Test.tests ++ Sound.SC3.Server.Allocator.Test.tests
113
tests = Sound.SC3.Server.Allocator.Range.Test.tests ++ Sound.SC3.Server.Allocator.Test.tests
97
false
true
2
7
12
39
22
17
null
null
martinvlk/cabal
cabal-install/Distribution/Client/Sandbox.hs
bsd-3-clause
sandboxDeleteSource :: Verbosity -> [FilePath] -> SandboxFlags -> GlobalFlags -> IO () sandboxDeleteSource verbosity buildTreeRefs _sandboxFlags globalFlags = do (sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags indexFile <- tryGetIndexFilePath (pkgEnvSavedConfig pkgEnv) (results, convDict) <- Index.removeBuildTreeRefs verbosity indexFile buildTreeRefs let (failedPaths, removedPaths) = partitionEithers results removedRefs = fmap convDict removedPaths unless (null removedPaths) $ do removeTimestamps sandboxDir removedPaths notice verbosity $ "Success deleting sources: " ++ showL removedRefs ++ "\n\n" unless (null failedPaths) $ do let groupedFailures = groupBy errorType failedPaths mapM_ handleErrors groupedFailures die $ "The sources with the above errors were skipped. (" ++ showL (fmap getPath failedPaths) ++ ")" notice verbosity $ "Note: 'sandbox delete-source' only unregisters the " ++ "source dependency, but does not remove the package " ++ "from the sandbox package DB.\n\n" ++ "Use 'sandbox hc-pkg -- unregister' to do that." where getPath (Index.ErrNonregisteredSource p) = p getPath (Index.ErrNonexistentSource p) = p showPaths f = concat . intersperse " " . fmap (show . f) showL = showPaths id showE [] = return ' ' showE errs = showPaths getPath errs errorType Index.ErrNonregisteredSource{} Index.ErrNonregisteredSource{} = True errorType Index.ErrNonexistentSource{} Index.ErrNonexistentSource{} = True errorType _ _ = False handleErrors [] = return () handleErrors errs@(Index.ErrNonregisteredSource{}:_) = warn verbosity ("Sources not registered: " ++ showE errs ++ "\n\n") handleErrors errs@(Index.ErrNonexistentSource{}:_) = warn verbosity ("Source directory not found for paths: " ++ showE errs ++ "\n" ++ "If you are trying to delete a reference to a removed directory, " ++ "please provide the full absolute path " ++ "(as given by `sandbox list-sources`).\n\n") -- | Entry point for the 'cabal sandbox list-sources' command.
2,187
sandboxDeleteSource :: Verbosity -> [FilePath] -> SandboxFlags -> GlobalFlags -> IO () sandboxDeleteSource verbosity buildTreeRefs _sandboxFlags globalFlags = do (sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags indexFile <- tryGetIndexFilePath (pkgEnvSavedConfig pkgEnv) (results, convDict) <- Index.removeBuildTreeRefs verbosity indexFile buildTreeRefs let (failedPaths, removedPaths) = partitionEithers results removedRefs = fmap convDict removedPaths unless (null removedPaths) $ do removeTimestamps sandboxDir removedPaths notice verbosity $ "Success deleting sources: " ++ showL removedRefs ++ "\n\n" unless (null failedPaths) $ do let groupedFailures = groupBy errorType failedPaths mapM_ handleErrors groupedFailures die $ "The sources with the above errors were skipped. (" ++ showL (fmap getPath failedPaths) ++ ")" notice verbosity $ "Note: 'sandbox delete-source' only unregisters the " ++ "source dependency, but does not remove the package " ++ "from the sandbox package DB.\n\n" ++ "Use 'sandbox hc-pkg -- unregister' to do that." where getPath (Index.ErrNonregisteredSource p) = p getPath (Index.ErrNonexistentSource p) = p showPaths f = concat . intersperse " " . fmap (show . f) showL = showPaths id showE [] = return ' ' showE errs = showPaths getPath errs errorType Index.ErrNonregisteredSource{} Index.ErrNonregisteredSource{} = True errorType Index.ErrNonexistentSource{} Index.ErrNonexistentSource{} = True errorType _ _ = False handleErrors [] = return () handleErrors errs@(Index.ErrNonregisteredSource{}:_) = warn verbosity ("Sources not registered: " ++ showE errs ++ "\n\n") handleErrors errs@(Index.ErrNonexistentSource{}:_) = warn verbosity ("Source directory not found for paths: " ++ showE errs ++ "\n" ++ "If you are trying to delete a reference to a removed directory, " ++ "please provide the full absolute path " ++ "(as given by `sandbox list-sources`).\n\n") -- | Entry point for the 'cabal sandbox list-sources' command.
2,187
sandboxDeleteSource verbosity buildTreeRefs _sandboxFlags globalFlags = do (sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags indexFile <- tryGetIndexFilePath (pkgEnvSavedConfig pkgEnv) (results, convDict) <- Index.removeBuildTreeRefs verbosity indexFile buildTreeRefs let (failedPaths, removedPaths) = partitionEithers results removedRefs = fmap convDict removedPaths unless (null removedPaths) $ do removeTimestamps sandboxDir removedPaths notice verbosity $ "Success deleting sources: " ++ showL removedRefs ++ "\n\n" unless (null failedPaths) $ do let groupedFailures = groupBy errorType failedPaths mapM_ handleErrors groupedFailures die $ "The sources with the above errors were skipped. (" ++ showL (fmap getPath failedPaths) ++ ")" notice verbosity $ "Note: 'sandbox delete-source' only unregisters the " ++ "source dependency, but does not remove the package " ++ "from the sandbox package DB.\n\n" ++ "Use 'sandbox hc-pkg -- unregister' to do that." where getPath (Index.ErrNonregisteredSource p) = p getPath (Index.ErrNonexistentSource p) = p showPaths f = concat . intersperse " " . fmap (show . f) showL = showPaths id showE [] = return ' ' showE errs = showPaths getPath errs errorType Index.ErrNonregisteredSource{} Index.ErrNonregisteredSource{} = True errorType Index.ErrNonexistentSource{} Index.ErrNonexistentSource{} = True errorType _ _ = False handleErrors [] = return () handleErrors errs@(Index.ErrNonregisteredSource{}:_) = warn verbosity ("Sources not registered: " ++ showE errs ++ "\n\n") handleErrors errs@(Index.ErrNonexistentSource{}:_) = warn verbosity ("Source directory not found for paths: " ++ showE errs ++ "\n" ++ "If you are trying to delete a reference to a removed directory, " ++ "please provide the full absolute path " ++ "(as given by `sandbox list-sources`).\n\n") -- | Entry point for the 'cabal sandbox list-sources' command.
2,077
false
true
11
14
474
475
242
233
null
null
roberth/uu-helium
src/Helium/CodeGeneration/PatternMatch.hs
gpl-3.0
freshIds :: String -> Int -> [Id] freshIds prefix number = fst (freshIds' prefix 0 number)
90
freshIds :: String -> Int -> [Id] freshIds prefix number = fst (freshIds' prefix 0 number)
90
freshIds prefix number = fst (freshIds' prefix 0 number)
56
false
true
0
7
15
40
20
20
null
null
nejla/nejla-common
src/NejlaCommon/Persistence.hs
bsd-3-clause
replaceUniqueConflict :: ( Eq a , Eq (Unique a) , DescribeUnique a , PersistEntityBackend a ~ SqlBackend ) => Key a -> a -> App st 'Privileged 'ReadCommitted () replaceUniqueConflict k v = do mbCfl <- db' $ E.replaceUnique k v case mbCfl of Nothing -> return () Just cfl -> liftIO . Ex.throwM $ conflict cfl -------------------------------------------------------------------------------- -- Getters with possible 404s -------------------------------------------------- --------------------------------------------------------------------------------
595
replaceUniqueConflict :: ( Eq a , Eq (Unique a) , DescribeUnique a , PersistEntityBackend a ~ SqlBackend ) => Key a -> a -> App st 'Privileged 'ReadCommitted () replaceUniqueConflict k v = do mbCfl <- db' $ E.replaceUnique k v case mbCfl of Nothing -> return () Just cfl -> liftIO . Ex.throwM $ conflict cfl -------------------------------------------------------------------------------- -- Getters with possible 404s -------------------------------------------------- --------------------------------------------------------------------------------
595
replaceUniqueConflict k v = do mbCfl <- db' $ E.replaceUnique k v case mbCfl of Nothing -> return () Just cfl -> liftIO . Ex.throwM $ conflict cfl -------------------------------------------------------------------------------- -- Getters with possible 404s -------------------------------------------------- --------------------------------------------------------------------------------
406
false
true
0
13
109
146
69
77
null
null
jacekszymanski/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/Layout.hs
lgpl-2.1
-- | Align the layout in the center of the assigned area. centre :: Layout -> Layout centre = alignCentre
107
centre :: Layout -> Layout centre = alignCentre
49
centre = alignCentre
22
true
true
0
7
21
19
9
10
null
null
caneroj1/median-stream
src/Data/MedianStream.hs
bsd-3-clause
median :: MedianStream a -> Maybe Double median ms@(MedianStream lh rh) | even $ size ms = average <$> Heap.viewHead lh <*> Heap.viewHead rh | otherwise = (fromRational . toRational) <$> Heap.viewHead lh
212
median :: MedianStream a -> Maybe Double median ms@(MedianStream lh rh) | even $ size ms = average <$> Heap.viewHead lh <*> Heap.viewHead rh | otherwise = (fromRational . toRational) <$> Heap.viewHead lh
212
median ms@(MedianStream lh rh) | even $ size ms = average <$> Heap.viewHead lh <*> Heap.viewHead rh | otherwise = (fromRational . toRational) <$> Heap.viewHead lh
171
false
true
1
9
41
89
42
47
null
null
DavidAlphaFox/ghc
libraries/Cabal/Cabal/Distribution/ParseUtils.hs
bsd-3-clause
parseVersionRangeQ :: ReadP r VersionRange parseVersionRangeQ = parseQuoted parse <++ parse
91
parseVersionRangeQ :: ReadP r VersionRange parseVersionRangeQ = parseQuoted parse <++ parse
91
parseVersionRangeQ = parseQuoted parse <++ parse
48
false
true
0
6
10
29
12
17
null
null
CarstenKoenig/MyWebSite
src/Models/Events/Database.hs
mit
appendEvents :: Int64 -> [SiteEvent] -> EventQuery () appendEvents blogId events = do time <- liftIO getCurrentTime nrs <- lift $ forM events (\ev -> insert (DB.Event blogId (json ev) time)) tell $ map (wrap time) $ zip nrs events where next [] = 1 next (x:_) = DB.eventAggregateId (entityVal x) + 1 json = toStrict . encode wrap time (nr, ev) = Event ev (fromSqlKey nr) blogId time ----------------------------------------------------------------------
486
appendEvents :: Int64 -> [SiteEvent] -> EventQuery () appendEvents blogId events = do time <- liftIO getCurrentTime nrs <- lift $ forM events (\ev -> insert (DB.Event blogId (json ev) time)) tell $ map (wrap time) $ zip nrs events where next [] = 1 next (x:_) = DB.eventAggregateId (entityVal x) + 1 json = toStrict . encode wrap time (nr, ev) = Event ev (fromSqlKey nr) blogId time ----------------------------------------------------------------------
486
appendEvents blogId events = do time <- liftIO getCurrentTime nrs <- lift $ forM events (\ev -> insert (DB.Event blogId (json ev) time)) tell $ map (wrap time) $ zip nrs events where next [] = 1 next (x:_) = DB.eventAggregateId (entityVal x) + 1 json = toStrict . encode wrap time (nr, ev) = Event ev (fromSqlKey nr) blogId time ----------------------------------------------------------------------
432
false
true
2
16
102
211
97
114
null
null
glguy/simple-spreadsheet-tools
lib/Spreadsheet/Sorting.hs
bsd-3-clause
-- | 'sortSpreadsheet' sorts the rows of a spreadsheet -- given the sort orders specified in the header row sortSpreadsheet :: Spreadsheet -> Spreadsheet sortSpreadsheet (Spreadsheet hs xs) = Spreadsheet hs (sortBy rowCompare xs) where ss = map columnSort hs rowCompare a b = mconcat (zipWith3 aux ss a b) aux Nothing _ _ = EQ aux (Just Ascending) a b = compareData a b aux (Just Descending) a b = compareData b a -- | 'compareData' compares two data cells using the underlying -- given the sort orders specified in the header row. -- Empty cells are considered the smallest and incomparable cells -- are considered equal (as this should not happen in real use)
688
sortSpreadsheet :: Spreadsheet -> Spreadsheet sortSpreadsheet (Spreadsheet hs xs) = Spreadsheet hs (sortBy rowCompare xs) where ss = map columnSort hs rowCompare a b = mconcat (zipWith3 aux ss a b) aux Nothing _ _ = EQ aux (Just Ascending) a b = compareData a b aux (Just Descending) a b = compareData b a -- | 'compareData' compares two data cells using the underlying -- given the sort orders specified in the header row. -- Empty cells are considered the smallest and incomparable cells -- are considered equal (as this should not happen in real use)
580
sortSpreadsheet (Spreadsheet hs xs) = Spreadsheet hs (sortBy rowCompare xs) where ss = map columnSort hs rowCompare a b = mconcat (zipWith3 aux ss a b) aux Nothing _ _ = EQ aux (Just Ascending) a b = compareData a b aux (Just Descending) a b = compareData b a -- | 'compareData' compares two data cells using the underlying -- given the sort orders specified in the header row. -- Empty cells are considered the smallest and incomparable cells -- are considered equal (as this should not happen in real use)
534
true
true
3
7
142
153
72
81
null
null
talw/crisp-compiler
src/Emit.hs
bsd-3-clause
argsTypeList :: Int -> [AST.Type] argsTypeList n = replicate n uint
67
argsTypeList :: Int -> [AST.Type] argsTypeList n = replicate n uint
67
argsTypeList n = replicate n uint
33
false
true
0
7
10
28
14
14
null
null