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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fuco1/mpris | src/main.hs | gpl-3.0 | myVolumeHook :: Callback Double
myVolumeHook = do
bus <- bus
whenJustM value $ \volume ->
liftIO . print $ "Volume changed " ++ show bus ++ " to " ++ show volume | 169 | myVolumeHook :: Callback Double
myVolumeHook = do
bus <- bus
whenJustM value $ \volume ->
liftIO . print $ "Volume changed " ++ show bus ++ " to " ++ show volume | 169 | myVolumeHook = do
bus <- bus
whenJustM value $ \volume ->
liftIO . print $ "Volume changed " ++ show bus ++ " to " ++ show volume | 137 | false | true | 0 | 13 | 39 | 62 | 29 | 33 | null | null |
poxu/pandoc | src/Text/Pandoc/Readers/DocBook.hs | gpl-2.0 | --
acceptingMetadata :: DB a -> DB a
acceptingMetadata p = do
modify (\s -> s { dbAcceptsMeta = True } )
res <- p
modify (\s -> s { dbAcceptsMeta = False })
return res | 176 | acceptingMetadata :: DB a -> DB a
acceptingMetadata p = do
modify (\s -> s { dbAcceptsMeta = True } )
res <- p
modify (\s -> s { dbAcceptsMeta = False })
return res | 172 | acceptingMetadata p = do
modify (\s -> s { dbAcceptsMeta = True } )
res <- p
modify (\s -> s { dbAcceptsMeta = False })
return res | 138 | true | true | 0 | 12 | 44 | 87 | 42 | 45 | null | null |
luqui/collada | Graphics/Formats/Collada/Render.hs | bsd-3-clause | compileNodeInstance (O.NIGeometry geom materials) = do
materials' <- Map.unions <$> mapM compileMaterialBinding materials
addBindings materials' $ compileGeometry geom | 175 | compileNodeInstance (O.NIGeometry geom materials) = do
materials' <- Map.unions <$> mapM compileMaterialBinding materials
addBindings materials' $ compileGeometry geom | 175 | compileNodeInstance (O.NIGeometry geom materials) = do
materials' <- Map.unions <$> mapM compileMaterialBinding materials
addBindings materials' $ compileGeometry geom | 175 | false | false | 0 | 9 | 25 | 50 | 22 | 28 | null | null |
markflorisson/hpack | testrepo/bytestring-0.9.1.9/Data/ByteString/Lazy.hs | bsd-3-clause | cons' w cs = Chunk (S.singleton w) cs | 65 | cons' w cs = Chunk (S.singleton w) cs | 65 | cons' w cs = Chunk (S.singleton w) cs | 65 | false | false | 0 | 8 | 35 | 24 | 11 | 13 | null | null |
DanielSchuessler/hstri | Triangulation/Transformations.hs | gpl-3.0 | deleteTet'
:: TIndex
-> Triangulation
-> EitherC (Located TriangulationConstructionError) Triangulation
deleteTet' (k :: TIndex) tr =
$(assrt [| k < tNumberOfTetrahedra tr |] [[|k|],[|tNumberOfTetrahedra tr :: Int|]]) $
let n = tNumberOfTetrahedra_ tr
in let gluings' =
map (mapTIndices (codegeneracy k))
. filter (\gl -> not $ k `elem2` map2 ($ gl) (glDomTet,glCodTet))
. tGluingsIrredundant $ tr
in
mkTriangulationSafe (n-1) gluings' | 535 | deleteTet'
:: TIndex
-> Triangulation
-> EitherC (Located TriangulationConstructionError) Triangulation
deleteTet' (k :: TIndex) tr =
$(assrt [| k < tNumberOfTetrahedra tr |] [[|k|],[|tNumberOfTetrahedra tr :: Int|]]) $
let n = tNumberOfTetrahedra_ tr
in let gluings' =
map (mapTIndices (codegeneracy k))
. filter (\gl -> not $ k `elem2` map2 ($ gl) (glDomTet,glCodTet))
. tGluingsIrredundant $ tr
in
mkTriangulationSafe (n-1) gluings' | 535 | deleteTet' (k :: TIndex) tr =
$(assrt [| k < tNumberOfTetrahedra tr |] [[|k|],[|tNumberOfTetrahedra tr :: Int|]]) $
let n = tNumberOfTetrahedra_ tr
in let gluings' =
map (mapTIndices (codegeneracy k))
. filter (\gl -> not $ k `elem2` map2 ($ gl) (glDomTet,glCodTet))
. tGluingsIrredundant $ tr
in
mkTriangulationSafe (n-1) gluings' | 419 | false | true | 0 | 20 | 160 | 173 | 92 | 81 | null | null |
DavidAlphaFox/darcs | src/Darcs/Repository/External.hs | gpl-2.0 | maybeURLCmd :: String -> String -> IO (Maybe String)
maybeURLCmd what url =
do let prot = map toUpper $ takeWhile (/= ':') url
fmap Just (getEnv ("DARCS_" ++ what ++ "_" ++ prot))
`catch` \(_ :: IOException) -> return Nothing | 245 | maybeURLCmd :: String -> String -> IO (Maybe String)
maybeURLCmd what url =
do let prot = map toUpper $ takeWhile (/= ':') url
fmap Just (getEnv ("DARCS_" ++ what ++ "_" ++ prot))
`catch` \(_ :: IOException) -> return Nothing | 245 | maybeURLCmd what url =
do let prot = map toUpper $ takeWhile (/= ':') url
fmap Just (getEnv ("DARCS_" ++ what ++ "_" ++ prot))
`catch` \(_ :: IOException) -> return Nothing | 192 | false | true | 0 | 15 | 60 | 113 | 55 | 58 | null | null |
5outh/LambdaPi | src/STLC.hs | mit | neutralQuote i (NApp n v) = neutralQuote i n :@: quote i v | 58 | neutralQuote i (NApp n v) = neutralQuote i n :@: quote i v | 58 | neutralQuote i (NApp n v) = neutralQuote i n :@: quote i v | 58 | false | false | 0 | 7 | 12 | 33 | 15 | 18 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/UniqSet.hs | bsd-3-clause | unionUniqSets = plusUFM | 23 | unionUniqSets = plusUFM | 23 | unionUniqSets = plusUFM | 23 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
olsner/m3 | CodeGen.hs | bsd-3-clause | -- Now for the cases with actually different types :)
cgCast to@(TPtr _) (TPtr _) lv = do
withFresh to (=% bitcast lv to) | 123 | cgCast to@(TPtr _) (TPtr _) lv = do
withFresh to (=% bitcast lv to) | 69 | cgCast to@(TPtr _) (TPtr _) lv = do
withFresh to (=% bitcast lv to) | 69 | true | false | 1 | 10 | 25 | 50 | 23 | 27 | null | null |
abakst/liquidhaskell | src/Language/Haskell/Liquid/UX/CmdLine.hs | bsd-3-clause | defaultPort :: Int
defaultPort = 3000 | 37 | defaultPort :: Int
defaultPort = 3000 | 37 | defaultPort = 3000 | 18 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
phaazon/bifunctors | src/Data/Bifoldable.hs | bsd-2-clause | bifoldrM :: (Bifoldable t, Monad m) => (a -> c -> m c) -> (b -> c -> m c) -> c -> t a b -> m c
bifoldrM f g z0 xs = bifoldl f' g' return xs z0 where
f' k x z = f x z >>= k
g' k x z = g x z >>= k
| 199 | bifoldrM :: (Bifoldable t, Monad m) => (a -> c -> m c) -> (b -> c -> m c) -> c -> t a b -> m c
bifoldrM f g z0 xs = bifoldl f' g' return xs z0 where
f' k x z = f x z >>= k
g' k x z = g x z >>= k
| 199 | bifoldrM f g z0 xs = bifoldl f' g' return xs z0 where
f' k x z = f x z >>= k
g' k x z = g x z >>= k
| 104 | false | true | 0 | 11 | 66 | 142 | 69 | 73 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/types/Kind.hs | bsd-3-clause | isSubKind k1 k2 = eqKind k1 k2 | 30 | isSubKind k1 k2 = eqKind k1 k2 | 30 | isSubKind k1 k2 = eqKind k1 k2 | 30 | false | false | 0 | 5 | 6 | 16 | 7 | 9 | null | null |
sgraf812/GLFW-b | Graphics/UI/GLFW.hs | bsd-2-clause | setCursorEnterCallback :: Window -> Maybe CursorEnterCallback -> IO ()
setCursorEnterCallback win = setWindowCallback
mk'GLFWcursorenterfun
(\cb a0 a1 -> schedule $ cb (fromC a0) (fromC a1))
(c'glfwSetCursorEnterCallback (toC win))
storedCursorEnterFun
win | 276 | setCursorEnterCallback :: Window -> Maybe CursorEnterCallback -> IO ()
setCursorEnterCallback win = setWindowCallback
mk'GLFWcursorenterfun
(\cb a0 a1 -> schedule $ cb (fromC a0) (fromC a1))
(c'glfwSetCursorEnterCallback (toC win))
storedCursorEnterFun
win | 276 | setCursorEnterCallback win = setWindowCallback
mk'GLFWcursorenterfun
(\cb a0 a1 -> schedule $ cb (fromC a0) (fromC a1))
(c'glfwSetCursorEnterCallback (toC win))
storedCursorEnterFun
win | 205 | false | true | 0 | 10 | 49 | 90 | 42 | 48 | null | null |
zaxtax/mcts_progsynth | Term.hs | mit | -- Does cons care about its arguments?
cons x (L xs) = L (x:xs) | 67 | cons x (L xs) = L (x:xs) | 28 | cons x (L xs) = L (x:xs) | 28 | true | false | 0 | 7 | 17 | 28 | 14 | 14 | null | null |
burz/Rayzer | Base/Intersection.hs | mit | intersection :: Double -> Vector3 -> Unit3 -> Intersection
intersection d p n = Intersection { _distance = d
, _position = p
, _normal = n
, _matrl = defaultMaterial
} | 308 | intersection :: Double -> Vector3 -> Unit3 -> Intersection
intersection d p n = Intersection { _distance = d
, _position = p
, _normal = n
, _matrl = defaultMaterial
} | 308 | intersection d p n = Intersection { _distance = d
, _position = p
, _normal = n
, _matrl = defaultMaterial
} | 249 | false | true | 0 | 7 | 172 | 56 | 32 | 24 | null | null |
adamse/haddock | haddock-api/src/Haddock/Backends/LaTeX.hs | bsd-2-clause | ppr_tylit (HsStrTy _ s) _ = text (show s) | 41 | ppr_tylit (HsStrTy _ s) _ = text (show s) | 41 | ppr_tylit (HsStrTy _ s) _ = text (show s) | 41 | false | false | 1 | 7 | 8 | 28 | 13 | 15 | null | null |
forked-upstream-packages-for-ghcjs/ghcjs | ghcjs/src/Gen2/Prim.hs | mit | genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 97 | genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 97 | genPrim d t CopyMutableByteArrayOp [] xs@[_a1,_o1,_a2,_o2,_n] = genPrim d t CopyByteArrayOp [] xs | 97 | false | false | 0 | 7 | 12 | 50 | 27 | 23 | null | null |
brendanhay/gogol | gogol-compute/gen/Network/Google/Resource/Compute/Instances/TestIAMPermissions.hs | mpl-2.0 | -- | Name or id of the resource for this request.
itipResource :: Lens' InstancesTestIAMPermissions Text
itipResource
= lens _itipResource (\ s a -> s{_itipResource = a}) | 172 | itipResource :: Lens' InstancesTestIAMPermissions Text
itipResource
= lens _itipResource (\ s a -> s{_itipResource = a}) | 122 | itipResource
= lens _itipResource (\ s a -> s{_itipResource = a}) | 67 | true | true | 0 | 9 | 28 | 42 | 22 | 20 | null | null |
v0lkan/learning-haskell | higher-order.hs | mit | applyTwice :: (a -> a) -> a -> a
applyTwice f x = f (f x) | 57 | applyTwice :: (a -> a) -> a -> a
applyTwice f x = f (f x) | 57 | applyTwice f x = f (f x) | 24 | false | true | 0 | 8 | 15 | 46 | 21 | 25 | null | null |
TomMD/ghc | compiler/codeGen/StgCmmPrim.hs | bsd-3-clause | emitPrimOp dflags [res] SparkOp [arg]
= do
-- returns the value of arg in res. We're going to therefore
-- refer to arg twice (once to pass to newSpark(), and once to
-- assign to res), so put it in a temporary.
tmp <- assignTemp arg
tmp2 <- newTemp (bWord dflags)
emitCCall
[(tmp2,NoHint)]
(CmmLit (CmmLabel (mkForeignLabel (fsLit "newSpark") Nothing ForeignLabelInExternalPackage IsFunction)))
[(CmmReg (CmmGlobal BaseReg), AddrHint), ((CmmReg (CmmLocal tmp)), AddrHint)]
emitAssign (CmmLocal res) (CmmReg (CmmLocal tmp)) | 618 | emitPrimOp dflags [res] SparkOp [arg]
= do
-- returns the value of arg in res. We're going to therefore
-- refer to arg twice (once to pass to newSpark(), and once to
-- assign to res), so put it in a temporary.
tmp <- assignTemp arg
tmp2 <- newTemp (bWord dflags)
emitCCall
[(tmp2,NoHint)]
(CmmLit (CmmLabel (mkForeignLabel (fsLit "newSpark") Nothing ForeignLabelInExternalPackage IsFunction)))
[(CmmReg (CmmGlobal BaseReg), AddrHint), ((CmmReg (CmmLocal tmp)), AddrHint)]
emitAssign (CmmLocal res) (CmmReg (CmmLocal tmp)) | 618 | emitPrimOp dflags [res] SparkOp [arg]
= do
-- returns the value of arg in res. We're going to therefore
-- refer to arg twice (once to pass to newSpark(), and once to
-- assign to res), so put it in a temporary.
tmp <- assignTemp arg
tmp2 <- newTemp (bWord dflags)
emitCCall
[(tmp2,NoHint)]
(CmmLit (CmmLabel (mkForeignLabel (fsLit "newSpark") Nothing ForeignLabelInExternalPackage IsFunction)))
[(CmmReg (CmmGlobal BaseReg), AddrHint), ((CmmReg (CmmLocal tmp)), AddrHint)]
emitAssign (CmmLocal res) (CmmReg (CmmLocal tmp)) | 618 | false | false | 0 | 15 | 169 | 168 | 84 | 84 | null | null |
jamesdarcy/DicomH | src/Data/Dicom/Tag.hs | bsd-3-clause | -- | Group 0x7fe0
pIXEL_DATA :: DicomTag
pIXEL_DATA = 0x7fe00010 | 64 | pIXEL_DATA :: DicomTag
pIXEL_DATA = 0x7fe00010 | 46 | pIXEL_DATA = 0x7fe00010 | 23 | true | true | 0 | 4 | 9 | 12 | 7 | 5 | null | null |
glutamate/inliterate | InOut.hs | bsd-3-clause | setModuleName s (Module v1 v2 v3 v4 v5 v6 decls) = Module v1 (ModuleName s) v3 v4 v5 v6 decls | 94 | setModuleName s (Module v1 v2 v3 v4 v5 v6 decls) = Module v1 (ModuleName s) v3 v4 v5 v6 decls | 94 | setModuleName s (Module v1 v2 v3 v4 v5 v6 decls) = Module v1 (ModuleName s) v3 v4 v5 v6 decls | 94 | false | false | 0 | 7 | 20 | 50 | 24 | 26 | null | null |
mjec/cryptopals-haskell | src/Set1.hs | bsd-3-clause | -- Challenge 5
challenge5 :: [B.ByteString] -> Either Error B.ByteString
challenge5 input
| null input = Left ("You need to supply a key", [stringToBytes "1-5"], True)
| otherwise = Right $ plusNL $ B.concat [bytesToHex $ bitwiseCombine xor ln (B.cycle key) | ln <- text]
where key = head input
text = tail input
-- Challenge 6 | 351 | challenge5 :: [B.ByteString] -> Either Error B.ByteString
challenge5 input
| null input = Left ("You need to supply a key", [stringToBytes "1-5"], True)
| otherwise = Right $ plusNL $ B.concat [bytesToHex $ bitwiseCombine xor ln (B.cycle key) | ln <- text]
where key = head input
text = tail input
-- Challenge 6 | 336 | challenge5 input
| null input = Left ("You need to supply a key", [stringToBytes "1-5"], True)
| otherwise = Right $ plusNL $ B.concat [bytesToHex $ bitwiseCombine xor ln (B.cycle key) | ln <- text]
where key = head input
text = tail input
-- Challenge 6 | 278 | true | true | 2 | 12 | 80 | 128 | 64 | 64 | null | null |
lhoghu/intranet | app/Settings.hs | mit | widgetFile :: String -> Q Exp
widgetFile = widgetFileNoReload def | 65 | widgetFile :: String -> Q Exp
widgetFile = widgetFileNoReload def | 65 | widgetFile = widgetFileNoReload def | 35 | false | true | 0 | 6 | 9 | 21 | 10 | 11 | null | null |
sebnow/archlinux-pacman | Distribution/Archlinux/PackageInfo/Parse.hs | mit | field :: Parser B.ByteString
field = A.takeTill isHorizontalSpace <?> "field" | 77 | field :: Parser B.ByteString
field = A.takeTill isHorizontalSpace <?> "field" | 77 | field = A.takeTill isHorizontalSpace <?> "field" | 48 | false | true | 0 | 7 | 9 | 30 | 13 | 17 | null | null |
noteed/buh | bin/buh.hs | bsd-3-clause | newPack :: FilePath -> IO Packer
newPack fn = do
h <- openFile fn ReadWriteMode
hSetFileSize h 0 -- TODO Instead use a temporary (and thus new) file,
-- moving it to the correct path when it is complete.
-- The number of objects will be set in `completePack`.
BC.hPut h "PACK\0\0\0\2\0\0\0\0"
counter <- newIORef 0
return Packer
{ packerPack = \o -> do
modifyIORef counter succ
let (sha, bs) = runPutM $ putObject o
L.hPut h bs
return sha
, packerComplete = do
hSeek h AbsoluteSeek 8
n <- readIORef counter
L.hPut h . runPut . putWord32be $ n
hSeek h AbsoluteSeek 0
content <- hReadAll h
let sha = bytestringDigest $ sha1 content
L.hPut h sha
hClose h
indexPack fn
} | 813 | newPack :: FilePath -> IO Packer
newPack fn = do
h <- openFile fn ReadWriteMode
hSetFileSize h 0 -- TODO Instead use a temporary (and thus new) file,
-- moving it to the correct path when it is complete.
-- The number of objects will be set in `completePack`.
BC.hPut h "PACK\0\0\0\2\0\0\0\0"
counter <- newIORef 0
return Packer
{ packerPack = \o -> do
modifyIORef counter succ
let (sha, bs) = runPutM $ putObject o
L.hPut h bs
return sha
, packerComplete = do
hSeek h AbsoluteSeek 8
n <- readIORef counter
L.hPut h . runPut . putWord32be $ n
hSeek h AbsoluteSeek 0
content <- hReadAll h
let sha = bytestringDigest $ sha1 content
L.hPut h sha
hClose h
indexPack fn
} | 813 | newPack fn = do
h <- openFile fn ReadWriteMode
hSetFileSize h 0 -- TODO Instead use a temporary (and thus new) file,
-- moving it to the correct path when it is complete.
-- The number of objects will be set in `completePack`.
BC.hPut h "PACK\0\0\0\2\0\0\0\0"
counter <- newIORef 0
return Packer
{ packerPack = \o -> do
modifyIORef counter succ
let (sha, bs) = runPutM $ putObject o
L.hPut h bs
return sha
, packerComplete = do
hSeek h AbsoluteSeek 8
n <- readIORef counter
L.hPut h . runPut . putWord32be $ n
hSeek h AbsoluteSeek 0
content <- hReadAll h
let sha = bytestringDigest $ sha1 content
L.hPut h sha
hClose h
indexPack fn
} | 780 | false | true | 0 | 17 | 269 | 234 | 103 | 131 | null | null |
rumblesan/improviz | src/Language/Parser.hs | bsd-3-clause | value :: Parser Value
value = v_number <|> v_symbol <|> v_null
where
v_symbol = char ':' >> Symbol <$> identifier <?> "symbol"
v_null = Null <$ rword "null" <?> "null"
v_number = Number <$> number | 205 | value :: Parser Value
value = v_number <|> v_symbol <|> v_null
where
v_symbol = char ':' >> Symbol <$> identifier <?> "symbol"
v_null = Null <$ rword "null" <?> "null"
v_number = Number <$> number | 205 | value = v_number <|> v_symbol <|> v_null
where
v_symbol = char ':' >> Symbol <$> identifier <?> "symbol"
v_null = Null <$ rword "null" <?> "null"
v_number = Number <$> number | 183 | false | true | 0 | 8 | 43 | 70 | 35 | 35 | null | null |
eryx67/haskell-libtorrent | src/Network/Libtorrent/FileStorage.hs | bsd-3-clause | fileStorageMtime :: MonadIO m => FileStorage -> CInt -> m C.CTime
fileStorageMtime ho idx =
liftIO . withPtr ho $ \hoPtr ->
[C.exp| time_t { $(file_storage * hoPtr)->mtime($(int idx)) } |] | 193 | fileStorageMtime :: MonadIO m => FileStorage -> CInt -> m C.CTime
fileStorageMtime ho idx =
liftIO . withPtr ho $ \hoPtr ->
[C.exp| time_t { $(file_storage * hoPtr)->mtime($(int idx)) } |] | 193 | fileStorageMtime ho idx =
liftIO . withPtr ho $ \hoPtr ->
[C.exp| time_t { $(file_storage * hoPtr)->mtime($(int idx)) } |] | 126 | false | true | 0 | 9 | 35 | 58 | 30 | 28 | null | null |
brendanhay/gogol | gogol-cloudsearch/gen/Network/Google/CloudSearch/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'EnumValuePair' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'evpIntegerValue'
--
-- * 'evpStringValue'
enumValuePair
:: EnumValuePair
enumValuePair =
EnumValuePair' {_evpIntegerValue = Nothing, _evpStringValue = Nothing} | 339 | enumValuePair
:: EnumValuePair
enumValuePair =
EnumValuePair' {_evpIntegerValue = Nothing, _evpStringValue = Nothing} | 123 | enumValuePair =
EnumValuePair' {_evpIntegerValue = Nothing, _evpStringValue = Nothing} | 88 | true | true | 0 | 7 | 55 | 42 | 24 | 18 | null | null |
jgm/Markdown | Markdown.hs | bsd-3-clause | -- Scan a space.
scanSpace :: Scanner
scanSpace = skip (==' ') | 62 | scanSpace :: Scanner
scanSpace = skip (==' ') | 45 | scanSpace = skip (==' ') | 24 | true | true | 0 | 6 | 11 | 19 | 11 | 8 | null | null |
keithodulaigh/Hets | Comorphisms/ExtModal2ExtModalTotal.hs | gpl-2.0 | noCondsEM :: EM_FORMULA -> EM_FORMULA
noCondsEM = mapExtForm noCondsEMFormula | 77 | noCondsEM :: EM_FORMULA -> EM_FORMULA
noCondsEM = mapExtForm noCondsEMFormula | 77 | noCondsEM = mapExtForm noCondsEMFormula | 39 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
chrisbanks/cpiwb | CPi/Logic.hs | gpl-3.0 | reconcileSpecs env (Conj f1 f2)
= Conj (reconcileSpecs env f1) (reconcileSpecs env f2) | 90 | reconcileSpecs env (Conj f1 f2)
= Conj (reconcileSpecs env f1) (reconcileSpecs env f2) | 90 | reconcileSpecs env (Conj f1 f2)
= Conj (reconcileSpecs env f1) (reconcileSpecs env f2) | 90 | false | false | 0 | 7 | 16 | 40 | 19 | 21 | null | null |
diagrams/diagrams-input | src/Diagrams/SVG/Tree.hs | bsd-3-clause | insertRefs :: (V b ~ V2, N b ~ n, RealFloat n, Place ~ n) => (HashMaps b n, ViewBox n) -> Tag b n -> Diagram b
insertRefs (maps,viewbox) (Leaf id1 path f) = (f (maps,viewbox)) # (if isJust id1 then named (T.unpack $ fromJust id1) else id) | 239 | insertRefs :: (V b ~ V2, N b ~ n, RealFloat n, Place ~ n) => (HashMaps b n, ViewBox n) -> Tag b n -> Diagram b
insertRefs (maps,viewbox) (Leaf id1 path f) = (f (maps,viewbox)) # (if isJust id1 then named (T.unpack $ fromJust id1) else id) | 238 | insertRefs (maps,viewbox) (Leaf id1 path f) = (f (maps,viewbox)) # (if isJust id1 then named (T.unpack $ fromJust id1) else id) | 127 | false | true | 0 | 12 | 49 | 151 | 75 | 76 | null | null |
rahulmutt/ghcvm | libraries/base/GHC/Enum.hs | bsd-3-clause | -- See Note [Inline FB functions] in GHC.List
-- Don't inline this until RULE "enumDeltaToInteger" has had a chance to fire
enumDeltaToInteger1FB :: (Integer -> a -> a) -> a
-> Integer -> Integer -> a
enumDeltaToInteger1FB c n x0 lim = go (x0 :: Integer)
where
go x | x > lim = n
| otherwise = x `c` go (x+1)
| 409 | enumDeltaToInteger1FB :: (Integer -> a -> a) -> a
-> Integer -> Integer -> a
enumDeltaToInteger1FB c n x0 lim = go (x0 :: Integer)
where
go x | x > lim = n
| otherwise = x `c` go (x+1)
| 285 | enumDeltaToInteger1FB c n x0 lim = go (x0 :: Integer)
where
go x | x > lim = n
| otherwise = x `c` go (x+1)
| 186 | true | true | 0 | 11 | 162 | 103 | 53 | 50 | null | null |
dolio/primitive | Data/Primitive/Array.hs | bsd-3-clause | freezeArray (MutableArray ma#) (I# off#) (I# len#) =
primitive $ \s -> case freezeArray# ma# off# len# s of
(# s', a# #) -> (# s', Array a# #)
#else
freezeArray src off len = do
dst <- newArray len (die "freezeArray" "impossible")
copyMutableArray dst 0 src off len
unsafeFreezeArray dst
#endif
-- | Convert a mutable array to an immutable one without copying. The
-- array should not be modified after the conversion. | 431 | freezeArray (MutableArray ma#) (I# off#) (I# len#) =
primitive $ \s -> case freezeArray# ma# off# len# s of
(# s', a# #) -> (# s', Array a# #)
#else
freezeArray src off len = do
dst <- newArray len (die "freezeArray" "impossible")
copyMutableArray dst 0 src off len
unsafeFreezeArray dst
#endif
-- | Convert a mutable array to an immutable one without copying. The
-- array should not be modified after the conversion. | 431 | freezeArray (MutableArray ma#) (I# off#) (I# len#) =
primitive $ \s -> case freezeArray# ma# off# len# s of
(# s', a# #) -> (# s', Array a# #)
#else
freezeArray src off len = do
dst <- newArray len (die "freezeArray" "impossible")
copyMutableArray dst 0 src off len
unsafeFreezeArray dst
#endif
-- | Convert a mutable array to an immutable one without copying. The
-- array should not be modified after the conversion. | 431 | false | false | 0 | 11 | 86 | 76 | 40 | 36 | null | null |
mydaum/cabal | cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs | bsd-3-clause | testGlobRemoveMatch :: Int -> Assertion
testGlobRemoveMatch mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "good-a")
touchFile root ("dir" </> "good-b")
updateMonitor root monitor [monitorFileGlobStr "dir/good-*"] () ()
threadDelay mtimeChange
removeFile root "dir/good-a"
reason <- expectMonitorChanged root monitor ()
reason @?= MonitoredFileChanged ("dir" </> "good-a") | 433 | testGlobRemoveMatch :: Int -> Assertion
testGlobRemoveMatch mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "good-a")
touchFile root ("dir" </> "good-b")
updateMonitor root monitor [monitorFileGlobStr "dir/good-*"] () ()
threadDelay mtimeChange
removeFile root "dir/good-a"
reason <- expectMonitorChanged root monitor ()
reason @?= MonitoredFileChanged ("dir" </> "good-a") | 433 | testGlobRemoveMatch mtimeChange =
withFileMonitor $ \root monitor -> do
touchFile root ("dir" </> "good-a")
touchFile root ("dir" </> "good-b")
updateMonitor root monitor [monitorFileGlobStr "dir/good-*"] () ()
threadDelay mtimeChange
removeFile root "dir/good-a"
reason <- expectMonitorChanged root monitor ()
reason @?= MonitoredFileChanged ("dir" </> "good-a") | 393 | false | true | 0 | 12 | 77 | 130 | 60 | 70 | null | null |
nadavshemer/buildsome | src/Lib/Exception.hs | gpl-2.0 | finally :: IO a -> IO () -> IO a
action `finally` cleanup =
E.mask $ \restore -> do
res <- restore action
`catch` \[email protected] {} -> do
cleanup `logErrors` ("overrides original error (" ++ show e ++ ")")
E.throwIO e
E.uninterruptibleMask_ cleanup `logErrors` "during successful finally cleanup"
return res | 347 | finally :: IO a -> IO () -> IO a
action `finally` cleanup =
E.mask $ \restore -> do
res <- restore action
`catch` \[email protected] {} -> do
cleanup `logErrors` ("overrides original error (" ++ show e ++ ")")
E.throwIO e
E.uninterruptibleMask_ cleanup `logErrors` "during successful finally cleanup"
return res | 347 | action `finally` cleanup =
E.mask $ \restore -> do
res <- restore action
`catch` \[email protected] {} -> do
cleanup `logErrors` ("overrides original error (" ++ show e ++ ")")
E.throwIO e
E.uninterruptibleMask_ cleanup `logErrors` "during successful finally cleanup"
return res | 314 | false | true | 0 | 18 | 85 | 130 | 64 | 66 | null | null |
rsasse/tamarin-prover | lib/theory/src/Theory/Tools/Wellformedness.hs | gpl-3.0 | unboundReportDiff :: OpenDiffTheory -> WfErrorReport
unboundReportDiff thy = do
DiffRuleItem ru <- get diffThyItems thy
unboundCheck ("rule " ++ quote (showRuleCaseName ru) ++
" has unbound variables: "
) ru
-- | Report on facts usage. | 279 | unboundReportDiff :: OpenDiffTheory -> WfErrorReport
unboundReportDiff thy = do
DiffRuleItem ru <- get diffThyItems thy
unboundCheck ("rule " ++ quote (showRuleCaseName ru) ++
" has unbound variables: "
) ru
-- | Report on facts usage. | 279 | unboundReportDiff thy = do
DiffRuleItem ru <- get diffThyItems thy
unboundCheck ("rule " ++ quote (showRuleCaseName ru) ++
" has unbound variables: "
) ru
-- | Report on facts usage. | 226 | false | true | 0 | 13 | 79 | 62 | 29 | 33 | null | null |
holmisen/glbrix | src/ModelRender.hs | gpl-3.0 | toGLColor DarkBlue = GLColor.darkBlue | 38 | toGLColor DarkBlue = GLColor.darkBlue | 38 | toGLColor DarkBlue = GLColor.darkBlue | 38 | false | false | 0 | 5 | 4 | 11 | 5 | 6 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/THNames.hs | bsd-3-clause | unboxedSumTIdKey = mkPreludeMiscIdUnique 386 | 47 | unboxedSumTIdKey = mkPreludeMiscIdUnique 386 | 47 | unboxedSumTIdKey = mkPreludeMiscIdUnique 386 | 47 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
apyrgio/ganeti | src/Ganeti/Utils.hs | bsd-2-clause | plural _ _ p = p | 16 | plural _ _ p = p | 16 | plural _ _ p = p | 16 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
andir/ganeti | src/Ganeti/HTools/Program/Hbal.hs | bsd-2-clause | arguments :: [ArgCompletion]
arguments = [] | 43 | arguments :: [ArgCompletion]
arguments = [] | 43 | arguments = [] | 14 | false | true | 0 | 5 | 5 | 16 | 9 | 7 | null | null |
AshyIsMe/osxmonad | OSXMonad/Keys.hs | bsd-3-clause | osxKeyToX11 0x5A = xK_F20 | 25 | osxKeyToX11 0x5A = xK_F20 | 25 | osxKeyToX11 0x5A = xK_F20 | 25 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
twittner/zeromq-haskell | src/System/ZMQ4/Monadic.hs | mit | setIpv6 :: Bool -> Socket z t -> ZMQ z ()
setIpv6 i = liftIO . Z.setIpv6 i . _unsocket | 86 | setIpv6 :: Bool -> Socket z t -> ZMQ z ()
setIpv6 i = liftIO . Z.setIpv6 i . _unsocket | 86 | setIpv6 i = liftIO . Z.setIpv6 i . _unsocket | 44 | false | true | 1 | 9 | 19 | 53 | 23 | 30 | null | null |
lancelet/bored-robot | src/CI/Git.hs | apache-2.0 | getHeadCommit :: IO (Either GitEx (Either ProcEx Commish))
getHeadCommit = runGitIO gitHeadCommit | 97 | getHeadCommit :: IO (Either GitEx (Either ProcEx Commish))
getHeadCommit = runGitIO gitHeadCommit | 97 | getHeadCommit = runGitIO gitHeadCommit | 38 | false | true | 0 | 9 | 11 | 33 | 16 | 17 | null | null |
roberth/uu-helium | src/Helium/Parser/ParseLibrary.hs | gpl-3.0 | lexBAR = lexeme (LexResVarSym "|") | 39 | lexBAR = lexeme (LexResVarSym "|") | 39 | lexBAR = lexeme (LexResVarSym "|") | 39 | false | false | 1 | 6 | 9 | 18 | 7 | 11 | null | null |
abuiles/turbinado-blog | tmp/dependencies/hs-plugins-1.3.1/src/System/Plugins/Utils.hs | bsd-3-clause | encode_ch '=' = "ze" | 21 | encode_ch '=' = "ze" | 21 | encode_ch '=' = "ze" | 21 | false | false | 0 | 4 | 4 | 10 | 4 | 6 | null | null |
facebookincubator/duckling | Duckling/Rules.hs | bsd-3-clause | localeRules CS = CSRules.localeRules | 36 | localeRules CS = CSRules.localeRules | 36 | localeRules CS = CSRules.localeRules | 36 | false | false | 0 | 5 | 3 | 11 | 5 | 6 | null | null |
charlesrosenbauer/Bzo-Compiler | src/BzoParserRules.hs | gpl-3.0 | -- | Function Types
parserIter fname tokens ((BzS_Statement p1 (BzS_Expr _ [def@(BzS_FnTy _ inty exty)]))
:(BzS_FnHead p0 (BzS_Undefined _) fn (BzS_Undefined _)):stk) = parserIter fname tokens ((BzS_Calls p0 [BzS_FnTypeDef p0 (BzS_Undefined p0) fn def]):stk) | 285 | parserIter fname tokens ((BzS_Statement p1 (BzS_Expr _ [def@(BzS_FnTy _ inty exty)]))
:(BzS_FnHead p0 (BzS_Undefined _) fn (BzS_Undefined _)):stk) = parserIter fname tokens ((BzS_Calls p0 [BzS_FnTypeDef p0 (BzS_Undefined p0) fn def]):stk) | 265 | parserIter fname tokens ((BzS_Statement p1 (BzS_Expr _ [def@(BzS_FnTy _ inty exty)]))
:(BzS_FnHead p0 (BzS_Undefined _) fn (BzS_Undefined _)):stk) = parserIter fname tokens ((BzS_Calls p0 [BzS_FnTypeDef p0 (BzS_Undefined p0) fn def]):stk) | 265 | true | false | 0 | 15 | 60 | 121 | 62 | 59 | null | null |
jcberentsen/causality | src/Examples/MontyHall.hs | bsd-3-clause | win_door_2 = fact "car behind door 2" | 37 | win_door_2 = fact "car behind door 2" | 37 | win_door_2 = fact "car behind door 2" | 37 | false | false | 0 | 5 | 6 | 9 | 4 | 5 | null | null |
Gabriel439/suns-search | src/PDB.hs | gpl-3.0 | double' :: P.Parser Double
double' = P.skipSpace >> P.double | 61 | double' :: P.Parser Double
double' = P.skipSpace >> P.double | 61 | double' = P.skipSpace >> P.double | 34 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
tittoassini/typed | src/ZM/To/Encoder.hs | bsd-3-clause | -- |Return an encoder for a given type
-- typeEncoder :: AbsTypeModel -> Parser OBJ
-- typeEncoder env tm = solve (t (typeEncoderMap tm)
typeEncoder_ :: TypeEncoderMap -> AbsType -> Parser OBJ
typeEncoder_ env typ = do
let typeParser :: Parser (OBJ, Type (TypeName Identifier)) =
(undefined, ) <$> (symbol ":" *> parType namedOrAbsRef)
valueParser = (, undefined) <$> solve typ env
((r, _), mtp) <- (,) <$> valueParser <*> optional typeParser
case mtp of
Nothing -> return r
-- BUG: no name check
Just (_, dtyp) -> if dtyp == (asTypeName Nothing . Just <$> typ)
then return r
else fail $ unwords
[ "Type Mismatch: declared type is"
, prettyShow dtyp
, "expected type is"
, prettyShow typ
]
{-
NOT DEFINED ELSEWHERE? see ZM.Parser.Value for declarative form
Parser for records fields.
For example, for a type such as :
data Msg = Msg {sent::Bool,content::String}
it would parse:
sent=Bool,content="some message"
-} | 1,010 | typeEncoder_ :: TypeEncoderMap -> AbsType -> Parser OBJ
typeEncoder_ env typ = do
let typeParser :: Parser (OBJ, Type (TypeName Identifier)) =
(undefined, ) <$> (symbol ":" *> parType namedOrAbsRef)
valueParser = (, undefined) <$> solve typ env
((r, _), mtp) <- (,) <$> valueParser <*> optional typeParser
case mtp of
Nothing -> return r
-- BUG: no name check
Just (_, dtyp) -> if dtyp == (asTypeName Nothing . Just <$> typ)
then return r
else fail $ unwords
[ "Type Mismatch: declared type is"
, prettyShow dtyp
, "expected type is"
, prettyShow typ
]
{-
NOT DEFINED ELSEWHERE? see ZM.Parser.Value for declarative form
Parser for records fields.
For example, for a type such as :
data Msg = Msg {sent::Bool,content::String}
it would parse:
sent=Bool,content="some message"
-} | 873 | typeEncoder_ env typ = do
let typeParser :: Parser (OBJ, Type (TypeName Identifier)) =
(undefined, ) <$> (symbol ":" *> parType namedOrAbsRef)
valueParser = (, undefined) <$> solve typ env
((r, _), mtp) <- (,) <$> valueParser <*> optional typeParser
case mtp of
Nothing -> return r
-- BUG: no name check
Just (_, dtyp) -> if dtyp == (asTypeName Nothing . Just <$> typ)
then return r
else fail $ unwords
[ "Type Mismatch: declared type is"
, prettyShow dtyp
, "expected type is"
, prettyShow typ
]
{-
NOT DEFINED ELSEWHERE? see ZM.Parser.Value for declarative form
Parser for records fields.
For example, for a type such as :
data Msg = Msg {sent::Bool,content::String}
it would parse:
sent=Bool,content="some message"
-} | 817 | true | true | 0 | 16 | 249 | 226 | 116 | 110 | null | null |
cirquit/hjc | src/Cmm/ASTToCmm.hs | mit | expParserC (BinOp e1 op e2) = do
ce1 <- expParserC e1
ce2 <- expParserC e2
case op of
PLUS -> return $ BINOP PLUS_C ce1 ce2
MINUS -> return $ BINOP MINUS_C ce1 ce2
MUL -> return $ BINOP MUL_C ce1 ce2
DIV -> return $ BINOP DIV_C ce1 ce2
EQS -> compareWith EQ_C ce1 ce2
LE -> compareWith LT_C ce1 ce2
GE -> compareWith GT_C ce1 ce2
LEQ -> compareWith LE_C ce1 ce2
GEQ -> compareWith GE_C ce1 ce2
NEQS -> compareWith NE_C ce1 ce2
AND -> andExpParserC ce1 ce2
OR -> orExpParserC ce1 ce2
o@_ -> error $ "hjc:ASTToCmmParser:expParserC - binary operation " ++ showJC o ++ " is not implemented yet" | 718 | expParserC (BinOp e1 op e2) = do
ce1 <- expParserC e1
ce2 <- expParserC e2
case op of
PLUS -> return $ BINOP PLUS_C ce1 ce2
MINUS -> return $ BINOP MINUS_C ce1 ce2
MUL -> return $ BINOP MUL_C ce1 ce2
DIV -> return $ BINOP DIV_C ce1 ce2
EQS -> compareWith EQ_C ce1 ce2
LE -> compareWith LT_C ce1 ce2
GE -> compareWith GT_C ce1 ce2
LEQ -> compareWith LE_C ce1 ce2
GEQ -> compareWith GE_C ce1 ce2
NEQS -> compareWith NE_C ce1 ce2
AND -> andExpParserC ce1 ce2
OR -> orExpParserC ce1 ce2
o@_ -> error $ "hjc:ASTToCmmParser:expParserC - binary operation " ++ showJC o ++ " is not implemented yet" | 718 | expParserC (BinOp e1 op e2) = do
ce1 <- expParserC e1
ce2 <- expParserC e2
case op of
PLUS -> return $ BINOP PLUS_C ce1 ce2
MINUS -> return $ BINOP MINUS_C ce1 ce2
MUL -> return $ BINOP MUL_C ce1 ce2
DIV -> return $ BINOP DIV_C ce1 ce2
EQS -> compareWith EQ_C ce1 ce2
LE -> compareWith LT_C ce1 ce2
GE -> compareWith GT_C ce1 ce2
LEQ -> compareWith LE_C ce1 ce2
GEQ -> compareWith GE_C ce1 ce2
NEQS -> compareWith NE_C ce1 ce2
AND -> andExpParserC ce1 ce2
OR -> orExpParserC ce1 ce2
o@_ -> error $ "hjc:ASTToCmmParser:expParserC - binary operation " ++ showJC o ++ " is not implemented yet" | 718 | false | false | 0 | 12 | 241 | 238 | 110 | 128 | null | null |
sinelaw/fresh | src/Fresh/InferMonad.hs | gpl-2.0 | liftST :: ST s a -> Infer s a
liftST = lift . lift | 50 | liftST :: ST s a -> Infer s a
liftST = lift . lift | 50 | liftST = lift . lift | 20 | false | true | 0 | 6 | 13 | 29 | 14 | 15 | null | null |
input-output-hk/pos-haskell-prototype | util/test/Test/Pos/Util/QuickCheck/Property.hs | mit | formsMonoid :: (Show m, Eq m, Semigroup m, Monoid m) => m -> m -> m -> Property
formsMonoid m1 m2 m3 =
(formsSemigroup m1 m2 m3) .&&. (hasIdentity m1) | 154 | formsMonoid :: (Show m, Eq m, Semigroup m, Monoid m) => m -> m -> m -> Property
formsMonoid m1 m2 m3 =
(formsSemigroup m1 m2 m3) .&&. (hasIdentity m1) | 154 | formsMonoid m1 m2 m3 =
(formsSemigroup m1 m2 m3) .&&. (hasIdentity m1) | 74 | false | true | 0 | 8 | 33 | 77 | 39 | 38 | null | null |
evolutics/haskell-formatter | testsuite/resources/source/comments/empty_lines/between_declaration_and_comment/before/2/Input.hs | gpl-3.0 | -- | comment
commented = commented | 36 | commented = commented | 21 | commented = commented | 21 | true | false | 0 | 4 | 7 | 7 | 4 | 3 | null | null |
keithodulaigh/Hets | TopHybrid/StatAna.hs | gpl-2.0 | anaForm :: (Logic l sub bs sen si smi sign mor symb raw pf) =>
l -> bs -> Sgn_Wrap -> Frm_Wrap -> Result Frm_Wrap
anaForm l bs s (Frm_Wrap _ f) = liftM (Frm_Wrap l) $ unroll l bs s f | 190 | anaForm :: (Logic l sub bs sen si smi sign mor symb raw pf) =>
l -> bs -> Sgn_Wrap -> Frm_Wrap -> Result Frm_Wrap
anaForm l bs s (Frm_Wrap _ f) = liftM (Frm_Wrap l) $ unroll l bs s f | 190 | anaForm l bs s (Frm_Wrap _ f) = liftM (Frm_Wrap l) $ unroll l bs s f | 68 | false | true | 0 | 10 | 49 | 98 | 48 | 50 | null | null |
keithodulaigh/Hets | LF/AS.hs | gpl-2.0 | printBasicItem (Form f) = dot <+> pretty f | 42 | printBasicItem (Form f) = dot <+> pretty f | 42 | printBasicItem (Form f) = dot <+> pretty f | 42 | false | false | 0 | 7 | 7 | 22 | 10 | 12 | null | null |
fmapfmapfmap/amazonka | amazonka-workspaces/gen/Network/AWS/WorkSpaces/DescribeWorkspaces.hs | mpl-2.0 | -- | If not null, more results are available. Pass this value for the
-- 'NextToken' parameter in a subsequent call to this operation to retrieve
-- the next set of items. This token is valid for one day and must be used
-- within that timeframe.
dwrsNextToken :: Lens' DescribeWorkspacesResponse (Maybe Text)
dwrsNextToken = lens _dwrsNextToken (\ s a -> s{_dwrsNextToken = a}) | 378 | dwrsNextToken :: Lens' DescribeWorkspacesResponse (Maybe Text)
dwrsNextToken = lens _dwrsNextToken (\ s a -> s{_dwrsNextToken = a}) | 131 | dwrsNextToken = lens _dwrsNextToken (\ s a -> s{_dwrsNextToken = a}) | 68 | true | true | 0 | 9 | 63 | 49 | 28 | 21 | null | null |
simonmichael/hledger | hledger-lib/Hledger/Data/Dates.hs | gpl-3.0 | failIfInvalidDate :: Fail.MonadFail m => SmartDate -> m SmartDate
failIfInvalidDate s = unless isValid (Fail.fail $ "bad smart date: " ++ show s) $> s
where isValid = case s of
SmartAssumeStart y (Just (m, md)) -> isJust $ fromGregorianValid y m (fromMaybe 1 md)
SmartFromReference mm d -> isJust $ fromGregorianValid 2004 (fromMaybe 1 mm) d
SmartMonth m -> validMonth m
_ -> True | 493 | failIfInvalidDate :: Fail.MonadFail m => SmartDate -> m SmartDate
failIfInvalidDate s = unless isValid (Fail.fail $ "bad smart date: " ++ show s) $> s
where isValid = case s of
SmartAssumeStart y (Just (m, md)) -> isJust $ fromGregorianValid y m (fromMaybe 1 md)
SmartFromReference mm d -> isJust $ fromGregorianValid 2004 (fromMaybe 1 mm) d
SmartMonth m -> validMonth m
_ -> True | 493 | failIfInvalidDate s = unless isValid (Fail.fail $ "bad smart date: " ++ show s) $> s
where isValid = case s of
SmartAssumeStart y (Just (m, md)) -> isJust $ fromGregorianValid y m (fromMaybe 1 md)
SmartFromReference mm d -> isJust $ fromGregorianValid 2004 (fromMaybe 1 mm) d
SmartMonth m -> validMonth m
_ -> True | 427 | false | true | 0 | 11 | 177 | 157 | 75 | 82 | null | null |
denisenkom/hspkcs11 | src/Bindings/Pkcs11/Shared.hs | mit | signFinal (Session sessHandle funcListPtr) maybeOutLen = do
(rv, bs) <-
varLenGet maybeOutLen $ uncurry (signFinal' funcListPtr sessHandle)
if rv /= 0
then fail $ "failed to finalize signing: " ++ rvToStr rv
else return bs | 238 | signFinal (Session sessHandle funcListPtr) maybeOutLen = do
(rv, bs) <-
varLenGet maybeOutLen $ uncurry (signFinal' funcListPtr sessHandle)
if rv /= 0
then fail $ "failed to finalize signing: " ++ rvToStr rv
else return bs | 238 | signFinal (Session sessHandle funcListPtr) maybeOutLen = do
(rv, bs) <-
varLenGet maybeOutLen $ uncurry (signFinal' funcListPtr sessHandle)
if rv /= 0
then fail $ "failed to finalize signing: " ++ rvToStr rv
else return bs | 238 | false | false | 1 | 12 | 50 | 82 | 38 | 44 | null | null |
darthdeus/scheme | src/Scheme/Evaluator.hs | mit | numberOp :: (Int -> Int -> AST) -> AST -> AST -> State Env AST
numberOp f x y = do
xx <- eval x
yy <- eval y
case (xx, yy) of
(ASTNumber xv, ASTNumber yv) ->
return $ f xv yv
(xv, yv) ->
error $ "evaluating non-numbers " ++ show xv ++ " and " ++ show yv | 283 | numberOp :: (Int -> Int -> AST) -> AST -> AST -> State Env AST
numberOp f x y = do
xx <- eval x
yy <- eval y
case (xx, yy) of
(ASTNumber xv, ASTNumber yv) ->
return $ f xv yv
(xv, yv) ->
error $ "evaluating non-numbers " ++ show xv ++ " and " ++ show yv | 283 | numberOp f x y = do
xx <- eval x
yy <- eval y
case (xx, yy) of
(ASTNumber xv, ASTNumber yv) ->
return $ f xv yv
(xv, yv) ->
error $ "evaluating non-numbers " ++ show xv ++ " and " ++ show yv | 220 | false | true | 0 | 14 | 90 | 145 | 69 | 76 | null | null |
yav/allegro | src/Allegro/Audio.hs | bsd-3-clause | -- | Throws 'FailedToSetSampleInstancePlaying'
setSampleInstancePlaying :: SampleInstance -> Bool -> IO ()
setSampleInstancePlaying s@(SampleInstance p) b =
chk (FailedToSetSampleInstancePlaying s b)
$ al_set_sample_instance_playing p b | 240 | setSampleInstancePlaying :: SampleInstance -> Bool -> IO ()
setSampleInstancePlaying s@(SampleInstance p) b =
chk (FailedToSetSampleInstancePlaying s b)
$ al_set_sample_instance_playing p b | 193 | setSampleInstancePlaying s@(SampleInstance p) b =
chk (FailedToSetSampleInstancePlaying s b)
$ al_set_sample_instance_playing p b | 133 | true | true | 2 | 8 | 28 | 60 | 29 | 31 | null | null |
acowley/ghc | compiler/prelude/THNames.hs | bsd-3-clause | letEIdKey = mkPreludeMiscIdUnique 284 | 45 | letEIdKey = mkPreludeMiscIdUnique 284 | 45 | letEIdKey = mkPreludeMiscIdUnique 284 | 45 | false | false | 0 | 5 | 11 | 9 | 4 | 5 | null | null |
sergv/vector | Data/Vector.hs | bsd-3-clause | unsafeAccumulate_ = G.unsafeAccumulate_ | 39 | unsafeAccumulate_ = G.unsafeAccumulate_ | 39 | unsafeAccumulate_ = G.unsafeAccumulate_ | 39 | false | false | 0 | 5 | 2 | 8 | 4 | 4 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/topic/distributed/static-config/StaticConfig.hs | unlicense | initialize
:: N.HostName -> N.ServiceName -> DP.RemoteTable -> [String]
-> IO (MVar Config)
initialize host port rtable0 nodeAddrs = do
mTransport <- NT.createTransport host port (host,) NT.defaultTCPParameters
case mTransport of
Left err -> throw err
Right transport0 ->
let config = Config
{ transport = transport0
, rtable = rtable0
, localNodes = []
, remoteNodeIds = map go nodeAddrs
, remotePids = []
}
in newMVar config
where
go x = DP.NodeId (NT.EndPointAddress ("127.0.0.1:" <> BSC8.pack x <> ":0")) | 628 | initialize
:: N.HostName -> N.ServiceName -> DP.RemoteTable -> [String]
-> IO (MVar Config)
initialize host port rtable0 nodeAddrs = do
mTransport <- NT.createTransport host port (host,) NT.defaultTCPParameters
case mTransport of
Left err -> throw err
Right transport0 ->
let config = Config
{ transport = transport0
, rtable = rtable0
, localNodes = []
, remoteNodeIds = map go nodeAddrs
, remotePids = []
}
in newMVar config
where
go x = DP.NodeId (NT.EndPointAddress ("127.0.0.1:" <> BSC8.pack x <> ":0")) | 628 | initialize host port rtable0 nodeAddrs = do
mTransport <- NT.createTransport host port (host,) NT.defaultTCPParameters
case mTransport of
Left err -> throw err
Right transport0 ->
let config = Config
{ transport = transport0
, rtable = rtable0
, localNodes = []
, remoteNodeIds = map go nodeAddrs
, remotePids = []
}
in newMVar config
where
go x = DP.NodeId (NT.EndPointAddress ("127.0.0.1:" <> BSC8.pack x <> ":0")) | 532 | false | true | 1 | 16 | 199 | 209 | 102 | 107 | null | null |
EarlGray/omit | Main.hs | mit | on f g x y = f (g x) (g y) | 26 | on f g x y = f (g x) (g y) | 26 | on f g x y = f (g x) (g y) | 26 | false | false | 1 | 7 | 10 | 40 | 15 | 25 | null | null |
erochest/barth-scrape | src/BarthPar/Scrape/XML.hs | apache-2.0 | filterNode :: MonadPlus m => (Element -> Bool) -> Node -> m Node
filterNode f (NodeElement e) = NodeElement <$> filterEl f e | 130 | filterNode :: MonadPlus m => (Element -> Bool) -> Node -> m Node
filterNode f (NodeElement e) = NodeElement <$> filterEl f e | 130 | filterNode f (NodeElement e) = NodeElement <$> filterEl f e | 65 | false | true | 0 | 8 | 28 | 56 | 27 | 29 | null | null |
msakai/ptq | src/PDict.hs | lgpl-2.1 | find, lose, eat, love, date, seek, coneiveg :: P TV
find = B cat_TV "find" | 78 | find, lose, eat, love, date, seek, coneiveg :: P TV
find = B cat_TV "find" | 78 | find = B cat_TV "find" | 26 | false | true | 9 | 5 | 18 | 52 | 21 | 31 | null | null |
lally/org-issue-sync | src/Sync/Retrieve/GitHub/GitHub.hs | apache-2.0 | convertEvent :: GD.Event -> IssueEventDetails
convertEvent evt = IssueComment (show evt) | 88 | convertEvent :: GD.Event -> IssueEventDetails
convertEvent evt = IssueComment (show evt) | 88 | convertEvent evt = IssueComment (show evt) | 42 | false | true | 0 | 7 | 10 | 29 | 14 | 15 | null | null |
noteed/covered | bin/covered.hs | bsd-3-clause | downToTopLevel :: [(Loc,Markup)] -> [(Loc,Markup)]
downToTopLevel ((_,TopLevelDecl {}):_) = [] | 94 | downToTopLevel :: [(Loc,Markup)] -> [(Loc,Markup)]
downToTopLevel ((_,TopLevelDecl {}):_) = [] | 94 | downToTopLevel ((_,TopLevelDecl {}):_) = [] | 43 | false | true | 0 | 9 | 9 | 55 | 32 | 23 | null | null |
termite2/tsl | TSL2Boogie/Spec2Boogie.hs | bsd-3-clause | bvbopname Mul = "MULT" | 27 | bvbopname Mul = "MULT" | 27 | bvbopname Mul = "MULT" | 27 | false | false | 1 | 5 | 8 | 13 | 4 | 9 | null | null |
ghc-android/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | deNoteType ty = ty | 18 | deNoteType ty = ty | 18 | deNoteType ty = ty | 18 | false | false | 1 | 5 | 3 | 13 | 4 | 9 | null | null |
mudphone/HaskellBook | src/Seventeen.hs | mit | concat' :: List (List a) -> List a
concat' = fold append Nil | 60 | concat' :: List (List a) -> List a
concat' = fold append Nil | 60 | concat' = fold append Nil | 25 | false | true | 0 | 8 | 12 | 32 | 15 | 17 | null | null |
nubis/Monono | Graphics/UI/Monono/Sprite.hs | bsd-3-clause | clearOnMouseEnter :: Sprite ()
clearOnMouseEnter = modifySprite $ \s -> s{ spriteOnMouseEnter = Nothing } | 105 | clearOnMouseEnter :: Sprite ()
clearOnMouseEnter = modifySprite $ \s -> s{ spriteOnMouseEnter = Nothing } | 105 | clearOnMouseEnter = modifySprite $ \s -> s{ spriteOnMouseEnter = Nothing } | 74 | false | true | 1 | 9 | 14 | 37 | 18 | 19 | null | null |
ribag/ganeti-experiments | src/Ganeti/Constants.hs | gpl-2.0 | -- * UUID regex
uuidRegex :: String
uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" | 113 | uuidRegex :: String
uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" | 96 | uuidRegex = "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$" | 76 | true | true | 0 | 4 | 10 | 12 | 7 | 5 | null | null |
green-haskell/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | mapForeignTargetM _ (PrimTarget _) = Nothing | 49 | mapForeignTargetM _ (PrimTarget _) = Nothing | 49 | mapForeignTargetM _ (PrimTarget _) = Nothing | 49 | false | false | 1 | 6 | 10 | 20 | 8 | 12 | null | null |
XinhuaZhang/PetaVisionHaskell | Application/PVPAnalysis/PlotEnergyTrend.hs | gpl-3.0 | main = do
(folderPath:numBatchStr:displayPeriodStr:numStr:_) <- getArgs
let str = "EnergyProbe_batchElement_"
fileNames =
L.map
(\i -> folderPath L.++ "/" L.++ str L.++ show i L.++ ".txt")
[0 .. (read numBatchStr :: Int) - 1]
xs <-
M.mapM
(\path ->
energyFileSource path $$ conduit ((read displayPeriodStr :: Int) - 1) =$=
CL.take (read numStr :: Int))
fileNames
let ys =
L.map
(\x -> (L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
xs
M.mapM_
(\x ->
printf
"%f %d\n"
((L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
(L.length x))
xs
printf "Avg. %f\n" ((L.sum ys) / (fromIntegral . L.length $ ys))
toFile def "energy.png" $ do
layout_title .= "Energy"
M.zipWithM_ (\i x -> plot (line (show i) [x])) [0 ..] xs | 895 | main = do
(folderPath:numBatchStr:displayPeriodStr:numStr:_) <- getArgs
let str = "EnergyProbe_batchElement_"
fileNames =
L.map
(\i -> folderPath L.++ "/" L.++ str L.++ show i L.++ ".txt")
[0 .. (read numBatchStr :: Int) - 1]
xs <-
M.mapM
(\path ->
energyFileSource path $$ conduit ((read displayPeriodStr :: Int) - 1) =$=
CL.take (read numStr :: Int))
fileNames
let ys =
L.map
(\x -> (L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
xs
M.mapM_
(\x ->
printf
"%f %d\n"
((L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
(L.length x))
xs
printf "Avg. %f\n" ((L.sum ys) / (fromIntegral . L.length $ ys))
toFile def "energy.png" $ do
layout_title .= "Energy"
M.zipWithM_ (\i x -> plot (line (show i) [x])) [0 ..] xs | 895 | main = do
(folderPath:numBatchStr:displayPeriodStr:numStr:_) <- getArgs
let str = "EnergyProbe_batchElement_"
fileNames =
L.map
(\i -> folderPath L.++ "/" L.++ str L.++ show i L.++ ".txt")
[0 .. (read numBatchStr :: Int) - 1]
xs <-
M.mapM
(\path ->
energyFileSource path $$ conduit ((read displayPeriodStr :: Int) - 1) =$=
CL.take (read numStr :: Int))
fileNames
let ys =
L.map
(\x -> (L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
xs
M.mapM_
(\x ->
printf
"%f %d\n"
((L.sum . snd . L.unzip $ x) / (fromIntegral . L.length $ x))
(L.length x))
xs
printf "Avg. %f\n" ((L.sum ys) / (fromIntegral . L.length $ ys))
toFile def "energy.png" $ do
layout_title .= "Energy"
M.zipWithM_ (\i x -> plot (line (show i) [x])) [0 ..] xs | 895 | false | false | 0 | 18 | 287 | 406 | 206 | 200 | null | null |
TikhonJelvis/adaptive-radix-trees | src/Data/ART/Internal/Array.hs | bsd-3-clause | binarySearch target arr = go 0 $ snd (Array.bounds arr) + 1
where go !from !to =
let i = from + (to - from) `div` 2 in
if | i + 1 == from || i == to -> Nothing
| arr ! i == target -> Just i
| arr ! i < target -> go (i + 1) to
| otherwise -> go from i
-- TODO: Man, this code is ugly! | 387 | binarySearch target arr = go 0 $ snd (Array.bounds arr) + 1
where go !from !to =
let i = from + (to - from) `div` 2 in
if | i + 1 == from || i == to -> Nothing
| arr ! i == target -> Just i
| arr ! i < target -> go (i + 1) to
| otherwise -> go from i
-- TODO: Man, this code is ugly! | 387 | binarySearch target arr = go 0 $ snd (Array.bounds arr) + 1
where go !from !to =
let i = from + (to - from) `div` 2 in
if | i + 1 == from || i == to -> Nothing
| arr ! i == target -> Just i
| arr ! i < target -> go (i + 1) to
| otherwise -> go from i
-- TODO: Man, this code is ugly! | 387 | false | false | 4 | 14 | 178 | 166 | 78 | 88 | null | null |
alexander-at-github/eta | compiler/ETA/BasicTypes/UniqSupply.hs | bsd-3-clause | lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
lazyThenUs expr cont
= USM (\us -> let (result, us') = liftUSM expr us in unUSM (cont result) us') | 154 | lazyThenUs :: UniqSM a -> (a -> UniqSM b) -> UniqSM b
lazyThenUs expr cont
= USM (\us -> let (result, us') = liftUSM expr us in unUSM (cont result) us') | 154 | lazyThenUs expr cont
= USM (\us -> let (result, us') = liftUSM expr us in unUSM (cont result) us') | 100 | false | true | 0 | 12 | 32 | 90 | 42 | 48 | null | null |
tpsinnem/Idris-dev | src/Idris/IdeMode.hs | bsd-3-clause | sexpToCommand (SexpList [SymbolAtom "error-string", StringAtom encoded]) = Just . ErrString . decodeErr $ encoded | 128 | sexpToCommand (SexpList [SymbolAtom "error-string", StringAtom encoded]) = Just . ErrString . decodeErr $ encoded | 128 | sexpToCommand (SexpList [SymbolAtom "error-string", StringAtom encoded]) = Just . ErrString . decodeErr $ encoded | 128 | false | false | 0 | 8 | 28 | 40 | 19 | 21 | null | null |
printedheart/Dao | src/Dao/Grammar.hs | agpl-3.0 | _cutBranches :: Array Regex -> Grammar m o
_cutBranches = GrReject . InvalidGrammar . (,,) Nothing nullValue . CutSomeBranches | 126 | _cutBranches :: Array Regex -> Grammar m o
_cutBranches = GrReject . InvalidGrammar . (,,) Nothing nullValue . CutSomeBranches | 126 | _cutBranches = GrReject . InvalidGrammar . (,,) Nothing nullValue . CutSomeBranches | 83 | false | true | 0 | 8 | 18 | 44 | 22 | 22 | null | null |
prowdsponsor/fb | src/Facebook/Pager.hs | bsd-3-clause | -- | (Internal) See 'fetchAllNextPages' and 'fetchAllPreviousPages'.
fetchAllHelper ::
(Monad m, MonadResourceBase n, A.FromJSON a) =>
(Pager a -> Maybe String) -> Pager a -> FacebookT anyAuth m (C.Source n a)
fetchAllHelper pagerRef pager = do
manager <- getManager
let go (x:xs) mnext = C.yield x >> go xs mnext
go [] Nothing = return ()
go [] (Just next) = do
req <- liftIO (H.parseUrl next)
let get = fbhttpHelper manager req { H.redirectCount = 3 }
start =<< lift (R.runResourceT $ asJsonHelper =<< get)
start p = go (pagerData p) $! pagerRef p
return (start pager) | 628 | fetchAllHelper ::
(Monad m, MonadResourceBase n, A.FromJSON a) =>
(Pager a -> Maybe String) -> Pager a -> FacebookT anyAuth m (C.Source n a)
fetchAllHelper pagerRef pager = do
manager <- getManager
let go (x:xs) mnext = C.yield x >> go xs mnext
go [] Nothing = return ()
go [] (Just next) = do
req <- liftIO (H.parseUrl next)
let get = fbhttpHelper manager req { H.redirectCount = 3 }
start =<< lift (R.runResourceT $ asJsonHelper =<< get)
start p = go (pagerData p) $! pagerRef p
return (start pager) | 559 | fetchAllHelper pagerRef pager = do
manager <- getManager
let go (x:xs) mnext = C.yield x >> go xs mnext
go [] Nothing = return ()
go [] (Just next) = do
req <- liftIO (H.parseUrl next)
let get = fbhttpHelper manager req { H.redirectCount = 3 }
start =<< lift (R.runResourceT $ asJsonHelper =<< get)
start p = go (pagerData p) $! pagerRef p
return (start pager) | 414 | true | true | 0 | 17 | 155 | 259 | 123 | 136 | null | null |
brendanhay/gogol | gogol-jobs/gen/Network/Google/Resource/Jobs/Projects/Tenants/CompleteQuery.hs | mpl-2.0 | -- | Required. Resource name of tenant the completion is performed within.
-- The format is \"projects\/{project_id}\/tenants\/{tenant_id}\", for
-- example, \"projects\/foo\/tenants\/bar\".
ptcqTenant :: Lens' ProjectsTenantsCompleteQuery Text
ptcqTenant
= lens _ptcqTenant (\ s a -> s{_ptcqTenant = a}) | 306 | ptcqTenant :: Lens' ProjectsTenantsCompleteQuery Text
ptcqTenant
= lens _ptcqTenant (\ s a -> s{_ptcqTenant = a}) | 115 | ptcqTenant
= lens _ptcqTenant (\ s a -> s{_ptcqTenant = a}) | 61 | true | true | 1 | 9 | 38 | 48 | 24 | 24 | null | null |
enolive/exercism | haskell/kindergarten-garden/src/Garden.hs | mit | toPlant :: Char -> Plant
toPlant plant =
case plant of
'V' -> Violets
'C' -> Clover
'R' -> Radishes
'G' -> Grass | 130 | toPlant :: Char -> Plant
toPlant plant =
case plant of
'V' -> Violets
'C' -> Clover
'R' -> Radishes
'G' -> Grass | 130 | toPlant plant =
case plant of
'V' -> Violets
'C' -> Clover
'R' -> Radishes
'G' -> Grass | 105 | false | true | 0 | 8 | 40 | 52 | 24 | 28 | null | null |
Codas/yesod-form-materialize | Yesod/Form/Materialize/Fields.hs | mit | colClass ColM6 = "col m6" | 26 | colClass ColM6 = "col m6" | 26 | colClass ColM6 = "col m6" | 26 | false | false | 0 | 5 | 5 | 9 | 4 | 5 | null | null |
jwiegley/BlogLiterately | src/Text/BlogLiterately/Transform.hs | gpl-3.0 | -- | Upload embedded local images to the server (if the @uploadImages@
-- flag is set).
imagesXF :: Transform
imagesXF = Transform (Kleisli . uploadAllImages) uploadImages | 173 | imagesXF :: Transform
imagesXF = Transform (Kleisli . uploadAllImages) uploadImages | 83 | imagesXF = Transform (Kleisli . uploadAllImages) uploadImages | 61 | true | true | 0 | 7 | 27 | 25 | 14 | 11 | null | null |
pepijnkokke/unlit | src/Unlit/String.hs | bsd-3-clause | emitClose :: Delimiter -> Maybe String -> [String]
emitClose Bird l = maybeToList l | 84 | emitClose :: Delimiter -> Maybe String -> [String]
emitClose Bird l = maybeToList l | 84 | emitClose Bird l = maybeToList l | 33 | false | true | 0 | 7 | 14 | 33 | 16 | 17 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2016/M08/D08/Exercise.hs | mit | {--
Let's, today, just read in the rows of JSON and dig into just a bit of the
information contained in these rows.
--}
readJSONRows :: FilePath -> IO [TableRow]
readJSONRows url = undefined | 191 | readJSONRows :: FilePath -> IO [TableRow]
readJSONRows url = undefined | 70 | readJSONRows url = undefined | 28 | true | true | 0 | 8 | 34 | 30 | 14 | 16 | null | null |
mzini/hosa | src/HoSA/SizeType/Infer.hs | mit | skolemVar :: InferCG f v Ix.Term
skolemVar = Ix.metaVar <$> (unique >>= Ix.freshMetaVar) | 88 | skolemVar :: InferCG f v Ix.Term
skolemVar = Ix.metaVar <$> (unique >>= Ix.freshMetaVar) | 88 | skolemVar = Ix.metaVar <$> (unique >>= Ix.freshMetaVar) | 55 | false | true | 0 | 8 | 12 | 35 | 18 | 17 | null | null |
ambiata/delorean | src/Delorean/Local/Date.hs | bsd-3-clause | nextMonthOn :: DayOfMonth -> Date -> Date
nextMonthOn dom d =
let (Date y m _) = nextMonth d
in gregorianDayToDate . dateToGregorianDay $ Date y m dom | 155 | nextMonthOn :: DayOfMonth -> Date -> Date
nextMonthOn dom d =
let (Date y m _) = nextMonth d
in gregorianDayToDate . dateToGregorianDay $ Date y m dom | 155 | nextMonthOn dom d =
let (Date y m _) = nextMonth d
in gregorianDayToDate . dateToGregorianDay $ Date y m dom | 113 | false | true | 0 | 10 | 32 | 64 | 30 | 34 | null | null |
gcampax/ghc | compiler/stranal/DmdAnal.hs | bsd-3-clause | addLazyFVs :: DmdType -> DmdEnv -> DmdType
addLazyFVs dmd_ty lazy_fvs
= dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs | 116 | addLazyFVs :: DmdType -> DmdEnv -> DmdType
addLazyFVs dmd_ty lazy_fvs
= dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs | 116 | addLazyFVs dmd_ty lazy_fvs
= dmd_ty `bothDmdType` mkBothDmdArg lazy_fvs | 73 | false | true | 0 | 6 | 16 | 33 | 17 | 16 | null | null |
music-suite/music-parts | src/Music/Parts.hs | bsd-3-clause | altoSax = fromMidiProgram 65 | 36 | altoSax = fromMidiProgram 65 | 36 | altoSax = fromMidiProgram 65 | 36 | false | false | 1 | 5 | 11 | 12 | 4 | 8 | null | null |
adamschoenemann/simple-frp | src/FRP/Parser/Lang.hs | mit | -- parses a reserved name
reservedOp = Tok.reservedOp lexer | 59 | reservedOp = Tok.reservedOp lexer | 33 | reservedOp = Tok.reservedOp lexer | 33 | true | false | 1 | 5 | 8 | 16 | 6 | 10 | null | null |
thiagoarrais/gtk2hs | demo/profileviewer/ParseProfile.hs | lgpl-2.1 | profileEntriesToProfile acum curDepth (entry:entries)
| depth entry == curDepth =
let (children, remaining) = profileEntriesToProfile
[] (depth entry + 1) entries
curNode = ProfileNode {
costCentre = ecostCentre entry,
moduleName = emoduleName entry,
entries = eentries entry,
individualTime = eindividualTime entry,
individualAlloc = eindividualAlloc entry,
inheritedTime = einheritedTime entry,
inheritedAlloc = einheritedAlloc entry,
children = children
}
in profileEntriesToProfile (curNode:acum) (depth entry) remaining
| depth entry < curDepth = (acum, entry:entries) --we're done for this level
| otherwise = error "bad indentation in file" | 829 | profileEntriesToProfile acum curDepth (entry:entries)
| depth entry == curDepth =
let (children, remaining) = profileEntriesToProfile
[] (depth entry + 1) entries
curNode = ProfileNode {
costCentre = ecostCentre entry,
moduleName = emoduleName entry,
entries = eentries entry,
individualTime = eindividualTime entry,
individualAlloc = eindividualAlloc entry,
inheritedTime = einheritedTime entry,
inheritedAlloc = einheritedAlloc entry,
children = children
}
in profileEntriesToProfile (curNode:acum) (depth entry) remaining
| depth entry < curDepth = (acum, entry:entries) --we're done for this level
| otherwise = error "bad indentation in file" | 829 | profileEntriesToProfile acum curDepth (entry:entries)
| depth entry == curDepth =
let (children, remaining) = profileEntriesToProfile
[] (depth entry + 1) entries
curNode = ProfileNode {
costCentre = ecostCentre entry,
moduleName = emoduleName entry,
entries = eentries entry,
individualTime = eindividualTime entry,
individualAlloc = eindividualAlloc entry,
inheritedTime = einheritedTime entry,
inheritedAlloc = einheritedAlloc entry,
children = children
}
in profileEntriesToProfile (curNode:acum) (depth entry) remaining
| depth entry < curDepth = (acum, entry:entries) --we're done for this level
| otherwise = error "bad indentation in file" | 829 | false | false | 0 | 13 | 265 | 214 | 107 | 107 | null | null |
egison/egison | hs-src/Language/Egison/Eval.hs | mit | evalTopExprs :: Env -> [TopExpr] -> EvalM Env
evalTopExprs env exprs = do
exprs <- desugarTopExprs exprs
opts <- ask
(bindings, rest) <- collectDefs opts exprs
env <- recursiveBind env bindings
forM_ rest $ \expr -> do
(val, _) <- evalTopExpr' env expr
case val of
Nothing -> return ()
Just val -> valueToStr val >>= liftIO . putStrLn
return env
-- | Evaluate Egison top expressions. | 417 | evalTopExprs :: Env -> [TopExpr] -> EvalM Env
evalTopExprs env exprs = do
exprs <- desugarTopExprs exprs
opts <- ask
(bindings, rest) <- collectDefs opts exprs
env <- recursiveBind env bindings
forM_ rest $ \expr -> do
(val, _) <- evalTopExpr' env expr
case val of
Nothing -> return ()
Just val -> valueToStr val >>= liftIO . putStrLn
return env
-- | Evaluate Egison top expressions. | 417 | evalTopExprs env exprs = do
exprs <- desugarTopExprs exprs
opts <- ask
(bindings, rest) <- collectDefs opts exprs
env <- recursiveBind env bindings
forM_ rest $ \expr -> do
(val, _) <- evalTopExpr' env expr
case val of
Nothing -> return ()
Just val -> valueToStr val >>= liftIO . putStrLn
return env
-- | Evaluate Egison top expressions. | 371 | false | true | 0 | 16 | 100 | 155 | 72 | 83 | null | null |
miniBill/entangle | src/lib/EntangleMonad.hs | mit | transformReset :: QubitId -> EntangleMonad ()
transformReset q = EntangleMonad res where
res bs ms = Right $ ResetNode q $ LeafNode (bs, ms, ()) | 148 | transformReset :: QubitId -> EntangleMonad ()
transformReset q = EntangleMonad res where
res bs ms = Right $ ResetNode q $ LeafNode (bs, ms, ()) | 148 | transformReset q = EntangleMonad res where
res bs ms = Right $ ResetNode q $ LeafNode (bs, ms, ()) | 102 | false | true | 0 | 10 | 28 | 63 | 31 | 32 | null | null |
adamse/haddock | haddock-api/src/Haddock/GhcUtils.hs | bsd-2-clause | -- | The parents of a subordinate in a declaration
parents :: Name -> HsDecl Name -> [Name]
parents n (TyClD d) = [ p | (c, p) <- parentMap d, c == n ] | 151 | parents :: Name -> HsDecl Name -> [Name]
parents n (TyClD d) = [ p | (c, p) <- parentMap d, c == n ] | 100 | parents n (TyClD d) = [ p | (c, p) <- parentMap d, c == n ] | 59 | true | true | 0 | 8 | 34 | 65 | 34 | 31 | null | null |
beni55/cps-core | CPS/FromGHC.hs | bsd-3-clause | rename :: Subst -> G.Id -> Maybe Trivial
rename subst x = findUniqueWithDefault (error "rename: out of scope") x subst | 118 | rename :: Subst -> G.Id -> Maybe Trivial
rename subst x = findUniqueWithDefault (error "rename: out of scope") x subst | 118 | rename subst x = findUniqueWithDefault (error "rename: out of scope") x subst | 77 | false | true | 0 | 7 | 19 | 42 | 20 | 22 | null | null |
davenport-haskell/ansiblecheck-cli | app/Main.hs | bsd-3-clause | main :: IO ()
main = do
options <- execParser opts
fp <- System.Directory.getCurrentDirectory
tests <- System.Directory.listDirectory $ fp ++ "/tests/"
run fp tests (osFromOptions options) (depsFromOptions options)
where
osFromOptions :: Options -> Maybe OperatingSystem
osFromOptions (Options os osv _) = readMaybe (os ++ " " ++ osv)
depsFromOptions :: Options -> Dependencies
depsFromOptions (Options _ _ deps) = deps
opts :: ParserInfo Options
opts =
info
((Options <$> operatingSystemP <*> operatingSystemVersionP <*> many dependencyP) <**> helper)
(fullDesc <> progDesc "Check Ansible Playbook" <>
header "ansiblecheck - a testing framework for ansible")
where
operatingSystemP :: Parser String
operatingSystemP =
strOption ( short 'o'
<> long "os"
<> metavar "OPERATING_SYSTEM"
<> help "Operating System to Target")
operatingSystemVersionP :: Parser String
operatingSystemVersionP =
strOption ( short 's'
<> long "osv"
<> metavar "OS_VERSION"
<> help "Operating System Version to Target")
dependencyP :: Parser String
dependencyP =
strOption ( short 'd'
<> long "dep"
<> metavar "DEPENDENCY"
<> help "Ansible Galaxy Dependency to Add") | 1,476 | main :: IO ()
main = do
options <- execParser opts
fp <- System.Directory.getCurrentDirectory
tests <- System.Directory.listDirectory $ fp ++ "/tests/"
run fp tests (osFromOptions options) (depsFromOptions options)
where
osFromOptions :: Options -> Maybe OperatingSystem
osFromOptions (Options os osv _) = readMaybe (os ++ " " ++ osv)
depsFromOptions :: Options -> Dependencies
depsFromOptions (Options _ _ deps) = deps
opts :: ParserInfo Options
opts =
info
((Options <$> operatingSystemP <*> operatingSystemVersionP <*> many dependencyP) <**> helper)
(fullDesc <> progDesc "Check Ansible Playbook" <>
header "ansiblecheck - a testing framework for ansible")
where
operatingSystemP :: Parser String
operatingSystemP =
strOption ( short 'o'
<> long "os"
<> metavar "OPERATING_SYSTEM"
<> help "Operating System to Target")
operatingSystemVersionP :: Parser String
operatingSystemVersionP =
strOption ( short 's'
<> long "osv"
<> metavar "OS_VERSION"
<> help "Operating System Version to Target")
dependencyP :: Parser String
dependencyP =
strOption ( short 'd'
<> long "dep"
<> metavar "DEPENDENCY"
<> help "Ansible Galaxy Dependency to Add") | 1,476 | main = do
options <- execParser opts
fp <- System.Directory.getCurrentDirectory
tests <- System.Directory.listDirectory $ fp ++ "/tests/"
run fp tests (osFromOptions options) (depsFromOptions options)
where
osFromOptions :: Options -> Maybe OperatingSystem
osFromOptions (Options os osv _) = readMaybe (os ++ " " ++ osv)
depsFromOptions :: Options -> Dependencies
depsFromOptions (Options _ _ deps) = deps
opts :: ParserInfo Options
opts =
info
((Options <$> operatingSystemP <*> operatingSystemVersionP <*> many dependencyP) <**> helper)
(fullDesc <> progDesc "Check Ansible Playbook" <>
header "ansiblecheck - a testing framework for ansible")
where
operatingSystemP :: Parser String
operatingSystemP =
strOption ( short 'o'
<> long "os"
<> metavar "OPERATING_SYSTEM"
<> help "Operating System to Target")
operatingSystemVersionP :: Parser String
operatingSystemVersionP =
strOption ( short 's'
<> long "osv"
<> metavar "OS_VERSION"
<> help "Operating System Version to Target")
dependencyP :: Parser String
dependencyP =
strOption ( short 'd'
<> long "dep"
<> metavar "DEPENDENCY"
<> help "Ansible Galaxy Dependency to Add") | 1,462 | false | true | 0 | 10 | 495 | 380 | 172 | 208 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.