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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
jfoutz/language-bash | src/Language/Bash/Expand.hs | bsd-3-clause | -- | Run a 'Parser', failing on a parse error.
parseUnsafe :: String -> Parser a -> Word -> a
parseUnsafe f p w = case parse p (prettyText w) w of
Left e -> error $ "Language.Bash.Expand." ++ f ++ ": " ++ show e
Right a -> a
-- | Parse a general token. | 262 | parseUnsafe :: String -> Parser a -> Word -> a
parseUnsafe f p w = case parse p (prettyText w) w of
Left e -> error $ "Language.Bash.Expand." ++ f ++ ": " ++ show e
Right a -> a
-- | Parse a general token. | 215 | parseUnsafe f p w = case parse p (prettyText w) w of
Left e -> error $ "Language.Bash.Expand." ++ f ++ ": " ++ show e
Right a -> a
-- | Parse a general token. | 168 | true | true | 0 | 11 | 65 | 89 | 43 | 46 | null | null |
PierreR/Haskell-Turtle-Library | src/Turtle/Prelude.hs | bsd-3-clause | -- | Get the time a file was last modified
datefile :: MonadIO io => FilePath -> io UTCTime
datefile path = liftIO (Filesystem.getModified path) | 144 | datefile :: MonadIO io => FilePath -> io UTCTime
datefile path = liftIO (Filesystem.getModified path) | 101 | datefile path = liftIO (Filesystem.getModified path) | 52 | true | true | 0 | 8 | 24 | 40 | 19 | 21 | null | null |
geraldus/yesod | yesod-bin/AddHandler.hs | mit | uncapitalize "" = "" | 20 | uncapitalize "" = "" | 20 | uncapitalize "" = "" | 20 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Fornost461/drafts-and-stuff | Haskell/projects/inference_engine/Forward.hs | cc0-1.0 | isLeaf = (== Leaf) | 18 | isLeaf = (== Leaf) | 18 | isLeaf = (== Leaf) | 18 | false | false | 0 | 5 | 3 | 10 | 6 | 4 | null | null |
zsedem/gitcommander | tools/eventlogger.hs | mit | drawUI :: St -> [Widget]
drawUI st = [a]
where
a = (str $ "Last Vty event: " <> (show $ st^.stLastVtyEvent))
<=>
(str $ "Counter value is: " <> (show $ st^.stCounter)) | 203 | drawUI :: St -> [Widget]
drawUI st = [a]
where
a = (str $ "Last Vty event: " <> (show $ st^.stLastVtyEvent))
<=>
(str $ "Counter value is: " <> (show $ st^.stCounter)) | 203 | drawUI st = [a]
where
a = (str $ "Last Vty event: " <> (show $ st^.stLastVtyEvent))
<=>
(str $ "Counter value is: " <> (show $ st^.stCounter)) | 178 | false | true | 0 | 10 | 68 | 80 | 43 | 37 | null | null |
idzardh/dotfiles | xmonad.hs | gpl-3.0 | darkgreen = "#98971a" | 21 | darkgreen = "#98971a" | 21 | darkgreen = "#98971a" | 21 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
inq/agitpunkt | src/Core/Buffer.hs | agpl-3.0 | readLine :: Buffer -> IO (Buffer, BS.ByteString)
-- ^ Read a line from the buffer
readLine (Buffer fd buf) = do
let (line, remaining') = BS.breakSubstring "\r\n" buf
let remaining = BS.drop 2 remaining'
putStrLn "readLin!!!!!!!!!!!"
BS.putStrLn line
if BS.length remaining' == 0
then do
buf' <- NSB.recv fd 4096
if BS.length buf' == 0
then error "Disconnected"
else readLine $ Buffer fd $ BS.append remaining buf'
else return (Buffer fd remaining', line) | 500 | readLine :: Buffer -> IO (Buffer, BS.ByteString)
readLine (Buffer fd buf) = do
let (line, remaining') = BS.breakSubstring "\r\n" buf
let remaining = BS.drop 2 remaining'
putStrLn "readLin!!!!!!!!!!!"
BS.putStrLn line
if BS.length remaining' == 0
then do
buf' <- NSB.recv fd 4096
if BS.length buf' == 0
then error "Disconnected"
else readLine $ Buffer fd $ BS.append remaining buf'
else return (Buffer fd remaining', line) | 467 | readLine (Buffer fd buf) = do
let (line, remaining') = BS.breakSubstring "\r\n" buf
let remaining = BS.drop 2 remaining'
putStrLn "readLin!!!!!!!!!!!"
BS.putStrLn line
if BS.length remaining' == 0
then do
buf' <- NSB.recv fd 4096
if BS.length buf' == 0
then error "Disconnected"
else readLine $ Buffer fd $ BS.append remaining buf'
else return (Buffer fd remaining', line) | 418 | true | true | 0 | 14 | 118 | 185 | 86 | 99 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | Chapter14_2.hs | mit | arbTree :: Arbitrary a => Int -> Gen (Tree a)
arbTree 0 = return Nil | 69 | arbTree :: Arbitrary a => Int -> Gen (Tree a)
arbTree 0 = return Nil | 68 | arbTree 0 = return Nil | 22 | false | true | 0 | 10 | 15 | 41 | 18 | 23 | null | null |
ghc-android/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | floatPrimTyConKey = mkPreludeTyConUnique 11 | 65 | floatPrimTyConKey = mkPreludeTyConUnique 11 | 65 | floatPrimTyConKey = mkPreludeTyConUnique 11 | 65 | false | false | 0 | 5 | 25 | 9 | 4 | 5 | null | null |
cjlarose/advent-2016 | src/OneTimePad.hs | bsd-3-clause | allHashes :: String -> [B.ByteString]
allHashes prefix = map hash [0..]
where
prefixCtx = MD5.update MD5.init $ pack prefix
hash = MD5.finalize . MD5.update prefixCtx . pack . show | 190 | allHashes :: String -> [B.ByteString]
allHashes prefix = map hash [0..]
where
prefixCtx = MD5.update MD5.init $ pack prefix
hash = MD5.finalize . MD5.update prefixCtx . pack . show | 190 | allHashes prefix = map hash [0..]
where
prefixCtx = MD5.update MD5.init $ pack prefix
hash = MD5.finalize . MD5.update prefixCtx . pack . show | 152 | false | true | 1 | 10 | 38 | 78 | 38 | 40 | null | null |
markuspf/Idris-dev | src/IRTS/CodegenC.hs | bsd-3-clause | hdr_export :: Export -> String
hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n" | 93 | hdr_export :: Export -> String
hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n" | 93 | hdr_export (ExportData n) = "typedef VAL " ++ cdesc n ++ ";\n" | 62 | false | true | 0 | 7 | 16 | 39 | 18 | 21 | null | null |
christiaanb/ghc | compiler/codeGen/StgCmmUtils.hs | bsd-3-clause | addToMemE :: CmmType -- rep of the counter
-> CmmExpr -- Address
-> CmmExpr -- What to add (a word-typed expression)
-> CmmAGraph
addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 262 | addToMemE :: CmmType -- rep of the counter
-> CmmExpr -- Address
-> CmmExpr -- What to add (a word-typed expression)
-> CmmAGraph
addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 262 | addToMemE rep ptr n
= mkStore ptr (CmmMachOp (MO_Add (typeWidth rep)) [CmmLoad ptr rep, n]) | 93 | false | true | 0 | 11 | 78 | 69 | 36 | 33 | null | null |
exercism/xhaskell | exercises/practice/custom-set/.meta/examples/success-standard/src/CustomSet.hs | mit | insert :: Ord a => a -> CustomSet a -> CustomSet a
insert x Tip = singleton x | 77 | insert :: Ord a => a -> CustomSet a -> CustomSet a
insert x Tip = singleton x | 77 | insert x Tip = singleton x | 26 | false | true | 0 | 8 | 17 | 40 | 18 | 22 | null | null |
beni55/old-openresty | haskell/src/RestyScript/Parser.hs | bsd-3-clause | symbol :: Parser String
symbol = do char '"'
s <- word
char '"'
return s
<|> word | 122 | symbol :: Parser String
symbol = do char '"'
s <- word
char '"'
return s
<|> word | 122 | symbol = do char '"'
s <- word
char '"'
return s
<|> word | 98 | false | true | 3 | 7 | 58 | 52 | 21 | 31 | null | null |
JohnLato/iteratee | src/Data/Iteratee/ListLike.hs | bsd-3-clause | -- |Enumerate a list of iteratees over a single stream simultaneously
-- and discard the results. This is a different behavior than Prelude's
-- sequence_ which runs iteratees in the list one after the other.
--
-- Compare to @Prelude.sequence_@.
sequence_
:: forall el s m a. (Monad m, LL.ListLike s el)
=> [Iteratee s m a]
-> Iteratee s m ()
sequence_ = check []
where
-- recursively checks each input iteratee to see if it's finished.
-- all of the unfinished iteratees are run with a single chunk,
-- then checked again.
check [] [] = idone ()
check ks [] = icont (step ks)
check ks (i:iters) = runIter i (\_ -> check ks iters)
(onCont ks iters)
(onErr ks iters)
onCont ks iters k = check (k:ks) iters
onErr ks iters i e = throwRec e (check ks (i:iters))
step ks str = CM.foldM (accf str) ([], str,Nothing) (reverse ks) >>= \ret -> case ret of
(iS, _, Just e) -> contErrM (check [] (reverse iS)) e
([], str', _) -> contDoneM () str'
(iS, EOF Nothing, _) -> contErrM (throwRec sExc (check [] (reverse iS)))
(toIterException sExc)
(iS, EOF (Just e), _) -> let e' = wrapEnumExc e
in contErrM (throwRec e' (check [] (reverse iS))) e'
(iS, _, _) -> contMoreM (check [] (reverse iS))
accf str (iS, !strs, !mErr) k = k str >>= \ret -> case ret of
ContDone _ str' -> return (iS, shorter str' strs, mErr)
ContMore i -> return (i:iS, strs, mErr)
ContErr i e -> return (i:iS, strs, Just e)
-- return the shorter one of two streams; errors are propagated with the
-- priority given to the "left"
shorter c1@(Chunk xs) c2@(Chunk ys)
| LL.length xs < LL.length ys = c1
| otherwise = c2
shorter (EOF e1 ) (EOF e2 ) = EOF (e1 `mplus` e2)
shorter e@(EOF _) _ = e
shorter _ e@(EOF _) = e
shorter _ _ = NoData
sExc = EofException "Iteratee.sequence_"
| 2,123 | sequence_
:: forall el s m a. (Monad m, LL.ListLike s el)
=> [Iteratee s m a]
-> Iteratee s m ()
sequence_ = check []
where
-- recursively checks each input iteratee to see if it's finished.
-- all of the unfinished iteratees are run with a single chunk,
-- then checked again.
check [] [] = idone ()
check ks [] = icont (step ks)
check ks (i:iters) = runIter i (\_ -> check ks iters)
(onCont ks iters)
(onErr ks iters)
onCont ks iters k = check (k:ks) iters
onErr ks iters i e = throwRec e (check ks (i:iters))
step ks str = CM.foldM (accf str) ([], str,Nothing) (reverse ks) >>= \ret -> case ret of
(iS, _, Just e) -> contErrM (check [] (reverse iS)) e
([], str', _) -> contDoneM () str'
(iS, EOF Nothing, _) -> contErrM (throwRec sExc (check [] (reverse iS)))
(toIterException sExc)
(iS, EOF (Just e), _) -> let e' = wrapEnumExc e
in contErrM (throwRec e' (check [] (reverse iS))) e'
(iS, _, _) -> contMoreM (check [] (reverse iS))
accf str (iS, !strs, !mErr) k = k str >>= \ret -> case ret of
ContDone _ str' -> return (iS, shorter str' strs, mErr)
ContMore i -> return (i:iS, strs, mErr)
ContErr i e -> return (i:iS, strs, Just e)
-- return the shorter one of two streams; errors are propagated with the
-- priority given to the "left"
shorter c1@(Chunk xs) c2@(Chunk ys)
| LL.length xs < LL.length ys = c1
| otherwise = c2
shorter (EOF e1 ) (EOF e2 ) = EOF (e1 `mplus` e2)
shorter e@(EOF _) _ = e
shorter _ e@(EOF _) = e
shorter _ _ = NoData
sExc = EofException "Iteratee.sequence_"
| 1,875 | sequence_ = check []
where
-- recursively checks each input iteratee to see if it's finished.
-- all of the unfinished iteratees are run with a single chunk,
-- then checked again.
check [] [] = idone ()
check ks [] = icont (step ks)
check ks (i:iters) = runIter i (\_ -> check ks iters)
(onCont ks iters)
(onErr ks iters)
onCont ks iters k = check (k:ks) iters
onErr ks iters i e = throwRec e (check ks (i:iters))
step ks str = CM.foldM (accf str) ([], str,Nothing) (reverse ks) >>= \ret -> case ret of
(iS, _, Just e) -> contErrM (check [] (reverse iS)) e
([], str', _) -> contDoneM () str'
(iS, EOF Nothing, _) -> contErrM (throwRec sExc (check [] (reverse iS)))
(toIterException sExc)
(iS, EOF (Just e), _) -> let e' = wrapEnumExc e
in contErrM (throwRec e' (check [] (reverse iS))) e'
(iS, _, _) -> contMoreM (check [] (reverse iS))
accf str (iS, !strs, !mErr) k = k str >>= \ret -> case ret of
ContDone _ str' -> return (iS, shorter str' strs, mErr)
ContMore i -> return (i:iS, strs, mErr)
ContErr i e -> return (i:iS, strs, Just e)
-- return the shorter one of two streams; errors are propagated with the
-- priority given to the "left"
shorter c1@(Chunk xs) c2@(Chunk ys)
| LL.length xs < LL.length ys = c1
| otherwise = c2
shorter (EOF e1 ) (EOF e2 ) = EOF (e1 `mplus` e2)
shorter e@(EOF _) _ = e
shorter _ e@(EOF _) = e
shorter _ _ = NoData
sExc = EofException "Iteratee.sequence_"
| 1,772 | true | true | 8 | 18 | 718 | 833 | 402 | 431 | null | null |
DavidAlphaFox/ghc | utils/haddock/haddock-api/src/Haddock/GhcUtils.hs | bsd-3-clause | lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv)
lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env ->
case lookupUFM (hsc_HPT hsc_env) mod_name of
Just mod_info -> return (mi_globals (hm_iface mod_info))
_not_a_home_module -> return Nothing | 297 | lookupLoadedHomeModuleGRE :: GhcMonad m => ModuleName -> m (Maybe GlobalRdrEnv)
lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env ->
case lookupUFM (hsc_HPT hsc_env) mod_name of
Just mod_info -> return (mi_globals (hm_iface mod_info))
_not_a_home_module -> return Nothing | 297 | lookupLoadedHomeModuleGRE mod_name = withSession $ \hsc_env ->
case lookupUFM (hsc_HPT hsc_env) mod_name of
Just mod_info -> return (mi_globals (hm_iface mod_info))
_not_a_home_module -> return Nothing | 216 | false | true | 0 | 14 | 49 | 91 | 43 | 48 | null | null |
romanb/amazonka | amazonka-redshift/gen/Network/AWS/Redshift/DeleteClusterParameterGroup.hs | mpl-2.0 | -- | 'DeleteClusterParameterGroupResponse' constructor.
deleteClusterParameterGroupResponse :: DeleteClusterParameterGroupResponse
deleteClusterParameterGroupResponse = DeleteClusterParameterGroupResponse | 204 | deleteClusterParameterGroupResponse :: DeleteClusterParameterGroupResponse
deleteClusterParameterGroupResponse = DeleteClusterParameterGroupResponse | 148 | deleteClusterParameterGroupResponse = DeleteClusterParameterGroupResponse | 73 | true | true | 0 | 4 | 9 | 12 | 7 | 5 | null | null |
bitemyapp/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | confdReqInstancesIpsList :: Int
confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList | 101 | confdReqInstancesIpsList :: Int
confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList | 101 | confdReqInstancesIpsList = Types.confdRequestTypeToRaw ReqInstIpsList | 69 | false | true | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
fmapfmapfmap/amazonka | amazonka-cloudsearch-domains/gen/Network/AWS/CloudSearchDomains/Suggest.hs | mpl-2.0 | -- | Creates a value of 'Suggest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'sSize'
--
-- * 'sQuery'
--
-- * 'sSuggester'
suggest
:: Text -- ^ 'sQuery'
-> Text -- ^ 'sSuggester'
-> Suggest
suggest pQuery_ pSuggester_ =
Suggest'
{ _sSize = Nothing
, _sQuery = pQuery_
, _sSuggester = pSuggester_
} | 419 | suggest
:: Text -- ^ 'sQuery'
-> Text -- ^ 'sSuggester'
-> Suggest
suggest pQuery_ pSuggester_ =
Suggest'
{ _sSize = Nothing
, _sQuery = pQuery_
, _sSuggester = pSuggester_
} | 206 | suggest pQuery_ pSuggester_ =
Suggest'
{ _sSize = Nothing
, _sQuery = pQuery_
, _sSuggester = pSuggester_
} | 127 | true | true | 0 | 8 | 104 | 64 | 38 | 26 | null | null |
idris-hackers/idris-llvm | test/runtest.hs | bsd-3-clause | main = do
hSetBuffering stdout LineBuffering
withCabal <- doesDirectoryExist "test"
when withCabal $ do
setCurrentDirectory "test"
args <- getArgs
conf <- parseArgs args
-- setPath conf
t1 <- getCurrentTime
res <- case tests conf of
[] -> return True
xs | showOutput conf -> runShow conf
xs | showDiff conf -> runDiff conf
xs -> runTests conf
t2 <- getCurrentTime
when (showTime conf) $ do
let dt = diffUTCTime t2 t1
putStrLn $ "Duration of Entire Test Suite was " ++ show dt
unless res exitFailure | 628 | main = do
hSetBuffering stdout LineBuffering
withCabal <- doesDirectoryExist "test"
when withCabal $ do
setCurrentDirectory "test"
args <- getArgs
conf <- parseArgs args
-- setPath conf
t1 <- getCurrentTime
res <- case tests conf of
[] -> return True
xs | showOutput conf -> runShow conf
xs | showDiff conf -> runDiff conf
xs -> runTests conf
t2 <- getCurrentTime
when (showTime conf) $ do
let dt = diffUTCTime t2 t1
putStrLn $ "Duration of Entire Test Suite was " ++ show dt
unless res exitFailure | 628 | main = do
hSetBuffering stdout LineBuffering
withCabal <- doesDirectoryExist "test"
when withCabal $ do
setCurrentDirectory "test"
args <- getArgs
conf <- parseArgs args
-- setPath conf
t1 <- getCurrentTime
res <- case tests conf of
[] -> return True
xs | showOutput conf -> runShow conf
xs | showDiff conf -> runDiff conf
xs -> runTests conf
t2 <- getCurrentTime
when (showTime conf) $ do
let dt = diffUTCTime t2 t1
putStrLn $ "Duration of Entire Test Suite was " ++ show dt
unless res exitFailure | 628 | false | false | 0 | 14 | 215 | 194 | 81 | 113 | null | null |
andorp/hs-bluesnap | src/Bluesnap/API/Response.hs | gpl-3.0 | elementToXMLCustom_param_title :: Xsd.XsdString -> [Content ()]
elementToXMLCustom_param_title = schemaTypeToXML "custom-param-title" | 133 | elementToXMLCustom_param_title :: Xsd.XsdString -> [Content ()]
elementToXMLCustom_param_title = schemaTypeToXML "custom-param-title" | 133 | elementToXMLCustom_param_title = schemaTypeToXML "custom-param-title" | 69 | false | true | 0 | 8 | 9 | 28 | 14 | 14 | null | null |
andreagenso/java2scala | test/Main.hs | apache-2.0 | test "tss162" = tss162 | 22 | test "tss162" = tss162 | 22 | test "tss162" = tss162 | 22 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
bgamari/pandoc | src/Text/Pandoc/Readers/Markdown.hs | gpl-2.0 | smart :: MarkdownParser (F Inlines)
smart = do
getOption readerSmart >>= guard
doubleQuoted <|> singleQuoted <|>
choice (map (return <$>) [apostrophe, dash, ellipses]) | 175 | smart :: MarkdownParser (F Inlines)
smart = do
getOption readerSmart >>= guard
doubleQuoted <|> singleQuoted <|>
choice (map (return <$>) [apostrophe, dash, ellipses]) | 175 | smart = do
getOption readerSmart >>= guard
doubleQuoted <|> singleQuoted <|>
choice (map (return <$>) [apostrophe, dash, ellipses]) | 139 | false | true | 0 | 11 | 30 | 65 | 33 | 32 | null | null |
pbl64k/WatLog | watlog.hs | bsd-2-clause | unify a b@(Var _) res = unify b a res | 37 | unify a b@(Var _) res = unify b a res | 37 | unify a b@(Var _) res = unify b a res | 37 | false | false | 1 | 7 | 9 | 39 | 14 | 25 | null | null |
snoyberg/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | gHC_STATICPTR :: Module
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr") | 76 | gHC_STATICPTR :: Module
gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr") | 76 | gHC_STATICPTR = mkBaseModule (fsLit "GHC.StaticPtr") | 52 | false | true | 0 | 7 | 7 | 20 | 10 | 10 | null | null |
vaishious/has-torrent | src/HasTorrent/Network/Communicate.hs | bsd-3-clause | -- State Computation on a Lazy ByteString which reads four bytes as an Int
readFourBytes :: State BL.ByteString Int
readFourBytes = state $ \bs -> let (left,right) = BL.splitAt 4 bs
word32 = BY.decode left :: Word32
in (fromIntegral word32,right) | 312 | readFourBytes :: State BL.ByteString Int
readFourBytes = state $ \bs -> let (left,right) = BL.splitAt 4 bs
word32 = BY.decode left :: Word32
in (fromIntegral word32,right) | 237 | readFourBytes = state $ \bs -> let (left,right) = BL.splitAt 4 bs
word32 = BY.decode left :: Word32
in (fromIntegral word32,right) | 196 | true | true | 0 | 12 | 105 | 75 | 39 | 36 | null | null |
beni55/hermit | src/HERMIT/Kure.hs | bsd-2-clause | -- | Rewrite all children of an expression of the form: @Let@ (@Rec@ ['CoreDef']) 'CoreExpr'
letRecAllR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, Monad m) => (Int -> Rewrite c m CoreDef) -> Rewrite c m CoreExpr -> Rewrite c m CoreExpr
letRecAllR rs r = letAllR (recAllR rs) r | 290 | letRecAllR :: (ExtendPath c Crumb, ReadPath c Crumb, AddBindings c, Monad m) => (Int -> Rewrite c m CoreDef) -> Rewrite c m CoreExpr -> Rewrite c m CoreExpr
letRecAllR rs r = letAllR (recAllR rs) r | 197 | letRecAllR rs r = letAllR (recAllR rs) r | 40 | true | true | 0 | 9 | 51 | 95 | 47 | 48 | null | null |
tomahawkins/improve | Language/ImProve.hs | bsd-3-clause | -- | True iff the predicate is true for all elements.
all_ :: (a -> E Bool) -> [a] -> E Bool
all_ f a = and_ $ map f a | 118 | all_ :: (a -> E Bool) -> [a] -> E Bool
all_ f a = and_ $ map f a | 64 | all_ f a = and_ $ map f a | 25 | true | true | 0 | 9 | 30 | 54 | 26 | 28 | null | null |
brendanhay/gogol | gogol-accesscontextmanager/gen/Network/Google/AccessContextManager/Types/Product.hs | mpl-2.0 | -- | Required. The desired Access Levels that should replace all existing
-- Access Levels in the Access Policy.
rAccessLevels :: Lens' ReplaceAccessLevelsRequest [AccessLevel]
rAccessLevels
= lens _rAccessLevels
(\ s a -> s{_rAccessLevels = a})
. _Default
. _Coerce | 286 | rAccessLevels :: Lens' ReplaceAccessLevelsRequest [AccessLevel]
rAccessLevels
= lens _rAccessLevels
(\ s a -> s{_rAccessLevels = a})
. _Default
. _Coerce | 173 | rAccessLevels
= lens _rAccessLevels
(\ s a -> s{_rAccessLevels = a})
. _Default
. _Coerce | 109 | true | true | 2 | 8 | 58 | 58 | 29 | 29 | null | null |
CindyLinz/Haskell.js | trans/src/Desugar/List.hs | mit | deListExp (Tuple l boxed exp) = Tuple (id l) (deListBoxed boxed) (fmap (deListExp) exp) | 87 | deListExp (Tuple l boxed exp) = Tuple (id l) (deListBoxed boxed) (fmap (deListExp) exp) | 87 | deListExp (Tuple l boxed exp) = Tuple (id l) (deListBoxed boxed) (fmap (deListExp) exp) | 87 | false | false | 0 | 8 | 13 | 49 | 24 | 25 | null | null |
pgj/bead | src/Bead/View/Content/CourseOverview/Page.hs | bsd-3-clause | courseSubmissionsContent :: UTCTime -> SubmissionTableContext -> SubmissionTableInfo -> IHtml
courseSubmissionsContent now c s = do
msg <- getI18N
return $ do
Bootstrap.rowColMd12 $
fromString . msg $ msg_Home_SubmissionTable_Info $ concat
[ "Assignments may be modified by clicking on their identifiers if you have rights for the modification (their names are shown in the tooltip). "
, "Students may be unregistered from the courses or the groups by checking the boxes in the Remove column "
, "then clicking on the button."
]
i18n msg $ submissionTable "course-table" now c s | 630 | courseSubmissionsContent :: UTCTime -> SubmissionTableContext -> SubmissionTableInfo -> IHtml
courseSubmissionsContent now c s = do
msg <- getI18N
return $ do
Bootstrap.rowColMd12 $
fromString . msg $ msg_Home_SubmissionTable_Info $ concat
[ "Assignments may be modified by clicking on their identifiers if you have rights for the modification (their names are shown in the tooltip). "
, "Students may be unregistered from the courses or the groups by checking the boxes in the Remove column "
, "then clicking on the button."
]
i18n msg $ submissionTable "course-table" now c s | 630 | courseSubmissionsContent now c s = do
msg <- getI18N
return $ do
Bootstrap.rowColMd12 $
fromString . msg $ msg_Home_SubmissionTable_Info $ concat
[ "Assignments may be modified by clicking on their identifiers if you have rights for the modification (their names are shown in the tooltip). "
, "Students may be unregistered from the courses or the groups by checking the boxes in the Remove column "
, "then clicking on the button."
]
i18n msg $ submissionTable "course-table" now c s | 536 | false | true | 0 | 15 | 141 | 102 | 47 | 55 | null | null |
amccausl/Swish | Swish/HaskellRDF/Vocabulary.hs | lgpl-2.1 | rdf_rest :: ScopedName
rdf_rest = ScopedName namespaceRDF "rest" | 95 | rdf_rest :: ScopedName
rdf_rest = ScopedName namespaceRDF "rest" | 95 | rdf_rest = ScopedName namespaceRDF "rest" | 57 | false | true | 0 | 5 | 38 | 16 | 8 | 8 | null | null |
portnov/yaledger | YaLedger/Reports/Common.hs | bsd-3-clause | datesBackFrom :: DateTime -> DateInterval -> [DateTime]
datesBackFrom date int = go date
where
go dt = dt: go (dt `minusInterval` int) | 140 | datesBackFrom :: DateTime -> DateInterval -> [DateTime]
datesBackFrom date int = go date
where
go dt = dt: go (dt `minusInterval` int) | 140 | datesBackFrom date int = go date
where
go dt = dt: go (dt `minusInterval` int) | 84 | false | true | 0 | 8 | 27 | 57 | 29 | 28 | null | null |
Zankoku-Okuno/ammonite | Language/Ammonite/Syntax/Parser.hs | gpl-3.0 | bytestr :: Parser SyntaxCore
bytestr = between (char 'b' *> sq) sq $
ByteStr . BS.pack <$> hexOctet `sepAroundBy` ws0 | 121 | bytestr :: Parser SyntaxCore
bytestr = between (char 'b' *> sq) sq $
ByteStr . BS.pack <$> hexOctet `sepAroundBy` ws0 | 121 | bytestr = between (char 'b' *> sq) sq $
ByteStr . BS.pack <$> hexOctet `sepAroundBy` ws0 | 92 | false | true | 0 | 12 | 23 | 49 | 25 | 24 | null | null |
seereason/ghcjs | src/Gen2/Prim.hs | mit | genPrim _ _ TryPutMVarOp [r] [m,v] = PrimInline [j| `r` = h$tryPutMVar(`m`,`v`) |] | 82 | genPrim _ _ TryPutMVarOp [r] [m,v] = PrimInline [j| `r` = h$tryPutMVar(`m`,`v`) |] | 82 | genPrim _ _ TryPutMVarOp [r] [m,v] = PrimInline [j| `r` = h$tryPutMVar(`m`,`v`) |] | 82 | false | false | 0 | 6 | 12 | 33 | 19 | 14 | null | null |
keithodulaigh/Hets | OWL2/XML.hs | gpl-2.0 | isPlainLiteral :: String -> Bool
isPlainLiteral s =
"http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" == s | 118 | isPlainLiteral :: String -> Bool
isPlainLiteral s =
"http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" == s | 118 | isPlainLiteral s =
"http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral" == s | 85 | false | true | 0 | 6 | 14 | 26 | 12 | 14 | null | null |
DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/Simple/HaskellSuite.hs | bsd-3-clause | getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf =
liftM (PackageIndex.fromList . concat) $ forM packagedbs $ \packagedb ->
do str <-
getDbProgramOutput verbosity haskellSuitePkgProgram conf
["dump", packageDbOpt packagedb]
`catchExit` \_ -> die $ "pkg dump failed"
case parsePackages str of
Right ok -> return ok
_ -> die "failed to parse output of 'pkg dump'"
where
parsePackages str =
let parsed = map parseInstalledPackageInfo (splitPkgs str)
in case [ msg | ParseFailed msg <- parsed ] of
[] -> Right [ pkg | ParseOk _ pkg <- parsed ]
msgs -> Left msgs
splitPkgs :: String -> [String]
splitPkgs = map unlines . splitWith ("---" ==) . lines
where
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith p xs = ys : case zs of
[] -> []
_:ws -> splitWith p ws
where (ys,zs) = break p xs | 1,119 | getInstalledPackages :: Verbosity -> PackageDBStack -> ProgramConfiguration
-> IO InstalledPackageIndex
getInstalledPackages verbosity packagedbs conf =
liftM (PackageIndex.fromList . concat) $ forM packagedbs $ \packagedb ->
do str <-
getDbProgramOutput verbosity haskellSuitePkgProgram conf
["dump", packageDbOpt packagedb]
`catchExit` \_ -> die $ "pkg dump failed"
case parsePackages str of
Right ok -> return ok
_ -> die "failed to parse output of 'pkg dump'"
where
parsePackages str =
let parsed = map parseInstalledPackageInfo (splitPkgs str)
in case [ msg | ParseFailed msg <- parsed ] of
[] -> Right [ pkg | ParseOk _ pkg <- parsed ]
msgs -> Left msgs
splitPkgs :: String -> [String]
splitPkgs = map unlines . splitWith ("---" ==) . lines
where
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith p xs = ys : case zs of
[] -> []
_:ws -> splitWith p ws
where (ys,zs) = break p xs | 1,119 | getInstalledPackages verbosity packagedbs conf =
liftM (PackageIndex.fromList . concat) $ forM packagedbs $ \packagedb ->
do str <-
getDbProgramOutput verbosity haskellSuitePkgProgram conf
["dump", packageDbOpt packagedb]
`catchExit` \_ -> die $ "pkg dump failed"
case parsePackages str of
Right ok -> return ok
_ -> die "failed to parse output of 'pkg dump'"
where
parsePackages str =
let parsed = map parseInstalledPackageInfo (splitPkgs str)
in case [ msg | ParseFailed msg <- parsed ] of
[] -> Right [ pkg | ParseOk _ pkg <- parsed ]
msgs -> Left msgs
splitPkgs :: String -> [String]
splitPkgs = map unlines . splitWith ("---" ==) . lines
where
splitWith :: (a -> Bool) -> [a] -> [[a]]
splitWith p xs = ys : case zs of
[] -> []
_:ws -> splitWith p ws
where (ys,zs) = break p xs | 994 | false | true | 0 | 14 | 381 | 348 | 173 | 175 | null | null |
apyrgio/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | cvEnodenet :: (String, String, String)
cvEnodenet =
("node",
Types.cVErrorCodeToRaw CvENODENET,
"Network-related node error") | 133 | cvEnodenet :: (String, String, String)
cvEnodenet =
("node",
Types.cVErrorCodeToRaw CvENODENET,
"Network-related node error") | 133 | cvEnodenet =
("node",
Types.cVErrorCodeToRaw CvENODENET,
"Network-related node error") | 94 | false | true | 0 | 7 | 20 | 34 | 20 | 14 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/Misc.hs | bsd-3-clause | ghc = "ghc-7.8" | 15 | ghc = "ghc-7.8" | 15 | ghc = "ghc-7.8" | 15 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
harrisi/on-being-better | list-expansion/Haskell/course/src/Course/Optional.hs | cc0-1.0 | (??) :: Optional a -> a -> a
Empty ?? d = d | 44 | (??) :: Optional a -> a -> a
Empty ?? d = d | 44 | Empty ?? d = d | 15 | false | true | 0 | 6 | 13 | 30 | 15 | 15 | null | null |
tonyfloatersu/solution-haskell-craft-of-FP | PicturesSVG.hs | mit | over = Over | 13 | over = Over | 13 | over = Over | 13 | false | false | 1 | 5 | 4 | 10 | 3 | 7 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | dot_tv_RDR = mkUnqual tvName (fsLit ".") | 43 | dot_tv_RDR = mkUnqual tvName (fsLit ".") | 43 | dot_tv_RDR = mkUnqual tvName (fsLit ".") | 43 | false | false | 1 | 7 | 8 | 21 | 8 | 13 | null | null |
enolan/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reifyTTConstApp f (Constant c@(I _))
| f == reflm "I" = return c | 82 | reifyTTConstApp f (Constant c@(I _))
| f == reflm "I" = return c | 82 | reifyTTConstApp f (Constant c@(I _))
| f == reflm "I" = return c | 82 | false | false | 0 | 9 | 30 | 44 | 19 | 25 | null | null |
tsahyt/clingo-haskell | src/Clingo/Model.hs | mit | context' :: (MonadIO m, MonadThrow m) => Model s -> m (SolveControl s)
context' (Model m) = SolveControl <$> marshal1 (Raw.modelContext m) | 138 | context' :: (MonadIO m, MonadThrow m) => Model s -> m (SolveControl s)
context' (Model m) = SolveControl <$> marshal1 (Raw.modelContext m) | 138 | context' (Model m) = SolveControl <$> marshal1 (Raw.modelContext m) | 67 | false | true | 0 | 9 | 21 | 66 | 32 | 34 | null | null |
kishoredbn/barrelfish | hake/Main.hs | mit | arse_arguments ("--source-dir" : s : t) =
(parse_arguments t) { opt_sourcedir = s }
| 86 | parse_arguments ("--source-dir" : s : t) =
(parse_arguments t) { opt_sourcedir = s } | 86 | parse_arguments ("--source-dir" : s : t) =
(parse_arguments t) { opt_sourcedir = s } | 86 | false | false | 0 | 8 | 16 | 34 | 18 | 16 | null | null |
benley/yet-another-haskell-scheme | Yahs/Scheme.hs | apache-2.0 | ioPrimitives :: [(String, [LispVal] -> IOThrowsError LispVal)]
ioPrimitives = [ ("apply", applyProc)
, ("open-input-file", makePort ReadMode)
, ("open-output-file", makePort WriteMode)
, ("close-input-port", closePort)
, ("close-output-port", closePort)
, ("read", readProc)
, ("read-char", readCharProc)
, ("peek-char", peekCharProc)
, ("write", writeProc)
, ("display", displayProc)
, ("read-contents", readContents)
, ("read-all", readAll)
] | 624 | ioPrimitives :: [(String, [LispVal] -> IOThrowsError LispVal)]
ioPrimitives = [ ("apply", applyProc)
, ("open-input-file", makePort ReadMode)
, ("open-output-file", makePort WriteMode)
, ("close-input-port", closePort)
, ("close-output-port", closePort)
, ("read", readProc)
, ("read-char", readCharProc)
, ("peek-char", peekCharProc)
, ("write", writeProc)
, ("display", displayProc)
, ("read-contents", readContents)
, ("read-all", readAll)
] | 624 | ioPrimitives = [ ("apply", applyProc)
, ("open-input-file", makePort ReadMode)
, ("open-output-file", makePort WriteMode)
, ("close-input-port", closePort)
, ("close-output-port", closePort)
, ("read", readProc)
, ("read-char", readCharProc)
, ("peek-char", peekCharProc)
, ("write", writeProc)
, ("display", displayProc)
, ("read-contents", readContents)
, ("read-all", readAll)
] | 561 | false | true | 0 | 8 | 227 | 144 | 91 | 53 | null | null |
brendanhay/gogol | gogol-cloudasset/gen/Network/Google/CloudAsset/Types/Product.hs | mpl-2.0 | -- | Textual representation of an expression in Common Expression Language
-- syntax.
eExpression :: Lens' Expr (Maybe Text)
eExpression
= lens _eExpression (\ s a -> s{_eExpression = a}) | 189 | eExpression :: Lens' Expr (Maybe Text)
eExpression
= lens _eExpression (\ s a -> s{_eExpression = a}) | 103 | eExpression
= lens _eExpression (\ s a -> s{_eExpression = a}) | 64 | true | true | 1 | 9 | 31 | 51 | 26 | 25 | null | null |
mariefarrell/Hets | Maude/PreComorphism.hs | gpl-2.0 | maudeType2caslSort :: MAS.Type -> IdMap -> CAS.SORT
maudeType2caslSort (MAS.TypeSort q) _ = token2id $ getName q | 112 | maudeType2caslSort :: MAS.Type -> IdMap -> CAS.SORT
maudeType2caslSort (MAS.TypeSort q) _ = token2id $ getName q | 112 | maudeType2caslSort (MAS.TypeSort q) _ = token2id $ getName q | 60 | false | true | 0 | 8 | 15 | 43 | 21 | 22 | null | null |
diffusionkinetics/open | fuml/lib/Fuml/Optimisation/NelderMead.hs | mit | (.*) :: Double -> Vector Double -> Vector Double
x .* v = VS.map (*x) v | 71 | (.*) :: Double -> Vector Double -> Vector Double
x .* v = VS.map (*x) v | 71 | x .* v = VS.map (*x) v | 22 | false | true | 0 | 9 | 15 | 44 | 22 | 22 | null | null |
gbwey/persistentold | persistent/Database/Persist/Sql/Run.hs | mit | -- | Get a connection from the pool, run the given action, and then return the
-- connection to the pool.
runSqlPool :: MonadBaseControl IO m => SqlPersistT m a -> Pool Connection -> m a
runSqlPool r pconn = do
mres <- withResourceTimeout 2000000 pconn $ runSqlConn r
maybe (throwIO Couldn'tGetSQLConnection) return mres | 328 | runSqlPool :: MonadBaseControl IO m => SqlPersistT m a -> Pool Connection -> m a
runSqlPool r pconn = do
mres <- withResourceTimeout 2000000 pconn $ runSqlConn r
maybe (throwIO Couldn'tGetSQLConnection) return mres | 222 | runSqlPool r pconn = do
mres <- withResourceTimeout 2000000 pconn $ runSqlConn r
maybe (throwIO Couldn'tGetSQLConnection) return mres | 141 | true | true | 0 | 9 | 61 | 81 | 37 | 44 | null | null |
NICTA/coordinate | src/Data/Geodetic/Ellipsoid.hs | bsd-3-clause | ans ::
Ellipsoid
ans =
Ellipsoid
6378160
298.25 | 59 | ans ::
Ellipsoid
ans =
Ellipsoid
6378160
298.25 | 59 | ans =
Ellipsoid
6378160
298.25 | 40 | false | true | 0 | 6 | 19 | 24 | 9 | 15 | null | null |
daniel-pape/haskell-meetup-k-means | .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/Paths_k_means.hs | bsd-3-clause | datadir = "/Users/dp/haskell-projects/k-means/.stack-work/install/x86_64-osx/lts-6.16/7.10.3/share/x86_64-osx-ghc-7.10.3/k-means-0.1.0.0" | 140 | datadir = "/Users/dp/haskell-projects/k-means/.stack-work/install/x86_64-osx/lts-6.16/7.10.3/share/x86_64-osx-ghc-7.10.3/k-means-0.1.0.0" | 140 | datadir = "/Users/dp/haskell-projects/k-means/.stack-work/install/x86_64-osx/lts-6.16/7.10.3/share/x86_64-osx-ghc-7.10.3/k-means-0.1.0.0" | 140 | false | false | 0 | 4 | 5 | 6 | 3 | 3 | null | null |
bell-kelly/courseography | app/Svg/Generator.hs | gpl-3.0 | -- | Converts a node to SVG.
rectToSVG :: Bool -> M.Map String String -> Shape -> S.Svg
rectToSVG styled courseMap rect
| shapeFill rect == "none" = S.rect
| otherwise =
let style = case shapeType_ rect of
Node -> fromMaybe "" $ M.lookup (shapeId_ rect)
courseMap
_ -> ""
class_ = case shapeType_ rect of
Node -> "node"
Hybrid -> "hybrid"
in S.g ! A.id_ (stringValue $ sanitizeId $ shapeId_ rect)
! A.class_ (stringValue class_)
! S.customAttribute "data-group" (stringValue
(getArea (shapeId_ rect)))
! S.customAttribute "text-rendering" "geometricPrecision"
! S.customAttribute "shape-rendering" "geometricPrecision"
-- TODO: Remove the reliance on the colours here
! (if styled || class_ /= "hybrid"
then
A.style (stringValue style)
else
mempty)
$
do S.rect ! A.rx "4"
! A.ry "4"
! A.x (stringValue . show . fst $ shapePos rect)
! A.y (stringValue . show . snd $ shapePos rect)
! A.width (stringValue . show $ shapeWidth rect)
! A.height (stringValue . show $ shapeHeight rect)
! A.style (stringValue $ "fill:" ++ shapeFill rect ++ ";")
sequence_ $ map
(textToSVG
styled
(shapeType_ rect)
(fst (shapePos rect) + (shapeWidth rect / 2)))
(shapeText rect)
-- | Converts an ellipse to SVG. | 1,921 | rectToSVG :: Bool -> M.Map String String -> Shape -> S.Svg
rectToSVG styled courseMap rect
| shapeFill rect == "none" = S.rect
| otherwise =
let style = case shapeType_ rect of
Node -> fromMaybe "" $ M.lookup (shapeId_ rect)
courseMap
_ -> ""
class_ = case shapeType_ rect of
Node -> "node"
Hybrid -> "hybrid"
in S.g ! A.id_ (stringValue $ sanitizeId $ shapeId_ rect)
! A.class_ (stringValue class_)
! S.customAttribute "data-group" (stringValue
(getArea (shapeId_ rect)))
! S.customAttribute "text-rendering" "geometricPrecision"
! S.customAttribute "shape-rendering" "geometricPrecision"
-- TODO: Remove the reliance on the colours here
! (if styled || class_ /= "hybrid"
then
A.style (stringValue style)
else
mempty)
$
do S.rect ! A.rx "4"
! A.ry "4"
! A.x (stringValue . show . fst $ shapePos rect)
! A.y (stringValue . show . snd $ shapePos rect)
! A.width (stringValue . show $ shapeWidth rect)
! A.height (stringValue . show $ shapeHeight rect)
! A.style (stringValue $ "fill:" ++ shapeFill rect ++ ";")
sequence_ $ map
(textToSVG
styled
(shapeType_ rect)
(fst (shapePos rect) + (shapeWidth rect / 2)))
(shapeText rect)
-- | Converts an ellipse to SVG. | 1,892 | rectToSVG styled courseMap rect
| shapeFill rect == "none" = S.rect
| otherwise =
let style = case shapeType_ rect of
Node -> fromMaybe "" $ M.lookup (shapeId_ rect)
courseMap
_ -> ""
class_ = case shapeType_ rect of
Node -> "node"
Hybrid -> "hybrid"
in S.g ! A.id_ (stringValue $ sanitizeId $ shapeId_ rect)
! A.class_ (stringValue class_)
! S.customAttribute "data-group" (stringValue
(getArea (shapeId_ rect)))
! S.customAttribute "text-rendering" "geometricPrecision"
! S.customAttribute "shape-rendering" "geometricPrecision"
-- TODO: Remove the reliance on the colours here
! (if styled || class_ /= "hybrid"
then
A.style (stringValue style)
else
mempty)
$
do S.rect ! A.rx "4"
! A.ry "4"
! A.x (stringValue . show . fst $ shapePos rect)
! A.y (stringValue . show . snd $ shapePos rect)
! A.width (stringValue . show $ shapeWidth rect)
! A.height (stringValue . show $ shapeHeight rect)
! A.style (stringValue $ "fill:" ++ shapeFill rect ++ ";")
sequence_ $ map
(textToSVG
styled
(shapeType_ rect)
(fst (shapePos rect) + (shapeWidth rect / 2)))
(shapeText rect)
-- | Converts an ellipse to SVG. | 1,833 | true | true | 0 | 20 | 925 | 479 | 230 | 249 | null | null |
mithrandi/advent2016 | Day17.hs | mit | applyMove :: Coord -> Move -> Coord
applyMove (Coord x y) move = case move of
MUp -> Coord x (y - 1)
MDown -> Coord x (y + 1)
MLeft -> Coord (x - 1) y
MRight -> Coord (x + 1) y | 189 | applyMove :: Coord -> Move -> Coord
applyMove (Coord x y) move = case move of
MUp -> Coord x (y - 1)
MDown -> Coord x (y + 1)
MLeft -> Coord (x - 1) y
MRight -> Coord (x + 1) y | 189 | applyMove (Coord x y) move = case move of
MUp -> Coord x (y - 1)
MDown -> Coord x (y + 1)
MLeft -> Coord (x - 1) y
MRight -> Coord (x + 1) y | 153 | false | true | 4 | 7 | 56 | 111 | 54 | 57 | null | null |
tpsinnem/Idris-dev | src/Pkg/Package.hs | bsd-3-clause | installIBC :: String -> String -> Name -> IO ()
installIBC dest p m = do
let f = toIBCFile m
let destdir = dest </> p </> getDest m
putStrLn $ "Installing " ++ f ++ " to " ++ destdir
createDirectoryIfMissing True destdir
copyFile f (destdir </> takeFileName f)
return ()
where
getDest (UN n) = ""
getDest (NS n ns) = foldl1' (</>) (reverse (getDest n : map str ns)) | 399 | installIBC :: String -> String -> Name -> IO ()
installIBC dest p m = do
let f = toIBCFile m
let destdir = dest </> p </> getDest m
putStrLn $ "Installing " ++ f ++ " to " ++ destdir
createDirectoryIfMissing True destdir
copyFile f (destdir </> takeFileName f)
return ()
where
getDest (UN n) = ""
getDest (NS n ns) = foldl1' (</>) (reverse (getDest n : map str ns)) | 399 | installIBC dest p m = do
let f = toIBCFile m
let destdir = dest </> p </> getDest m
putStrLn $ "Installing " ++ f ++ " to " ++ destdir
createDirectoryIfMissing True destdir
copyFile f (destdir </> takeFileName f)
return ()
where
getDest (UN n) = ""
getDest (NS n ns) = foldl1' (</>) (reverse (getDest n : map str ns)) | 351 | false | true | 0 | 11 | 106 | 181 | 84 | 97 | null | null |
vTurbine/ghc | compiler/cmm/CmmNode.hs | bsd-3-clause | -- | Returns the head uniques of the scopes. This is based on the
-- assumption that the @Unique@ of @SubScope@ identifies the
-- underlying super-scope. Used for efficient equality and comparison,
-- see below.
scopeUniques :: CmmTickScope -> [U.Unique]
scopeUniques GlobalScope = [] | 294 | scopeUniques :: CmmTickScope -> [U.Unique]
scopeUniques GlobalScope = [] | 82 | scopeUniques GlobalScope = [] | 39 | true | true | 0 | 7 | 53 | 29 | 17 | 12 | null | null |
Zoetermeer/latro | src/Latro/Typecheck.hs | mit | -- TODO: Make this exhaustive and truly deep
makeDeeplyRigid :: Ty -> Ty
makeDeeplyRigid ty@TyRigid{} = ty | 106 | makeDeeplyRigid :: Ty -> Ty
makeDeeplyRigid ty@TyRigid{} = ty | 61 | makeDeeplyRigid ty@TyRigid{} = ty | 33 | true | true | 3 | 5 | 16 | 29 | 15 | 14 | null | null |
ryanplusplus/seven-languages-in-seven-weeks | haskell/day2/string_to_number.hs | mit | stringToNumber s = aux s 0
where
aux [] acc = acc
aux (h:t) acc
| h == '$' = aux t acc
| h == ',' = aux t acc
| h == '.' = acc + (read ("0." ++ t) :: Float)
| otherwise = aux t (acc * 10 + (read [h] :: Float)) | 257 | stringToNumber s = aux s 0
where
aux [] acc = acc
aux (h:t) acc
| h == '$' = aux t acc
| h == ',' = aux t acc
| h == '.' = acc + (read ("0." ++ t) :: Float)
| otherwise = aux t (acc * 10 + (read [h] :: Float)) | 257 | stringToNumber s = aux s 0
where
aux [] acc = acc
aux (h:t) acc
| h == '$' = aux t acc
| h == ',' = aux t acc
| h == '.' = acc + (read ("0." ++ t) :: Float)
| otherwise = aux t (acc * 10 + (read [h] :: Float)) | 257 | false | false | 7 | 12 | 104 | 147 | 72 | 75 | null | null |
OS2World/DEV-UTIL-HUGS | oldlib/TestOrdBag.hs | bsd-3-clause | prop_lookup :: Bag Int -> Int -> Bool
prop_lookup xs x =
if member xs x then
lookup xs x == x
&&
lookupM xs x == Just x
&&
lookupWithDefault 999 xs x == x
&&
lookupAll xs x == Prelude.take (count xs x) (repeat x)
else
lookupM xs x == Nothing
&&
lookupWithDefault 999 xs x == 999
&&
lookupAll xs x == [] | 382 | prop_lookup :: Bag Int -> Int -> Bool
prop_lookup xs x =
if member xs x then
lookup xs x == x
&&
lookupM xs x == Just x
&&
lookupWithDefault 999 xs x == x
&&
lookupAll xs x == Prelude.take (count xs x) (repeat x)
else
lookupM xs x == Nothing
&&
lookupWithDefault 999 xs x == 999
&&
lookupAll xs x == [] | 382 | prop_lookup xs x =
if member xs x then
lookup xs x == x
&&
lookupM xs x == Just x
&&
lookupWithDefault 999 xs x == x
&&
lookupAll xs x == Prelude.take (count xs x) (repeat x)
else
lookupM xs x == Nothing
&&
lookupWithDefault 999 xs x == 999
&&
lookupAll xs x == [] | 344 | false | true | 4 | 13 | 145 | 156 | 72 | 84 | null | null |
debug-ito/wild-bind | wild-bind/test/WildBind/ForTest.hs | bsd-3-clause | evalStateEmpty :: State.StateT (WB.Binding SampleState SampleInput) IO () -> IO ()
evalStateEmpty s = State.evalStateT s mempty | 127 | evalStateEmpty :: State.StateT (WB.Binding SampleState SampleInput) IO () -> IO ()
evalStateEmpty s = State.evalStateT s mempty | 127 | evalStateEmpty s = State.evalStateT s mempty | 44 | false | true | 3 | 8 | 16 | 57 | 24 | 33 | null | null |
stepcut/minecraft-data | Minecraft/Core.hs | bsd-3-clause | tilda :: Int32 -> Pos
tilda = Pos Tilda | 39 | tilda :: Int32 -> Pos
tilda = Pos Tilda | 39 | tilda = Pos Tilda | 17 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
ben-schulz/Idris-dev | src/IRTS/CodegenJavaScript.hs | bsd-3-clause | jsMYOLDBASE :: JS
jsMYOLDBASE = JSIdent "myoldbase" | 51 | jsMYOLDBASE :: JS
jsMYOLDBASE = JSIdent "myoldbase" | 51 | jsMYOLDBASE = JSIdent "myoldbase" | 33 | false | true | 0 | 5 | 6 | 14 | 7 | 7 | null | null |
bholst/blog | Handler/DeleteComment.hs | mit | getDeleteCommentR :: CommentId -> Handler Html
getDeleteCommentR commentId = do
comment <- runDB $ get404 commentId
(formWidget, enctype) <- generateFormPost deleteForm
defaultLayout $ do
setTitleI MsgReallyDeleteCommentTitle
$(widgetFile "delete-comment") | 270 | getDeleteCommentR :: CommentId -> Handler Html
getDeleteCommentR commentId = do
comment <- runDB $ get404 commentId
(formWidget, enctype) <- generateFormPost deleteForm
defaultLayout $ do
setTitleI MsgReallyDeleteCommentTitle
$(widgetFile "delete-comment") | 270 | getDeleteCommentR commentId = do
comment <- runDB $ get404 commentId
(formWidget, enctype) <- generateFormPost deleteForm
defaultLayout $ do
setTitleI MsgReallyDeleteCommentTitle
$(widgetFile "delete-comment") | 223 | false | true | 0 | 13 | 41 | 79 | 34 | 45 | null | null |
thkoch2001/gitit2 | Network/Gitit2/Handler/Delete.hs | gpl-2.0 | postDeleteR :: HasGitit master => Page -> GH master Html
postDeleteR page = do
user <- requireUser
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(FS.Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR | 436 | postDeleteR :: HasGitit master => Page -> GH master Html
postDeleteR page = do
user <- requireUser
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(FS.Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR | 436 | postDeleteR page = do
user <- requireUser
fs <- filestore <$> getYesod
mr <- getMessageRender
fileToDelete <- lift $ runInputPost $ ireq textField "fileToDelete"
liftIO $ FS.delete fs (T.unpack fileToDelete)
(FS.Author (gititUserName user) (gititUserEmail user))
(T.unpack $ mr $ MsgDeleted page)
setMessageI $ MsgDeleted page
redirect HomeR | 379 | false | true | 0 | 12 | 94 | 155 | 71 | 84 | null | null |
olsner/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | arrayPrimTyConKey = mkPreludeTyConUnique 3 | 65 | arrayPrimTyConKey = mkPreludeTyConUnique 3 | 65 | arrayPrimTyConKey = mkPreludeTyConUnique 3 | 65 | false | false | 0 | 5 | 26 | 9 | 4 | 5 | null | null |
CRogers/stack | src/main/Main.hs | bsd-3-clause | initCmd :: InitOpts -> GlobalOpts -> IO ()
initCmd initOpts go = withConfig go $ initProject initOpts | 101 | initCmd :: InitOpts -> GlobalOpts -> IO ()
initCmd initOpts go = withConfig go $ initProject initOpts | 101 | initCmd initOpts go = withConfig go $ initProject initOpts | 58 | false | true | 0 | 8 | 16 | 43 | 19 | 24 | null | null |
narurien/ganeti-ceph | src/Ganeti/HTools/Types.hs | gpl-2.0 | opToResult (Ok v) = Ok v | 24 | opToResult (Ok v) = Ok v | 24 | opToResult (Ok v) = Ok v | 24 | false | false | 0 | 7 | 5 | 18 | 8 | 10 | null | null |
brendanhay/gogol | gogol-cloudfunctions/gen/Network/Google/CloudFunctions/Types/Product.hs | mpl-2.0 | -- | Creates a value of 'Location' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'lName'
--
-- * 'lMetadata'
--
-- * 'lDisplayName'
--
-- * 'lLabels'
--
-- * 'lLocationId'
location
:: Location
location =
Location'
{ _lName = Nothing
, _lMetadata = Nothing
, _lDisplayName = Nothing
, _lLabels = Nothing
, _lLocationId = Nothing
} | 446 | location
:: Location
location =
Location'
{ _lName = Nothing
, _lMetadata = Nothing
, _lDisplayName = Nothing
, _lLabels = Nothing
, _lLocationId = Nothing
} | 187 | location =
Location'
{ _lName = Nothing
, _lMetadata = Nothing
, _lDisplayName = Nothing
, _lLabels = Nothing
, _lLocationId = Nothing
} | 162 | true | true | 0 | 6 | 106 | 56 | 40 | 16 | null | null |
RossMeikleham/Tainted | examples/TransExample.hs | bsd-3-clause | ex3 = doStuff 5 h | 17 | ex3 = doStuff 5 h | 17 | ex3 = doStuff 5 h | 17 | false | false | 1 | 5 | 4 | 14 | 5 | 9 | null | null |
andorp/bead | src/Bead/Persistence/SQL/FileSystem.hs | bsd-3-clause | removeFS :: (MonadIO io) => io ()
removeFS = liftIO $ do
exists <- doesDirectoryExist datadir
when exists $ removeDirectoryRecursive datadir | 144 | removeFS :: (MonadIO io) => io ()
removeFS = liftIO $ do
exists <- doesDirectoryExist datadir
when exists $ removeDirectoryRecursive datadir | 144 | removeFS = liftIO $ do
exists <- doesDirectoryExist datadir
when exists $ removeDirectoryRecursive datadir | 110 | false | true | 2 | 9 | 24 | 59 | 25 | 34 | null | null |
Vlix/wechat | Web/WeChat/XMLParse.hs | mit | parseEventScan elt = do
eventKey <- textTag "EventKey" elt
eventTicket <- textTag "Ticket" elt
return $ InEvent QRScan{..} | 131 | parseEventScan elt = do
eventKey <- textTag "EventKey" elt
eventTicket <- textTag "Ticket" elt
return $ InEvent QRScan{..} | 131 | parseEventScan elt = do
eventKey <- textTag "EventKey" elt
eventTicket <- textTag "Ticket" elt
return $ InEvent QRScan{..} | 131 | false | false | 0 | 9 | 26 | 48 | 21 | 27 | null | null |
deweyvm/starstats | src/StarStats/Renderer.hs | mit | genTag :: String -> [(String,String)] -> String -> String
genTag t props c =
let props' = foldl (\acc kv -> acc ++ propToString kv) "" props in
concat ["<", t, " ", props', ">\n", c, "\n</", t, ">"] | 209 | genTag :: String -> [(String,String)] -> String -> String
genTag t props c =
let props' = foldl (\acc kv -> acc ++ propToString kv) "" props in
concat ["<", t, " ", props', ">\n", c, "\n</", t, ">"] | 208 | genTag t props c =
let props' = foldl (\acc kv -> acc ++ propToString kv) "" props in
concat ["<", t, " ", props', ">\n", c, "\n</", t, ">"] | 150 | false | true | 0 | 13 | 49 | 104 | 57 | 47 | null | null |
mfpi/boom | src/CleanFRP.hs | mit | flattenDelta d@(Free (DeltaRemoveEntity eId n)) = do
rc <- flattenDelta n
return $ (DeltaRemoveEntity' eId) : rc | 121 | flattenDelta d@(Free (DeltaRemoveEntity eId n)) = do
rc <- flattenDelta n
return $ (DeltaRemoveEntity' eId) : rc | 121 | flattenDelta d@(Free (DeltaRemoveEntity eId n)) = do
rc <- flattenDelta n
return $ (DeltaRemoveEntity' eId) : rc | 121 | false | false | 1 | 11 | 25 | 59 | 25 | 34 | null | null |
abuiles/turbinado-blog | tmp/dependencies/utf8-string-0.3.3/Data/String/UTF8.hs | bsd-3-clause | -- | Traverse a bytestring (right biased).
foldr :: UTF8Bytes string index => (Char -> a -> a) -> a -> UTF8 string -> a
foldr cons nil (Str cs) = G.foldr cons nil cs | 165 | foldr :: UTF8Bytes string index => (Char -> a -> a) -> a -> UTF8 string -> a
foldr cons nil (Str cs) = G.foldr cons nil cs | 122 | foldr cons nil (Str cs) = G.foldr cons nil cs | 45 | true | true | 0 | 9 | 34 | 69 | 34 | 35 | null | null |
barischj/threepenny-gui-contextmenu | src/Graphics/UI/Threepenny/Ext/ContextMenu.hs | bsd-3-clause | menuItem :: [UI ()] -> MenuItem -> UI (Element, [UI ()])
menuItem closeParents (MenuItem text value) = do
menuItem <- UI.li # set UI.text text # set style menuItemStyle
highlightWhileHover menuItem
case value of
MenuItemActions actions -> do
-- On click close the entire menu and execute the UI actions.
on UI.click menuItem $ const $ sequence $ closeParents ++ actions
return (menuItem, [])
NestedMenu nestedMenuItems -> do
(nestedMenu, closeNestedMenu, closeNestedMenusNestedMenus)
<- newMenu closeParents nestedMenuItems
-- Position a nested menu relative to this menu item.
-- element menuItemEl # set UI.position "relative"
-- element nestedMenuEl # set UI.position "absolute" # set UI.right "0px" # set UI.top "0px"
element menuItem #+ [element nestedMenu]
-- On hover display the nested menu.
on UI.hover menuItem $ const $ display "block" nestedMenu
return (menuItem, [closeNestedMenu] ++ closeNestedMenusNestedMenus)
-- |Highlight an element while hovered over. | 1,060 | menuItem :: [UI ()] -> MenuItem -> UI (Element, [UI ()])
menuItem closeParents (MenuItem text value) = do
menuItem <- UI.li # set UI.text text # set style menuItemStyle
highlightWhileHover menuItem
case value of
MenuItemActions actions -> do
-- On click close the entire menu and execute the UI actions.
on UI.click menuItem $ const $ sequence $ closeParents ++ actions
return (menuItem, [])
NestedMenu nestedMenuItems -> do
(nestedMenu, closeNestedMenu, closeNestedMenusNestedMenus)
<- newMenu closeParents nestedMenuItems
-- Position a nested menu relative to this menu item.
-- element menuItemEl # set UI.position "relative"
-- element nestedMenuEl # set UI.position "absolute" # set UI.right "0px" # set UI.top "0px"
element menuItem #+ [element nestedMenu]
-- On hover display the nested menu.
on UI.hover menuItem $ const $ display "block" nestedMenu
return (menuItem, [closeNestedMenu] ++ closeNestedMenusNestedMenus)
-- |Highlight an element while hovered over. | 1,060 | menuItem closeParents (MenuItem text value) = do
menuItem <- UI.li # set UI.text text # set style menuItemStyle
highlightWhileHover menuItem
case value of
MenuItemActions actions -> do
-- On click close the entire menu and execute the UI actions.
on UI.click menuItem $ const $ sequence $ closeParents ++ actions
return (menuItem, [])
NestedMenu nestedMenuItems -> do
(nestedMenu, closeNestedMenu, closeNestedMenusNestedMenus)
<- newMenu closeParents nestedMenuItems
-- Position a nested menu relative to this menu item.
-- element menuItemEl # set UI.position "relative"
-- element nestedMenuEl # set UI.position "absolute" # set UI.right "0px" # set UI.top "0px"
element menuItem #+ [element nestedMenu]
-- On hover display the nested menu.
on UI.hover menuItem $ const $ display "block" nestedMenu
return (menuItem, [closeNestedMenu] ++ closeNestedMenusNestedMenus)
-- |Highlight an element while hovered over. | 1,003 | false | true | 0 | 17 | 229 | 242 | 118 | 124 | null | null |
minoki/jstrans | JSTrans/Transform.hs | mit | getOption f = gets (f . transformOptions) | 41 | getOption f = gets (f . transformOptions) | 41 | getOption f = gets (f . transformOptions) | 41 | false | false | 0 | 7 | 6 | 19 | 9 | 10 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/Literal.hs | bsd-3-clause | litIsTrivial (LitInteger {}) = False | 37 | litIsTrivial (LitInteger {}) = False | 37 | litIsTrivial (LitInteger {}) = False | 37 | false | false | 0 | 7 | 5 | 16 | 8 | 8 | null | null |
gustavoramos00/tecnicas-topdown | S8_3.hs | mit | s8T :: Board
s8T = array (0,8) [(0,(2,2)),(1,(1,2)),(2,(1,1)),
(3,(3,3)),(4,(2,1)),(5,(3,2)),
(6,(1,3)),(7,(3,1)),(8,(2,3))] | 162 | s8T :: Board
s8T = array (0,8) [(0,(2,2)),(1,(1,2)),(2,(1,1)),
(3,(3,3)),(4,(2,1)),(5,(3,2)),
(6,(1,3)),(7,(3,1)),(8,(2,3))] | 162 | s8T = array (0,8) [(0,(2,2)),(1,(1,2)),(2,(1,1)),
(3,(3,3)),(4,(2,1)),(5,(3,2)),
(6,(1,3)),(7,(3,1)),(8,(2,3))] | 149 | false | true | 0 | 8 | 47 | 157 | 102 | 55 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/Typechecker/Extractor.hs | mit | inSubtype :: SubseqExtractor v loc (C.Type v loc, C.Type v loc)
inSubtype = asPathExtractor $ \case
C.InSubtype found expected -> Just (found, expected)
_ -> Nothing | 194 | inSubtype :: SubseqExtractor v loc (C.Type v loc, C.Type v loc)
inSubtype = asPathExtractor $ \case
C.InSubtype found expected -> Just (found, expected)
_ -> Nothing | 194 | inSubtype = asPathExtractor $ \case
C.InSubtype found expected -> Just (found, expected)
_ -> Nothing | 130 | false | true | 0 | 10 | 54 | 72 | 36 | 36 | null | null |
sordina/GLM | src/GLM/Tokenizer.hs | mit | pToken :: P Token
pToken = pComment <|> pLBrace <|> pRBrace <|> pSemi <|> pString <|> pWord | 91 | pToken :: P Token
pToken = pComment <|> pLBrace <|> pRBrace <|> pSemi <|> pString <|> pWord | 91 | pToken = pComment <|> pLBrace <|> pRBrace <|> pSemi <|> pString <|> pWord | 73 | false | true | 0 | 9 | 16 | 34 | 17 | 17 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrelNames.hs | bsd-3-clause | jcharTyConKey = mkPreludeTyConUnique 108 | 46 | jcharTyConKey = mkPreludeTyConUnique 108 | 46 | jcharTyConKey = mkPreludeTyConUnique 108 | 46 | false | false | 0 | 5 | 9 | 9 | 4 | 5 | null | null |
Fuuzetsu/yi-emacs-colours | src/Yi/Style/EmacsColours.hs | gpl-2.0 | -- | Names: @["LightSalmon4"]@
--
-- R139 G87 B66, 0x8b5742
lightSalmon4 :: Color
lightSalmon4 = RGB 139 87 66 | 110 | lightSalmon4 :: Color
lightSalmon4 = RGB 139 87 66 | 50 | lightSalmon4 = RGB 139 87 66 | 28 | true | true | 0 | 5 | 18 | 21 | 12 | 9 | null | null |
TWal/ENS_adac | src/Asm.hs | bsd-3-clause | andw = ins2 "andw" | 18 | andw = ins2 "andw" | 18 | andw = ins2 "andw" | 18 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
uwitty/mosquitto | src/Network/Mosquitto.hs | mit | connect :: Mosquitto -> String -> Int -> Int -> IO Int
connect mosquitto hostname port keepAlive =
fmap fromIntegral . withCString hostname $ \hostnameC ->
c_mosquitto_connect (mosquittoObject mosquitto) hostnameC (fromIntegral port) (fromIntegral keepAlive) | 270 | connect :: Mosquitto -> String -> Int -> Int -> IO Int
connect mosquitto hostname port keepAlive =
fmap fromIntegral . withCString hostname $ \hostnameC ->
c_mosquitto_connect (mosquittoObject mosquitto) hostnameC (fromIntegral port) (fromIntegral keepAlive) | 270 | connect mosquitto hostname port keepAlive =
fmap fromIntegral . withCString hostname $ \hostnameC ->
c_mosquitto_connect (mosquittoObject mosquitto) hostnameC (fromIntegral port) (fromIntegral keepAlive) | 215 | false | true | 0 | 9 | 45 | 85 | 41 | 44 | null | null |
codecurve/FieldML-Haskell-01 | src/FieldML/Utility01.hs | bsd-2-clause | freeVariables (LessThan a b) = freeVariables $ Tuple [ a, b ] | 61 | freeVariables (LessThan a b) = freeVariables $ Tuple [ a, b ] | 61 | freeVariables (LessThan a b) = freeVariables $ Tuple [ a, b ] | 61 | false | false | 0 | 7 | 11 | 31 | 15 | 16 | null | null |
mplamann/magic-spieler | src/CardSelector.hs | mit | selectAttribute :: Attribute -> CardSelector
selectAttribute attr _ (PlayerTarget _) = return False | 99 | selectAttribute :: Attribute -> CardSelector
selectAttribute attr _ (PlayerTarget _) = return False | 99 | selectAttribute attr _ (PlayerTarget _) = return False | 54 | false | true | 0 | 7 | 12 | 31 | 15 | 16 | null | null |
charles-l/comp | build_me_a_scheme/scheme.hs | mit | apply (Func params varargs body closure) args =
if num params /= num args && varargs == Nothing
then throwError $ NumArgs (num params) args
else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody
where remainingArgs = drop (length params) args
num = toInteger . length
evalBody env = liftM last $ mapM (eval env) body
bindVarArgs arg env = case arg of
Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)]
Nothing -> return env | 546 | apply (Func params varargs body closure) args =
if num params /= num args && varargs == Nothing
then throwError $ NumArgs (num params) args
else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody
where remainingArgs = drop (length params) args
num = toInteger . length
evalBody env = liftM last $ mapM (eval env) body
bindVarArgs arg env = case arg of
Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)]
Nothing -> return env | 546 | apply (Func params varargs body closure) args =
if num params /= num args && varargs == Nothing
then throwError $ NumArgs (num params) args
else (liftIO $ bindVars closure $ zip params args) >>= bindVarArgs varargs >>= evalBody
where remainingArgs = drop (length params) args
num = toInteger . length
evalBody env = liftM last $ mapM (eval env) body
bindVarArgs arg env = case arg of
Just argName -> liftIO $ bindVars env [(argName, List $ remainingArgs)]
Nothing -> return env | 546 | false | false | 2 | 12 | 151 | 209 | 98 | 111 | null | null |
atsukotakahashi/wi | src/library/Yi/Buffer/TextUnit.hs | gpl-2.0 | -- | Turns a unit into its "negative" by inverting the boundaries. For example,
-- @outsideUnit unitViWord@ will be the unit of spaces between words. For units
-- without boundaries ('Character', 'Document', ...), this is the identity
-- function.
outsideUnit :: TextUnit -> TextUnit
outsideUnit (GenUnit enclosing boundary) = GenUnit enclosing (boundary . reverseDir) | 368 | outsideUnit :: TextUnit -> TextUnit
outsideUnit (GenUnit enclosing boundary) = GenUnit enclosing (boundary . reverseDir) | 120 | outsideUnit (GenUnit enclosing boundary) = GenUnit enclosing (boundary . reverseDir) | 84 | true | true | 0 | 7 | 53 | 42 | 23 | 19 | null | null |
tibbe/ghc | compiler/nativeGen/SPARC/CodeGen.hs | bsd-3-clause | -- | Top level code generation
cmmTopCodeGen :: RawCmmDecl
-> NatM [NatCmmDecl CmmStatics Instr]
cmmTopCodeGen (CmmProc info lab live graph)
= do let blocks = toBlockListEntryFirst graph
(nat_blocks,statics) <- mapAndUnzipM basicBlockCodeGen blocks
let proc = CmmProc info lab live (ListGraph $ concat nat_blocks)
let tops = proc : concat statics
return tops | 400 | cmmTopCodeGen :: RawCmmDecl
-> NatM [NatCmmDecl CmmStatics Instr]
cmmTopCodeGen (CmmProc info lab live graph)
= do let blocks = toBlockListEntryFirst graph
(nat_blocks,statics) <- mapAndUnzipM basicBlockCodeGen blocks
let proc = CmmProc info lab live (ListGraph $ concat nat_blocks)
let tops = proc : concat statics
return tops | 368 | cmmTopCodeGen (CmmProc info lab live graph)
= do let blocks = toBlockListEntryFirst graph
(nat_blocks,statics) <- mapAndUnzipM basicBlockCodeGen blocks
let proc = CmmProc info lab live (ListGraph $ concat nat_blocks)
let tops = proc : concat statics
return tops | 288 | true | true | 0 | 13 | 93 | 122 | 57 | 65 | null | null |
semaj/hademlia | src/Real.hs | bsd-3-clause | timeToBootstrap (Just bootstrap) = do
s <- C.getSocket bootstrap
send s "X"
return [s] | 92 | timeToBootstrap (Just bootstrap) = do
s <- C.getSocket bootstrap
send s "X"
return [s] | 92 | timeToBootstrap (Just bootstrap) = do
s <- C.getSocket bootstrap
send s "X"
return [s] | 92 | false | false | 0 | 9 | 19 | 44 | 19 | 25 | null | null |
idris-hackers/idris-bot | src/IdeMode.hs | bsd-3-clause | sExpToString (BoolAtom False) = ":False" | 40 | sExpToString (BoolAtom False) = ":False" | 40 | sExpToString (BoolAtom False) = ":False" | 40 | false | false | 0 | 7 | 4 | 15 | 7 | 8 | null | null |
ehlemur/HLearn | src/HLearn/Optimization/GradientDescent.hs | bsd-3-clause | -- | performs a single iteration of the conjugate gradient descent algorithm
step_cgd ::
( VectorSpace v
, ClassicalLogic v
) => MultivariateLineSearch v
-> ConjugateMethod v
-> (v -> Scalar v)
-> (v -> v)
-> Iterator_cgd v
-> History (Iterator_cgd v)
step_cgd stepMethod conjMethod f f' (Iterator_cgd x1 fx1 f'x1 alpha1 f'x0 s0 _) = {-# SCC step_cgd #-} do
-- this test ensures that conjugacy will be reset when it is lost; the
-- formula is taken from equation 1.174 of the book "Nonlinear Programming"
-- let beta = if abs (f'x1 <> f'x0) > 0.2 * squaredInnerProductNorm f'x0
-- then 0
-- else max 0 $ conjMethod f'x1 f'x0 s0
let beta = conjMethod f'x1 f'x0 s0
let s1 = - f'x1 + beta *. f'x1
-- let s1 = - f'x1 + beta *. s0
alpha <- stepMethod f f' x1 s1 alpha1
let x = x1 + alpha *. s1
return $ Iterator_cgd
{ _cgd_x1 = x
, _cgd_fx1 = f x
, _cgd_f'x1 = f' x
, _cgd_alpha = alpha
, _cgd_f'x0 = f'x1
, _cgd_s0 = s1
, _cgd_f = f
} | 1,102 | step_cgd ::
( VectorSpace v
, ClassicalLogic v
) => MultivariateLineSearch v
-> ConjugateMethod v
-> (v -> Scalar v)
-> (v -> v)
-> Iterator_cgd v
-> History (Iterator_cgd v)
step_cgd stepMethod conjMethod f f' (Iterator_cgd x1 fx1 f'x1 alpha1 f'x0 s0 _) = {-# SCC step_cgd #-} do
-- this test ensures that conjugacy will be reset when it is lost; the
-- formula is taken from equation 1.174 of the book "Nonlinear Programming"
-- let beta = if abs (f'x1 <> f'x0) > 0.2 * squaredInnerProductNorm f'x0
-- then 0
-- else max 0 $ conjMethod f'x1 f'x0 s0
let beta = conjMethod f'x1 f'x0 s0
let s1 = - f'x1 + beta *. f'x1
-- let s1 = - f'x1 + beta *. s0
alpha <- stepMethod f f' x1 s1 alpha1
let x = x1 + alpha *. s1
return $ Iterator_cgd
{ _cgd_x1 = x
, _cgd_fx1 = f x
, _cgd_f'x1 = f' x
, _cgd_alpha = alpha
, _cgd_f'x0 = f'x1
, _cgd_s0 = s1
, _cgd_f = f
} | 1,025 | step_cgd stepMethod conjMethod f f' (Iterator_cgd x1 fx1 f'x1 alpha1 f'x0 s0 _) = {-# SCC step_cgd #-} do
-- this test ensures that conjugacy will be reset when it is lost; the
-- formula is taken from equation 1.174 of the book "Nonlinear Programming"
-- let beta = if abs (f'x1 <> f'x0) > 0.2 * squaredInnerProductNorm f'x0
-- then 0
-- else max 0 $ conjMethod f'x1 f'x0 s0
let beta = conjMethod f'x1 f'x0 s0
let s1 = - f'x1 + beta *. f'x1
-- let s1 = - f'x1 + beta *. s0
alpha <- stepMethod f f' x1 s1 alpha1
let x = x1 + alpha *. s1
return $ Iterator_cgd
{ _cgd_x1 = x
, _cgd_fx1 = f x
, _cgd_f'x1 = f' x
, _cgd_alpha = alpha
, _cgd_f'x0 = f'x1
, _cgd_s0 = s1
, _cgd_f = f
} | 808 | true | true | 0 | 14 | 361 | 250 | 129 | 121 | null | null |
ony/yampa-glut | FRP/Yampa/GLUT/UI.hs | gpl-3.0 | impleMousePosition :: Fractional a => SF (Event UI) (Vector2 a)
simpleMousePosition = windowSize &&& mousePosition >>> arr f where
f (Size w h, Position x y) = Vector2 x' y' where
{-
b = fromIntegral (w `min` h)
x' = (2 * fromIntegral x - fromIntegral w) / b
y' = (fromIntegral h - 2 * fromIntegral y) / b
-}
b = realToFrac (w `min` h)
x' = (2 * realToFrac x - realToFrac w) / b
y' = (realToFrac h - 2 * realToFrac y) / b
{ | 492 | simpleMousePosition :: Fractional a => SF (Event UI) (Vector2 a)
simpleMousePosition = windowSize &&& mousePosition >>> arr f where
f (Size w h, Position x y) = Vector2 x' y' where
{-
b = fromIntegral (w `min` h)
x' = (2 * fromIntegral x - fromIntegral w) / b
y' = (fromIntegral h - 2 * fromIntegral y) / b
-}
b = realToFrac (w `min` h)
x' = (2 * realToFrac x - realToFrac w) / b
y' = (realToFrac h - 2 * realToFrac y) / b
| 492 | simpleMousePosition = windowSize &&& mousePosition >>> arr f where
f (Size w h, Position x y) = Vector2 x' y' where
{-
b = fromIntegral (w `min` h)
x' = (2 * fromIntegral x - fromIntegral w) / b
y' = (fromIntegral h - 2 * fromIntegral y) / b
-}
b = realToFrac (w `min` h)
x' = (2 * realToFrac x - realToFrac w) / b
y' = (realToFrac h - 2 * realToFrac y) / b
| 427 | false | true | 1 | 11 | 158 | 151 | 76 | 75 | null | null |
yaxu/volca-tidal | beats.hs | gpl-3.0 | parse "/speed/claves" = parseIntegral (Speed Claves) | 53 | parse "/speed/claves" = parseIntegral (Speed Claves) | 53 | parse "/speed/claves" = parseIntegral (Speed Claves) | 53 | false | false | 0 | 7 | 6 | 19 | 8 | 11 | null | null |
tmishima/Hinecraft | Hinecraft/GUI/GLFWWindow.hs | apache-2.0 | setUIMode :: GLFWHandle -> UIMode -> IO ()
setUIMode glfwHdl mode = do
writeIORef ui' mode
winStat <- readIORef $ winHdl glfwHdl
case winStat of
(Just win,_) -> case mode of
Mode2D -> -- 2D
GLFW.setCursorInputMode win GLFW.CursorInputMode'Normal
Mode3D ->
GLFW.setCursorInputMode win GLFW.CursorInputMode'Hidden
(Nothing,_) -> return ()
where
!ui' = uiMode glfwHdl | 413 | setUIMode :: GLFWHandle -> UIMode -> IO ()
setUIMode glfwHdl mode = do
writeIORef ui' mode
winStat <- readIORef $ winHdl glfwHdl
case winStat of
(Just win,_) -> case mode of
Mode2D -> -- 2D
GLFW.setCursorInputMode win GLFW.CursorInputMode'Normal
Mode3D ->
GLFW.setCursorInputMode win GLFW.CursorInputMode'Hidden
(Nothing,_) -> return ()
where
!ui' = uiMode glfwHdl | 413 | setUIMode glfwHdl mode = do
writeIORef ui' mode
winStat <- readIORef $ winHdl glfwHdl
case winStat of
(Just win,_) -> case mode of
Mode2D -> -- 2D
GLFW.setCursorInputMode win GLFW.CursorInputMode'Normal
Mode3D ->
GLFW.setCursorInputMode win GLFW.CursorInputMode'Hidden
(Nothing,_) -> return ()
where
!ui' = uiMode glfwHdl | 370 | false | true | 0 | 14 | 100 | 138 | 65 | 73 | null | null |
tjakway/ghcjvm | compiler/utils/OrdList.hs | bsd-3-clause | a `appOL` One b = Snoc a b | 30 | a `appOL` One b = Snoc a b | 30 | a `appOL` One b = Snoc a b | 30 | false | false | 0 | 6 | 11 | 22 | 10 | 12 | null | null |
matthewleon/libmpd-haskell | src/Network/MPD/Core.hs | mit | -- | Send a command to the MPD server and return the result.
getResponse :: (MonadMPD m) => String -> m [ByteString]
getResponse cmd = (send cmd >>= parseResponse) `catchError` sendpw
where
sendpw e@(ACK Auth _) = do
pw <- getPassword
if null pw then throwError e
else send ("password " ++ pw) >>= parseResponse
>> send cmd >>= parseResponse
sendpw e =
throwError e
-- Consume response and return a Response. | 499 | getResponse :: (MonadMPD m) => String -> m [ByteString]
getResponse cmd = (send cmd >>= parseResponse) `catchError` sendpw
where
sendpw e@(ACK Auth _) = do
pw <- getPassword
if null pw then throwError e
else send ("password " ++ pw) >>= parseResponse
>> send cmd >>= parseResponse
sendpw e =
throwError e
-- Consume response and return a Response. | 438 | getResponse cmd = (send cmd >>= parseResponse) `catchError` sendpw
where
sendpw e@(ACK Auth _) = do
pw <- getPassword
if null pw then throwError e
else send ("password " ++ pw) >>= parseResponse
>> send cmd >>= parseResponse
sendpw e =
throwError e
-- Consume response and return a Response. | 382 | true | true | 1 | 14 | 162 | 132 | 67 | 65 | null | null |
jethomas/WaveSim | src/Main.hs | bsd-3-clause | main :: IO ()
main = waveSim defaultConfig | 42 | main :: IO ()
main = waveSim defaultConfig | 42 | main = waveSim defaultConfig | 28 | false | true | 0 | 6 | 7 | 19 | 9 | 10 | null | null |
mdulac/mower-haskell | lib/Mower/Core.hs | lgpl-3.0 | playGame :: [Player] -> State Field ()
playGame = undefined | 59 | playGame :: [Player] -> State Field ()
playGame = undefined | 59 | playGame = undefined | 20 | false | true | 0 | 8 | 9 | 31 | 14 | 17 | null | null |
fmapfmapfmap/amazonka | amazonka-devicefarm/gen/Network/AWS/DeviceFarm/ListArtifacts.hs | mpl-2.0 | -- | The artifacts\' ARNs.
laArn :: Lens' ListArtifacts Text
laArn = lens _laArn (\ s a -> s{_laArn = a}) | 105 | laArn :: Lens' ListArtifacts Text
laArn = lens _laArn (\ s a -> s{_laArn = a}) | 78 | laArn = lens _laArn (\ s a -> s{_laArn = a}) | 44 | true | true | 0 | 9 | 20 | 40 | 22 | 18 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.