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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
suhailshergill/liboleg | Control/CCRef.hs | bsd-3-clause | test5''' = (expect 115 =<<) . runCC $ do
p0 <- newPrompt
p1 <- newPrompt
incr 10 . pushPrompt p0 $
incr 2 . (id =<<) . shiftP p0 $ \sk ->
incr 100 $ sk
(pushPrompt p1 (incr 9 $ sk (abortP p1 (return 3)))) | 237 | test5''' = (expect 115 =<<) . runCC $ do
p0 <- newPrompt
p1 <- newPrompt
incr 10 . pushPrompt p0 $
incr 2 . (id =<<) . shiftP p0 $ \sk ->
incr 100 $ sk
(pushPrompt p1 (incr 9 $ sk (abortP p1 (return 3)))) | 237 | test5''' = (expect 115 =<<) . runCC $ do
p0 <- newPrompt
p1 <- newPrompt
incr 10 . pushPrompt p0 $
incr 2 . (id =<<) . shiftP p0 $ \sk ->
incr 100 $ sk
(pushPrompt p1 (incr 9 $ sk (abortP p1 (return 3)))) | 237 | false | false | 4 | 20 | 78 | 130 | 59 | 71 | null | null |
jsavatgy/hatupist | code/fileError.hs | gpl-2.0 | drawKey x y letter selected dupl = do
setLineWidth 1.0
let co = qwertyColor(qwertyLetter x y)
botColor = if selected then white else black
selColor = if dupl then gray else black
case co of
Just c -> drawRect (intToDouble (zentr xx))
(intToDouble (zentr yy))
(intToDouble r2)
c True
Nothing -> return ()
when selected (drawRect (intToDouble xx)
(intToDouble yy)
(intToDouble r1)
selColor True)
drawRect (intToDouble xx) (intToDouble yy) (intToDouble r1) botColor False
paintLetter (intToDouble (xx+2)) (intToDouble (yy+2)) letter botColor
where
r1 = 18
r2 = 21
zentr z = z - (r2-r1) `div` 2
deltaXs = [3,12,0]
margin = 5
xx = x*r2+deltaXs!!y + margin
yy = y*r2 + margin | 898 | drawKey x y letter selected dupl = do
setLineWidth 1.0
let co = qwertyColor(qwertyLetter x y)
botColor = if selected then white else black
selColor = if dupl then gray else black
case co of
Just c -> drawRect (intToDouble (zentr xx))
(intToDouble (zentr yy))
(intToDouble r2)
c True
Nothing -> return ()
when selected (drawRect (intToDouble xx)
(intToDouble yy)
(intToDouble r1)
selColor True)
drawRect (intToDouble xx) (intToDouble yy) (intToDouble r1) botColor False
paintLetter (intToDouble (xx+2)) (intToDouble (yy+2)) letter botColor
where
r1 = 18
r2 = 21
zentr z = z - (r2-r1) `div` 2
deltaXs = [3,12,0]
margin = 5
xx = x*r2+deltaXs!!y + margin
yy = y*r2 + margin | 898 | drawKey x y letter selected dupl = do
setLineWidth 1.0
let co = qwertyColor(qwertyLetter x y)
botColor = if selected then white else black
selColor = if dupl then gray else black
case co of
Just c -> drawRect (intToDouble (zentr xx))
(intToDouble (zentr yy))
(intToDouble r2)
c True
Nothing -> return ()
when selected (drawRect (intToDouble xx)
(intToDouble yy)
(intToDouble r1)
selColor True)
drawRect (intToDouble xx) (intToDouble yy) (intToDouble r1) botColor False
paintLetter (intToDouble (xx+2)) (intToDouble (yy+2)) letter botColor
where
r1 = 18
r2 = 21
zentr z = z - (r2-r1) `div` 2
deltaXs = [3,12,0]
margin = 5
xx = x*r2+deltaXs!!y + margin
yy = y*r2 + margin | 898 | false | false | 11 | 14 | 339 | 368 | 171 | 197 | null | null |
benkolera/haskell-opaleye | src/Opaleye/Internal/HaskellDB/Sql/Print.hs | bsd-3-clause | ppAs :: Maybe String -> Doc -> Doc
ppAs Nothing expr = expr | 64 | ppAs :: Maybe String -> Doc -> Doc
ppAs Nothing expr = expr | 64 | ppAs Nothing expr = expr | 29 | false | true | 0 | 6 | 17 | 32 | 14 | 18 | null | null |
Palmik/data-store | src/Data/Store.hs | bsd-3-clause | -- | The expression (@'Data.Store.updateElements' tr sel s@) is equivalent
-- to (@'Data.Store.Selection.update' tr' sel s@) where
-- (@tr' = (maybe Nothing (\v -> Just (v, Nothing)) . tr)@).
--
-- Complexity: /O(c + s * min(n, W))/
updateElements :: IsSelection sel
=> (v -> Maybe v)
-> sel tag krs irs ts
-> I.Store tag krs irs ts v
-> I.Store tag krs irs ts v
updateElements tr sel s =
runIdentity $! I.genericUpdateWithKey I.indexInsertID'' tr' (resolve sel s) s
where
tr' _ = maybe Nothing (\v -> Just (v, Nothing)) . tr
{-# INLINE tr' #-}
| 618 | updateElements :: IsSelection sel
=> (v -> Maybe v)
-> sel tag krs irs ts
-> I.Store tag krs irs ts v
-> I.Store tag krs irs ts v
updateElements tr sel s =
runIdentity $! I.genericUpdateWithKey I.indexInsertID'' tr' (resolve sel s) s
where
tr' _ = maybe Nothing (\v -> Just (v, Nothing)) . tr
{-# INLINE tr' #-}
| 384 | updateElements tr sel s =
runIdentity $! I.genericUpdateWithKey I.indexInsertID'' tr' (resolve sel s) s
where
tr' _ = maybe Nothing (\v -> Just (v, Nothing)) . tr
{-# INLINE tr' #-}
| 194 | true | true | 0 | 10 | 171 | 151 | 76 | 75 | null | null |
unisonweb/platform | codebase2/codebase-sqlite/U/Codebase/Sqlite/Branch/Full.hs | mit | quadmap :: forall t h p c t' h' p' c'. (Ord t', Ord h') => (t -> t') -> (h -> h') -> (p -> p') -> (c -> c') -> Branch' t h p c -> Branch' t' h' p' c'
quadmap ft fh fp fc (Branch terms types patches children) =
Branch
(Map.bimap ft doTerms terms)
(Map.bimap ft doTypes types)
(Map.bimap ft fp patches)
(Map.bimap ft fc children)
where
doTerms = Map.bimap (bimap (bimap ft fh) (bimap ft fh)) doMetadata
doTypes = Map.bimap (bimap ft fh) doMetadata
doMetadata (Inline s) = Inline . Set.map (bimap ft fh) $ s | 536 | quadmap :: forall t h p c t' h' p' c'. (Ord t', Ord h') => (t -> t') -> (h -> h') -> (p -> p') -> (c -> c') -> Branch' t h p c -> Branch' t' h' p' c'
quadmap ft fh fp fc (Branch terms types patches children) =
Branch
(Map.bimap ft doTerms terms)
(Map.bimap ft doTypes types)
(Map.bimap ft fp patches)
(Map.bimap ft fc children)
where
doTerms = Map.bimap (bimap (bimap ft fh) (bimap ft fh)) doMetadata
doTypes = Map.bimap (bimap ft fh) doMetadata
doMetadata (Inline s) = Inline . Set.map (bimap ft fh) $ s | 536 | quadmap ft fh fp fc (Branch terms types patches children) =
Branch
(Map.bimap ft doTerms terms)
(Map.bimap ft doTypes types)
(Map.bimap ft fp patches)
(Map.bimap ft fc children)
where
doTerms = Map.bimap (bimap (bimap ft fh) (bimap ft fh)) doMetadata
doTypes = Map.bimap (bimap ft fh) doMetadata
doMetadata (Inline s) = Inline . Set.map (bimap ft fh) $ s | 386 | false | true | 2 | 12 | 133 | 278 | 143 | 135 | null | null |
lally/xmonad-reenberg | XMonad/Core.hs | bsd-3-clause | -- | Like 'spawn', but returns the 'ProcessID' of the launched application
spawnPID :: MonadIO m => String -> m ProcessID
spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", encodeString x] Nothing | 201 | spawnPID :: MonadIO m => String -> m ProcessID
spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", encodeString x] Nothing | 126 | spawnPID x = xfork $ executeFile "/bin/sh" False ["-c", encodeString x] Nothing | 79 | true | true | 0 | 8 | 32 | 51 | 25 | 26 | null | null |
tolysz/prepare-ghcjs | spec-lts8/base/GHC/IO/Handle/Internals.hs | bsd-3-clause | dEFAULT_CHAR_BUFFER_SIZE :: Int
dEFAULT_CHAR_BUFFER_SIZE = 2048 | 63 | dEFAULT_CHAR_BUFFER_SIZE :: Int
dEFAULT_CHAR_BUFFER_SIZE = 2048 | 63 | dEFAULT_CHAR_BUFFER_SIZE = 2048 | 31 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
cartazio/permutations-perrry | tests/Driver.hs | bsd-3-clause | swap n = do
i <- choose (0,n-1)
j <- choose (0,n-1)
return (i,j) | 76 | swap n = do
i <- choose (0,n-1)
j <- choose (0,n-1)
return (i,j) | 76 | swap n = do
i <- choose (0,n-1)
j <- choose (0,n-1)
return (i,j) | 76 | false | false | 1 | 11 | 25 | 65 | 30 | 35 | null | null |
acowley/language-c | src/Language/C/Data/Node.hs | bsd-3-clause | nameOfNode :: NodeInfo -> Maybe Name
nameOfNode (OnlyPos _ _) = Nothing | 71 | nameOfNode :: NodeInfo -> Maybe Name
nameOfNode (OnlyPos _ _) = Nothing | 71 | nameOfNode (OnlyPos _ _) = Nothing | 34 | false | true | 0 | 6 | 11 | 33 | 15 | 18 | null | null |
vikraman/ghc | compiler/main/DynFlags.hs | bsd-3-clause | defaultFlags :: Settings -> [GeneralFlag]
defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_KeepHiFiles,
Opt_KeepOFiles,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining,
Opt_VersionMacros
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ concatMap (wayGeneralFlags platform) (defaultWays settings)
where platform = sTargetPlatform settings | 749 | defaultFlags :: Settings -> [GeneralFlag]
defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_KeepHiFiles,
Opt_KeepOFiles,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining,
Opt_VersionMacros
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ concatMap (wayGeneralFlags platform) (defaultWays settings)
where platform = sTargetPlatform settings | 749 | defaultFlags settings
-- See Note [Updating flag description in the User's Guide]
= [ Opt_AutoLinkPackages,
Opt_EmbedManifest,
Opt_FlatCache,
Opt_GenManifest,
Opt_GhciHistory,
Opt_GhciSandbox,
Opt_HelpfulErrors,
Opt_KeepHiFiles,
Opt_KeepOFiles,
Opt_OmitYields,
Opt_PrintBindContents,
Opt_ProfCountEntries,
Opt_RPath,
Opt_SharedImplib,
Opt_SimplPreInlining,
Opt_VersionMacros
]
++ [f | (ns,f) <- optLevelFlags, 0 `elem` ns]
-- The default -O0 options
++ default_PIC platform
++ concatMap (wayGeneralFlags platform) (defaultWays settings)
where platform = sTargetPlatform settings | 707 | false | true | 6 | 8 | 192 | 144 | 81 | 63 | null | null |
mightymoose/liquidhaskell | tests/pos/RBTree-color.hs | bsd-3-clause | makeBlack (Node _ x l r) = Node B x l r | 39 | makeBlack (Node _ x l r) = Node B x l r | 39 | makeBlack (Node _ x l r) = Node B x l r | 39 | false | false | 0 | 7 | 11 | 30 | 14 | 16 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/nativeGen/RegAlloc/Graph/SpillClean.hs | bsd-3-clause | - | Check if this is a reg store.
isStoreReg :: Store -> Bool
isStoreReg ss
= case ss of
SSlot _ -> False
SReg _ -> True
-- Spill cleaning is only done once all virtuals have been allocated to realRegs
| 222 | isStoreReg :: Store -> Bool
isStoreReg ss
= case ss of
SSlot _ -> False
SReg _ -> True
-- Spill cleaning is only done once all virtuals have been allocated to realRegs | 187 | isStoreReg ss
= case ss of
SSlot _ -> False
SReg _ -> True
-- Spill cleaning is only done once all virtuals have been allocated to realRegs | 159 | true | true | 4 | 5 | 62 | 58 | 31 | 27 | null | null |
brendanhay/gogol | gogol-adsense/gen/Network/Google/AdSense/Types/Product.hs | mpl-2.0 | -- | Output only. Unique ID of the ad client as used in the \`AD_CLIENT_ID\`
-- reporting dimension. Present only if the ad client supports reporting.
acReportingDimensionId :: Lens' AdClient (Maybe Text)
acReportingDimensionId
= lens _acReportingDimensionId
(\ s a -> s{_acReportingDimensionId = a}) | 308 | acReportingDimensionId :: Lens' AdClient (Maybe Text)
acReportingDimensionId
= lens _acReportingDimensionId
(\ s a -> s{_acReportingDimensionId = a}) | 157 | acReportingDimensionId
= lens _acReportingDimensionId
(\ s a -> s{_acReportingDimensionId = a}) | 103 | true | true | 0 | 8 | 50 | 50 | 26 | 24 | null | null |
arekfu/project_euler | p0055/p0055.hs | mit | answer = 10000 - (length $ filter id $ map producesPalindrome [1..10000]) | 73 | answer = 10000 - (length $ filter id $ map producesPalindrome [1..10000]) | 73 | answer = 10000 - (length $ filter id $ map producesPalindrome [1..10000]) | 73 | false | false | 0 | 9 | 11 | 34 | 17 | 17 | null | null |
sdiehl/ghc | compiler/GHC/Iface/Ext/Utils.hs | bsd-3-clause | -- | Merge two nodes together.
--
-- Precondition and postcondition: elements in 'nodeType' are ordered.
combineNodeInfo :: NodeInfo Type -> NodeInfo Type -> NodeInfo Type
(NodeInfo as ai ad) `combineNodeInfo` (NodeInfo bs bi bd) =
NodeInfo (S.union as bs) (mergeSorted ai bi) (M.unionWith (<>) ad bd)
where
mergeSorted :: [Type] -> [Type] -> [Type]
mergeSorted la@(a:as) lb@(b:bs) = case nonDetCmpType a b of
LT -> a : mergeSorted as lb
EQ -> a : mergeSorted as bs
GT -> b : mergeSorted la bs
mergeSorted as [] = as
mergeSorted [] bs = bs
{- | Merge two sorted, disjoint lists of ASTs, combining when necessary.
In the absence of position-altering pragmas (ex: @# line "file.hs" 3@),
different nodes in an AST tree should either have disjoint spans (in
which case you can say for sure which one comes first) or one span
should be completely contained in the other (in which case the contained
span corresponds to some child node).
However, since Haskell does have position-altering pragmas it /is/
possible for spans to be overlapping. Here is an example of a source file
in which @foozball@ and @quuuuuux@ have overlapping spans:
@
module Baz where
# line 3 "Baz.hs"
foozball :: Int
foozball = 0
# line 3 "Baz.hs"
bar, quuuuuux :: Int
bar = 1
quuuuuux = 2
@
In these cases, we just do our best to produce sensible `HieAST`'s. The blame
should be laid at the feet of whoever wrote the line pragmas in the first place
(usually the C preprocessor...).
-} | 1,601 | combineNodeInfo :: NodeInfo Type -> NodeInfo Type -> NodeInfo Type
(NodeInfo as ai ad) `combineNodeInfo` (NodeInfo bs bi bd) =
NodeInfo (S.union as bs) (mergeSorted ai bi) (M.unionWith (<>) ad bd)
where
mergeSorted :: [Type] -> [Type] -> [Type]
mergeSorted la@(a:as) lb@(b:bs) = case nonDetCmpType a b of
LT -> a : mergeSorted as lb
EQ -> a : mergeSorted as bs
GT -> b : mergeSorted la bs
mergeSorted as [] = as
mergeSorted [] bs = bs
{- | Merge two sorted, disjoint lists of ASTs, combining when necessary.
In the absence of position-altering pragmas (ex: @# line "file.hs" 3@),
different nodes in an AST tree should either have disjoint spans (in
which case you can say for sure which one comes first) or one span
should be completely contained in the other (in which case the contained
span corresponds to some child node).
However, since Haskell does have position-altering pragmas it /is/
possible for spans to be overlapping. Here is an example of a source file
in which @foozball@ and @quuuuuux@ have overlapping spans:
@
module Baz where
# line 3 "Baz.hs"
foozball :: Int
foozball = 0
# line 3 "Baz.hs"
bar, quuuuuux :: Int
bar = 1
quuuuuux = 2
@
In these cases, we just do our best to produce sensible `HieAST`'s. The blame
should be laid at the feet of whoever wrote the line pragmas in the first place
(usually the C preprocessor...).
-} | 1,496 | (NodeInfo as ai ad) `combineNodeInfo` (NodeInfo bs bi bd) =
NodeInfo (S.union as bs) (mergeSorted ai bi) (M.unionWith (<>) ad bd)
where
mergeSorted :: [Type] -> [Type] -> [Type]
mergeSorted la@(a:as) lb@(b:bs) = case nonDetCmpType a b of
LT -> a : mergeSorted as lb
EQ -> a : mergeSorted as bs
GT -> b : mergeSorted la bs
mergeSorted as [] = as
mergeSorted [] bs = bs
{- | Merge two sorted, disjoint lists of ASTs, combining when necessary.
In the absence of position-altering pragmas (ex: @# line "file.hs" 3@),
different nodes in an AST tree should either have disjoint spans (in
which case you can say for sure which one comes first) or one span
should be completely contained in the other (in which case the contained
span corresponds to some child node).
However, since Haskell does have position-altering pragmas it /is/
possible for spans to be overlapping. Here is an example of a source file
in which @foozball@ and @quuuuuux@ have overlapping spans:
@
module Baz where
# line 3 "Baz.hs"
foozball :: Int
foozball = 0
# line 3 "Baz.hs"
bar, quuuuuux :: Int
bar = 1
quuuuuux = 2
@
In these cases, we just do our best to produce sensible `HieAST`'s. The blame
should be laid at the feet of whoever wrote the line pragmas in the first place
(usually the C preprocessor...).
-} | 1,429 | true | true | 5 | 10 | 404 | 234 | 120 | 114 | null | null |
shlevy/ghc | compiler/utils/UniqSet.hs | bsd-3-clause | uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool
uniqSetAny p (UniqSet s) = anyUFM p s | 84 | uniqSetAny :: (a -> Bool) -> UniqSet a -> Bool
uniqSetAny p (UniqSet s) = anyUFM p s | 84 | uniqSetAny p (UniqSet s) = anyUFM p s | 37 | false | true | 0 | 10 | 17 | 50 | 23 | 27 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/PrimitiveMode.hs | bsd-3-clause | -- | Contains the maximumum number of vertices in a single patch.
maxPatchVertices :: GettableStateVar GLint
maxPatchVertices = makeGettableStateVar $ getInteger1 id GetMaxPatchVertices | 186 | maxPatchVertices :: GettableStateVar GLint
maxPatchVertices = makeGettableStateVar $ getInteger1 id GetMaxPatchVertices | 119 | maxPatchVertices = makeGettableStateVar $ getInteger1 id GetMaxPatchVertices | 76 | true | true | 0 | 6 | 23 | 24 | 12 | 12 | null | null |
limaner2002/EPC-tools | USACScripts/src/Scripts/Common.hs | bsd-3-clause | dropdownUpdateF' :: (Eq a, Parseable a) =>
Text -> a -> ReifiedMonadicFold m Value (Either Text Update)
dropdownUpdateF' label v = MonadicFold $ dropdownUpdate' label v | 188 | dropdownUpdateF' :: (Eq a, Parseable a) =>
Text -> a -> ReifiedMonadicFold m Value (Either Text Update)
dropdownUpdateF' label v = MonadicFold $ dropdownUpdate' label v | 188 | dropdownUpdateF' label v = MonadicFold $ dropdownUpdate' label v | 64 | false | true | 0 | 10 | 45 | 63 | 31 | 32 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/Data/Aeson/TH.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- Parsing errors
--------------------------------------------------------------------------------
matchFailed :: Name -> Name -> String -> MatchQ
matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 496 | matchFailed :: Name -> Name -> String -> MatchQ
matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 315 | matchFailed tName conName expected = do
other <- newName "other"
match (varP other)
( normalB $ parseTypeMismatch tName conName
(litE $ stringL expected)
([|valueConName|] `appE` varE other)
)
[] | 267 | true | true | 0 | 13 | 115 | 102 | 53 | 49 | null | null |
gridaphobe/liquid-fixpoint | src/Language/Fixpoint/Types/Visitor.hs | bsd-3-clause | kvars :: Visitable t => t -> [KVar]
kvars = fold kvVis () []
where
kvVis = defaultVisitor { accPred = kv' }
kv' _ (PKVar k _) = [k]
kv' _ _ = [] | 194 | kvars :: Visitable t => t -> [KVar]
kvars = fold kvVis () []
where
kvVis = defaultVisitor { accPred = kv' }
kv' _ (PKVar k _) = [k]
kv' _ _ = [] | 194 | kvars = fold kvVis () []
where
kvVis = defaultVisitor { accPred = kv' }
kv' _ (PKVar k _) = [k]
kv' _ _ = [] | 158 | false | true | 3 | 9 | 84 | 102 | 46 | 56 | null | null |
DanielSchuessler/hstri | Tetrahedron/Triangle.hs | gpl-3.0 | oTriangleByVertices :: (Triple Vertex) -> OTriangle
oTriangleByVertices vs =
case $(unEitherC) "oTriangleByVertices" (sort3WithPermutation' vs) of
(vs',g) -> packOrderedFace (ascVerticesToTriangle vs') g | 217 | oTriangleByVertices :: (Triple Vertex) -> OTriangle
oTriangleByVertices vs =
case $(unEitherC) "oTriangleByVertices" (sort3WithPermutation' vs) of
(vs',g) -> packOrderedFace (ascVerticesToTriangle vs') g | 217 | oTriangleByVertices vs =
case $(unEitherC) "oTriangleByVertices" (sort3WithPermutation' vs) of
(vs',g) -> packOrderedFace (ascVerticesToTriangle vs') g | 164 | false | true | 0 | 10 | 34 | 66 | 33 | 33 | null | null |
ghc/packages-haskeline | System/Console/Haskeline/Command/History.hs | bsd-3-clause | doSearch :: MonadState HistLog m => Bool -> SearchMode -> m (Either Effect SearchMode)
doSearch useCurrent sm = case direction sm of
Reverse -> searchHist
Forward -> reverseHist searchHist
where
searchHist = do
hist <- get
case searchBackwards useCurrent sm hist of
Just (sm',hist') -> put hist' >> return (Right sm')
Nothing -> return $ Left RingBell | 405 | doSearch :: MonadState HistLog m => Bool -> SearchMode -> m (Either Effect SearchMode)
doSearch useCurrent sm = case direction sm of
Reverse -> searchHist
Forward -> reverseHist searchHist
where
searchHist = do
hist <- get
case searchBackwards useCurrent sm hist of
Just (sm',hist') -> put hist' >> return (Right sm')
Nothing -> return $ Left RingBell | 405 | doSearch useCurrent sm = case direction sm of
Reverse -> searchHist
Forward -> reverseHist searchHist
where
searchHist = do
hist <- get
case searchBackwards useCurrent sm hist of
Just (sm',hist') -> put hist' >> return (Right sm')
Nothing -> return $ Left RingBell | 318 | false | true | 1 | 14 | 110 | 147 | 66 | 81 | null | null |
nonowarn/tkhs | src/Parser.hs | bsd-3-clause | lines :: PC [String]
lines = line `manyTill` (lookAhead (any_sig <|> eof)) | 74 | lines :: PC [String]
lines = line `manyTill` (lookAhead (any_sig <|> eof)) | 74 | lines = line `manyTill` (lookAhead (any_sig <|> eof)) | 53 | false | true | 0 | 10 | 11 | 45 | 22 | 23 | null | null |
fjarri/haskell-sdl-template | Setup.hs | mit | main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
buildHook = pathsHook,
postBuild = bundleHook
} | 121 | main :: IO ()
main = defaultMainWithHooks $ simpleUserHooks {
buildHook = pathsHook,
postBuild = bundleHook
} | 121 | main = defaultMainWithHooks $ simpleUserHooks {
buildHook = pathsHook,
postBuild = bundleHook
} | 107 | false | true | 0 | 7 | 28 | 34 | 19 | 15 | null | null |
scott-fleischman/greek-grammar | haskell/greek-grammar/src/Text/Greek/Phonology/Consonant.hs | mit | promotePlusRoughRho Rh_κ = RB_κ | 31 | promotePlusRoughRho Rh_κ = RB_κ | 31 | promotePlusRoughRho Rh_κ = RB_κ | 31 | false | false | 1 | 5 | 3 | 19 | 6 | 13 | null | null |
olsner/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | mkGroupByUsingStmt ss b u = emptyTransStmt { trS_form = GroupForm, trS_stmts = ss, trS_using = u, trS_by = Just b } | 115 | mkGroupByUsingStmt ss b u = emptyTransStmt { trS_form = GroupForm, trS_stmts = ss, trS_using = u, trS_by = Just b } | 115 | mkGroupByUsingStmt ss b u = emptyTransStmt { trS_form = GroupForm, trS_stmts = ss, trS_using = u, trS_by = Just b } | 115 | false | false | 0 | 7 | 20 | 42 | 24 | 18 | null | null |
input-output-hk/pos-haskell-prototype | lib/test/Test/Pos/Update/PollSpec.hs | mit | modifyPollStateWithModifiers
:: Poll.PollState
-> Poll.PollModifier
-> Poll.PollModifier
-> Property
modifyPollStateWithModifiers pst pm1 pm2 =
Poll.modifyPollState pm2 (Poll.modifyPollState pm1 pst) ===
Poll.modifyPollState (pm1 <> pm2) pst | 265 | modifyPollStateWithModifiers
:: Poll.PollState
-> Poll.PollModifier
-> Poll.PollModifier
-> Property
modifyPollStateWithModifiers pst pm1 pm2 =
Poll.modifyPollState pm2 (Poll.modifyPollState pm1 pst) ===
Poll.modifyPollState (pm1 <> pm2) pst | 265 | modifyPollStateWithModifiers pst pm1 pm2 =
Poll.modifyPollState pm2 (Poll.modifyPollState pm1 pst) ===
Poll.modifyPollState (pm1 <> pm2) pst | 148 | false | true | 0 | 9 | 48 | 71 | 35 | 36 | null | null |
tomahawkins/ecu | src/CANDBParser.hs | bsd-3-clause | showCANSignalRxNodes :: [String] -> String
showCANSignalRxNodes nodes = case nodes of
[] -> ""
x -> drop 23 (concatMap showCANSignalRxNode x) | 146 | showCANSignalRxNodes :: [String] -> String
showCANSignalRxNodes nodes = case nodes of
[] -> ""
x -> drop 23 (concatMap showCANSignalRxNode x) | 146 | showCANSignalRxNodes nodes = case nodes of
[] -> ""
x -> drop 23 (concatMap showCANSignalRxNode x) | 103 | false | true | 0 | 10 | 25 | 52 | 26 | 26 | null | null |
fboyer/craft3e | Chapter3.hs | mit | str3 = "\99a\116" | 17 | str3 = "\99a\116" | 17 | str3 = "\99a\116" | 17 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
rrnewton/accelerate | Data/Array/Accelerate/Trafo/Vectorise.hs | bsd-3-clause | sndE :: forall acc env aenv a b. (Elt a, Elt b)
=> PreOpenExp acc env aenv (a,b)
-> PreOpenExp acc env aenv b
sndE = Prj ZeroTupIdx | 141 | sndE :: forall acc env aenv a b. (Elt a, Elt b)
=> PreOpenExp acc env aenv (a,b)
-> PreOpenExp acc env aenv b
sndE = Prj ZeroTupIdx | 141 | sndE = Prj ZeroTupIdx | 21 | false | true | 0 | 9 | 37 | 66 | 36 | 30 | null | null |
input-output-hk/pos-haskell-prototype | util/src/Pos/Util/Log/Rotator.hs | mit | latestLogFile :: FileDescription -> IO (Maybe FilePath)
latestLogFile fdesc =
listLogFiles fdesc >>= \fs -> return $ latestLogFile' fs
where
latestLogFile' :: Maybe (NonEmpty FilePath) -> Maybe FilePath
latestLogFile' Nothing = Nothing
latestLogFile' (Just flist) = Just $ last flist
-- | initialize log file at startup
-- may append to existing file | 376 | latestLogFile :: FileDescription -> IO (Maybe FilePath)
latestLogFile fdesc =
listLogFiles fdesc >>= \fs -> return $ latestLogFile' fs
where
latestLogFile' :: Maybe (NonEmpty FilePath) -> Maybe FilePath
latestLogFile' Nothing = Nothing
latestLogFile' (Just flist) = Just $ last flist
-- | initialize log file at startup
-- may append to existing file | 376 | latestLogFile fdesc =
listLogFiles fdesc >>= \fs -> return $ latestLogFile' fs
where
latestLogFile' :: Maybe (NonEmpty FilePath) -> Maybe FilePath
latestLogFile' Nothing = Nothing
latestLogFile' (Just flist) = Just $ last flist
-- | initialize log file at startup
-- may append to existing file | 320 | false | true | 0 | 8 | 78 | 101 | 49 | 52 | null | null |
zinfra/khan | khan/src/Khan/Internal/Options.hs | mpl-2.0 | groupRefOption :: String -> Mod OptionFields GroupRef -> String -> Parser GroupRef
groupRefOption key = customOption key "ID|name:STR" (Right . parser . Text.pack)
where
parser s = case Text.stripPrefix "name:" s of
Nothing -> GroupId s
Just n -> GroupName n | 277 | groupRefOption :: String -> Mod OptionFields GroupRef -> String -> Parser GroupRef
groupRefOption key = customOption key "ID|name:STR" (Right . parser . Text.pack)
where
parser s = case Text.stripPrefix "name:" s of
Nothing -> GroupId s
Just n -> GroupName n | 277 | groupRefOption key = customOption key "ID|name:STR" (Right . parser . Text.pack)
where
parser s = case Text.stripPrefix "name:" s of
Nothing -> GroupId s
Just n -> GroupName n | 194 | false | true | 1 | 9 | 59 | 105 | 46 | 59 | null | null |
timmytofu/graphql-haskell | Data/GraphQL/Encoder.hs | bsd-3-clause | field :: Field -> Text
field (Field alias name args ds ss) =
optempty (`snoc` ':') alias
<> name
<> optempty arguments args
<> optempty directives ds
<> optempty selectionSet ss | 200 | field :: Field -> Text
field (Field alias name args ds ss) =
optempty (`snoc` ':') alias
<> name
<> optempty arguments args
<> optempty directives ds
<> optempty selectionSet ss | 200 | field (Field alias name args ds ss) =
optempty (`snoc` ':') alias
<> name
<> optempty arguments args
<> optempty directives ds
<> optempty selectionSet ss | 177 | false | true | 8 | 6 | 53 | 82 | 38 | 44 | null | null |
timjb/lens | src/Data/Text/Strict/Lens.hs | bsd-3-clause | -- | This isomorphism can be used to 'unpack' (or 'pack') lazy 'Text'.
--
-- >>> "hello"^.unpacked -- :: String
-- "hello"
--
-- This 'Iso' is provided for notational convenience rather than out of great need, since
--
-- @
-- 'unpacked' ≡ 'from' 'packed'
-- @
--
-- @
-- 'pack' x ≡ x '^.' 'from' 'unpacked'
-- 'unpack' x ≡ x '^.' 'packed'
-- 'unpacked' ≡ 'iso' 'unpack' 'pack'
-- @
unpacked :: Iso' Text String
unpacked = iso unpack pack | 438 | unpacked :: Iso' Text String
unpacked = iso unpack pack | 55 | unpacked = iso unpack pack | 26 | true | true | 0 | 5 | 83 | 37 | 26 | 11 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Subnetworks/Patch.hs | mpl-2.0 | -- | Name of the region scoping this request.
spRegion :: Lens' SubnetworksPatch Text
spRegion = lens _spRegion (\ s a -> s{_spRegion = a}) | 139 | spRegion :: Lens' SubnetworksPatch Text
spRegion = lens _spRegion (\ s a -> s{_spRegion = a}) | 93 | spRegion = lens _spRegion (\ s a -> s{_spRegion = a}) | 53 | true | true | 0 | 9 | 24 | 40 | 22 | 18 | null | null |
ChrisKuklewicz/SafeSemaphore | tests/TestKillSem.hs | bsd-3-clause | -- This is run by "cabal test"
main = do
runTestTT testsQ
putStrLn "Expected 3 Failures for above code\n"
c <- runTestTT testsM
if failures c == 0 then exitSuccess else exitFailure | 188 | main = do
runTestTT testsQ
putStrLn "Expected 3 Failures for above code\n"
c <- runTestTT testsM
if failures c == 0 then exitSuccess else exitFailure | 157 | main = do
runTestTT testsQ
putStrLn "Expected 3 Failures for above code\n"
c <- runTestTT testsM
if failures c == 0 then exitSuccess else exitFailure | 157 | true | false | 0 | 9 | 39 | 47 | 21 | 26 | null | null |
jandersen7/Daily | src/294e/hs/scrabble.hs | gpl-3.0 | value 'c' = 3 | 13 | value 'c' = 3 | 13 | value 'c' = 3 | 13 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
rsasse/tamarin-prover | lib/utils/src/Text/Dot.hs | gpl-3.0 | showGraphElement (GraphEdge from to attrs) = show from ++ " -> " ++ show to ++ showAttrs attrs ++ ";" | 102 | showGraphElement (GraphEdge from to attrs) = show from ++ " -> " ++ show to ++ showAttrs attrs ++ ";" | 102 | showGraphElement (GraphEdge from to attrs) = show from ++ " -> " ++ show to ++ showAttrs attrs ++ ";" | 102 | false | false | 0 | 9 | 20 | 44 | 20 | 24 | null | null |
TheFrameworkGame/blog-haskell-happstack-attempt | Main.hs | mit | config :: ServerConfig
config =
ServerConfig { port = 8001
, ramQuota = 1 * 10^6
, diskQuota = 20 * 10^6
, tmpDir = "/tmp/"
} | 206 | config :: ServerConfig
config =
ServerConfig { port = 8001
, ramQuota = 1 * 10^6
, diskQuota = 20 * 10^6
, tmpDir = "/tmp/"
} | 206 | config =
ServerConfig { port = 8001
, ramQuota = 1 * 10^6
, diskQuota = 20 * 10^6
, tmpDir = "/tmp/"
} | 183 | false | true | 0 | 8 | 107 | 53 | 31 | 22 | null | null |
cbare/Etudes | haskell/interpretter_00.hs | apache-2.0 | interp (Con i) e = unitM (Num i) | 35 | interp (Con i) e = unitM (Num i) | 35 | interp (Con i) e = unitM (Num i) | 35 | false | false | 0 | 7 | 10 | 26 | 12 | 14 | null | null |
rrnewton/accelerate | Data/Array/Accelerate.hs | bsd-3-clause | -- Renamings
--
-- FIXME: these all need to go into a separate module for separate importing!
-- rename as '(!)' is already used by the EDSL for indexing
-- |Array indexing in plain Haskell code.
--
indexArray :: S.Array sh e -> sh -> e
indexArray = (S.!) | 258 | indexArray :: S.Array sh e -> sh -> e
indexArray = (S.!) | 56 | indexArray = (S.!) | 18 | true | true | 0 | 8 | 51 | 43 | 23 | 20 | null | null |
brendanhay/gogol | gogol-apps-tasks/gen/Network/Google/Resource/Tasks/Tasks/Update.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
tuUploadType :: Lens' TasksUpdate (Maybe Text)
tuUploadType
= lens _tuUploadType (\ s a -> s{_tuUploadType = a}) | 185 | tuUploadType :: Lens' TasksUpdate (Maybe Text)
tuUploadType
= lens _tuUploadType (\ s a -> s{_tuUploadType = a}) | 114 | tuUploadType
= lens _tuUploadType (\ s a -> s{_tuUploadType = a}) | 67 | true | true | 0 | 9 | 28 | 48 | 25 | 23 | null | null |
ibotty/snaplet-mysql-simple | src/Snap/Snaplet/MysqlSimple.hs | bsd-3-clause | commit :: (HasMysql m, MonadCatchIO m) => m ()
commit = withMysql M.commit | 74 | commit :: (HasMysql m, MonadCatchIO m) => m ()
commit = withMysql M.commit | 74 | commit = withMysql M.commit | 27 | false | true | 0 | 7 | 12 | 36 | 18 | 18 | null | null |
DanielSchuessler/hstri | test_concreteNormal.hs | gpl-3.0 | q_ab' = standardCoordinates (0 ./ Q_ad) | 39 | q_ab' = standardCoordinates (0 ./ Q_ad) | 39 | q_ab' = standardCoordinates (0 ./ Q_ad) | 39 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
yiannist/ganeti | src/Ganeti/Hs2Py/OpDoc.hs | bsd-2-clause | opRepairNodeStorage :: String
opRepairNodeStorage =
"Repairs the volume group on a node." | 91 | opRepairNodeStorage :: String
opRepairNodeStorage =
"Repairs the volume group on a node." | 91 | opRepairNodeStorage =
"Repairs the volume group on a node." | 61 | false | true | 0 | 6 | 13 | 18 | 7 | 11 | null | null |
a143753/AOJ | 0106.hs | apache-2.0 | main = do
c <- getContents
let i = takeWhile (/= 0) $ map read $ lines c :: [Int]
o = map ans i
print o | 115 | main = do
c <- getContents
let i = takeWhile (/= 0) $ map read $ lines c :: [Int]
o = map ans i
print o | 115 | main = do
c <- getContents
let i = takeWhile (/= 0) $ map read $ lines c :: [Int]
o = map ans i
print o | 115 | false | false | 0 | 13 | 38 | 65 | 31 | 34 | null | null |
drx/petal | Tests.hs | mit | -- load i save na int, a nie pointer
test Tc 1 = Unpassable "start: code{r0: uptr(int), r2: int} \n\
\r1 = mem[r2 + 5] \n\
\mem[r2 + 5] = r1 \n\
\r3 = malloc 3 \n\
\commit r3 \n\
\salloc 6 \n\
\sfree 2 \n\
\jump exit" | 301 | test Tc 1 = Unpassable "start: code{r0: uptr(int), r2: int} \n\
\r1 = mem[r2 + 5] \n\
\mem[r2 + 5] = r1 \n\
\r3 = malloc 3 \n\
\commit r3 \n\
\salloc 6 \n\
\sfree 2 \n\
\jump exit" | 264 | test Tc 1 = Unpassable "start: code{r0: uptr(int), r2: int} \n\
\r1 = mem[r2 + 5] \n\
\mem[r2 + 5] = r1 \n\
\r3 = malloc 3 \n\
\commit r3 \n\
\salloc 6 \n\
\sfree 2 \n\
\jump exit" | 264 | true | false | 1 | 5 | 131 | 19 | 7 | 12 | null | null |
fferreira/hnh | CPS.hs | gpl-3.0 | cpsAlt :: [Identifier] -> (Identifier, KExp) -> Alternative -> State CPSSt AltK
cpsAlt caseIds (v,k) (Alternative pats e) =
do ke <- cps e (v, k)
v' <- newVar
ke' <- addLinks caseIds pats (v', ke)
return $ AltK (map patToCond pats) ke' | 253 | cpsAlt :: [Identifier] -> (Identifier, KExp) -> Alternative -> State CPSSt AltK
cpsAlt caseIds (v,k) (Alternative pats e) =
do ke <- cps e (v, k)
v' <- newVar
ke' <- addLinks caseIds pats (v', ke)
return $ AltK (map patToCond pats) ke' | 253 | cpsAlt caseIds (v,k) (Alternative pats e) =
do ke <- cps e (v, k)
v' <- newVar
ke' <- addLinks caseIds pats (v', ke)
return $ AltK (map patToCond pats) ke' | 173 | false | true | 0 | 11 | 60 | 128 | 63 | 65 | null | null |
karamellpelle/grid | source/Game/Grid/GridData/Plain/SoundPath.hs | gpl-3.0 | unloadSoundPath :: SoundPath -> IO ()
unloadSoundPath sound = do
-- alStopSource?
delSrc $ soundPathSrc sound
delBuf $ soundPathBuf sound | 149 | unloadSoundPath :: SoundPath -> IO ()
unloadSoundPath sound = do
-- alStopSource?
delSrc $ soundPathSrc sound
delBuf $ soundPathBuf sound | 149 | unloadSoundPath sound = do
-- alStopSource?
delSrc $ soundPathSrc sound
delBuf $ soundPathBuf sound | 111 | false | true | 0 | 8 | 31 | 44 | 20 | 24 | null | null |
HJvT/hdirect | src/Parser.hs | bsd-3-clause | happyReduction_7 _ _ _ = notHappyAtAll | 39 | happyReduction_7 _ _ _ = notHappyAtAll | 39 | happyReduction_7 _ _ _ = notHappyAtAll | 39 | false | false | 0 | 5 | 6 | 13 | 6 | 7 | null | null |
ezyang/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | bytesToString :: [Word8] -> String
bytesToString = map (chr . fromIntegral) | 75 | bytesToString :: [Word8] -> String
bytesToString = map (chr . fromIntegral) | 75 | bytesToString = map (chr . fromIntegral) | 40 | false | true | 0 | 7 | 10 | 28 | 15 | 13 | null | null |
vikraman/ghc | compiler/types/Type.hs | bsd-3-clause | -- Now here comes the real worker
{-
Note [cmpType nondeterminism]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cmpType is implemented in terms of cmpTypeX. cmpTypeX uses cmpTc which
compares TyCons by their Unique value. Using Uniques for ordering leads
to nondeterminism. We hit the same problem in the TyVarTy case, comparing
type variables is nondeterministic, note the call to nonDetCmpVar in cmpTypeX.
See Note [Unique Determinism] for more details.
-}
cmpType :: Type -> Type -> Ordering
cmpType t1 t2
-- we know k1 and k2 have the same kind, because they both have kind *.
= cmpTypeX rn_env t1 t2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes [t1, t2])) | 668 | cmpType :: Type -> Type -> Ordering
cmpType t1 t2
-- we know k1 and k2 have the same kind, because they both have kind *.
= cmpTypeX rn_env t1 t2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes [t1, t2])) | 221 | cmpType t1 t2
-- we know k1 and k2 have the same kind, because they both have kind *.
= cmpTypeX rn_env t1 t2
where
rn_env = mkRnEnv2 (mkInScopeSet (tyCoVarsOfTypes [t1, t2])) | 185 | true | true | 1 | 10 | 115 | 74 | 34 | 40 | null | null |
OpenXT/xclibs | xchutils/Tools/Periodic.hs | lgpl-2.1 | runNext :: Context -> IO Context
runNext context =
case timeline context of
[] -> return $ Context []
(x:xs) -> do
let dt = max (waitT x) 0
xs' = map (subtractTime dt) xs
threadDelay (dt*1000)
run x
case atyp x of
Periodic t -> return $ queue t x (Context xs')
Once -> return $ Context xs'
-- Empty context with no actions | 414 | runNext :: Context -> IO Context
runNext context =
case timeline context of
[] -> return $ Context []
(x:xs) -> do
let dt = max (waitT x) 0
xs' = map (subtractTime dt) xs
threadDelay (dt*1000)
run x
case atyp x of
Periodic t -> return $ queue t x (Context xs')
Once -> return $ Context xs'
-- Empty context with no actions | 414 | runNext context =
case timeline context of
[] -> return $ Context []
(x:xs) -> do
let dt = max (waitT x) 0
xs' = map (subtractTime dt) xs
threadDelay (dt*1000)
run x
case atyp x of
Periodic t -> return $ queue t x (Context xs')
Once -> return $ Context xs'
-- Empty context with no actions | 381 | false | true | 0 | 17 | 156 | 168 | 77 | 91 | null | null |
jeannekamikaze/Nexus | Nexus/Network.hs | bsd-3-clause | -- | Receive a bytestring.
recvBString :: MonadIO m => Int -> NetworkT m B.ByteString
recvBString nbytes = NetworkT $ \sock -> do
str <- liftIO $ safeRecv sock nbytes
if B.null str then left Disconnected else right . Just $ str
-- | Receive a bytestring.
--
-- This operation is non-blocking. | 301 | recvBString :: MonadIO m => Int -> NetworkT m B.ByteString
recvBString nbytes = NetworkT $ \sock -> do
str <- liftIO $ safeRecv sock nbytes
if B.null str then left Disconnected else right . Just $ str
-- | Receive a bytestring.
--
-- This operation is non-blocking. | 274 | recvBString nbytes = NetworkT $ \sock -> do
str <- liftIO $ safeRecv sock nbytes
if B.null str then left Disconnected else right . Just $ str
-- | Receive a bytestring.
--
-- This operation is non-blocking. | 215 | true | true | 0 | 11 | 61 | 88 | 44 | 44 | null | null |
timsears/species | Math/Combinatorics/Species/AST.hs | bsd-3-clause | needsCI (Rec _) = True | 27 | needsCI (Rec _) = True | 27 | needsCI (Rec _) = True | 27 | false | false | 0 | 7 | 9 | 15 | 7 | 8 | null | null |
alexander-at-github/eta | shake/Build.hs | bsd-3-clause | getDependencies "ghc-boot-th" = ["base"] | 40 | getDependencies "ghc-boot-th" = ["base"] | 40 | getDependencies "ghc-boot-th" = ["base"] | 40 | false | false | 0 | 5 | 3 | 13 | 6 | 7 | null | null |
hugonasciutti/Exercises | Haskell/Exercises/pratica3.hs | mit | {-
al_media nome notas = (nome, sum notas / fromIntegral(length notas))
-- Para uma média perfeita que conta quantos elementos uma lista possui e retorna um número inteiro para a divisão.
-}
{-
2. Diga quais são os tipos das seguintes expressões:
a) False
Main> :type False
False :: Bool
b) (["foo", "bar"], 'a')
Main> :type (["foo", "bar"], 'a')
(["foo","bar"],'a') :: ([[Char]],Char)
c) [(True, []), (False, [['a']])]
Main> :type [(True, []), (False, [['a']])]
[(True,[]),(False,[['a']])] :: [(Bool,[[Char]])]
d) 2.5
Main> :type 2.5
2.5 :: Fractional a => a
e) (1, 1.5, 2.5, 10)
Main> :type (1, 1.5, 2.5, 10)
(1,1.5,2.5,10) :: (Num a, Fractional b, Fractional c, Num d) => (d,c,b,a)
-}
{-
3. Crie as seguintes funções em Haskell definindo corretamente os tipos de dados.
a) Função para calcular a média de 4 números em ponto flutuante.
b) Função soma de 3 números inteiros.
c) Função que retorne a raiz quadrada de um número real. Utilize a função sqrt para o cálculo da raiz.
-}
e3a :: Float -> Float -> Float -> Float -> Float
e3a x1 x2 x3 x4 = (x1+x2+x3+x4)/4 | 1,151 | e3a :: Float -> Float -> Float -> Float -> Float
e3a x1 x2 x3 x4 = (x1+x2+x3+x4)/4 | 82 | e3a x1 x2 x3 x4 = (x1+x2+x3+x4)/4 | 33 | true | true | 0 | 9 | 269 | 63 | 32 | 31 | null | null |
siddhanathan/ghc | testsuite/tests/codeGen/should_run/T7953.hs | bsd-3-clause | atMost :: Prio -> PSQ -> ([Elem], PSQ)
atMost pt q = case q of
(Winner e _)
| prio e > pt -> ([], q)
Void -> ([], Void)
Winner e Start -> ([e], Void)
Winner e (Fork e' tl tr) ->
let (sequ, q') = atMost pt (Winner e' tl)
(sequ', q'') = atMost pt (Winner e tr)
in (sequ ++ sequ', q' `play` q'') | 362 | atMost :: Prio -> PSQ -> ([Elem], PSQ)
atMost pt q = case q of
(Winner e _)
| prio e > pt -> ([], q)
Void -> ([], Void)
Winner e Start -> ([e], Void)
Winner e (Fork e' tl tr) ->
let (sequ, q') = atMost pt (Winner e' tl)
(sequ', q'') = atMost pt (Winner e tr)
in (sequ ++ sequ', q' `play` q'') | 362 | atMost pt q = case q of
(Winner e _)
| prio e > pt -> ([], q)
Void -> ([], Void)
Winner e Start -> ([e], Void)
Winner e (Fork e' tl tr) ->
let (sequ, q') = atMost pt (Winner e' tl)
(sequ', q'') = atMost pt (Winner e tr)
in (sequ ++ sequ', q' `play` q'') | 323 | false | true | 5 | 8 | 136 | 195 | 104 | 91 | null | null |
ianclement/dzen-utils | System/Dzen/Process.hs | gpl-3.0 | -- | Pipes a 'Printer' to a fresh instance of @dzen@. It runs
-- the following commands:
--
-- (1) Start @dzen@ with the supplied executable and arguments.
--
-- (2) Call the supply to get an input.
--
-- (3) Apply the input to the printer.
--
-- (4) Write the printer's output to @dzen@'s standard input.
--
-- (5) Sleeps for the specified delay using 'threadDelay'.
--
-- (6) Go back to step 2.
--
-- You may want to use this function inside a 'forkIO' if,
-- for example, you're inside @xmonad@.
runDzen :: FilePath -- ^ Path to @dzen@ executable, probably @\"dzen2\"@
-> [String] -- ^ Arguments for @dzen@.
-> Int -- ^ Delay between suplies in milliseconds. May be zero.
-> Printer a -- ^ @Printer@ to be used.
-> IO a -- ^ Supply of inputs.
-> IO ()
runDzen path args delay printer get = do
handle <- createDzen' path args
let put s = hPutStrLn handle s >> threadDelay (delay * 1000)
applyForever printer get put
-- | This is the same as @liftM2 (,)@, but with as a convenient
-- operator with right infixity (the same as '+++'). For example,
-- suppose you have printers
--
-- > prA :: Printer a
-- > prB :: Printer b
-- > prC :: Printer c
--
-- and supply functions
--
-- > getA :: m a
-- > getB :: m b
-- > getC :: m c
--
-- for some monad @m@. The final printer
--
-- > prFinal = prA +++ prB +++ prC
--
-- will be of type @Printer (a,(b,c))@, so you may use
-- as its supply function
--
-- > getFinal = getA ## getB ## getC
--
-- which is of type @m (a,(b,c))@. | 1,581 | runDzen :: FilePath -- ^ Path to @dzen@ executable, probably @\"dzen2\"@
-> [String] -- ^ Arguments for @dzen@.
-> Int -- ^ Delay between suplies in milliseconds. May be zero.
-> Printer a -- ^ @Printer@ to be used.
-> IO a -- ^ Supply of inputs.
-> IO ()
runDzen path args delay printer get = do
handle <- createDzen' path args
let put s = hPutStrLn handle s >> threadDelay (delay * 1000)
applyForever printer get put
-- | This is the same as @liftM2 (,)@, but with as a convenient
-- operator with right infixity (the same as '+++'). For example,
-- suppose you have printers
--
-- > prA :: Printer a
-- > prB :: Printer b
-- > prC :: Printer c
--
-- and supply functions
--
-- > getA :: m a
-- > getB :: m b
-- > getC :: m c
--
-- for some monad @m@. The final printer
--
-- > prFinal = prA +++ prB +++ prC
--
-- will be of type @Printer (a,(b,c))@, so you may use
-- as its supply function
--
-- > getFinal = getA ## getB ## getC
--
-- which is of type @m (a,(b,c))@. | 1,064 | runDzen path args delay printer get = do
handle <- createDzen' path args
let put s = hPutStrLn handle s >> threadDelay (delay * 1000)
applyForever printer get put
-- | This is the same as @liftM2 (,)@, but with as a convenient
-- operator with right infixity (the same as '+++'). For example,
-- suppose you have printers
--
-- > prA :: Printer a
-- > prB :: Printer b
-- > prC :: Printer c
--
-- and supply functions
--
-- > getA :: m a
-- > getB :: m b
-- > getC :: m c
--
-- for some monad @m@. The final printer
--
-- > prFinal = prA +++ prB +++ prC
--
-- will be of type @Printer (a,(b,c))@, so you may use
-- as its supply function
--
-- > getFinal = getA ## getB ## getC
--
-- which is of type @m (a,(b,c))@. | 755 | true | true | 0 | 13 | 411 | 155 | 96 | 59 | null | null |
rueshyna/gogol | gogol-games-management/gen/Network/Google/Resource/GamesManagement/Events/ResetForAllPlayers.hs | mpl-2.0 | -- | Creates a value of 'EventsResetForAllPlayers' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'erfapEventId'
eventsResetForAllPlayers
:: Text -- ^ 'erfapEventId'
-> EventsResetForAllPlayers
eventsResetForAllPlayers pErfapEventId_ =
EventsResetForAllPlayers'
{ _erfapEventId = pErfapEventId_
} | 402 | eventsResetForAllPlayers
:: Text -- ^ 'erfapEventId'
-> EventsResetForAllPlayers
eventsResetForAllPlayers pErfapEventId_ =
EventsResetForAllPlayers'
{ _erfapEventId = pErfapEventId_
} | 203 | eventsResetForAllPlayers pErfapEventId_ =
EventsResetForAllPlayers'
{ _erfapEventId = pErfapEventId_
} | 114 | true | true | 0 | 7 | 70 | 40 | 22 | 18 | null | null |
drx/petal | Tests.hs | mit | test Tc 4 = Passable "copy: code{r1:ptr(int,int), r2:int,r3:int}\n\
\r2 = malloc 2;\n\
\r3 = mem[r1+1];\n\
\mem[r2+1] = r3;\n\
\r3 = mem[r1+2];\n\
\mem[r2+1] = r3;\n\
\commit r2;\n\
\jump exit" | 277 | test Tc 4 = Passable "copy: code{r1:ptr(int,int), r2:int,r3:int}\n\
\r2 = malloc 2;\n\
\r3 = mem[r1+1];\n\
\mem[r2+1] = r3;\n\
\r3 = mem[r1+2];\n\
\mem[r2+1] = r3;\n\
\commit r2;\n\
\jump exit" | 277 | test Tc 4 = Passable "copy: code{r1:ptr(int,int), r2:int,r3:int}\n\
\r2 = malloc 2;\n\
\r3 = mem[r1+1];\n\
\mem[r2+1] = r3;\n\
\r3 = mem[r1+2];\n\
\mem[r2+1] = r3;\n\
\commit r2;\n\
\jump exit" | 277 | false | false | 1 | 5 | 111 | 18 | 6 | 12 | null | null |
pminten/xhaskell | sgf-parsing/example.hs | mit | tree :: Parser SgfTree
tree = makeSgfTree <$> (char '(' *> many1 node)
<*> (many tree <* char ')') | 117 | tree :: Parser SgfTree
tree = makeSgfTree <$> (char '(' *> many1 node)
<*> (many tree <* char ')') | 117 | tree = makeSgfTree <$> (char '(' *> many1 node)
<*> (many tree <* char ')') | 94 | false | true | 5 | 8 | 37 | 58 | 26 | 32 | null | null |
ksaveljev/hake-2 | src/Util/Binary.hs | bsd-3-clause | getInt16 :: Get Int16
getInt16 = fromIntegral <$> getWord16le | 61 | getInt16 :: Get Int16
getInt16 = fromIntegral <$> getWord16le | 61 | getInt16 = fromIntegral <$> getWord16le | 39 | false | true | 1 | 6 | 8 | 22 | 9 | 13 | null | null |
fmapfmapfmap/amazonka | amazonka-ec2/gen/Network/AWS/EC2/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'NetworkInterfaceAttachment' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'niaInstanceId'
--
-- * 'niaStatus'
--
-- * 'niaDeleteOnTermination'
--
-- * 'niaAttachmentId'
--
-- * 'niaInstanceOwnerId'
--
-- * 'niaAttachTime'
--
-- * 'niaDeviceIndex'
networkInterfaceAttachment
:: NetworkInterfaceAttachment
networkInterfaceAttachment =
NetworkInterfaceAttachment'
{ _niaInstanceId = Nothing
, _niaStatus = Nothing
, _niaDeleteOnTermination = Nothing
, _niaAttachmentId = Nothing
, _niaInstanceOwnerId = Nothing
, _niaAttachTime = Nothing
, _niaDeviceIndex = Nothing
} | 716 | networkInterfaceAttachment
:: NetworkInterfaceAttachment
networkInterfaceAttachment =
NetworkInterfaceAttachment'
{ _niaInstanceId = Nothing
, _niaStatus = Nothing
, _niaDeleteOnTermination = Nothing
, _niaAttachmentId = Nothing
, _niaInstanceOwnerId = Nothing
, _niaAttachTime = Nothing
, _niaDeviceIndex = Nothing
} | 357 | networkInterfaceAttachment =
NetworkInterfaceAttachment'
{ _niaInstanceId = Nothing
, _niaStatus = Nothing
, _niaDeleteOnTermination = Nothing
, _niaAttachmentId = Nothing
, _niaInstanceOwnerId = Nothing
, _niaAttachTime = Nothing
, _niaDeviceIndex = Nothing
} | 296 | true | true | 0 | 6 | 132 | 72 | 52 | 20 | null | null |
DavidAlphaFox/darcs | src/Darcs/UI/Commands/Send.hs | gpl-2.0 | sendAdvancedOpts :: DarcsOption a
(O.Logfile
-> O.RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> O.NetworkOptions
-> a)
sendAdvancedOpts
= O.logfile
^ O.remoteRepos
^ O.sendToContext
^ O.changesReverse
^ O.network | 357 | sendAdvancedOpts :: DarcsOption a
(O.Logfile
-> O.RemoteRepos
-> Maybe AbsolutePath
-> Bool
-> O.NetworkOptions
-> a)
sendAdvancedOpts
= O.logfile
^ O.remoteRepos
^ O.sendToContext
^ O.changesReverse
^ O.network | 357 | sendAdvancedOpts
= O.logfile
^ O.remoteRepos
^ O.sendToContext
^ O.changesReverse
^ O.network | 114 | false | true | 10 | 11 | 172 | 82 | 37 | 45 | null | null |
hpacheco/HAAP | src/HAAP/IO.hs | mit | haapRetry i m = orDo (\e -> logError e >> haapRetry (pred i) m) m | 65 | haapRetry i m = orDo (\e -> logError e >> haapRetry (pred i) m) m | 65 | haapRetry i m = orDo (\e -> logError e >> haapRetry (pred i) m) m | 65 | false | false | 0 | 11 | 14 | 42 | 20 | 22 | null | null |
showpoint/refs | src/Data.hs | bsd-3-clause | refC = refProxy (Proxy :: Proxy C) . (TC,) | 42 | refC = refProxy (Proxy :: Proxy C) . (TC,) | 42 | refC = refProxy (Proxy :: Proxy C) . (TC,) | 42 | false | false | 0 | 8 | 8 | 26 | 14 | 12 | null | null |
ekmett/data-store | src/Data/Store.hs | bsd-3-clause | debugShow :: (Show a1, Show a2, Show a3, Show a4, Show v) => I.Store tag ((a1, dt1) I.:. (a2, dt2) I.:. (a3, dt3) I.:. (a4, dt4) I.:. I.K0) v -> String
debugShow (I.Store values index noid) = unlines
[ "Store values: " ++ show values
, "Store index: " ++ show index
, "Store next oid: " ++ show noid
] | 317 | debugShow :: (Show a1, Show a2, Show a3, Show a4, Show v) => I.Store tag ((a1, dt1) I.:. (a2, dt2) I.:. (a3, dt3) I.:. (a4, dt4) I.:. I.K0) v -> String
debugShow (I.Store values index noid) = unlines
[ "Store values: " ++ show values
, "Store index: " ++ show index
, "Store next oid: " ++ show noid
] | 317 | debugShow (I.Store values index noid) = unlines
[ "Store values: " ++ show values
, "Store index: " ++ show index
, "Store next oid: " ++ show noid
] | 165 | false | true | 0 | 13 | 76 | 158 | 83 | 75 | null | null |
Soostone/wunderground | test/Main.hs | mit | -------------------------------------------------------------------------------
nycResponse :: ObservationResponse
nycResponse = ObservationResponse (Just obs)
where
obs = Observation img loc time ltime weather tF tC wMPH wgMPH wKPH wgKPH dpF dpC flF flC
img = Image "http://icons.wxug.com/graphics/wu2/logo_130x80.png" "Weather Underground" "http://www.wunderground.com"
loc = DisplayLocation lfn city st stn c ciso z lt lg
lfn = LocationFullName "New York, NY"
city = City "New York"
st = GeoState "NY"
stn = GeoStateName "New York"
c = Country "US"
ciso = CountryISO3166 "US"
z = PostalCode "10172"
lt = Lat 40.75
lg = Lng (-73.98)
time = posixSecondsToUTCTime 1432851597
ltime = posixSecondsToUTCTime 1432851619
weather = Weather "Scattered Clouds"
tF = TempF 82.9
tC = TempC 28.3
wMPH = MPH 1
wgMPH = MPH 4
wKPH = KPH 1.6
wgKPH = KPH 6.4
dpF = TempF 68
dpC = TempC 20
flF = TempF 86
flC = TempC 30
------------------------------------------------------------------------------- | 1,086 | nycResponse :: ObservationResponse
nycResponse = ObservationResponse (Just obs)
where
obs = Observation img loc time ltime weather tF tC wMPH wgMPH wKPH wgKPH dpF dpC flF flC
img = Image "http://icons.wxug.com/graphics/wu2/logo_130x80.png" "Weather Underground" "http://www.wunderground.com"
loc = DisplayLocation lfn city st stn c ciso z lt lg
lfn = LocationFullName "New York, NY"
city = City "New York"
st = GeoState "NY"
stn = GeoStateName "New York"
c = Country "US"
ciso = CountryISO3166 "US"
z = PostalCode "10172"
lt = Lat 40.75
lg = Lng (-73.98)
time = posixSecondsToUTCTime 1432851597
ltime = posixSecondsToUTCTime 1432851619
weather = Weather "Scattered Clouds"
tF = TempF 82.9
tC = TempC 28.3
wMPH = MPH 1
wgMPH = MPH 4
wKPH = KPH 1.6
wgKPH = KPH 6.4
dpF = TempF 68
dpC = TempC 20
flF = TempF 86
flC = TempC 30
------------------------------------------------------------------------------- | 1,006 | nycResponse = ObservationResponse (Just obs)
where
obs = Observation img loc time ltime weather tF tC wMPH wgMPH wKPH wgKPH dpF dpC flF flC
img = Image "http://icons.wxug.com/graphics/wu2/logo_130x80.png" "Weather Underground" "http://www.wunderground.com"
loc = DisplayLocation lfn city st stn c ciso z lt lg
lfn = LocationFullName "New York, NY"
city = City "New York"
st = GeoState "NY"
stn = GeoStateName "New York"
c = Country "US"
ciso = CountryISO3166 "US"
z = PostalCode "10172"
lt = Lat 40.75
lg = Lng (-73.98)
time = posixSecondsToUTCTime 1432851597
ltime = posixSecondsToUTCTime 1432851619
weather = Weather "Scattered Clouds"
tF = TempF 82.9
tC = TempC 28.3
wMPH = MPH 1
wgMPH = MPH 4
wKPH = KPH 1.6
wgKPH = KPH 6.4
dpF = TempF 68
dpC = TempC 20
flF = TempF 86
flC = TempC 30
------------------------------------------------------------------------------- | 971 | true | true | 22 | 7 | 244 | 354 | 141 | 213 | null | null |
TachoMex/MiniSequel | src/MiniSequel/Mapper.hs | mit | snakeCase :: String -> String
snakeCase = map toLower . concat . underscores . splitR isUpper
where
underscores :: [String] -> [String]
underscores [] = []
underscores (h:t) = h : map ('_':) t
splitR :: (Char -> Bool) -> String -> [String]
splitR _ [] = []
splitR p s =
let
go :: Char -> String -> [String]
go m s' = case break p s' of
(b', []) -> [ m:b' ]
(b', x:xs) -> ( m:b' ) : go x xs
in case break p s of
(b, []) -> [ b ]
([], h:t) -> go h t
(b, h:t) -> b : go h t | 610 | snakeCase :: String -> String
snakeCase = map toLower . concat . underscores . splitR isUpper
where
underscores :: [String] -> [String]
underscores [] = []
underscores (h:t) = h : map ('_':) t
splitR :: (Char -> Bool) -> String -> [String]
splitR _ [] = []
splitR p s =
let
go :: Char -> String -> [String]
go m s' = case break p s' of
(b', []) -> [ m:b' ]
(b', x:xs) -> ( m:b' ) : go x xs
in case break p s of
(b, []) -> [ b ]
([], h:t) -> go h t
(b, h:t) -> b : go h t | 608 | snakeCase = map toLower . concat . underscores . splitR isUpper
where
underscores :: [String] -> [String]
underscores [] = []
underscores (h:t) = h : map ('_':) t
splitR :: (Char -> Bool) -> String -> [String]
splitR _ [] = []
splitR p s =
let
go :: Char -> String -> [String]
go m s' = case break p s' of
(b', []) -> [ m:b' ]
(b', x:xs) -> ( m:b' ) : go x xs
in case break p s of
(b, []) -> [ b ]
([], h:t) -> go h t
(b, h:t) -> b : go h t | 578 | false | true | 0 | 14 | 250 | 306 | 160 | 146 | null | null |
jkr/pandoc-citeproc | src/Text/CSL/Util.hs | bsd-3-clause | splitStrWhen p (x : ys) = x : splitStrWhen p ys | 47 | splitStrWhen p (x : ys) = x : splitStrWhen p ys | 47 | splitStrWhen p (x : ys) = x : splitStrWhen p ys | 47 | false | false | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
sdiehl/ghc | compiler/basicTypes/DataCon.hs | bsd-3-clause | -- | The \"stupid theta\" of the 'DataCon', such as @data Eq a@ in:
--
-- > data Eq a => T a = ...
dataConStupidTheta :: DataCon -> ThetaType
dataConStupidTheta dc = dcStupidTheta dc | 182 | dataConStupidTheta :: DataCon -> ThetaType
dataConStupidTheta dc = dcStupidTheta dc | 83 | dataConStupidTheta dc = dcStupidTheta dc | 40 | true | true | 0 | 5 | 34 | 24 | 13 | 11 | null | null |
mathhun/stack | src/main/Main.hs | bsd-3-clause | dockerCleanupCmd :: Docker.CleanupOpts -> GlobalOpts -> IO ()
dockerCleanupCmd cleanupOpts go@GlobalOpts{..} = do
(manager,lc) <- liftIO $ loadConfigWithOpts go
-- TODO: can we eliminate this lock if it doesn't touch ~/.stack/?
withUserFileLock go (configStackRoot $ lcConfig lc) $ \_ ->
runStackTGlobal manager (lcConfig lc) go $
Docker.preventInContainer $
Docker.cleanup cleanupOpts | 422 | dockerCleanupCmd :: Docker.CleanupOpts -> GlobalOpts -> IO ()
dockerCleanupCmd cleanupOpts go@GlobalOpts{..} = do
(manager,lc) <- liftIO $ loadConfigWithOpts go
-- TODO: can we eliminate this lock if it doesn't touch ~/.stack/?
withUserFileLock go (configStackRoot $ lcConfig lc) $ \_ ->
runStackTGlobal manager (lcConfig lc) go $
Docker.preventInContainer $
Docker.cleanup cleanupOpts | 422 | dockerCleanupCmd cleanupOpts go@GlobalOpts{..} = do
(manager,lc) <- liftIO $ loadConfigWithOpts go
-- TODO: can we eliminate this lock if it doesn't touch ~/.stack/?
withUserFileLock go (configStackRoot $ lcConfig lc) $ \_ ->
runStackTGlobal manager (lcConfig lc) go $
Docker.preventInContainer $
Docker.cleanup cleanupOpts | 360 | false | true | 0 | 13 | 86 | 116 | 57 | 59 | null | null |
sethfowler/pygmalion | src/Pygmalion/Database/IO.hs | bsd-3-clause | -- Search for declarations referenced by the first file which are
-- located in the second file. Used by getInclusionHierarchy.
getDeclsReferencedInFile :: DBHandle -> SourceFile -> SourceFile -> IO [DefInfo]
getDeclsReferencedInFile h sf hf = execQuery h getDeclsReferencedInFileStmt (stableHash sf, stableHash hf) | 315 | getDeclsReferencedInFile :: DBHandle -> SourceFile -> SourceFile -> IO [DefInfo]
getDeclsReferencedInFile h sf hf = execQuery h getDeclsReferencedInFileStmt (stableHash sf, stableHash hf) | 187 | getDeclsReferencedInFile h sf hf = execQuery h getDeclsReferencedInFileStmt (stableHash sf, stableHash hf) | 106 | true | true | 0 | 9 | 41 | 57 | 29 | 28 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/HashChangeEvent.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HashChangeEvent Mozilla HashChangeEvent documentation>
newHashChangeEvent ::
(MonadDOM m, ToJSString type') =>
type' -> Maybe HashChangeEventInit -> m HashChangeEvent
newHashChangeEvent type' eventInitDict
= liftDOM
(HashChangeEvent <$>
new (jsg "HashChangeEvent") [toJSVal type', toJSVal eventInitDict]) | 417 | newHashChangeEvent ::
(MonadDOM m, ToJSString type') =>
type' -> Maybe HashChangeEventInit -> m HashChangeEvent
newHashChangeEvent type' eventInitDict
= liftDOM
(HashChangeEvent <$>
new (jsg "HashChangeEvent") [toJSVal type', toJSVal eventInitDict]) | 306 | newHashChangeEvent type' eventInitDict
= liftDOM
(HashChangeEvent <$>
new (jsg "HashChangeEvent") [toJSVal type', toJSVal eventInitDict]) | 154 | true | true | 0 | 10 | 91 | 79 | 39 | 40 | null | null |
pbl64k/MD5.hs | MD5.hs | bsd-2-clause | ein :: Hasher
ein (_, b, c, d, i) = f' `seq` g' `seq` (f', g')
where f' = (b .&. c) .|. ((complement b) .&. d)
g' = fromIntegral i | 144 | ein :: Hasher
ein (_, b, c, d, i) = f' `seq` g' `seq` (f', g')
where f' = (b .&. c) .|. ((complement b) .&. d)
g' = fromIntegral i | 144 | ein (_, b, c, d, i) = f' `seq` g' `seq` (f', g')
where f' = (b .&. c) .|. ((complement b) .&. d)
g' = fromIntegral i | 130 | false | true | 3 | 9 | 44 | 97 | 50 | 47 | null | null |
diku-dk/futhark | src/Language/Futhark/Interpreter.hs | isc | eval env (ArrayLit [] (Info t) _) = do
t' <- typeValueShape env $ toStruct t
return $ toArray t' [] | 103 | eval env (ArrayLit [] (Info t) _) = do
t' <- typeValueShape env $ toStruct t
return $ toArray t' [] | 103 | eval env (ArrayLit [] (Info t) _) = do
t' <- typeValueShape env $ toStruct t
return $ toArray t' [] | 103 | false | false | 0 | 9 | 24 | 60 | 27 | 33 | null | null |
zhenyavinogradov/ml-labs | src/Lab2/Main.hs | gpl-3.0 | normal :: Rnd Double
normal = state R.normal | 44 | normal :: Rnd Double
normal = state R.normal | 44 | normal = state R.normal | 23 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
WraithM/HCatmullClark | src/Camera.hs | gpl-3.0 | -- Move forward by amount speed in the x-z plane
cameraMoveForward (Camera p v u) speed =
let fwdv = normalizeV $ v -. p
px = x p + x fwdv * speed
pz = z p + z fwdv * speed
vx = x v + x fwdv * speed
vz = z v + z fwdv * speed
in Camera (Vec3 px (y p) pz) (Vec3 vx (y v) vz) u | 316 | cameraMoveForward (Camera p v u) speed =
let fwdv = normalizeV $ v -. p
px = x p + x fwdv * speed
pz = z p + z fwdv * speed
vx = x v + x fwdv * speed
vz = z v + z fwdv * speed
in Camera (Vec3 px (y p) pz) (Vec3 vx (y v) vz) u | 267 | cameraMoveForward (Camera p v u) speed =
let fwdv = normalizeV $ v -. p
px = x p + x fwdv * speed
pz = z p + z fwdv * speed
vx = x v + x fwdv * speed
vz = z v + z fwdv * speed
in Camera (Vec3 px (y p) pz) (Vec3 vx (y v) vz) u | 267 | true | false | 0 | 11 | 115 | 156 | 75 | 81 | null | null |
denibertovic/haskell | kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs | bsd-3-clause | -- | 'v1beta1ClusterRoleListItems' Lens
v1beta1ClusterRoleListItemsL :: Lens_' V1beta1ClusterRoleList ([V1beta1ClusterRole])
v1beta1ClusterRoleListItemsL f V1beta1ClusterRoleList{..} = (\v1beta1ClusterRoleListItems -> V1beta1ClusterRoleList { v1beta1ClusterRoleListItems, ..} ) <$> f v1beta1ClusterRoleListItems | 311 | v1beta1ClusterRoleListItemsL :: Lens_' V1beta1ClusterRoleList ([V1beta1ClusterRole])
v1beta1ClusterRoleListItemsL f V1beta1ClusterRoleList{..} = (\v1beta1ClusterRoleListItems -> V1beta1ClusterRoleList { v1beta1ClusterRoleListItems, ..} ) <$> f v1beta1ClusterRoleListItems | 271 | v1beta1ClusterRoleListItemsL f V1beta1ClusterRoleList{..} = (\v1beta1ClusterRoleListItems -> V1beta1ClusterRoleList { v1beta1ClusterRoleListItems, ..} ) <$> f v1beta1ClusterRoleListItems | 186 | true | true | 0 | 8 | 22 | 57 | 31 | 26 | null | null |
tjakway/ghcjvm | compiler/stgSyn/StgSyn.hs | bsd-3-clause | -- | Strip ticks of a given type from an STG expression
stripStgTicksTop :: (Tickish Id -> Bool) -> StgExpr -> ([Tickish Id], StgExpr)
stripStgTicksTop p = go []
where go ts (StgTick t e) | p t = go (t:ts) e
go ts other = (reverse ts, other)
{-
************************************************************************
* *
\subsection{STG expressions}
* *
************************************************************************
The @GenStgExpr@ data type is parameterised on binder and occurrence
info, as before.
************************************************************************
* *
\subsubsection{@GenStgExpr@ application}
* *
************************************************************************
An application is of a function to a list of atoms [not expressions].
Operationally, we want to push the arguments on the stack and call the
function. (If the arguments were expressions, we would have to build
their closures first.)
There is no constructor for a lone variable; it would appear as
@StgApp var []@.
-} | 1,333 | stripStgTicksTop :: (Tickish Id -> Bool) -> StgExpr -> ([Tickish Id], StgExpr)
stripStgTicksTop p = go []
where go ts (StgTick t e) | p t = go (t:ts) e
go ts other = (reverse ts, other)
{-
************************************************************************
* *
\subsection{STG expressions}
* *
************************************************************************
The @GenStgExpr@ data type is parameterised on binder and occurrence
info, as before.
************************************************************************
* *
\subsubsection{@GenStgExpr@ application}
* *
************************************************************************
An application is of a function to a list of atoms [not expressions].
Operationally, we want to push the arguments on the stack and call the
function. (If the arguments were expressions, we would have to build
their closures first.)
There is no constructor for a lone variable; it would appear as
@StgApp var []@.
-} | 1,277 | stripStgTicksTop p = go []
where go ts (StgTick t e) | p t = go (t:ts) e
go ts other = (reverse ts, other)
{-
************************************************************************
* *
\subsection{STG expressions}
* *
************************************************************************
The @GenStgExpr@ data type is parameterised on binder and occurrence
info, as before.
************************************************************************
* *
\subsubsection{@GenStgExpr@ application}
* *
************************************************************************
An application is of a function to a list of atoms [not expressions].
Operationally, we want to push the arguments on the stack and call the
function. (If the arguments were expressions, we would have to build
their closures first.)
There is no constructor for a lone variable; it would appear as
@StgApp var []@.
-} | 1,198 | true | true | 0 | 10 | 442 | 111 | 56 | 55 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/TermPrinter.hs | mit | nameEndsWith :: PrettyPrintEnv -> Text -> Reference -> Bool
nameEndsWith ppe suffix r = case PrettyPrintEnv.termName ppe (Referent.Ref r) of
HQ.NameOnly n ->
let tn = Name.toText n
in tn == Text.drop 1 suffix || Text.isSuffixOf suffix tn
_ -> False | 261 | nameEndsWith :: PrettyPrintEnv -> Text -> Reference -> Bool
nameEndsWith ppe suffix r = case PrettyPrintEnv.termName ppe (Referent.Ref r) of
HQ.NameOnly n ->
let tn = Name.toText n
in tn == Text.drop 1 suffix || Text.isSuffixOf suffix tn
_ -> False | 261 | nameEndsWith ppe suffix r = case PrettyPrintEnv.termName ppe (Referent.Ref r) of
HQ.NameOnly n ->
let tn = Name.toText n
in tn == Text.drop 1 suffix || Text.isSuffixOf suffix tn
_ -> False | 201 | false | true | 0 | 13 | 53 | 110 | 50 | 60 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/SrcLoc.hs | bsd-3-clause | srcSpanStartLine SrcSpanPoint{ srcSpanLine=l } = l | 50 | srcSpanStartLine SrcSpanPoint{ srcSpanLine=l } = l | 50 | srcSpanStartLine SrcSpanPoint{ srcSpanLine=l } = l | 50 | false | false | 0 | 8 | 5 | 18 | 9 | 9 | null | null |
FranklinChen/Idris-dev | src/Idris/IBC.hs | bsd-3-clause | ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f } | 63 | ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f } | 63 | ibc i (IBCUsage n) f = return f { ibc_usage = n : ibc_usage f } | 63 | false | false | 1 | 9 | 15 | 42 | 18 | 24 | null | null |
kovach/web2 | src/Convert.hs | mit | -- edgeFile: a file containing tuples, one per line.
-- empty lines separate blocks. each block is added simultaneously;
-- a fixed point is computed after each block
-- ruleFile: a file containing an ordered list of rules, one per line.
-- rules may not be split across lines.
loadProgram :: FilePath -> FilePath -> IO ([RHS], [Rule])
loadProgram edgeFile ruleFile = do
edgeBlocks <- readDBFile edgeFile
rules <- readRules ruleFile
return (edgeBlocks, rules)
-- Main program execution function
-- returns result, but not the full execution context | 573 | loadProgram :: FilePath -> FilePath -> IO ([RHS], [Rule])
loadProgram edgeFile ruleFile = do
edgeBlocks <- readDBFile edgeFile
rules <- readRules ruleFile
return (edgeBlocks, rules)
-- Main program execution function
-- returns result, but not the full execution context | 286 | loadProgram edgeFile ruleFile = do
edgeBlocks <- readDBFile edgeFile
rules <- readRules ruleFile
return (edgeBlocks, rules)
-- Main program execution function
-- returns result, but not the full execution context | 228 | true | true | 0 | 9 | 112 | 83 | 43 | 40 | null | null |
miguelpagano/equ | Equ/Parser/Proof.hs | gpl-3.0 | initPProofState :: TheoSet -> PExprState -> PProofState
initPProofState theoSet estate = PProofState theoSet estate | 115 | initPProofState :: TheoSet -> PExprState -> PProofState
initPProofState theoSet estate = PProofState theoSet estate | 115 | initPProofState theoSet estate = PProofState theoSet estate | 59 | false | true | 0 | 8 | 13 | 34 | 15 | 19 | null | null |
hdgarrood/aeson-better-errors | src/Data/Aeson/BetterErrors/Internal.hs | mit | -- | A version of `displaySpecifics` for parsers which do not produce
-- custom validation errors.
displaySpecifics' :: ErrorSpecifics' -> [Text]
displaySpecifics' = displaySpecifics absurd | 189 | displaySpecifics' :: ErrorSpecifics' -> [Text]
displaySpecifics' = displaySpecifics absurd | 90 | displaySpecifics' = displaySpecifics absurd | 43 | true | true | 0 | 6 | 24 | 23 | 13 | 10 | null | null |
noughtmare/yi | yi-dynamic-configuration/src/Yi/Main.hs | gpl-2.0 | convertCustomArgDesc (OptArg f s) = OptArg (CustomOptArg f) s | 61 | convertCustomArgDesc (OptArg f s) = OptArg (CustomOptArg f) s | 61 | convertCustomArgDesc (OptArg f s) = OptArg (CustomOptArg f) s | 61 | false | false | 0 | 7 | 8 | 28 | 13 | 15 | null | null |
iliastsi/gac | src/typecheck/TcMonad.hs | mit | getProtos finfo@(FunInfo (L loc fn) _ _ _ _ True) =
let changed_name = getFuncName $ Just finfo in
Just (loc, fn, changed_name) | 135 | getProtos finfo@(FunInfo (L loc fn) _ _ _ _ True) =
let changed_name = getFuncName $ Just finfo in
Just (loc, fn, changed_name) | 135 | getProtos finfo@(FunInfo (L loc fn) _ _ _ _ True) =
let changed_name = getFuncName $ Just finfo in
Just (loc, fn, changed_name) | 135 | false | false | 0 | 10 | 30 | 66 | 33 | 33 | null | null |
msakai/folkung | Haskell/Name.hs | mit | isName p (n :% _) = isName p n | 30 | isName p (n :% _) = isName p n | 30 | isName p (n :% _) = isName p n | 30 | false | false | 0 | 7 | 8 | 23 | 11 | 12 | null | null |
tolysz/prepare-ghcjs | spec-lts8/aeson/benchmarks/Typed/TH.hs | bsd-3-clause | benchmarks :: Benchmark
benchmarks =
env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) ->
bgroup "th" [
bgroup "direct" [
bench "twitter100" $ nf encodeDirectB twitter100
, bench "jp100" $ nf encodeDirectB jp100
, bench "twitter100 baseline" $ nf encodeDirectA twitter100
, bench "jp100 baseline" $ nf encodeDirectA jp100
]
, bgroup "viaValue" [
bench "twitter100" $ nf encodeViaValueA twitter100
, bench "jp100" $ nf encodeViaValueA jp100
, bench "twitter100 baseline" $ nf encodeViaValueB twitter100
, bench "jp100 baseline" $ nf encodeViaValueB jp100
]
] | 749 | benchmarks :: Benchmark
benchmarks =
env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) ->
bgroup "th" [
bgroup "direct" [
bench "twitter100" $ nf encodeDirectB twitter100
, bench "jp100" $ nf encodeDirectB jp100
, bench "twitter100 baseline" $ nf encodeDirectA twitter100
, bench "jp100 baseline" $ nf encodeDirectA jp100
]
, bgroup "viaValue" [
bench "twitter100" $ nf encodeViaValueA twitter100
, bench "jp100" $ nf encodeViaValueA jp100
, bench "twitter100 baseline" $ nf encodeViaValueB twitter100
, bench "jp100 baseline" $ nf encodeViaValueB jp100
]
] | 749 | benchmarks =
env ((,) <$> load "json-data/twitter100.json" <*> load "json-data/jp100.json") $ \ ~(twitter100, jp100) ->
bgroup "th" [
bgroup "direct" [
bench "twitter100" $ nf encodeDirectB twitter100
, bench "jp100" $ nf encodeDirectB jp100
, bench "twitter100 baseline" $ nf encodeDirectA twitter100
, bench "jp100 baseline" $ nf encodeDirectA jp100
]
, bgroup "viaValue" [
bench "twitter100" $ nf encodeViaValueA twitter100
, bench "jp100" $ nf encodeViaValueA jp100
, bench "twitter100 baseline" $ nf encodeViaValueB twitter100
, bench "jp100 baseline" $ nf encodeViaValueB jp100
]
] | 725 | false | true | 0 | 12 | 226 | 191 | 92 | 99 | null | null |
aelve/Jane | GUI/Fake.hs | mit | getLine' :: Text → Fake (Maybe Text)
getLine' p = do
setPrompt p
queue ← use inputQueue
liftIO' $ atomically $ tryReadTChan queue | 135 | getLine' :: Text → Fake (Maybe Text)
getLine' p = do
setPrompt p
queue ← use inputQueue
liftIO' $ atomically $ tryReadTChan queue | 135 | getLine' p = do
setPrompt p
queue ← use inputQueue
liftIO' $ atomically $ tryReadTChan queue | 98 | false | true | 0 | 8 | 28 | 57 | 25 | 32 | null | null |
nfjinjing/monoid-owns | test/example.hs | bsd-3-clause | hiding ((+))
import Data.Monoid.Owns
main = do
putStrLn ( "Hello" + " " + "world" )
print (1 + 2 :: Int)
print (3.0 + 4.0 :: Double) | 139 | hiding ((+))
import Data.Monoid.Owns
main = do
putStrLn ( "Hello" + " " + "world" )
print (1 + 2 :: Int)
print (3.0 + 4.0 :: Double) | 139 | hiding ((+))
import Data.Monoid.Owns
main = do
putStrLn ( "Hello" + " " + "world" )
print (1 + 2 :: Int)
print (3.0 + 4.0 :: Double) | 139 | false | false | 1 | 11 | 34 | 76 | 37 | 39 | null | null |
facebookincubator/duckling | Duckling/Temperature/AR/Rules.hs | bsd-3-clause | ruleTemperatureCelsius :: Rule
ruleTemperatureCelsius = Rule
{ name = "<temp> Celsius"
, pattern =
[ Predicate $ isValueOnly True
, regex "(درج([ةه]|ات) )?سي?لي?[سز]ي?وس"
]
, prod = \case
(Token Temperature td:_) -> Just . Token Temperature $
withUnit TTemperature.Celsius td
_ -> Nothing
} | 324 | ruleTemperatureCelsius :: Rule
ruleTemperatureCelsius = Rule
{ name = "<temp> Celsius"
, pattern =
[ Predicate $ isValueOnly True
, regex "(درج([ةه]|ات) )?سي?لي?[سز]ي?وس"
]
, prod = \case
(Token Temperature td:_) -> Just . Token Temperature $
withUnit TTemperature.Celsius td
_ -> Nothing
} | 324 | ruleTemperatureCelsius = Rule
{ name = "<temp> Celsius"
, pattern =
[ Predicate $ isValueOnly True
, regex "(درج([ةه]|ات) )?سي?لي?[سز]ي?وس"
]
, prod = \case
(Token Temperature td:_) -> Just . Token Temperature $
withUnit TTemperature.Celsius td
_ -> Nothing
} | 293 | false | true | 0 | 13 | 77 | 95 | 49 | 46 | null | null |
MedeaMelana/custard | MudTypes.hs | bsd-3-clause | byId :: Id a -> Accessor (IdSet a) a
byId key = accessor (IM.! key) (IM.insert key) | 83 | byId :: Id a -> Accessor (IdSet a) a
byId key = accessor (IM.! key) (IM.insert key) | 83 | byId key = accessor (IM.! key) (IM.insert key) | 46 | false | true | 0 | 8 | 16 | 54 | 26 | 28 | null | null |
michalkonecny/polypaver | src/PolyPaver/Eval.hs | bsd-3-clause | expandRoundedOpsInForm ::
(HasDefaultValue l, Eq l) =>
Form l -> Form l
expandRoundedOpsInForm form =
case form of
Not arg -> expOp1 Not arg
Or left right -> expOp2 Or left right
And left right -> expOp2 And left right
Implies left right -> expOp2 Implies left right
Le lab left right -> expT2 Le lab left right
Leq lab left right -> expT2 Leq lab left right
Ge lab left right -> expT2 Ge lab right left
Geq lab left right -> expT2 Geq lab right left
Eq lab left right -> expT2 Eq lab left right
Neq lab left right -> expT2 Neq lab left right
ContainedIn lab left right -> expT2 ContainedIn lab left right
IsRange lab t lower upper -> expT3 IsRange lab t lower upper
IsIntRange lab t lower upper -> expT3 IsIntRange lab t lower upper
IsInt lab t -> expT1 IsInt lab t
where
expOp1 op arg = op (expandRoundedOpsInForm arg)
expOp2 op arg1 arg2 = op (expandRoundedOpsInForm arg1) (expandRoundedOpsInForm arg2)
expT1 op lab t = op lab (expandRoundedOpsInTerm t)
expT2 op lab t1 t2 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2)
expT3 op lab t1 t2 t3 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2) (expandRoundedOpsInTerm t3) | 1,307 | expandRoundedOpsInForm ::
(HasDefaultValue l, Eq l) =>
Form l -> Form l
expandRoundedOpsInForm form =
case form of
Not arg -> expOp1 Not arg
Or left right -> expOp2 Or left right
And left right -> expOp2 And left right
Implies left right -> expOp2 Implies left right
Le lab left right -> expT2 Le lab left right
Leq lab left right -> expT2 Leq lab left right
Ge lab left right -> expT2 Ge lab right left
Geq lab left right -> expT2 Geq lab right left
Eq lab left right -> expT2 Eq lab left right
Neq lab left right -> expT2 Neq lab left right
ContainedIn lab left right -> expT2 ContainedIn lab left right
IsRange lab t lower upper -> expT3 IsRange lab t lower upper
IsIntRange lab t lower upper -> expT3 IsIntRange lab t lower upper
IsInt lab t -> expT1 IsInt lab t
where
expOp1 op arg = op (expandRoundedOpsInForm arg)
expOp2 op arg1 arg2 = op (expandRoundedOpsInForm arg1) (expandRoundedOpsInForm arg2)
expT1 op lab t = op lab (expandRoundedOpsInTerm t)
expT2 op lab t1 t2 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2)
expT3 op lab t1 t2 t3 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2) (expandRoundedOpsInTerm t3) | 1,307 | expandRoundedOpsInForm form =
case form of
Not arg -> expOp1 Not arg
Or left right -> expOp2 Or left right
And left right -> expOp2 And left right
Implies left right -> expOp2 Implies left right
Le lab left right -> expT2 Le lab left right
Leq lab left right -> expT2 Leq lab left right
Ge lab left right -> expT2 Ge lab right left
Geq lab left right -> expT2 Geq lab right left
Eq lab left right -> expT2 Eq lab left right
Neq lab left right -> expT2 Neq lab left right
ContainedIn lab left right -> expT2 ContainedIn lab left right
IsRange lab t lower upper -> expT3 IsRange lab t lower upper
IsIntRange lab t lower upper -> expT3 IsIntRange lab t lower upper
IsInt lab t -> expT1 IsInt lab t
where
expOp1 op arg = op (expandRoundedOpsInForm arg)
expOp2 op arg1 arg2 = op (expandRoundedOpsInForm arg1) (expandRoundedOpsInForm arg2)
expT1 op lab t = op lab (expandRoundedOpsInTerm t)
expT2 op lab t1 t2 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2)
expT3 op lab t1 t2 t3 = op lab (expandRoundedOpsInTerm t1) (expandRoundedOpsInTerm t2) (expandRoundedOpsInTerm t3) | 1,226 | false | true | 0 | 9 | 355 | 484 | 225 | 259 | null | null |
manyoo/ghcjs | test/pkg/base/enum03.hs | mit | testEnumWord8 :: IO ()
testEnumWord8 = do
-- succ
printTest ((succ (0::Word8)))
printTest ((succ (minBound::Word8)))
mayBomb (printTest ((succ (maxBound::Word8))))
-- pred
printTest (pred (1::Word8))
printTest (pred (maxBound::Word8))
mayBomb (printTest (pred (minBound::Word8)))
-- toEnum
printTest ((map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]))
mayBomb (printTest ((toEnum (maxBound::Int))::Word8))
-- fromEnum
printTest ((map fromEnum [(1::Word8),minBound,maxBound]))
-- [x..] aka enumFrom
printTest ((take 7 [(1::Word8)..]))
printTest ((take 7 [((maxBound::Word8)-5)..])) -- just in case it doesn't catch the upper bound..
-- [x,y..] aka enumFromThen
printTest ((take 7 [(1::Word8),2..]))
printTest ((take 7 [(1::Word8),7..]))
printTest ((take 7 [(1::Word8),1..]))
printTest ((take 7 [(1::Word8),0..]))
printTest ((take 7 [(5::Word8),2..]))
let x = (minBound::Word8) + 1
printTest ((take 7 [x, x-1 ..]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x, x-1 ..]))
let x = (maxBound::Word8) - 5
printTest ((take 7 [x, (x+1) ..]))
-- [x..y] aka enumFromTo
printTest ((take 7 ([(1::Word8) .. 5])))
printTest ((take 4 ([(1::Word8) .. 1])))
printTest ((take 7 ([(1::Word8) .. 0])))
printTest ((take 7 ([(5::Word8) .. 0])))
printTest ((take 7 ([(maxBound-(5::Word8)) .. maxBound])))
printTest ((take 7 ([(minBound+(5::Word8)) .. minBound])))
-- [x,y..z] aka enumFromThenTo
printTest ((take 7 [(5::Word8),4..1]))
printTest ((take 7 [(5::Word8),3..1]))
printTest ((take 7 [(5::Word8),3..2]))
printTest ((take 7 [(1::Word8),2..1]))
printTest ((take 7 [(2::Word8),1..2]))
printTest ((take 7 [(2::Word8),1..1]))
printTest ((take 7 [(2::Word8),3..1]))
let x = (maxBound::Word8) - 4
printTest ((take 7 [x,(x+1)..maxBound]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x,(x-1)..minBound])) | 1,981 | testEnumWord8 :: IO ()
testEnumWord8 = do
-- succ
printTest ((succ (0::Word8)))
printTest ((succ (minBound::Word8)))
mayBomb (printTest ((succ (maxBound::Word8))))
-- pred
printTest (pred (1::Word8))
printTest (pred (maxBound::Word8))
mayBomb (printTest (pred (minBound::Word8)))
-- toEnum
printTest ((map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]))
mayBomb (printTest ((toEnum (maxBound::Int))::Word8))
-- fromEnum
printTest ((map fromEnum [(1::Word8),minBound,maxBound]))
-- [x..] aka enumFrom
printTest ((take 7 [(1::Word8)..]))
printTest ((take 7 [((maxBound::Word8)-5)..])) -- just in case it doesn't catch the upper bound..
-- [x,y..] aka enumFromThen
printTest ((take 7 [(1::Word8),2..]))
printTest ((take 7 [(1::Word8),7..]))
printTest ((take 7 [(1::Word8),1..]))
printTest ((take 7 [(1::Word8),0..]))
printTest ((take 7 [(5::Word8),2..]))
let x = (minBound::Word8) + 1
printTest ((take 7 [x, x-1 ..]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x, x-1 ..]))
let x = (maxBound::Word8) - 5
printTest ((take 7 [x, (x+1) ..]))
-- [x..y] aka enumFromTo
printTest ((take 7 ([(1::Word8) .. 5])))
printTest ((take 4 ([(1::Word8) .. 1])))
printTest ((take 7 ([(1::Word8) .. 0])))
printTest ((take 7 ([(5::Word8) .. 0])))
printTest ((take 7 ([(maxBound-(5::Word8)) .. maxBound])))
printTest ((take 7 ([(minBound+(5::Word8)) .. minBound])))
-- [x,y..z] aka enumFromThenTo
printTest ((take 7 [(5::Word8),4..1]))
printTest ((take 7 [(5::Word8),3..1]))
printTest ((take 7 [(5::Word8),3..2]))
printTest ((take 7 [(1::Word8),2..1]))
printTest ((take 7 [(2::Word8),1..2]))
printTest ((take 7 [(2::Word8),1..1]))
printTest ((take 7 [(2::Word8),3..1]))
let x = (maxBound::Word8) - 4
printTest ((take 7 [x,(x+1)..maxBound]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x,(x-1)..minBound])) | 1,981 | testEnumWord8 = do
-- succ
printTest ((succ (0::Word8)))
printTest ((succ (minBound::Word8)))
mayBomb (printTest ((succ (maxBound::Word8))))
-- pred
printTest (pred (1::Word8))
printTest (pred (maxBound::Word8))
mayBomb (printTest (pred (minBound::Word8)))
-- toEnum
printTest ((map (toEnum::Int->Word8) [1, fromIntegral (minBound::Word8)::Int, fromIntegral (maxBound::Word8)::Int]))
mayBomb (printTest ((toEnum (maxBound::Int))::Word8))
-- fromEnum
printTest ((map fromEnum [(1::Word8),minBound,maxBound]))
-- [x..] aka enumFrom
printTest ((take 7 [(1::Word8)..]))
printTest ((take 7 [((maxBound::Word8)-5)..])) -- just in case it doesn't catch the upper bound..
-- [x,y..] aka enumFromThen
printTest ((take 7 [(1::Word8),2..]))
printTest ((take 7 [(1::Word8),7..]))
printTest ((take 7 [(1::Word8),1..]))
printTest ((take 7 [(1::Word8),0..]))
printTest ((take 7 [(5::Word8),2..]))
let x = (minBound::Word8) + 1
printTest ((take 7 [x, x-1 ..]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x, x-1 ..]))
let x = (maxBound::Word8) - 5
printTest ((take 7 [x, (x+1) ..]))
-- [x..y] aka enumFromTo
printTest ((take 7 ([(1::Word8) .. 5])))
printTest ((take 4 ([(1::Word8) .. 1])))
printTest ((take 7 ([(1::Word8) .. 0])))
printTest ((take 7 ([(5::Word8) .. 0])))
printTest ((take 7 ([(maxBound-(5::Word8)) .. maxBound])))
printTest ((take 7 ([(minBound+(5::Word8)) .. minBound])))
-- [x,y..z] aka enumFromThenTo
printTest ((take 7 [(5::Word8),4..1]))
printTest ((take 7 [(5::Word8),3..1]))
printTest ((take 7 [(5::Word8),3..2]))
printTest ((take 7 [(1::Word8),2..1]))
printTest ((take 7 [(2::Word8),1..2]))
printTest ((take 7 [(2::Word8),1..1]))
printTest ((take 7 [(2::Word8),3..1]))
let x = (maxBound::Word8) - 4
printTest ((take 7 [x,(x+1)..maxBound]))
let x = (minBound::Word8) + 5
printTest ((take 7 [x,(x-1)..minBound])) | 1,958 | false | true | 0 | 15 | 357 | 1,149 | 629 | 520 | null | null |
andrewthad/vinyl-vectors | src/Data/List/TypeLevel/Witness/BoundedList.hs | bsd-3-clause | head :: BoundedList u (a ': as) -> Proxy a
head BoundedListCons = Proxy | 71 | head :: BoundedList u (a ': as) -> Proxy a
head BoundedListCons = Proxy | 71 | head BoundedListCons = Proxy | 28 | false | true | 0 | 9 | 13 | 40 | 18 | 22 | null | null |
antalsz/urn-random | src/Data/Urn/Common.hs | mit | size :: Urn a -> Word
size = (coerce :: (Urn a -> Size) -> (Urn a -> Word)) Internal.size | 89 | size :: Urn a -> Word
size = (coerce :: (Urn a -> Size) -> (Urn a -> Word)) Internal.size | 89 | size = (coerce :: (Urn a -> Size) -> (Urn a -> Word)) Internal.size | 67 | false | true | 0 | 10 | 19 | 53 | 27 | 26 | null | null |
spechub/Hets | Isabelle/IsaConsts.hs | gpl-2.0 | -- | 10
lowPrio :: Int
lowPrio = 10 | 35 | lowPrio :: Int
lowPrio = 10 | 27 | lowPrio = 10 | 12 | true | true | 0 | 4 | 8 | 12 | 7 | 5 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.