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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
mpickering/hackage-server | Distribution/Server/Framework/BlobStorage.hs | bsd-3-clause | withIncomingFile :: BlobStorage
-> FilePath
-> (FilePath -> BlobId -> IO (a, Bool))
-> IO a
withIncomingFile store file action =
do blobId <- fileBlobId file
withIncoming' store file blobId action | 258 | withIncomingFile :: BlobStorage
-> FilePath
-> (FilePath -> BlobId -> IO (a, Bool))
-> IO a
withIncomingFile store file action =
do blobId <- fileBlobId file
withIncoming' store file blobId action | 258 | withIncomingFile store file action =
do blobId <- fileBlobId file
withIncoming' store file blobId action | 115 | false | true | 0 | 12 | 92 | 75 | 36 | 39 | null | null |
itchyny/miv | src/VimScript.hs | mit | vimScriptToList :: VimScript -> [(Place, [Text])]
vimScriptToList (VimScript x) = M.toList x | 92 | vimScriptToList :: VimScript -> [(Place, [Text])]
vimScriptToList (VimScript x) = M.toList x | 92 | vimScriptToList (VimScript x) = M.toList x | 42 | false | true | 0 | 8 | 11 | 41 | 22 | 19 | null | null |
phischu/fragnix | builtins/base/Data.Data.hs | bsd-3-clause | equalityDataType :: DataType
equalityDataType = mkDataType "Data.Type.Equality.(:~:)" [reflConstr] | 98 | equalityDataType :: DataType
equalityDataType = mkDataType "Data.Type.Equality.(:~:)" [reflConstr] | 98 | equalityDataType = mkDataType "Data.Type.Equality.(:~:)" [reflConstr] | 69 | false | true | 0 | 6 | 7 | 25 | 11 | 14 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/enumFrom_2.hs | mit | ltEsMyInt :: MyInt -> MyInt -> MyBool
ltEsMyInt x y = fsEsOrdering (compareMyInt x y) GT | 92 | ltEsMyInt :: MyInt -> MyInt -> MyBool
ltEsMyInt x y = fsEsOrdering (compareMyInt x y) GT | 92 | ltEsMyInt x y = fsEsOrdering (compareMyInt x y) GT | 50 | false | true | 0 | 8 | 19 | 42 | 19 | 23 | null | null |
wavewave/devadmin | lib/Application/DevAdmin/Refactor/Parse/Import.hs | bsd-3-clause | maybeImportLine :: ParsecT String () Identity (Maybe ImportLine)
maybeImportLine = (try (Just <$> importLine))
<|>
return Nothing | 166 | maybeImportLine :: ParsecT String () Identity (Maybe ImportLine)
maybeImportLine = (try (Just <$> importLine))
<|>
return Nothing | 166 | maybeImportLine = (try (Just <$> importLine))
<|>
return Nothing | 101 | false | true | 1 | 9 | 53 | 51 | 24 | 27 | null | null |
kmate/raw-feldspar | src/Feldspar/Data/Storable.hs | bsd-3-clause | initStoreRepVec2 :: forall m vec
. ( Storable vec
, StoreSize vec ~ (Data Length, Data Length)
, Finite2 vec
, MonadComp m
)
=> vec -> m (StoreRep vec)
initStoreRepVec2 vec = do
st <- newStoreRep (Proxy :: Proxy vec) $ extent2 vec
writeStoreRep st vec
return st | 310 | initStoreRepVec2 :: forall m vec
. ( Storable vec
, StoreSize vec ~ (Data Length, Data Length)
, Finite2 vec
, MonadComp m
)
=> vec -> m (StoreRep vec)
initStoreRepVec2 vec = do
st <- newStoreRep (Proxy :: Proxy vec) $ extent2 vec
writeStoreRep st vec
return st | 310 | initStoreRepVec2 vec = do
st <- newStoreRep (Proxy :: Proxy vec) $ extent2 vec
writeStoreRep st vec
return st | 121 | false | true | 0 | 11 | 97 | 117 | 56 | 61 | null | null |
zeyuanxy/haskell-playground | ninety-nine-haskell-problems/vol1/10.hs | mit | encode :: (Eq a) => [a] -> [(Int, a)]
encode [] = [] | 52 | encode :: (Eq a) => [a] -> [(Int, a)]
encode [] = [] | 52 | encode [] = [] | 14 | false | true | 0 | 8 | 12 | 43 | 24 | 19 | null | null |
Daniel-Diaz/FTPLine | Main.hs | bsd-3-clause | ftplogin (Just (name, pass))
= do r <- withConnection $
\ c -> liftIO $ login c name (Just pass) Nothing
saveLogin name pass
return r | 163 | ftplogin (Just (name, pass))
= do r <- withConnection $
\ c -> liftIO $ login c name (Just pass) Nothing
saveLogin name pass
return r | 163 | ftplogin (Just (name, pass))
= do r <- withConnection $
\ c -> liftIO $ login c name (Just pass) Nothing
saveLogin name pass
return r | 163 | false | false | 0 | 13 | 55 | 70 | 33 | 37 | null | null |
kawamuray/ganeti | src/Ganeti/HTools/Cluster.hs | gpl-2.0 | nodeEvacInstance _ _ _ (Instance.Instance
{Instance.diskTemplate = DTFile}) _ _ =
fail "Instances of type file cannot be relocated" | 173 | nodeEvacInstance _ _ _ (Instance.Instance
{Instance.diskTemplate = DTFile}) _ _ =
fail "Instances of type file cannot be relocated" | 173 | nodeEvacInstance _ _ _ (Instance.Instance
{Instance.diskTemplate = DTFile}) _ _ =
fail "Instances of type file cannot be relocated" | 173 | false | false | 0 | 9 | 60 | 38 | 19 | 19 | null | null |
poxu/pandoc | src/Text/Pandoc/Readers/LaTeX.hs | gpl-2.0 | umlaut 'E' = "Ë" | 16 | umlaut 'E' = "Ë" | 16 | umlaut 'E' = "Ë" | 16 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
pjones/xmonad-test | vendor/xmonad-contrib/XMonad/Hooks/EwmhDesktops.hs | bsd-2-clause | setCurrentDesktop :: (Integral a) => a -> X ()
setCurrentDesktop i = withDisplay $ \dpy -> do
a <- getAtom "_NET_CURRENT_DESKTOP"
c <- getAtom "CARDINAL"
r <- asks theRoot
io $ changeProperty32 dpy r a c propModeReplace [fromIntegral i] | 252 | setCurrentDesktop :: (Integral a) => a -> X ()
setCurrentDesktop i = withDisplay $ \dpy -> do
a <- getAtom "_NET_CURRENT_DESKTOP"
c <- getAtom "CARDINAL"
r <- asks theRoot
io $ changeProperty32 dpy r a c propModeReplace [fromIntegral i] | 252 | setCurrentDesktop i = withDisplay $ \dpy -> do
a <- getAtom "_NET_CURRENT_DESKTOP"
c <- getAtom "CARDINAL"
r <- asks theRoot
io $ changeProperty32 dpy r a c propModeReplace [fromIntegral i] | 205 | false | true | 0 | 13 | 54 | 102 | 46 | 56 | null | null |
mattias-lundell/timber-llvm | src/Kindle.hs | bsd-3-clause | tInt = tId Int | 49 | tInt = tId Int | 49 | tInt = tId Int | 49 | false | false | 0 | 5 | 38 | 9 | 4 | 5 | null | null |
capital-match/bake | src/General/HTML.hs | bsd-3-clause | ol_ = tag_ "ol" | 15 | ol_ = tag_ "ol" | 15 | ol_ = tag_ "ol" | 15 | false | false | 1 | 5 | 3 | 12 | 4 | 8 | null | null |
tolysz/hiccup | Util.hs | lgpl-2.1 | -- catchAny :: TclM -> (SomeException -> IO a) -> TclM a
-- catchAny = catch
-- ifFails :: MonadError e m => m a -> a -> m a
ifFails f v = f `catchError` (\_ -> return v) | 171 | ifFails f v = f `catchError` (\_ -> return v) | 45 | ifFails f v = f `catchError` (\_ -> return v) | 45 | true | false | 1 | 9 | 40 | 39 | 19 | 20 | null | null |
kolmodin/cabal | cabal-install/tests/UnitTests/Distribution/Client/JobControl.hs | bsd-3-clause | tests :: [TestTree]
tests =
[ testGroup "serial"
[ testProperty "submit batch" prop_submit_serial
, testProperty "submit batch" prop_remaining_serial
, testProperty "submit interleaved" prop_interleaved_serial
, testProperty "concurrent jobs" prop_concurrent_serial
, testProperty "cancel" prop_cancel_serial
, testProperty "exceptions" prop_exception_serial
]
, testGroup "parallel"
[ testProperty "submit batch" prop_submit_parallel
, testProperty "submit batch" prop_remaining_parallel
, testProperty "submit interleaved" prop_interleaved_parallel
, testProperty "concurrent jobs" prop_concurrent_parallel
, testProperty "cancel" prop_cancel_parallel
, testProperty "exceptions" prop_exception_parallel
]
] | 869 | tests :: [TestTree]
tests =
[ testGroup "serial"
[ testProperty "submit batch" prop_submit_serial
, testProperty "submit batch" prop_remaining_serial
, testProperty "submit interleaved" prop_interleaved_serial
, testProperty "concurrent jobs" prop_concurrent_serial
, testProperty "cancel" prop_cancel_serial
, testProperty "exceptions" prop_exception_serial
]
, testGroup "parallel"
[ testProperty "submit batch" prop_submit_parallel
, testProperty "submit batch" prop_remaining_parallel
, testProperty "submit interleaved" prop_interleaved_parallel
, testProperty "concurrent jobs" prop_concurrent_parallel
, testProperty "cancel" prop_cancel_parallel
, testProperty "exceptions" prop_exception_parallel
]
] | 869 | tests =
[ testGroup "serial"
[ testProperty "submit batch" prop_submit_serial
, testProperty "submit batch" prop_remaining_serial
, testProperty "submit interleaved" prop_interleaved_serial
, testProperty "concurrent jobs" prop_concurrent_serial
, testProperty "cancel" prop_cancel_serial
, testProperty "exceptions" prop_exception_serial
]
, testGroup "parallel"
[ testProperty "submit batch" prop_submit_parallel
, testProperty "submit batch" prop_remaining_parallel
, testProperty "submit interleaved" prop_interleaved_parallel
, testProperty "concurrent jobs" prop_concurrent_parallel
, testProperty "cancel" prop_cancel_parallel
, testProperty "exceptions" prop_exception_parallel
]
] | 849 | false | true | 0 | 9 | 229 | 133 | 65 | 68 | null | null |
ghorn/classy-dvda | src/Classy/Utils.hs | bsd-3-clause | -- | Given two frames, finds the closest ancestor frame (in terms of dependency)
-- If all else fails, the newtonian reference frame is always a valid answer
lastCommonBases :: Bases -> Bases -> Bases
lastCommonBases frameA frameB = lastCommonList (reverse $ parentBasesChain frameA) (reverse $ parentBasesChain frameB) NewtonianBases | 335 | lastCommonBases :: Bases -> Bases -> Bases
lastCommonBases frameA frameB = lastCommonList (reverse $ parentBasesChain frameA) (reverse $ parentBasesChain frameB) NewtonianBases | 177 | lastCommonBases frameA frameB = lastCommonList (reverse $ parentBasesChain frameA) (reverse $ parentBasesChain frameB) NewtonianBases | 134 | true | true | 0 | 8 | 49 | 53 | 27 | 26 | null | null |
brow/noise | src/Text/Noise/Renderer/SVG/Attributes.hs | mit | rx :: D.Coordinate -> Attribute
rx = SVG.rx . stringValue . show | 64 | rx :: D.Coordinate -> Attribute
rx = SVG.rx . stringValue . show | 64 | rx = SVG.rx . stringValue . show | 32 | false | true | 0 | 7 | 11 | 34 | 15 | 19 | null | null |
gridaphobe/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | evVarsOfTypeable :: EvTypeable -> VarSet
evVarsOfTypeable ev =
case ev of
EvTypeableTyCon es -> evVarsOfTerms es
EvTypeableTyApp e1 e2 -> evVarsOfTerms [e1,e2]
EvTypeableTyLit e -> evVarsOfTerm e
{-
************************************************************************
* *
Pretty printing
* *
************************************************************************
-} | 549 | evVarsOfTypeable :: EvTypeable -> VarSet
evVarsOfTypeable ev =
case ev of
EvTypeableTyCon es -> evVarsOfTerms es
EvTypeableTyApp e1 e2 -> evVarsOfTerms [e1,e2]
EvTypeableTyLit e -> evVarsOfTerm e
{-
************************************************************************
* *
Pretty printing
* *
************************************************************************
-} | 549 | evVarsOfTypeable ev =
case ev of
EvTypeableTyCon es -> evVarsOfTerms es
EvTypeableTyApp e1 e2 -> evVarsOfTerms [e1,e2]
EvTypeableTyLit e -> evVarsOfTerm e
{-
************************************************************************
* *
Pretty printing
* *
************************************************************************
-} | 508 | false | true | 4 | 6 | 214 | 62 | 32 | 30 | null | null |
bitemyapp/protocol-buffers | hprotoc/Text/ProtocolBuffers/ProtoCompile/Identifiers.hs | apache-2.0 | toString :: Utf8 -> String
toString = U.toString . utf8 | 55 | toString :: Utf8 -> String
toString = U.toString . utf8 | 55 | toString = U.toString . utf8 | 28 | false | true | 1 | 7 | 9 | 29 | 12 | 17 | null | null |
quyse/flaw | flaw-lua/Flaw/Script/Lua/Operations.hs | mit | luaValueSet :: LuaMonad m => LuaValue m -> LuaValue m -> LuaValue m -> m ()
luaValueSet t i v = case t of
LuaTable
{ luaTable = tt
, luaTableLength = lenVar
, luaTableMetaTable = mtVar
} -> do
let
setExisting = case v of
LuaNil -> do
liftPrim $ HT.delete tt i
modifyMutVar' lenVar (+ (-1))
_ -> liftPrim $ HT.insert tt i v
setNew = case v of
LuaNil -> return ()
_ -> do
liftPrim $ HT.insert tt i v
modifyMutVar' lenVar (+ 1)
mv <- liftPrim $ HT.lookup tt i
case mv of
Just _ -> setExisting
Nothing -> do
mt <- readMutVar mtVar
case mt of
LuaTable
{ luaTable = mtt
} -> do
mmm <- liftPrim $ HT.lookup mtt $ LuaString "__newindex"
case mmm of
Just mm -> case mm of
LuaClosure
{ luaClosure = c
} -> void $ c [t, i, v]
nt@LuaTable {} -> luaValueSet nt i v
_ -> throwLuaError $ LuaBadOperation "__newindex"
Nothing -> setNew
_ -> setNew
_ -> throwLuaError $ LuaBadOperation "__newindex"
| 1,209 | luaValueSet :: LuaMonad m => LuaValue m -> LuaValue m -> LuaValue m -> m ()
luaValueSet t i v = case t of
LuaTable
{ luaTable = tt
, luaTableLength = lenVar
, luaTableMetaTable = mtVar
} -> do
let
setExisting = case v of
LuaNil -> do
liftPrim $ HT.delete tt i
modifyMutVar' lenVar (+ (-1))
_ -> liftPrim $ HT.insert tt i v
setNew = case v of
LuaNil -> return ()
_ -> do
liftPrim $ HT.insert tt i v
modifyMutVar' lenVar (+ 1)
mv <- liftPrim $ HT.lookup tt i
case mv of
Just _ -> setExisting
Nothing -> do
mt <- readMutVar mtVar
case mt of
LuaTable
{ luaTable = mtt
} -> do
mmm <- liftPrim $ HT.lookup mtt $ LuaString "__newindex"
case mmm of
Just mm -> case mm of
LuaClosure
{ luaClosure = c
} -> void $ c [t, i, v]
nt@LuaTable {} -> luaValueSet nt i v
_ -> throwLuaError $ LuaBadOperation "__newindex"
Nothing -> setNew
_ -> setNew
_ -> throwLuaError $ LuaBadOperation "__newindex"
| 1,209 | luaValueSet t i v = case t of
LuaTable
{ luaTable = tt
, luaTableLength = lenVar
, luaTableMetaTable = mtVar
} -> do
let
setExisting = case v of
LuaNil -> do
liftPrim $ HT.delete tt i
modifyMutVar' lenVar (+ (-1))
_ -> liftPrim $ HT.insert tt i v
setNew = case v of
LuaNil -> return ()
_ -> do
liftPrim $ HT.insert tt i v
modifyMutVar' lenVar (+ 1)
mv <- liftPrim $ HT.lookup tt i
case mv of
Just _ -> setExisting
Nothing -> do
mt <- readMutVar mtVar
case mt of
LuaTable
{ luaTable = mtt
} -> do
mmm <- liftPrim $ HT.lookup mtt $ LuaString "__newindex"
case mmm of
Just mm -> case mm of
LuaClosure
{ luaClosure = c
} -> void $ c [t, i, v]
nt@LuaTable {} -> luaValueSet nt i v
_ -> throwLuaError $ LuaBadOperation "__newindex"
Nothing -> setNew
_ -> setNew
_ -> throwLuaError $ LuaBadOperation "__newindex"
| 1,133 | false | true | 1 | 25 | 503 | 410 | 197 | 213 | null | null |
zouppen/stratum-tool | src/BitPay.hs | agpl-3.0 | rateToPair :: Value -> Parser (Text, Value)
rateToPair (Object v) = do
k <- v .: "code"
v <- v .: "rate"
return (toLower k,v) | 131 | rateToPair :: Value -> Parser (Text, Value)
rateToPair (Object v) = do
k <- v .: "code"
v <- v .: "rate"
return (toLower k,v) | 131 | rateToPair (Object v) = do
k <- v .: "code"
v <- v .: "rate"
return (toLower k,v) | 87 | false | true | 0 | 9 | 30 | 70 | 34 | 36 | null | null |
Southern-Exposure-Seed-Exchange/southernexposure.com | server/src/Routes/Admin/ProductSales.hs | gpl-3.0 | productSalesRoutes :: ProductSalesRoutes
productSalesRoutes =
productSalesListRoute
:<|> productSalesNewDataRoute
:<|> productSalesNewRoute
:<|> productSalesEditDataRoute
:<|> productSalesEditRoute | 222 | productSalesRoutes :: ProductSalesRoutes
productSalesRoutes =
productSalesListRoute
:<|> productSalesNewDataRoute
:<|> productSalesNewRoute
:<|> productSalesEditDataRoute
:<|> productSalesEditRoute | 222 | productSalesRoutes =
productSalesListRoute
:<|> productSalesNewDataRoute
:<|> productSalesNewRoute
:<|> productSalesEditDataRoute
:<|> productSalesEditRoute | 181 | false | true | 0 | 8 | 38 | 27 | 14 | 13 | null | null |
spencerjanssen/cabal2nix | src/Cabal2Nix/Name.hs | bsd-3-clause | libNixName "gtkglext-1.0" = return "gtkglext" | 67 | libNixName "gtkglext-1.0" = return "gtkglext" | 67 | libNixName "gtkglext-1.0" = return "gtkglext" | 67 | false | false | 0 | 5 | 26 | 12 | 5 | 7 | null | null |
nadyac/haskell-gol | src/gol.hs | mit | read_file :: IO ()
read_file = do
putStrLn "please enter a file name"
fileName <- getLine
fileContents <- readFile fileName
let file_lines = lines fileContents
putStrLn fileContents
let tuples = (read . head $ file_lines :: [(Int, Int)])
{-
let replacedMatrix = flip execState base_matrix $ do
mapM_ (\t -> modify $ replace t) tuples
-}
-- foldl :: (b -> a -> b) -> b -> [a] -> b
-- sum xs = fold (+) 0 xs
-- foldl :: (Matrix -> (Int,Int) -> Matrix) -> Matrix -> [(Int, Int)] -> Matrix
let replacedMatrix = foldl (flip replace) base_matrix tuples
printMatrix replacedMatrix
print "Done."
-- Print out the contents of the file | 725 | read_file :: IO ()
read_file = do
putStrLn "please enter a file name"
fileName <- getLine
fileContents <- readFile fileName
let file_lines = lines fileContents
putStrLn fileContents
let tuples = (read . head $ file_lines :: [(Int, Int)])
{-
let replacedMatrix = flip execState base_matrix $ do
mapM_ (\t -> modify $ replace t) tuples
-}
-- foldl :: (b -> a -> b) -> b -> [a] -> b
-- sum xs = fold (+) 0 xs
-- foldl :: (Matrix -> (Int,Int) -> Matrix) -> Matrix -> [(Int, Int)] -> Matrix
let replacedMatrix = foldl (flip replace) base_matrix tuples
printMatrix replacedMatrix
print "Done."
-- Print out the contents of the file | 725 | read_file = do
putStrLn "please enter a file name"
fileName <- getLine
fileContents <- readFile fileName
let file_lines = lines fileContents
putStrLn fileContents
let tuples = (read . head $ file_lines :: [(Int, Int)])
{-
let replacedMatrix = flip execState base_matrix $ do
mapM_ (\t -> modify $ replace t) tuples
-}
-- foldl :: (b -> a -> b) -> b -> [a] -> b
-- sum xs = fold (+) 0 xs
-- foldl :: (Matrix -> (Int,Int) -> Matrix) -> Matrix -> [(Int, Int)] -> Matrix
let replacedMatrix = foldl (flip replace) base_matrix tuples
printMatrix replacedMatrix
print "Done."
-- Print out the contents of the file | 706 | false | true | 0 | 13 | 212 | 134 | 62 | 72 | null | null |
jtojnar/hulk | src/Hulk/Client.hs | bsd-3-clause | thisClientReply :: RPL -> [Text] -> Hulk ()
thisClientReply typ params = do
ref <- getRef
clientReply ref typ params
-- | Send a client reply of the given type with the given params, on
-- the given connection reference. | 225 | thisClientReply :: RPL -> [Text] -> Hulk ()
thisClientReply typ params = do
ref <- getRef
clientReply ref typ params
-- | Send a client reply of the given type with the given params, on
-- the given connection reference. | 225 | thisClientReply typ params = do
ref <- getRef
clientReply ref typ params
-- | Send a client reply of the given type with the given params, on
-- the given connection reference. | 181 | false | true | 0 | 9 | 44 | 56 | 26 | 30 | null | null |
jozefg/c_of_scheme | src/CodeGen.hs | mit | generateSDec (Init v) = simpleSDec v 0 | 38 | generateSDec (Init v) = simpleSDec v 0 | 38 | generateSDec (Init v) = simpleSDec v 0 | 38 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
snoyberg/ghc | compiler/basicTypes/IdInfo.hs | bsd-3-clause | setOccInfo :: IdInfo -> OccInfo -> IdInfo
setOccInfo info oc = oc `seq` info { occInfo = oc } | 100 | setOccInfo :: IdInfo -> OccInfo -> IdInfo
setOccInfo info oc = oc `seq` info { occInfo = oc } | 100 | setOccInfo info oc = oc `seq` info { occInfo = oc } | 58 | false | true | 0 | 7 | 25 | 38 | 21 | 17 | null | null |
urbanslug/ghc | testsuite/tests/codeGen/should_run/cgrun068.hs | bsd-3-clause | toListM :: MArray s e -> ST s [e]
toListM marr =
sequence [read marr i | i <- [0..(length marr)-1]] | 103 | toListM :: MArray s e -> ST s [e]
toListM marr =
sequence [read marr i | i <- [0..(length marr)-1]] | 103 | toListM marr =
sequence [read marr i | i <- [0..(length marr)-1]] | 69 | false | true | 0 | 12 | 24 | 65 | 32 | 33 | null | null |
ghc-android/ghc | testsuite/tests/ghci/should_run/ghcirun004.hs | bsd-3-clause | 4540 = 4539 | 11 | 4540 = 4539 | 11 | 4540 = 4539 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
jstolarek/ghc | libraries/base/GHC/IO/Encoding.hs | bsd-3-clause | (getForeignEncoding, setForeignEncoding) = mkGlobal initForeignEncoding | 77 | (getForeignEncoding, setForeignEncoding) = mkGlobal initForeignEncoding | 77 | (getForeignEncoding, setForeignEncoding) = mkGlobal initForeignEncoding | 77 | false | false | 0 | 5 | 10 | 16 | 8 | 8 | null | null |
yangjueji/hblas | tests/UnitBLAS/Level1.hs | bsd-3-clause | vecTest1DDOT :: IO ()
vecTest1DDOT = do
left <- Matrix.generateMutableDenseVectorWithStride 12 2 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] !! idx)
right <- Matrix.generateMutableDenseVectorWithStride 6 1 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] !! idx)
res <- ddot 6 left right
res @?= 1 + 6 + 15 + 28 + 45 + 66 | 349 | vecTest1DDOT :: IO ()
vecTest1DDOT = do
left <- Matrix.generateMutableDenseVectorWithStride 12 2 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] !! idx)
right <- Matrix.generateMutableDenseVectorWithStride 6 1 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] !! idx)
res <- ddot 6 left right
res @?= 1 + 6 + 15 + 28 + 45 + 66 | 349 | vecTest1DDOT = do
left <- Matrix.generateMutableDenseVectorWithStride 12 2 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0] !! idx)
right <- Matrix.generateMutableDenseVectorWithStride 6 1 (\idx -> [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] !! idx)
res <- ddot 6 left right
res @?= 1 + 6 + 15 + 28 + 45 + 66 | 327 | false | true | 0 | 12 | 69 | 167 | 91 | 76 | null | null |
SWP-Ubau-SoSe2014-Haskell/SWPSoSe14 | src/RailEditor/Selection.hs | mit | -- | clears a selection and removes all selected characters
clear :: TAC.TextAreaContent -> TAC.Position -> IO (TAC.Position,TAC.Position)
clear tac pos@(x,y) = do
positions <- TAC.getSelectedPositons tac
if not (null positions) then do
cells <- Selection.getCellsByPositons tac positions
History.action tac (getMinimum positions) (TAC.Remove cells)
clearCells tac positions
return (getMinimum positions,getMaximum positions)
else return ((x-1,y),(x-1,y)) | 477 | clear :: TAC.TextAreaContent -> TAC.Position -> IO (TAC.Position,TAC.Position)
clear tac pos@(x,y) = do
positions <- TAC.getSelectedPositons tac
if not (null positions) then do
cells <- Selection.getCellsByPositons tac positions
History.action tac (getMinimum positions) (TAC.Remove cells)
clearCells tac positions
return (getMinimum positions,getMaximum positions)
else return ((x-1,y),(x-1,y)) | 417 | clear tac pos@(x,y) = do
positions <- TAC.getSelectedPositons tac
if not (null positions) then do
cells <- Selection.getCellsByPositons tac positions
History.action tac (getMinimum positions) (TAC.Remove cells)
clearCells tac positions
return (getMinimum positions,getMaximum positions)
else return ((x-1,y),(x-1,y)) | 338 | true | true | 0 | 13 | 75 | 178 | 89 | 89 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | wordTyCon :: TyCon
wordTyCon = pcNonRecDataTyCon wordTyConName
(Just (CType "" Nothing (fsLit "HsWord"))) []
[wordDataCon] | 182 | wordTyCon :: TyCon
wordTyCon = pcNonRecDataTyCon wordTyConName
(Just (CType "" Nothing (fsLit "HsWord"))) []
[wordDataCon] | 182 | wordTyCon = pcNonRecDataTyCon wordTyConName
(Just (CType "" Nothing (fsLit "HsWord"))) []
[wordDataCon] | 163 | false | true | 0 | 11 | 74 | 53 | 25 | 28 | null | null |
jgm/Markdown | Markdown.hs | bsd-3-clause | scannerPairs :: [(Scanner, Text -> Text -> BlockParser Blocks)]
scannerPairs = [
(scanBlockquoteStart, blockquoteParser)
, (scanIndentSpace, indentedCodeBlockParser)
, (scanAtxHeaderStart, atxHeaderParser)
, (scanCodeFenceLine, codeFenceParser)
, (scanReference, referenceParser)
, (scanHRuleLine, hruleParser)
, (scanNonindentSpaces >> scanListStart Nothing, listParser)
, (scanHtmlBlockStart, htmlBlockParser) ] | 431 | scannerPairs :: [(Scanner, Text -> Text -> BlockParser Blocks)]
scannerPairs = [
(scanBlockquoteStart, blockquoteParser)
, (scanIndentSpace, indentedCodeBlockParser)
, (scanAtxHeaderStart, atxHeaderParser)
, (scanCodeFenceLine, codeFenceParser)
, (scanReference, referenceParser)
, (scanHRuleLine, hruleParser)
, (scanNonindentSpaces >> scanListStart Nothing, listParser)
, (scanHtmlBlockStart, htmlBlockParser) ] | 431 | scannerPairs = [
(scanBlockquoteStart, blockquoteParser)
, (scanIndentSpace, indentedCodeBlockParser)
, (scanAtxHeaderStart, atxHeaderParser)
, (scanCodeFenceLine, codeFenceParser)
, (scanReference, referenceParser)
, (scanHRuleLine, hruleParser)
, (scanNonindentSpaces >> scanListStart Nothing, listParser)
, (scanHtmlBlockStart, htmlBlockParser) ] | 367 | false | true | 0 | 9 | 56 | 110 | 68 | 42 | null | null |
kmate/HaRe | old/testing/demote/D1_AstOut.hs | bsd-3-clause | sumSquares ((x : xs))
= sq + (sumSquares xs) where sq = x ^ pow | 67 | sumSquares ((x : xs))
= sq + (sumSquares xs) where sq = x ^ pow | 67 | sumSquares ((x : xs))
= sq + (sumSquares xs) where sq = x ^ pow | 67 | false | false | 3 | 8 | 18 | 45 | 21 | 24 | null | null |
ewestern/geos | src/Data/Geometry/Geos/Raw/Buffer.hs | mit | createBufferParams :: Geos BufferParams
createBufferParams = withGeos $ \h -> do
bp <- geos_BufferParamsCreate h
fp <- newForeignPtrEnv geos_BufferParamsDestroy h bp
return $ BufferParams fp | 196 | createBufferParams :: Geos BufferParams
createBufferParams = withGeos $ \h -> do
bp <- geos_BufferParamsCreate h
fp <- newForeignPtrEnv geos_BufferParamsDestroy h bp
return $ BufferParams fp | 196 | createBufferParams = withGeos $ \h -> do
bp <- geos_BufferParamsCreate h
fp <- newForeignPtrEnv geos_BufferParamsDestroy h bp
return $ BufferParams fp | 156 | false | true | 2 | 10 | 30 | 64 | 27 | 37 | null | null |
manyoo/reflex-dom | src-ghc/Reflex/Dom/Internal/Foreign.hs | bsd-3-clause | runWebGUI :: (WebView -> IO ()) -> IO ()
runWebGUI = runWebGUI' "GHCJS" | 71 | runWebGUI :: (WebView -> IO ()) -> IO ()
runWebGUI = runWebGUI' "GHCJS" | 71 | runWebGUI = runWebGUI' "GHCJS" | 30 | false | true | 0 | 9 | 12 | 35 | 17 | 18 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/SVGRectElement.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGRectElement.ry Mozilla SVGRectElement.ry documentation>
getRy :: (MonadDOM m) => SVGRectElement -> m SVGAnimatedLength
getRy self = liftDOM ((self ^. js "ry") >>= fromJSValUnchecked) | 241 | getRy :: (MonadDOM m) => SVGRectElement -> m SVGAnimatedLength
getRy self = liftDOM ((self ^. js "ry") >>= fromJSValUnchecked) | 126 | getRy self = liftDOM ((self ^. js "ry") >>= fromJSValUnchecked) | 63 | true | true | 0 | 10 | 25 | 56 | 27 | 29 | null | null |
alios/geojson-types | src/Data/GeoJSON/Intern.hs | bsd-3-clause | toAeson (Bson.UTC a) = toJSON a | 35 | toAeson (Bson.UTC a) = toJSON a | 35 | toAeson (Bson.UTC a) = toJSON a | 35 | false | false | 0 | 7 | 9 | 21 | 9 | 12 | null | null |
kim/amazonka | amazonka-iam/gen/Network/AWS/IAM/UpdateGroup.hs | mpl-2.0 | -- | New path for the group. Only include this if changing the group's path.
ugNewPath :: Lens' UpdateGroup (Maybe Text)
ugNewPath = lens _ugNewPath (\s a -> s { _ugNewPath = a }) | 179 | ugNewPath :: Lens' UpdateGroup (Maybe Text)
ugNewPath = lens _ugNewPath (\s a -> s { _ugNewPath = a }) | 102 | ugNewPath = lens _ugNewPath (\s a -> s { _ugNewPath = a }) | 58 | true | true | 0 | 9 | 33 | 46 | 25 | 21 | null | null |
icyfork/shellcheck | ShellCheck/Parser.hs | gpl-3.0 | readDoubleLiteral = do
id <- getNextId
s <- many1 readDoubleLiteralPart
return $ T_Literal id (concat s) | 116 | readDoubleLiteral = do
id <- getNextId
s <- many1 readDoubleLiteralPart
return $ T_Literal id (concat s) | 116 | readDoubleLiteral = do
id <- getNextId
s <- many1 readDoubleLiteralPart
return $ T_Literal id (concat s) | 116 | false | false | 1 | 11 | 27 | 45 | 18 | 27 | null | null |
mgold/elm-make | src/Utils/File.hs | bsd-3-clause | writeBinary :: (Binary.Binary a) => FilePath -> a -> IO ()
writeBinary path value =
do let dir = dropFileName path
createDirectoryIfMissing True dir
withBinaryFile path WriteMode $ \handle ->
LBS.hPut handle (Binary.encode value) | 254 | writeBinary :: (Binary.Binary a) => FilePath -> a -> IO ()
writeBinary path value =
do let dir = dropFileName path
createDirectoryIfMissing True dir
withBinaryFile path WriteMode $ \handle ->
LBS.hPut handle (Binary.encode value) | 254 | writeBinary path value =
do let dir = dropFileName path
createDirectoryIfMissing True dir
withBinaryFile path WriteMode $ \handle ->
LBS.hPut handle (Binary.encode value) | 195 | false | true | 0 | 13 | 58 | 97 | 44 | 53 | null | null |
keera-studios/pang-a-lambda | Yampa-0.10.4/src/FRP/Yampa/Event.hs | gpl-3.0 | mergeBy _ NoEvent re@(Event _) = re | 46 | mergeBy _ NoEvent re@(Event _) = re | 46 | mergeBy _ NoEvent re@(Event _) = re | 46 | false | false | 1 | 7 | 17 | 24 | 11 | 13 | null | null |
joelburget/graphreduction | src/Machine/Internal/GC/MarkScan.hs | bsd-3-clause | runMarkingMachine :: MarkingMachine -> MarkingMachine
runMarkingMachine machine = case machine^.pointsTo forwardP of
NAp a1 a2 -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NAp b a2)
& forwardP .~ a1
NData tag (p:ps) -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NData tag (b:ps))
& forwardP .~ p
-- these are all the same
node@(NData _ []) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NPrim{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NSupercomb{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NNum _) ->
machine & nodeAt forwardP .~ NMarked Done node
-- If we come across a node with some visits we're circularly seeing
-- it. Back slowly away from the node...
--
-- If it's marked as done we're returning to it through sharing. We
-- still don't need to do anything.
NMarked _ _ -> dispatchReturnVisit $ machine^.pointsTo backwardP
NInd a -> machine & forwardP .~ a
where f = machine^.forwardP
b = machine^.backwardP
dispatchReturnVisit (NMarked (Visits 1) (NAp b' a2)) =
machine & nodeAt backwardP .~ NMarked (Visits 2) (NAp f b')
& forwardP .~ a2
dispatchReturnVisit (NMarked (Visits 2) (NAp a1 b')) =
machine & nodeAt backwardP .~ NMarked Done (NAp a1 f)
& forwardP .~ b
& backwardP .~ b'
dispatchReturnVisit (NMarked (Visits n) (NData tag components))
| n < length components
= let newComponents = components
& ix (n-1) .~ (machine^.forwardP)
& ix n .~ reservedBack
newForward = components^?!ix n
reservedBack = components^?!ix (n-1)
in machine & nodeAt backwardP .~
NMarked (Visits (n+1)) (NData tag newComponents)
& forwardP .~ newForward
| otherwise
= let newComponents = components & ix (n-1) .~ f
in machine & nodeAt backwardP .~
NMarked Done (NData tag newComponents)
& forwardP .~ b
& backwardP .~ last components
dispatchReturnVisit x = error $ T.unpack $ textify $ showHeap $
machine^.machineHeap | 2,718 | runMarkingMachine :: MarkingMachine -> MarkingMachine
runMarkingMachine machine = case machine^.pointsTo forwardP of
NAp a1 a2 -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NAp b a2)
& forwardP .~ a1
NData tag (p:ps) -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NData tag (b:ps))
& forwardP .~ p
-- these are all the same
node@(NData _ []) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NPrim{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NSupercomb{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NNum _) ->
machine & nodeAt forwardP .~ NMarked Done node
-- If we come across a node with some visits we're circularly seeing
-- it. Back slowly away from the node...
--
-- If it's marked as done we're returning to it through sharing. We
-- still don't need to do anything.
NMarked _ _ -> dispatchReturnVisit $ machine^.pointsTo backwardP
NInd a -> machine & forwardP .~ a
where f = machine^.forwardP
b = machine^.backwardP
dispatchReturnVisit (NMarked (Visits 1) (NAp b' a2)) =
machine & nodeAt backwardP .~ NMarked (Visits 2) (NAp f b')
& forwardP .~ a2
dispatchReturnVisit (NMarked (Visits 2) (NAp a1 b')) =
machine & nodeAt backwardP .~ NMarked Done (NAp a1 f)
& forwardP .~ b
& backwardP .~ b'
dispatchReturnVisit (NMarked (Visits n) (NData tag components))
| n < length components
= let newComponents = components
& ix (n-1) .~ (machine^.forwardP)
& ix n .~ reservedBack
newForward = components^?!ix n
reservedBack = components^?!ix (n-1)
in machine & nodeAt backwardP .~
NMarked (Visits (n+1)) (NData tag newComponents)
& forwardP .~ newForward
| otherwise
= let newComponents = components & ix (n-1) .~ f
in machine & nodeAt backwardP .~
NMarked Done (NData tag newComponents)
& forwardP .~ b
& backwardP .~ last components
dispatchReturnVisit x = error $ T.unpack $ textify $ showHeap $
machine^.machineHeap | 2,718 | runMarkingMachine machine = case machine^.pointsTo forwardP of
NAp a1 a2 -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NAp b a2)
& forwardP .~ a1
NData tag (p:ps) -> machine & backwardP .~ f
& nodeAt forwardP .~
NMarked (Visits 1) (NData tag (b:ps))
& forwardP .~ p
-- these are all the same
node@(NData _ []) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NPrim{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NSupercomb{}) ->
machine & nodeAt forwardP .~ NMarked Done node
node@(NNum _) ->
machine & nodeAt forwardP .~ NMarked Done node
-- If we come across a node with some visits we're circularly seeing
-- it. Back slowly away from the node...
--
-- If it's marked as done we're returning to it through sharing. We
-- still don't need to do anything.
NMarked _ _ -> dispatchReturnVisit $ machine^.pointsTo backwardP
NInd a -> machine & forwardP .~ a
where f = machine^.forwardP
b = machine^.backwardP
dispatchReturnVisit (NMarked (Visits 1) (NAp b' a2)) =
machine & nodeAt backwardP .~ NMarked (Visits 2) (NAp f b')
& forwardP .~ a2
dispatchReturnVisit (NMarked (Visits 2) (NAp a1 b')) =
machine & nodeAt backwardP .~ NMarked Done (NAp a1 f)
& forwardP .~ b
& backwardP .~ b'
dispatchReturnVisit (NMarked (Visits n) (NData tag components))
| n < length components
= let newComponents = components
& ix (n-1) .~ (machine^.forwardP)
& ix n .~ reservedBack
newForward = components^?!ix n
reservedBack = components^?!ix (n-1)
in machine & nodeAt backwardP .~
NMarked (Visits (n+1)) (NData tag newComponents)
& forwardP .~ newForward
| otherwise
= let newComponents = components & ix (n-1) .~ f
in machine & nodeAt backwardP .~
NMarked Done (NData tag newComponents)
& forwardP .~ b
& backwardP .~ last components
dispatchReturnVisit x = error $ T.unpack $ textify $ showHeap $
machine^.machineHeap | 2,664 | false | true | 40 | 16 | 1,138 | 782 | 377 | 405 | null | null |
ezyang/ghc | testsuite/tests/codeGen/should_run/T9533c.hs | bsd-3-clause | -- Don't wrap literals that will be used at type Integer
f :: Integer -> Int
f n = case n of
0x100000000000000000000000 -> 1
0 -> 2
_ -> 3 | 144 | f :: Integer -> Int
f n = case n of
0x100000000000000000000000 -> 1
0 -> 2
_ -> 3 | 87 | f n = case n of
0x100000000000000000000000 -> 1
0 -> 2
_ -> 3 | 67 | true | true | 0 | 8 | 36 | 47 | 22 | 25 | null | null |
ChShersh/rogue-lang | src/Rogue/LLVM/Emitter.hs | bsd-3-clause | genBlockBody _ ( (S.Ret _) : _) = error "return expression not in the end of block (unreachable block)" | 119 | genBlockBody _ ( (S.Ret _) : _) = error "return expression not in the end of block (unreachable block)" | 119 | genBlockBody _ ( (S.Ret _) : _) = error "return expression not in the end of block (unreachable block)" | 119 | false | false | 0 | 10 | 34 | 29 | 14 | 15 | null | null |
unclechu/xmonadrc | xmobar/indicators-cmd/test/Spec.hs | gpl-3.0 | withApp :: (Client -> ProcessHandle -> Handle -> IO ()) -> IO ()
withApp m = withTmpDBus $ \client addr -> do
envList <- filter ((/= "DBUS_SESSION_BUS_ADDRESS") . fst) <$> getEnvironment
(lines -> head -> (++ "/bin") -> binDir) <-
readProcess "stack" ["path", "--local-install-root"] ""
(Nothing, Just pOut, _, pHandle) <-
createProcess
(proc (binDir ++ "/unclechu-xmobar-indicators-cmd") [])
{ std_in = NoStream
, std_out = CreatePipe
, std_err = Inherit
, env = Just $
("DBUS_SESSION_BUS_ADDRESS", formatAddress addr) : envList
}
m client pHandle pOut
`finally` (terminateProcess pHandle >> waitForProcess pHandle) | 700 | withApp :: (Client -> ProcessHandle -> Handle -> IO ()) -> IO ()
withApp m = withTmpDBus $ \client addr -> do
envList <- filter ((/= "DBUS_SESSION_BUS_ADDRESS") . fst) <$> getEnvironment
(lines -> head -> (++ "/bin") -> binDir) <-
readProcess "stack" ["path", "--local-install-root"] ""
(Nothing, Just pOut, _, pHandle) <-
createProcess
(proc (binDir ++ "/unclechu-xmobar-indicators-cmd") [])
{ std_in = NoStream
, std_out = CreatePipe
, std_err = Inherit
, env = Just $
("DBUS_SESSION_BUS_ADDRESS", formatAddress addr) : envList
}
m client pHandle pOut
`finally` (terminateProcess pHandle >> waitForProcess pHandle) | 700 | withApp m = withTmpDBus $ \client addr -> do
envList <- filter ((/= "DBUS_SESSION_BUS_ADDRESS") . fst) <$> getEnvironment
(lines -> head -> (++ "/bin") -> binDir) <-
readProcess "stack" ["path", "--local-install-root"] ""
(Nothing, Just pOut, _, pHandle) <-
createProcess
(proc (binDir ++ "/unclechu-xmobar-indicators-cmd") [])
{ std_in = NoStream
, std_out = CreatePipe
, std_err = Inherit
, env = Just $
("DBUS_SESSION_BUS_ADDRESS", formatAddress addr) : envList
}
m client pHandle pOut
`finally` (terminateProcess pHandle >> waitForProcess pHandle) | 635 | false | true | 0 | 16 | 173 | 232 | 123 | 109 | null | null |
garetxe/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | programConfigurationOptions
:: ProgramConfiguration
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programConfigurationOptions progConf showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOptions "PROG"]
ParseArgs -> map (programOptions . programName . fst)
(knownPrograms progConf)
where
programOptions prog =
option "" [prog ++ "-options"]
("give extra options to " ++ prog)
get set
(reqArg' "OPTS" (\args -> [(prog, splitArgs args)]) (const []))
-- ------------------------------------------------------------
-- * GetOpt Utils
-- ------------------------------------------------------------ | 841 | programConfigurationOptions
:: ProgramConfiguration
-> ShowOrParseArgs
-> (flags -> [(String, [String])])
-> ([(String, [String])] -> (flags -> flags))
-> [OptionField flags]
programConfigurationOptions progConf showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOptions "PROG"]
ParseArgs -> map (programOptions . programName . fst)
(knownPrograms progConf)
where
programOptions prog =
option "" [prog ++ "-options"]
("give extra options to " ++ prog)
get set
(reqArg' "OPTS" (\args -> [(prog, splitArgs args)]) (const []))
-- ------------------------------------------------------------
-- * GetOpt Utils
-- ------------------------------------------------------------ | 841 | programConfigurationOptions progConf showOrParseArgs get set =
case showOrParseArgs of
-- we don't want a verbose help text list so we just show a generic one:
ShowArgs -> [programOptions "PROG"]
ParseArgs -> map (programOptions . programName . fst)
(knownPrograms progConf)
where
programOptions prog =
option "" [prog ++ "-options"]
("give extra options to " ++ prog)
get set
(reqArg' "OPTS" (\args -> [(prog, splitArgs args)]) (const []))
-- ------------------------------------------------------------
-- * GetOpt Utils
-- ------------------------------------------------------------ | 656 | false | true | 0 | 14 | 173 | 216 | 116 | 100 | null | null |
ekmett/fixed-precision | Numeric/Fixed.hs | bsd-3-clause | floatPrecision :: RealFloat a => Tagged a M.Precision
floatPrecision = r
where
r = Tagged (fromIntegral (floatDigits (undefined `asArg1Of` r)))
asArg1Of :: a -> f a b -> a
asArg1Of = const
| 219 | floatPrecision :: RealFloat a => Tagged a M.Precision
floatPrecision = r
where
r = Tagged (fromIntegral (floatDigits (undefined `asArg1Of` r)))
asArg1Of :: a -> f a b -> a
asArg1Of = const
| 219 | floatPrecision = r
where
r = Tagged (fromIntegral (floatDigits (undefined `asArg1Of` r)))
asArg1Of :: a -> f a b -> a
asArg1Of = const
| 165 | false | true | 1 | 10 | 62 | 94 | 43 | 51 | null | null |
masterdezign/evochess | src/Lib.hs | gpl-3.0 | showP (Piece Black Pawn) = "p" | 30 | showP (Piece Black Pawn) = "p" | 30 | showP (Piece Black Pawn) = "p" | 30 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
ublubu/shapes-demo | src/Physics/Scenes/TwoFlyingBoxes.hs | mit | contactBehavior :: (Floating a) => ContactBehavior a
contactBehavior = ContactBehavior 0.01 0.02 | 96 | contactBehavior :: (Floating a) => ContactBehavior a
contactBehavior = ContactBehavior 0.01 0.02 | 96 | contactBehavior = ContactBehavior 0.01 0.02 | 43 | false | true | 0 | 6 | 11 | 28 | 14 | 14 | null | null |
dmpots/fibon | FindBench.hs | bsd-3-clause | benchInstanceDecl qBms = benchInstanceTypeDecl ++ (join ("\n") $ map defn qBms)
where
defn (g,bm) =
"benchInstance " ++ bm ++ " = " ++ (importAs g bm) ++ ".mkInstance" | 175 | benchInstanceDecl qBms = benchInstanceTypeDecl ++ (join ("\n") $ map defn qBms)
where
defn (g,bm) =
"benchInstance " ++ bm ++ " = " ++ (importAs g bm) ++ ".mkInstance" | 175 | benchInstanceDecl qBms = benchInstanceTypeDecl ++ (join ("\n") $ map defn qBms)
where
defn (g,bm) =
"benchInstance " ++ bm ++ " = " ++ (importAs g bm) ++ ".mkInstance" | 175 | false | false | 0 | 9 | 36 | 72 | 36 | 36 | null | null |
mrakgr/futhark | src/Futhark/Optimise/Simplifier/Rules.hs | bsd-3-clause | simplifyReshapeScratch :: LetTopDownRule lore u
simplifyReshapeScratch defOf _ (Reshape _ newshape v)
| Just (Scratch bt _) <- asPrimOp =<< defOf v =
Just $ Scratch bt $ newDims newshape | 192 | simplifyReshapeScratch :: LetTopDownRule lore u
simplifyReshapeScratch defOf _ (Reshape _ newshape v)
| Just (Scratch bt _) <- asPrimOp =<< defOf v =
Just $ Scratch bt $ newDims newshape | 192 | simplifyReshapeScratch defOf _ (Reshape _ newshape v)
| Just (Scratch bt _) <- asPrimOp =<< defOf v =
Just $ Scratch bt $ newDims newshape | 144 | false | true | 0 | 11 | 35 | 75 | 34 | 41 | null | null |
flocc-net/flocc | v0.1/Compiler/Types/TypeAssignment.hs | apache-2.0 | -- |tupleOffsetFunMap is a map from (tupSize,tupOffset) pairs
-- |to the names of the tuple accessor functions
tupleOffsetFunMap :: Map (Int,Int) String
tupleOffsetFunMap = Data.Map.fromList $ concat $ l'
where l' = [ [ ((tupSize,tupOffset),funName)
| (tupOffset,funName) <- zip [1..] funList ]
| (tupSize,funList) <- zip [1..] tupleOffsetFunctions ]
-- |getTupleAccessorFun takes the tuple size and tuple length
-- |and returns the function-name and var id of the tuple
-- |accessor function. | 535 | tupleOffsetFunMap :: Map (Int,Int) String
tupleOffsetFunMap = Data.Map.fromList $ concat $ l'
where l' = [ [ ((tupSize,tupOffset),funName)
| (tupOffset,funName) <- zip [1..] funList ]
| (tupSize,funList) <- zip [1..] tupleOffsetFunctions ]
-- |getTupleAccessorFun takes the tuple size and tuple length
-- |and returns the function-name and var id of the tuple
-- |accessor function. | 424 | tupleOffsetFunMap = Data.Map.fromList $ concat $ l'
where l' = [ [ ((tupSize,tupOffset),funName)
| (tupOffset,funName) <- zip [1..] funList ]
| (tupSize,funList) <- zip [1..] tupleOffsetFunctions ]
-- |getTupleAccessorFun takes the tuple size and tuple length
-- |and returns the function-name and var id of the tuple
-- |accessor function. | 382 | true | true | 0 | 10 | 113 | 108 | 63 | 45 | null | null |
cbrghostrider/Hacking | HackerRank/FunctionalProgramming/Recursion/superQueens_v2_slow.hs | mit | markDiagonalsUnsafe :: Int -> Coord -> Board
markDiagonalsUnsafe bsize crd@(cr, cc) =
let q1crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c+1))
q2crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c-1))
q3crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c+1))
q4crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c-1))
in q1crds ++ q2crds ++ q3crds ++ q4crds | 653 | markDiagonalsUnsafe :: Int -> Coord -> Board
markDiagonalsUnsafe bsize crd@(cr, cc) =
let q1crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c+1))
q2crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c-1))
q3crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c+1))
q4crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c-1))
in q1crds ++ q2crds ++ q3crds ++ q4crds | 653 | markDiagonalsUnsafe bsize crd@(cr, cc) =
let q1crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c+1))
q2crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r-1, c-1))
q3crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c+1))
q4crds = filter (onBoardCell bsize) . scanl (\acc f -> f acc) (cr, cc) . take (bsize - 1) . repeat $ (\(r, c) -> (r+1, c-1))
in q1crds ++ q2crds ++ q3crds ++ q4crds | 608 | false | true | 0 | 16 | 152 | 419 | 226 | 193 | null | null |
nushio3/ghc | compiler/basicTypes/SrcLoc.hs | bsd-3-clause | unLoc :: GenLocated l e -> e
unLoc (L _ e) = e | 46 | unLoc :: GenLocated l e -> e
unLoc (L _ e) = e | 46 | unLoc (L _ e) = e | 17 | false | true | 0 | 9 | 12 | 37 | 16 | 21 | null | null |
eligottlieb/Calumbda | src/UntypedLambda.hs | mit | dynamicType (Abstraction _ _ _) = Arrow | 39 | dynamicType (Abstraction _ _ _) = Arrow | 39 | dynamicType (Abstraction _ _ _) = Arrow | 39 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
jbearer/hspl | src/Control/Hspl/Internal/Unification.hs | mit | -- | Compute the most general unifier for two 'Term's. A "most general unifier" is a 'Unifier' that
-- cannot be created by composing (@<>@) two smaller unifiers. This function will fail with
-- 'Nothing' if the two terms cannot be unified.
mgu :: MonadUnification m => Term a -> Term a -> m Unifier
mgu (Variable Anon) _ = return M.empty | 338 | mgu :: MonadUnification m => Term a -> Term a -> m Unifier
mgu (Variable Anon) _ = return M.empty | 97 | mgu (Variable Anon) _ = return M.empty | 38 | true | true | 0 | 11 | 61 | 59 | 27 | 32 | null | null |
benzrf/board | src/Game/Board/CommImpl.hs | lgpl-3.0 | anyWith (ForallC _ _ c) = anyWith c | 35 | anyWith (ForallC _ _ c) = anyWith c | 35 | anyWith (ForallC _ _ c) = anyWith c | 35 | false | false | 0 | 6 | 7 | 23 | 10 | 13 | null | null |
nushio3/ghc | compiler/basicTypes/RdrName.hs | bsd-3-clause | greOccName gre = nameOccName (gre_name gre) | 86 | greOccName gre = nameOccName (gre_name gre) | 86 | greOccName gre = nameOccName (gre_name gre) | 86 | false | false | 0 | 7 | 48 | 18 | 8 | 10 | null | null |
kejace/alto | app/Main.hs | mit | ------
runEval :: Eval a -> a
runEval (Eval ret) = ret | 55 | runEval :: Eval a -> a
runEval (Eval ret) = ret | 47 | runEval (Eval ret) = ret | 24 | true | true | 0 | 7 | 12 | 28 | 14 | 14 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/Core31/Tokens.hs | bsd-3-clause | gl_RGB16UI :: GLenum
gl_RGB16UI = 0x8D77 | 40 | gl_RGB16UI :: GLenum
gl_RGB16UI = 0x8D77 | 40 | gl_RGB16UI = 0x8D77 | 19 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
ucsd-progsys/liquidhaskell-tutorial | filters/Figures.hs | mit | resetChapter LATEX _ _ = return () | 41 | resetChapter LATEX _ _ = return () | 41 | resetChapter LATEX _ _ = return () | 41 | false | false | 0 | 6 | 13 | 18 | 8 | 10 | null | null |
joom/civ | src/Main.hs | mit | framebufferSizeCallback tc win w h = atomically $ writeTQueue tc $ EventFramebufferSize win w h | 102 | framebufferSizeCallback tc win w h = atomically $ writeTQueue tc $ EventFramebufferSize win w h | 102 | framebufferSizeCallback tc win w h = atomically $ writeTQueue tc $ EventFramebufferSize win w h | 102 | false | false | 0 | 7 | 21 | 33 | 15 | 18 | null | null |
fgaray/shakespeare | Text/MkSizeType.hs | mit | numInstanceDec :: Name -> Dec
numInstanceDec name = InstanceD [] (instanceType "Num" name) decs
where decs = map (binaryFunDec name) ["+", "*", "-"] ++
map (unariFunDec1 name) ["abs", "signum"] ++
[unariFunDec2 name "fromInteger"] | 262 | numInstanceDec :: Name -> Dec
numInstanceDec name = InstanceD [] (instanceType "Num" name) decs
where decs = map (binaryFunDec name) ["+", "*", "-"] ++
map (unariFunDec1 name) ["abs", "signum"] ++
[unariFunDec2 name "fromInteger"] | 262 | numInstanceDec name = InstanceD [] (instanceType "Num" name) decs
where decs = map (binaryFunDec name) ["+", "*", "-"] ++
map (unariFunDec1 name) ["abs", "signum"] ++
[unariFunDec2 name "fromInteger"] | 232 | false | true | 0 | 9 | 64 | 96 | 49 | 47 | null | null |
uuhan/Idris-dev | src/Idris/REPL.hs | bsd-3-clause | -- Elaborate as if LHS of a pattern (debug command)
process fn (Pattelab t)
= do (tm, ty) <- elabVal (recinfo (fileFC "toplevel")) ELHS t
iPrintResult $ show tm ++ "\n\n : " ++ show ty | 199 | process fn (Pattelab t)
= do (tm, ty) <- elabVal (recinfo (fileFC "toplevel")) ELHS t
iPrintResult $ show tm ++ "\n\n : " ++ show ty | 147 | process fn (Pattelab t)
= do (tm, ty) <- elabVal (recinfo (fileFC "toplevel")) ELHS t
iPrintResult $ show tm ++ "\n\n : " ++ show ty | 147 | true | false | 0 | 12 | 50 | 71 | 34 | 37 | null | null |
gallais/potpourri | haskell/nurules/TypeCheck.hs | gpl-3.0 | check _ Nat Zro = return () | 53 | check _ Nat Zro = return () | 53 | check _ Nat Zro = return () | 53 | false | false | 0 | 6 | 32 | 18 | 8 | 10 | null | null |
ssaavedra/liquidhaskell | src/Language/Haskell/Liquid/Constraint/Axioms.hs | bsd-3-clause | makeAxioms =
do recs <- ae_recs <$> get
tce <- ae_emb <$> get
sigs <- ae_sigs <$> get
gs <- ae_globals <$> get
let (rgs, gs') = L.partition (`elem` (fst <$> recs)) $ filter returnsProof gs
let as1 = varToPAxiom tce sigs <$> gs'
let as2 = varToPAxiomWithGuard tce sigs recs <$> rgs
return (as1 ++ as2) | 350 | makeAxioms =
do recs <- ae_recs <$> get
tce <- ae_emb <$> get
sigs <- ae_sigs <$> get
gs <- ae_globals <$> get
let (rgs, gs') = L.partition (`elem` (fst <$> recs)) $ filter returnsProof gs
let as1 = varToPAxiom tce sigs <$> gs'
let as2 = varToPAxiomWithGuard tce sigs recs <$> rgs
return (as1 ++ as2) | 350 | makeAxioms =
do recs <- ae_recs <$> get
tce <- ae_emb <$> get
sigs <- ae_sigs <$> get
gs <- ae_globals <$> get
let (rgs, gs') = L.partition (`elem` (fst <$> recs)) $ filter returnsProof gs
let as1 = varToPAxiom tce sigs <$> gs'
let as2 = varToPAxiomWithGuard tce sigs recs <$> rgs
return (as1 ++ as2) | 350 | false | false | 0 | 14 | 106 | 144 | 69 | 75 | null | null |
beni55/hermit | src/HERMIT/Core.hs | bsd-2-clause | -----------------------------------------------------------------------
-- $freeVarsNote
-- The GHC Function exprFreeVars defined in "CoreFVs" only returns *locally-defined* free variables.
-- In HERMIT, this is typically not what we want, so we define our own functions.
-- We reuse some of the functionality in "CoreFVs", but alas much of it is not exposed, so we have to reimplement some of it.
-- We do not use GHC's exprSomeFreeVars because it does not return the full set of free vars for a Var.
-- It only returns the Var itself, rather than extendVarSet (freeVarsVar v) v like it should.
-- | Find all free identifiers in an expression.
freeIdsExpr :: CoreExpr -> IdSet
freeIdsExpr = filterVarSet isId . freeVarsExpr | 726 | freeIdsExpr :: CoreExpr -> IdSet
freeIdsExpr = filterVarSet isId . freeVarsExpr | 79 | freeIdsExpr = filterVarSet isId . freeVarsExpr | 46 | true | true | 0 | 6 | 115 | 30 | 19 | 11 | null | null |
kuribas/metatyper | src/Parselang.hs | gpl-3.0 | parseArgList :: TypedVal -> MetaParser TypedVal
parseArgList (TypedVal (FunType a b) f) =
do e <- castType a term
someSpace
case b of
FunType _ _ -> char ',' >> someSpace
_ -> return ()
parseArgList $ TypedVal b $ f e | 248 | parseArgList :: TypedVal -> MetaParser TypedVal
parseArgList (TypedVal (FunType a b) f) =
do e <- castType a term
someSpace
case b of
FunType _ _ -> char ',' >> someSpace
_ -> return ()
parseArgList $ TypedVal b $ f e | 248 | parseArgList (TypedVal (FunType a b) f) =
do e <- castType a term
someSpace
case b of
FunType _ _ -> char ',' >> someSpace
_ -> return ()
parseArgList $ TypedVal b $ f e | 200 | false | true | 0 | 11 | 72 | 105 | 47 | 58 | null | null |
luispedro/NGH | Data/NGH/Formats/Tests/Sam.hs | mit | case_all = (length alignments) @?= 7 | 36 | case_all = (length alignments) @?= 7 | 36 | case_all = (length alignments) @?= 7 | 36 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
neothemachine/monadiccp | src/Control/CP/FD/Interface.hs | bsd-3-clause | loopall :: (Term s ModelInt, Term s ModelBool, Term s ModelCol, Constraint s ~ Either Model q, MonadTree m, TreeSolver m ~ s) => (ModelInt,ModelInt) -> (ModelInt -> Tree DummySolver ()) -> m ()
-- loopall r f = exists $ \nv -> addM $ Sugar.loopall r $ mm nv $ treeToModel $ f nv
loopall r f = addM $ Sugar.loopall r (treeToModel . f) | 333 | loopall :: (Term s ModelInt, Term s ModelBool, Term s ModelCol, Constraint s ~ Either Model q, MonadTree m, TreeSolver m ~ s) => (ModelInt,ModelInt) -> (ModelInt -> Tree DummySolver ()) -> m ()
loopall r f = addM $ Sugar.loopall r (treeToModel . f) | 248 | loopall r f = addM $ Sugar.loopall r (treeToModel . f) | 54 | true | true | 2 | 12 | 65 | 133 | 65 | 68 | null | null |
MichielDerhaeg/stack | src/Stack/Package.hs | bsd-3-clause | readPackageUnresolved :: (MonadIO m, MonadThrow m)
=> Path Abs File
-> m ([PWarning],GenericPackageDescription)
readPackageUnresolved cabalfp =
liftIO (BS.readFile (FL.toFilePath cabalfp))
>>= readPackageUnresolvedBS (PLOther $ PLFilePath $ toFilePath cabalfp) | 308 | readPackageUnresolved :: (MonadIO m, MonadThrow m)
=> Path Abs File
-> m ([PWarning],GenericPackageDescription)
readPackageUnresolved cabalfp =
liftIO (BS.readFile (FL.toFilePath cabalfp))
>>= readPackageUnresolvedBS (PLOther $ PLFilePath $ toFilePath cabalfp) | 308 | readPackageUnresolved cabalfp =
liftIO (BS.readFile (FL.toFilePath cabalfp))
>>= readPackageUnresolvedBS (PLOther $ PLFilePath $ toFilePath cabalfp) | 152 | false | true | 2 | 10 | 75 | 92 | 46 | 46 | null | null |
da-x/Algorithm-W-Step-By-Step | Lamdu/Infer.hs | gpl-3.0 | inferInternal ::
(Type -> Scope -> a -> b) ->
Loaded -> Scope -> Val a -> Infer (Val b)
inferInternal f loaded =
(fmap . fmap) snd . go
where
go locals (Val pl body) =
( case body of
V.BLeaf leaf -> inferLeaf (loadedGlobalTypes loaded) leaf
V.BAbs lam -> inferAbs lam
V.BApp app -> inferApply app
V.BGetField getField -> inferGetField getField
V.BInject inject -> inferInject inject
V.BCase case_ -> inferCase case_
V.BRecExtend recExtend -> inferRecExtend recExtend
V.BFromNom nom -> inferFromNom (loadedNominals loaded) nom
V.BToNom nom -> inferToNom (loadedNominals loaded) nom
) go locals
<&> \(body', typ) -> (typ, Val (f typ locals pl) body') | 834 | inferInternal ::
(Type -> Scope -> a -> b) ->
Loaded -> Scope -> Val a -> Infer (Val b)
inferInternal f loaded =
(fmap . fmap) snd . go
where
go locals (Val pl body) =
( case body of
V.BLeaf leaf -> inferLeaf (loadedGlobalTypes loaded) leaf
V.BAbs lam -> inferAbs lam
V.BApp app -> inferApply app
V.BGetField getField -> inferGetField getField
V.BInject inject -> inferInject inject
V.BCase case_ -> inferCase case_
V.BRecExtend recExtend -> inferRecExtend recExtend
V.BFromNom nom -> inferFromNom (loadedNominals loaded) nom
V.BToNom nom -> inferToNom (loadedNominals loaded) nom
) go locals
<&> \(body', typ) -> (typ, Val (f typ locals pl) body') | 834 | inferInternal f loaded =
(fmap . fmap) snd . go
where
go locals (Val pl body) =
( case body of
V.BLeaf leaf -> inferLeaf (loadedGlobalTypes loaded) leaf
V.BAbs lam -> inferAbs lam
V.BApp app -> inferApply app
V.BGetField getField -> inferGetField getField
V.BInject inject -> inferInject inject
V.BCase case_ -> inferCase case_
V.BRecExtend recExtend -> inferRecExtend recExtend
V.BFromNom nom -> inferFromNom (loadedNominals loaded) nom
V.BToNom nom -> inferToNom (loadedNominals loaded) nom
) go locals
<&> \(body', typ) -> (typ, Val (f typ locals pl) body') | 738 | false | true | 0 | 13 | 291 | 292 | 138 | 154 | null | null |
gnn/Hets | OWL2/Keywords.hs | gpl-2.0 | dateTimeStampS :: String
dateTimeStampS = "dateTimeStamp" | 57 | dateTimeStampS :: String
dateTimeStampS = "dateTimeStamp" | 57 | dateTimeStampS = "dateTimeStamp" | 32 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
bitc/crap-chopper-game | GameState.hs | mit | setChopper :: Chopper -> GameState -> GameState
setChopper c gs = gs { gsChopper = c } | 86 | setChopper :: Chopper -> GameState -> GameState
setChopper c gs = gs { gsChopper = c } | 86 | setChopper c gs = gs { gsChopper = c } | 38 | false | true | 0 | 6 | 16 | 32 | 17 | 15 | null | null |
frantisekfarka/ghc-dsi | compiler/main/DynFlags.hs | bsd-3-clause | wayExtras _ WayEventLog dflags = dflags | 39 | wayExtras _ WayEventLog dflags = dflags | 39 | wayExtras _ WayEventLog dflags = dflags | 39 | false | false | 0 | 5 | 5 | 13 | 6 | 7 | null | null |
GaloisInc/halvm-ghc | compiler/typecheck/TcType.hs | bsd-3-clause | tcIsTyVarTy (CastTy ty _) = tcIsTyVarTy ty | 42 | tcIsTyVarTy (CastTy ty _) = tcIsTyVarTy ty | 42 | tcIsTyVarTy (CastTy ty _) = tcIsTyVarTy ty | 42 | false | false | 0 | 6 | 6 | 21 | 9 | 12 | null | null |
aBhallo/AoC2016 | Day 18/day18part2.hs | mit | isSafe ('^', '.', '.') = False | 30 | isSafe ('^', '.', '.') = False | 30 | isSafe ('^', '.', '.') = False | 30 | false | false | 0 | 5 | 5 | 19 | 10 | 9 | null | null |
acowley/ghc | compiler/deSugar/DsArrows.hs | bsd-3-clause | mkSndExpr :: Type -> Type -> DsM CoreExpr
mkSndExpr a_ty b_ty = do
a_var <- newSysLocalDs a_ty
b_var <- newSysLocalDs b_ty
pair_var <- newSysLocalDs (mkCorePairTy a_ty b_ty)
return (Lam pair_var
(coreCasePair pair_var a_var b_var (Var b_var)))
{-
Build case analysis of a tuple. This cannot be done in the DsM monad,
because the list of variables is typically not yet defined.
-}
-- coreCaseTuple [u1..] v [x1..xn] body
-- = case v of v { (x1, .., xn) -> body }
-- But the matching may be nested if the tuple is very big | 559 | mkSndExpr :: Type -> Type -> DsM CoreExpr
mkSndExpr a_ty b_ty = do
a_var <- newSysLocalDs a_ty
b_var <- newSysLocalDs b_ty
pair_var <- newSysLocalDs (mkCorePairTy a_ty b_ty)
return (Lam pair_var
(coreCasePair pair_var a_var b_var (Var b_var)))
{-
Build case analysis of a tuple. This cannot be done in the DsM monad,
because the list of variables is typically not yet defined.
-}
-- coreCaseTuple [u1..] v [x1..xn] body
-- = case v of v { (x1, .., xn) -> body }
-- But the matching may be nested if the tuple is very big | 559 | mkSndExpr a_ty b_ty = do
a_var <- newSysLocalDs a_ty
b_var <- newSysLocalDs b_ty
pair_var <- newSysLocalDs (mkCorePairTy a_ty b_ty)
return (Lam pair_var
(coreCasePair pair_var a_var b_var (Var b_var)))
{-
Build case analysis of a tuple. This cannot be done in the DsM monad,
because the list of variables is typically not yet defined.
-}
-- coreCaseTuple [u1..] v [x1..xn] body
-- = case v of v { (x1, .., xn) -> body }
-- But the matching may be nested if the tuple is very big | 517 | false | true | 0 | 13 | 132 | 101 | 48 | 53 | null | null |
shlevy/ghc | libraries/ghc-compact/GHC/Compact/Serialized.hs | bsd-3-clause | importCompactByteStrings :: SerializedCompact a -> [ByteString.ByteString] ->
IO (Maybe (Compact a))
importCompactByteStrings serialized stringList =
-- sanity check stringList first - if we throw an exception later we leak
-- memory!
if not (sanityCheckByteStrings serialized stringList) then
return Nothing
else do
state <- newIORef stringList
let filler :: Ptr Word8 -> Word -> IO ()
filler to size = do
-- this pattern match will never fail
(next:rest) <- readIORef state
let (fp, off, _) = toForeignPtr next
withForeignPtr fp $ \from -> do
copyBytes to (from `plusPtr` off) (fromIntegral size)
writeIORef state rest
importCompact serialized filler | 774 | importCompactByteStrings :: SerializedCompact a -> [ByteString.ByteString] ->
IO (Maybe (Compact a))
importCompactByteStrings serialized stringList =
-- sanity check stringList first - if we throw an exception later we leak
-- memory!
if not (sanityCheckByteStrings serialized stringList) then
return Nothing
else do
state <- newIORef stringList
let filler :: Ptr Word8 -> Word -> IO ()
filler to size = do
-- this pattern match will never fail
(next:rest) <- readIORef state
let (fp, off, _) = toForeignPtr next
withForeignPtr fp $ \from -> do
copyBytes to (from `plusPtr` off) (fromIntegral size)
writeIORef state rest
importCompact serialized filler | 774 | importCompactByteStrings serialized stringList =
-- sanity check stringList first - if we throw an exception later we leak
-- memory!
if not (sanityCheckByteStrings serialized stringList) then
return Nothing
else do
state <- newIORef stringList
let filler :: Ptr Word8 -> Word -> IO ()
filler to size = do
-- this pattern match will never fail
(next:rest) <- readIORef state
let (fp, off, _) = toForeignPtr next
withForeignPtr fp $ \from -> do
copyBytes to (from `plusPtr` off) (fromIntegral size)
writeIORef state rest
importCompact serialized filler | 645 | false | true | 0 | 19 | 218 | 212 | 102 | 110 | null | null |
plaprade/haskoin | haskoin-core/src/Network/Haskoin/Script/SigHash.hs | unlicense | isSigAll :: SigHash -> Bool
isSigAll sh = case sh of
SigAll _ -> True
_ -> False
-- | Returns True if the 'SigHash' has the value SigNone. | 154 | isSigAll :: SigHash -> Bool
isSigAll sh = case sh of
SigAll _ -> True
_ -> False
-- | Returns True if the 'SigHash' has the value SigNone. | 154 | isSigAll sh = case sh of
SigAll _ -> True
_ -> False
-- | Returns True if the 'SigHash' has the value SigNone. | 126 | false | true | 3 | 5 | 44 | 36 | 19 | 17 | null | null |
grzegorzbalcerek/chess-haskell | Chess/Board.hs | mit | -- | The board state when the game starts.
startingBoard :: Board
startingBoard = Map.fromList [
(Field 1 1, Figure Rook White),
(Field 2 1, Figure Knight White),
(Field 3 1, Figure Bishop White),
(Field 4 1, Figure Queen White),
(Field 5 1, Figure King White),
(Field 6 1, Figure Bishop White),
(Field 7 1, Figure Knight White),
(Field 8 1, Figure Rook White),
(Field 1 2, Figure Pawn White),
(Field 2 2, Figure Pawn White),
(Field 3 2, Figure Pawn White),
(Field 4 2, Figure Pawn White),
(Field 5 2, Figure Pawn White),
(Field 6 2, Figure Pawn White),
(Field 7 2, Figure Pawn White),
(Field 8 2, Figure Pawn White),
(Field 1 7, Figure Pawn Black),
(Field 2 7, Figure Pawn Black),
(Field 3 7, Figure Pawn Black),
(Field 4 7, Figure Pawn Black),
(Field 5 7, Figure Pawn Black),
(Field 6 7, Figure Pawn Black),
(Field 7 7, Figure Pawn Black),
(Field 8 7, Figure Pawn Black),
(Field 1 8, Figure Rook Black),
(Field 2 8, Figure Knight Black),
(Field 3 8, Figure Bishop Black),
(Field 4 8, Figure Queen Black),
(Field 5 8, Figure King Black),
(Field 6 8, Figure Bishop Black),
(Field 7 8, Figure Knight Black),
(Field 8 8, Figure Rook Black)] | 1,202 | startingBoard :: Board
startingBoard = Map.fromList [
(Field 1 1, Figure Rook White),
(Field 2 1, Figure Knight White),
(Field 3 1, Figure Bishop White),
(Field 4 1, Figure Queen White),
(Field 5 1, Figure King White),
(Field 6 1, Figure Bishop White),
(Field 7 1, Figure Knight White),
(Field 8 1, Figure Rook White),
(Field 1 2, Figure Pawn White),
(Field 2 2, Figure Pawn White),
(Field 3 2, Figure Pawn White),
(Field 4 2, Figure Pawn White),
(Field 5 2, Figure Pawn White),
(Field 6 2, Figure Pawn White),
(Field 7 2, Figure Pawn White),
(Field 8 2, Figure Pawn White),
(Field 1 7, Figure Pawn Black),
(Field 2 7, Figure Pawn Black),
(Field 3 7, Figure Pawn Black),
(Field 4 7, Figure Pawn Black),
(Field 5 7, Figure Pawn Black),
(Field 6 7, Figure Pawn Black),
(Field 7 7, Figure Pawn Black),
(Field 8 7, Figure Pawn Black),
(Field 1 8, Figure Rook Black),
(Field 2 8, Figure Knight Black),
(Field 3 8, Figure Bishop Black),
(Field 4 8, Figure Queen Black),
(Field 5 8, Figure King Black),
(Field 6 8, Figure Bishop Black),
(Field 7 8, Figure Knight Black),
(Field 8 8, Figure Rook Black)] | 1,159 | startingBoard = Map.fromList [
(Field 1 1, Figure Rook White),
(Field 2 1, Figure Knight White),
(Field 3 1, Figure Bishop White),
(Field 4 1, Figure Queen White),
(Field 5 1, Figure King White),
(Field 6 1, Figure Bishop White),
(Field 7 1, Figure Knight White),
(Field 8 1, Figure Rook White),
(Field 1 2, Figure Pawn White),
(Field 2 2, Figure Pawn White),
(Field 3 2, Figure Pawn White),
(Field 4 2, Figure Pawn White),
(Field 5 2, Figure Pawn White),
(Field 6 2, Figure Pawn White),
(Field 7 2, Figure Pawn White),
(Field 8 2, Figure Pawn White),
(Field 1 7, Figure Pawn Black),
(Field 2 7, Figure Pawn Black),
(Field 3 7, Figure Pawn Black),
(Field 4 7, Figure Pawn Black),
(Field 5 7, Figure Pawn Black),
(Field 6 7, Figure Pawn Black),
(Field 7 7, Figure Pawn Black),
(Field 8 7, Figure Pawn Black),
(Field 1 8, Figure Rook Black),
(Field 2 8, Figure Knight Black),
(Field 3 8, Figure Bishop Black),
(Field 4 8, Figure Queen Black),
(Field 5 8, Figure King Black),
(Field 6 8, Figure Bishop Black),
(Field 7 8, Figure Knight Black),
(Field 8 8, Figure Rook Black)] | 1,136 | true | true | 0 | 8 | 271 | 625 | 329 | 296 | null | null |
brendanhay/gogol | gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Regions/WorkflowTemplates/Create.hs | mpl-2.0 | -- | Legacy upload protocol for media (e.g. \"media\", \"multipart\").
prwtcUploadType :: Lens' ProjectsRegionsWorkflowTemplatesCreate (Maybe Text)
prwtcUploadType
= lens _prwtcUploadType
(\ s a -> s{_prwtcUploadType = a}) | 230 | prwtcUploadType :: Lens' ProjectsRegionsWorkflowTemplatesCreate (Maybe Text)
prwtcUploadType
= lens _prwtcUploadType
(\ s a -> s{_prwtcUploadType = a}) | 159 | prwtcUploadType
= lens _prwtcUploadType
(\ s a -> s{_prwtcUploadType = a}) | 82 | true | true | 1 | 9 | 34 | 52 | 25 | 27 | null | null |
brendanhay/gogol | gogol-dfareporting/gen/Network/Google/Resource/DFAReporting/AccountPermissionGroups/List.hs | mpl-2.0 | -- | Creates a value of 'AccountPermissionGroupsList' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'apglXgafv'
--
-- * 'apglUploadProtocol'
--
-- * 'apglAccessToken'
--
-- * 'apglUploadType'
--
-- * 'apglProFileId'
--
-- * 'apglCallback'
accountPermissionGroupsList
:: Int64 -- ^ 'apglProFileId'
-> AccountPermissionGroupsList
accountPermissionGroupsList pApglProFileId_ =
AccountPermissionGroupsList'
{ _apglXgafv = Nothing
, _apglUploadProtocol = Nothing
, _apglAccessToken = Nothing
, _apglUploadType = Nothing
, _apglProFileId = _Coerce # pApglProFileId_
, _apglCallback = Nothing
} | 712 | accountPermissionGroupsList
:: Int64 -- ^ 'apglProFileId'
-> AccountPermissionGroupsList
accountPermissionGroupsList pApglProFileId_ =
AccountPermissionGroupsList'
{ _apglXgafv = Nothing
, _apglUploadProtocol = Nothing
, _apglAccessToken = Nothing
, _apglUploadType = Nothing
, _apglProFileId = _Coerce # pApglProFileId_
, _apglCallback = Nothing
} | 386 | accountPermissionGroupsList pApglProFileId_ =
AccountPermissionGroupsList'
{ _apglXgafv = Nothing
, _apglUploadProtocol = Nothing
, _apglAccessToken = Nothing
, _apglUploadType = Nothing
, _apglProFileId = _Coerce # pApglProFileId_
, _apglCallback = Nothing
} | 289 | true | true | 0 | 7 | 130 | 76 | 52 | 24 | null | null |
szehk/Haskell-Carbonara-Library | src/Control/Carbonara/Writer.hs | bsd-3-clause | composeListToTuple :: Int -> String
composeListToTuple i = concat [ "\n", "listToTuple", i', " :: [a] -> ", repeatWord "(Maybe a)" i
, "\n", "listToTuple", i', " ", incrementWord "[x]" i, " ="
, "\n", " ", incrementWord "(Just x)" i
, "\n", "listToTuple", i', " _ = ", repeatWord "(Nothing)" i
, "\n\n" ]
where i' = show i | 475 | composeListToTuple :: Int -> String
composeListToTuple i = concat [ "\n", "listToTuple", i', " :: [a] -> ", repeatWord "(Maybe a)" i
, "\n", "listToTuple", i', " ", incrementWord "[x]" i, " ="
, "\n", " ", incrementWord "(Just x)" i
, "\n", "listToTuple", i', " _ = ", repeatWord "(Nothing)" i
, "\n\n" ]
where i' = show i | 475 | composeListToTuple i = concat [ "\n", "listToTuple", i', " :: [a] -> ", repeatWord "(Maybe a)" i
, "\n", "listToTuple", i', " ", incrementWord "[x]" i, " ="
, "\n", " ", incrementWord "(Just x)" i
, "\n", "listToTuple", i', " _ = ", repeatWord "(Nothing)" i
, "\n\n" ]
where i' = show i | 439 | false | true | 0 | 7 | 212 | 111 | 63 | 48 | null | null |
damianfral/clay | src/Clay/Display.hs | bsd-3-clause | vAlignBottom = VerticalAlignValue "bottom" | 42 | vAlignBottom = VerticalAlignValue "bottom" | 42 | vAlignBottom = VerticalAlignValue "bottom" | 42 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
mietek/lambda-pi | LambdaPi.hs | mit | typeC i c (Lam e) (VPi t t')
= typeC (i + 1) ((Local i, t) : c)
(substC 0 (Free (Local i)) e) (t' (vfree (Local i))) | 128 | typeC i c (Lam e) (VPi t t')
= typeC (i + 1) ((Local i, t) : c)
(substC 0 (Free (Local i)) e) (t' (vfree (Local i))) | 128 | typeC i c (Lam e) (VPi t t')
= typeC (i + 1) ((Local i, t) : c)
(substC 0 (Free (Local i)) e) (t' (vfree (Local i))) | 128 | false | false | 1 | 11 | 39 | 110 | 51 | 59 | null | null |
tschacht/4e-poc | src/Data.hs | bsd-3-clause | constructState :: BoltCfg -> IO ServerState
constructState bcfg = do pool <- createPool (connect bcfg) close 4 500 1
return (ServerState pool)
-- | *** Demo stuff *** | 192 | constructState :: BoltCfg -> IO ServerState
constructState bcfg = do pool <- createPool (connect bcfg) close 4 500 1
return (ServerState pool)
-- | *** Demo stuff *** | 192 | constructState bcfg = do pool <- createPool (connect bcfg) close 4 500 1
return (ServerState pool)
-- | *** Demo stuff *** | 148 | false | true | 0 | 10 | 53 | 58 | 27 | 31 | null | null |
haroldcarr/learn-haskell-coq-ml-etc | haskell/topic/program-structure/juno/src/Types.hs | unlicense | getMsgId :: RPC -> MsgId
getMsgId (AE' _v) = "_aeMsgId v" | 60 | getMsgId :: RPC -> MsgId
getMsgId (AE' _v) = "_aeMsgId v" | 60 | getMsgId (AE' _v) = "_aeMsgId v" | 35 | false | true | 0 | 7 | 13 | 24 | 12 | 12 | null | null |
orangefiredragon/bear | src/Servant/Extentions/Server.hs | bsd-3-clause | serveWithContextEx :: (HasServer api context)
=> Proxy api -> Context context -> Server api -> Application
serveWithContextEx p context server =
toApplication' (runRouter (route p context (emptyDelayed (Route server)))) | 225 | serveWithContextEx :: (HasServer api context)
=> Proxy api -> Context context -> Server api -> Application
serveWithContextEx p context server =
toApplication' (runRouter (route p context (emptyDelayed (Route server)))) | 225 | serveWithContextEx p context server =
toApplication' (runRouter (route p context (emptyDelayed (Route server)))) | 114 | false | true | 0 | 13 | 34 | 87 | 40 | 47 | null | null |
benzrf/board | src/Game/Board/CommImpl.hs | lgpl-3.0 | anyWith :: Con -> PatQ
anyWith (NormalC n f) = conP n (wildP <$ f) | 68 | anyWith :: Con -> PatQ
anyWith (NormalC n f) = conP n (wildP <$ f) | 68 | anyWith (NormalC n f) = conP n (wildP <$ f) | 45 | false | true | 0 | 9 | 16 | 43 | 20 | 23 | null | null |
weihu816/Adagio | src/Worker.hs | bsd-3-clause | dbDone :: Server -> ProcessId -> TxnId -> STM ()
dbDone server@Server{..} pid txnId = do
vMap <- readTVar txnVotes
case Map.lookup txnId vMap of
Just (c, ps, stat, cname) -> do
let new_ps = Set.delete pid ps
writeTVar txnVotes $ Map.insert txnId (c, new_ps, stat, cname) vMap
when (Set.null new_ps) $
if stat == TXN_COMMITTED then void $ sendToName server cname (DB "OK")
else void $ sendToName server cname (DB "ABORT")
_ -> error "dbDone should not reach here" >> return ()
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- >> MESSAGE Handling <<
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Handle message received from local client | 950 | dbDone :: Server -> ProcessId -> TxnId -> STM ()
dbDone server@Server{..} pid txnId = do
vMap <- readTVar txnVotes
case Map.lookup txnId vMap of
Just (c, ps, stat, cname) -> do
let new_ps = Set.delete pid ps
writeTVar txnVotes $ Map.insert txnId (c, new_ps, stat, cname) vMap
when (Set.null new_ps) $
if stat == TXN_COMMITTED then void $ sendToName server cname (DB "OK")
else void $ sendToName server cname (DB "ABORT")
_ -> error "dbDone should not reach here" >> return ()
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- >> MESSAGE Handling <<
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Handle message received from local client | 950 | dbDone server@Server{..} pid txnId = do
vMap <- readTVar txnVotes
case Map.lookup txnId vMap of
Just (c, ps, stat, cname) -> do
let new_ps = Set.delete pid ps
writeTVar txnVotes $ Map.insert txnId (c, new_ps, stat, cname) vMap
when (Set.null new_ps) $
if stat == TXN_COMMITTED then void $ sendToName server cname (DB "OK")
else void $ sendToName server cname (DB "ABORT")
_ -> error "dbDone should not reach here" >> return ()
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- >> MESSAGE Handling <<
--
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Handle message received from local client | 901 | false | true | 0 | 17 | 174 | 226 | 114 | 112 | null | null |
jwiegley/github | samples/Issues/Events/ShowIssueEvents.hs | bsd-3-clause | withCommitId event f = maybe "" f (Github.eventCommitId event) | 62 | withCommitId event f = maybe "" f (Github.eventCommitId event) | 62 | withCommitId event f = maybe "" f (Github.eventCommitId event) | 62 | false | false | 0 | 8 | 8 | 26 | 12 | 14 | null | null |
kurnevsky/missile | src/Cli.hs | agpl-3.0 | horizontalReflectionParser :: Parser Bool
horizontalReflectionParser = switch $ long "reflect-horizontally" <> help "Reflect field horizontally" | 144 | horizontalReflectionParser :: Parser Bool
horizontalReflectionParser = switch $ long "reflect-horizontally" <> help "Reflect field horizontally" | 144 | horizontalReflectionParser = switch $ long "reflect-horizontally" <> help "Reflect field horizontally" | 102 | false | true | 0 | 7 | 14 | 28 | 13 | 15 | null | null |
jthornber/language-c-ejt | src/Language/C/Analysis/AstAnalysis.hs | bsd-3-clause | tExpr _ side (CVar i ni) =
lookupObject i >>=
maybe (typeErrorOnLeft ni $ notFound i) (return . declType) | 122 | tExpr _ side (CVar i ni) =
lookupObject i >>=
maybe (typeErrorOnLeft ni $ notFound i) (return . declType) | 122 | tExpr _ side (CVar i ni) =
lookupObject i >>=
maybe (typeErrorOnLeft ni $ notFound i) (return . declType) | 122 | false | false | 0 | 9 | 35 | 53 | 25 | 28 | null | null |
uduki/hsQt | Qtc/Enums/Core/QEventLoop.hs | bsd-2-clause | eDeferredDeletion :: ProcessEventsFlag
eDeferredDeletion
= ieProcessEventsFlag $ 16 | 85 | eDeferredDeletion :: ProcessEventsFlag
eDeferredDeletion
= ieProcessEventsFlag $ 16 | 85 | eDeferredDeletion
= ieProcessEventsFlag $ 16 | 46 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
kairuku/stack | src/Stack/Build.hs | bsd-3-clause | clean :: (M env m) => m ()
clean = do
econfig <- asks getEnvConfig
forM_
(Map.keys (envConfigPackages econfig))
(distDirFromDir >=> removeTreeIfExists) | 175 | clean :: (M env m) => m ()
clean = do
econfig <- asks getEnvConfig
forM_
(Map.keys (envConfigPackages econfig))
(distDirFromDir >=> removeTreeIfExists) | 175 | clean = do
econfig <- asks getEnvConfig
forM_
(Map.keys (envConfigPackages econfig))
(distDirFromDir >=> removeTreeIfExists) | 148 | false | true | 0 | 11 | 45 | 66 | 32 | 34 | null | null |
corajr/adventofcode2015 | 11/Main.hs | mit | partTwo = fmap findNextPassword $ findNextPassword input | 56 | partTwo = fmap findNextPassword $ findNextPassword input | 56 | partTwo = fmap findNextPassword $ findNextPassword input | 56 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
geigerzaehler/pladen | Pladen/Tar.hs | mit | preChecksumHeader :: Header -> Builder
preChecksumHeader h =
paddedString 100 (hTarPathName h)
<> paddedOct 8 (hPermissions h)
<> paddedOct 8 (0 :: Int) -- owner uid
<> paddedOct 8 (0 :: Int) -- owner gid
<> paddedOct 12 (hSize h)
<> paddedOct 12 (hModTime h) | 317 | preChecksumHeader :: Header -> Builder
preChecksumHeader h =
paddedString 100 (hTarPathName h)
<> paddedOct 8 (hPermissions h)
<> paddedOct 8 (0 :: Int) -- owner uid
<> paddedOct 8 (0 :: Int) -- owner gid
<> paddedOct 12 (hSize h)
<> paddedOct 12 (hModTime h) | 317 | preChecksumHeader h =
paddedString 100 (hTarPathName h)
<> paddedOct 8 (hPermissions h)
<> paddedOct 8 (0 :: Int) -- owner uid
<> paddedOct 8 (0 :: Int) -- owner gid
<> paddedOct 12 (hSize h)
<> paddedOct 12 (hModTime h) | 278 | false | true | 10 | 7 | 102 | 122 | 54 | 68 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.