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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ucsd-progsys/nanomaly | src/NanoML/Step.hs | bsd-3-clause | stepApp ms f' es = do
a <- freshTVar
b <- freshTVar
force f' (TVar a :-> TVar b) $ \f' -> case f' of
-- With _ e f -> stepApp ms f es
-- Replace _ e f -> stepApp ms f es
-- immediately apply saturated primitve wrappers
Prim1 ms' (P1 x f' t) -> do
-- traceShowM (f, es)
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (freeTyVars t) $ \tv -> (tv,) . TVar <$> freshTVar
case es of
[e] -> force e (subst su t) $ \v -> f' v
e:es -> do x <- force e (subst su t) $ \v -> f' v
return (App ms x es)
Prim2 ms' (P2 x f t1 t2) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2] -> forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
e1:e2:es -> do x <- forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
return (App ms x es)
-- _ -> do traceShowM (pretty $ App Nothing (Prim2 ms' (P2 x f t1 t2)) es)
-- undefined
Prim3 ms' (P3 x f t1 t2 t3) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2 ++ freeTyVars t3) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
t3' = subst su t3
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x")
(Lam ms (VarPat ms "$y")
(App ms f' (es ++ [Var ms "$x", Var ms "$y"]))
(Just env))
(Just env))
[e1,e2] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2,e3] -> forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
e1:e2:e3:es -> do x <- forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
return (App ms x es)
PrimN ms' (PN x f ts) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ concatMap freeTyVars ts) $ \tv ->
(tv,) . TVar <$> freshTVar
let ts' = map (subst su) ts
if | length ts' < length es -> do
env <- gets stVarEnv
let n = length es - length ts'
let vs = map (\v -> "$" ++ [v]) $ take n ['a'..'z']
return (foldr (\v e -> (Lam ms (VarPat ms v) e (Just env)))
(App ms f' (es ++ (map (Var ms) vs)))
vs)
| length es < length ts' -> do
let (xs, ys) = splitAt (length ts' - length es) es
x <- forces (zip xs ts') $ \vs -> f vs
return (App ms x ys)
| otherwise -> do
forces (zip es ts') $ \vs -> f vs
Lam _ _ _ (Just _) -> do
let (ps, e, env) = gatherLams f'
(eps, es', ps') = zipWithLeftover es ps
-- traceShowM (eps, es', ps')
-- traceShowM (f,es)
pat_env' <- mconcat <$> mapM (\(v, p) -> matchPat v p) eps
pat_env <- maybe (withCurrentProvM $
throwError . MLException . mkExn "Match_failure" [])
return
pat_env'
-- pat_env <- forM pat_env' $ \(var, val) -> (var,) <$> refreshExpr val
-- traceShowM pat_env
-- traceM ""
-- pushEnv env
-- pushEnv pat_env
nenv' <- allocEnvWith ("app:" ++ show (srcSpanStartLine $ fromJust ms)) env pat_env
(su, e') <- unshadow' e nenv'
let nenv = nenv' { envEnv = substEnv su (envEnv nenv') }
case (ps', es') of
([], []) -> do
pushCallStack (getSrcSpanExprMaybe f') es
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv e')
-- Replace ms nenv <$> (refreshExpr e' `withEnv` nenv) -- only refresh at saturated applications
([], _) -> do
pushCallStack (getSrcSpanExprMaybe f') (map fst eps)
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv (App ms e' es'))
-- e'' <- refreshExpr e' `withEnv` nenv
-- Replace ms nenv <$> addSubTerms (App ms e'' es')
(_, []) -> mkLamsSubTerms ps' e' >>= \(Lam ms p e _) ->
return $ Lam ms p e $ Just nenv -- WRONG?? mkLamsSubTerms ps' e
_ -> error $ "stepApp: impossible: " ++ show f'
-- _ -> typeError (TVar "a" :-> TVar "b") (typeOf f') -- otherError $ printf "'%s' is not a function" (show f')
-- stepApp _ f es = error (show (f:es)) | 4,816 | stepApp ms f' es = do
a <- freshTVar
b <- freshTVar
force f' (TVar a :-> TVar b) $ \f' -> case f' of
-- With _ e f -> stepApp ms f es
-- Replace _ e f -> stepApp ms f es
-- immediately apply saturated primitve wrappers
Prim1 ms' (P1 x f' t) -> do
-- traceShowM (f, es)
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (freeTyVars t) $ \tv -> (tv,) . TVar <$> freshTVar
case es of
[e] -> force e (subst su t) $ \v -> f' v
e:es -> do x <- force e (subst su t) $ \v -> f' v
return (App ms x es)
Prim2 ms' (P2 x f t1 t2) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2] -> forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
e1:e2:es -> do x <- forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
return (App ms x es)
-- _ -> do traceShowM (pretty $ App Nothing (Prim2 ms' (P2 x f t1 t2)) es)
-- undefined
Prim3 ms' (P3 x f t1 t2 t3) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2 ++ freeTyVars t3) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
t3' = subst su t3
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x")
(Lam ms (VarPat ms "$y")
(App ms f' (es ++ [Var ms "$x", Var ms "$y"]))
(Just env))
(Just env))
[e1,e2] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2,e3] -> forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
e1:e2:e3:es -> do x <- forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
return (App ms x es)
PrimN ms' (PN x f ts) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ concatMap freeTyVars ts) $ \tv ->
(tv,) . TVar <$> freshTVar
let ts' = map (subst su) ts
if | length ts' < length es -> do
env <- gets stVarEnv
let n = length es - length ts'
let vs = map (\v -> "$" ++ [v]) $ take n ['a'..'z']
return (foldr (\v e -> (Lam ms (VarPat ms v) e (Just env)))
(App ms f' (es ++ (map (Var ms) vs)))
vs)
| length es < length ts' -> do
let (xs, ys) = splitAt (length ts' - length es) es
x <- forces (zip xs ts') $ \vs -> f vs
return (App ms x ys)
| otherwise -> do
forces (zip es ts') $ \vs -> f vs
Lam _ _ _ (Just _) -> do
let (ps, e, env) = gatherLams f'
(eps, es', ps') = zipWithLeftover es ps
-- traceShowM (eps, es', ps')
-- traceShowM (f,es)
pat_env' <- mconcat <$> mapM (\(v, p) -> matchPat v p) eps
pat_env <- maybe (withCurrentProvM $
throwError . MLException . mkExn "Match_failure" [])
return
pat_env'
-- pat_env <- forM pat_env' $ \(var, val) -> (var,) <$> refreshExpr val
-- traceShowM pat_env
-- traceM ""
-- pushEnv env
-- pushEnv pat_env
nenv' <- allocEnvWith ("app:" ++ show (srcSpanStartLine $ fromJust ms)) env pat_env
(su, e') <- unshadow' e nenv'
let nenv = nenv' { envEnv = substEnv su (envEnv nenv') }
case (ps', es') of
([], []) -> do
pushCallStack (getSrcSpanExprMaybe f') es
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv e')
-- Replace ms nenv <$> (refreshExpr e' `withEnv` nenv) -- only refresh at saturated applications
([], _) -> do
pushCallStack (getSrcSpanExprMaybe f') (map fst eps)
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv (App ms e' es'))
-- e'' <- refreshExpr e' `withEnv` nenv
-- Replace ms nenv <$> addSubTerms (App ms e'' es')
(_, []) -> mkLamsSubTerms ps' e' >>= \(Lam ms p e _) ->
return $ Lam ms p e $ Just nenv -- WRONG?? mkLamsSubTerms ps' e
_ -> error $ "stepApp: impossible: " ++ show f'
-- _ -> typeError (TVar "a" :-> TVar "b") (typeOf f') -- otherError $ printf "'%s' is not a function" (show f')
-- stepApp _ f es = error (show (f:es)) | 4,816 | stepApp ms f' es = do
a <- freshTVar
b <- freshTVar
force f' (TVar a :-> TVar b) $ \f' -> case f' of
-- With _ e f -> stepApp ms f es
-- Replace _ e f -> stepApp ms f es
-- immediately apply saturated primitve wrappers
Prim1 ms' (P1 x f' t) -> do
-- traceShowM (f, es)
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (freeTyVars t) $ \tv -> (tv,) . TVar <$> freshTVar
case es of
[e] -> force e (subst su t) $ \v -> f' v
e:es -> do x <- force e (subst su t) $ \v -> f' v
return (App ms x es)
Prim2 ms' (P2 x f t1 t2) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2] -> forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
e1:e2:es -> do x <- forces [(e1,t1'),(e2,t2')] $ \[v1,v2] -> f v1 v2
return (App ms x es)
-- _ -> do traceShowM (pretty $ App Nothing (Prim2 ms' (P2 x f t1 t2)) es)
-- undefined
Prim3 ms' (P3 x f t1 t2 t3) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ freeTyVars t1 ++ freeTyVars t2 ++ freeTyVars t3) $ \tv ->
(tv,) . TVar <$> freshTVar
let t1' = subst su t1
t2' = subst su t2
t3' = subst su t3
case es of
[e1] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x")
(Lam ms (VarPat ms "$y")
(App ms f' (es ++ [Var ms "$x", Var ms "$y"]))
(Just env))
(Just env))
[e1,e2] -> do env <- gets stVarEnv
return (Lam ms (VarPat ms "$x") (App ms f' (es ++ [Var ms "$x"])) (Just env))
[e1,e2,e3] -> forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
e1:e2:e3:es -> do x <- forces [(e1,t1'),(e2,t2'),(e3,t3')] $ \[v1,v2,v3] -> f v1 v2 v3
return (App ms x es)
PrimN ms' (PN x f ts) -> do
modify' (\s -> s { stStepKind = PrimStep })
su <- fmap Map.fromList $ forM (nub $ concatMap freeTyVars ts) $ \tv ->
(tv,) . TVar <$> freshTVar
let ts' = map (subst su) ts
if | length ts' < length es -> do
env <- gets stVarEnv
let n = length es - length ts'
let vs = map (\v -> "$" ++ [v]) $ take n ['a'..'z']
return (foldr (\v e -> (Lam ms (VarPat ms v) e (Just env)))
(App ms f' (es ++ (map (Var ms) vs)))
vs)
| length es < length ts' -> do
let (xs, ys) = splitAt (length ts' - length es) es
x <- forces (zip xs ts') $ \vs -> f vs
return (App ms x ys)
| otherwise -> do
forces (zip es ts') $ \vs -> f vs
Lam _ _ _ (Just _) -> do
let (ps, e, env) = gatherLams f'
(eps, es', ps') = zipWithLeftover es ps
-- traceShowM (eps, es', ps')
-- traceShowM (f,es)
pat_env' <- mconcat <$> mapM (\(v, p) -> matchPat v p) eps
pat_env <- maybe (withCurrentProvM $
throwError . MLException . mkExn "Match_failure" [])
return
pat_env'
-- pat_env <- forM pat_env' $ \(var, val) -> (var,) <$> refreshExpr val
-- traceShowM pat_env
-- traceM ""
-- pushEnv env
-- pushEnv pat_env
nenv' <- allocEnvWith ("app:" ++ show (srcSpanStartLine $ fromJust ms)) env pat_env
(su, e') <- unshadow' e nenv'
let nenv = nenv' { envEnv = substEnv su (envEnv nenv') }
case (ps', es') of
([], []) -> do
pushCallStack (getSrcSpanExprMaybe f') es
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv e')
-- Replace ms nenv <$> (refreshExpr e' `withEnv` nenv) -- only refresh at saturated applications
([], _) -> do
pushCallStack (getSrcSpanExprMaybe f') (map fst eps)
modify' (\s -> s { stStepKind = CallStep })
refreshExpr (Replace ms nenv (App ms e' es'))
-- e'' <- refreshExpr e' `withEnv` nenv
-- Replace ms nenv <$> addSubTerms (App ms e'' es')
(_, []) -> mkLamsSubTerms ps' e' >>= \(Lam ms p e _) ->
return $ Lam ms p e $ Just nenv -- WRONG?? mkLamsSubTerms ps' e
_ -> error $ "stepApp: impossible: " ++ show f'
-- _ -> typeError (TVar "a" :-> TVar "b") (typeOf f') -- otherError $ printf "'%s' is not a function" (show f')
-- stepApp _ f es = error (show (f:es)) | 4,816 | false | false | 26 | 22 | 1,717 | 1,965 | 1,001 | 964 | null | null |
Peaker/lamdu | src/Lamdu/Data/Export/JSON/Codec.hs | gpl-3.0 | encodePresentationMode :: Encoder Meta.PresentationMode
encodePresentationMode Meta.Verbose = Aeson.String "Verbose" | 116 | encodePresentationMode :: Encoder Meta.PresentationMode
encodePresentationMode Meta.Verbose = Aeson.String "Verbose" | 116 | encodePresentationMode Meta.Verbose = Aeson.String "Verbose" | 60 | false | true | 0 | 6 | 8 | 26 | 12 | 14 | null | null |
flowbox-public/language-c-quote | Language/C/Quote/Base.hs | bsd-3-clause | qqCEnumP :: C.CEnum -> Maybe (Q Pat)
qqCEnumP (C.AntiEnum v _) = Just $ antiVarP v | 82 | qqCEnumP :: C.CEnum -> Maybe (Q Pat)
qqCEnumP (C.AntiEnum v _) = Just $ antiVarP v | 82 | qqCEnumP (C.AntiEnum v _) = Just $ antiVarP v | 45 | false | true | 0 | 8 | 15 | 46 | 22 | 24 | null | null |
tobiasreinhardt/show | IniConfiguration/src/Encoder.hs | apache-2.0 | encodeProperty :: Property -> String
encodeProperty (key, value) = key ++ "=" ++ value | 86 | encodeProperty :: Property -> String
encodeProperty (key, value) = key ++ "=" ++ value | 86 | encodeProperty (key, value) = key ++ "=" ++ value | 49 | false | true | 0 | 6 | 13 | 36 | 18 | 18 | null | null |
f-me/snap-core | src/Snap/Internal/Routing.hs | bsd-3-clause | route' pre !ctx [] !params (Dir _ fb) =
route' pre ctx [] params fb | 71 | route' pre !ctx [] !params (Dir _ fb) =
route' pre ctx [] params fb | 71 | route' pre !ctx [] !params (Dir _ fb) =
route' pre ctx [] params fb | 71 | false | false | 0 | 7 | 18 | 42 | 19 | 23 | null | null |
brendanhay/gogol | gogol-drive/gen/Network/Google/Resource/Drive/Changes/Watch.hs | mpl-2.0 | -- | Whether to include changes indicating that items have been removed from
-- the list of changes, for example by deletion or loss of access.
cwIncludeRemoved :: Lens' ChangesWatch Bool
cwIncludeRemoved
= lens _cwIncludeRemoved
(\ s a -> s{_cwIncludeRemoved = a}) | 273 | cwIncludeRemoved :: Lens' ChangesWatch Bool
cwIncludeRemoved
= lens _cwIncludeRemoved
(\ s a -> s{_cwIncludeRemoved = a}) | 129 | cwIncludeRemoved
= lens _cwIncludeRemoved
(\ s a -> s{_cwIncludeRemoved = a}) | 85 | true | true | 0 | 9 | 49 | 43 | 23 | 20 | null | null |
shnarazk/mios | src/SAT/Mios/Main.hs | gpl-3.0 | analyzeFinal :: Solver -> Clause -> Bool -> IO ()
analyzeFinal Solver{..} confl skipFirst = do
reset conflicts
rl <- get' rootLevel
unless (rl == 0) $ do
n <- get' confl
let lstack = lits confl
loopOnConfl :: Int -> IO ()
loopOnConfl ((<= n) -> False) = return ()
loopOnConfl i = do
(x :: Var) <- lit2var <$> getNth lstack i
lvl <- getNth level x
when (0 < lvl) $ setNth an'seen x 1
loopOnConfl $ i + 1
loopOnConfl $ if skipFirst then 2 else 1
tls <- get' trailLim
trs <- get' trail
tlz <- getNth trailLim 1
let loopOnTrail :: Int -> IO ()
loopOnTrail ((tlz <=) -> False) = return ()
loopOnTrail i = do
(l :: Lit) <- getNth trail (i + 1)
let (x :: Var) = lit2var l
saw <- getNth an'seen x
when (saw == 1) $ do
(r :: Clause) <- getNth reason x
if r == NullClause
then pushTo conflicts (negateLit l)
else do
k <- get' r
let lstack' = lits r
loopOnLits :: Int -> IO ()
loopOnLits ((<= k) -> False) = return ()
loopOnLits j = do
(v :: Var) <- lit2var <$> getNth lstack' j
lv <- getNth level v
when (0 < lv) $ setNth an'seen v 1
loopOnLits $ i + 1
loopOnLits 2
setNth an'seen x 0
loopOnTrail $ i - 1
loopOnTrail =<< if tls <= rl then return (trs - 1) else getNth trailLim (rl + 1)
-- | M114:
-- propagate : [void] -> [Clause+]
--
-- __Description:__
-- Porpagates all enqueued facts. If a conflict arises, the conflicting clause is returned.
-- otherwise CRef_undef.
--
-- __Post-conditions:__
-- * the propagation queue is empty, even if there was a conflict.
--
-- memo: @propagate@ is invoked by @search@,`simpleDB` and `solve` | 1,978 | analyzeFinal :: Solver -> Clause -> Bool -> IO ()
analyzeFinal Solver{..} confl skipFirst = do
reset conflicts
rl <- get' rootLevel
unless (rl == 0) $ do
n <- get' confl
let lstack = lits confl
loopOnConfl :: Int -> IO ()
loopOnConfl ((<= n) -> False) = return ()
loopOnConfl i = do
(x :: Var) <- lit2var <$> getNth lstack i
lvl <- getNth level x
when (0 < lvl) $ setNth an'seen x 1
loopOnConfl $ i + 1
loopOnConfl $ if skipFirst then 2 else 1
tls <- get' trailLim
trs <- get' trail
tlz <- getNth trailLim 1
let loopOnTrail :: Int -> IO ()
loopOnTrail ((tlz <=) -> False) = return ()
loopOnTrail i = do
(l :: Lit) <- getNth trail (i + 1)
let (x :: Var) = lit2var l
saw <- getNth an'seen x
when (saw == 1) $ do
(r :: Clause) <- getNth reason x
if r == NullClause
then pushTo conflicts (negateLit l)
else do
k <- get' r
let lstack' = lits r
loopOnLits :: Int -> IO ()
loopOnLits ((<= k) -> False) = return ()
loopOnLits j = do
(v :: Var) <- lit2var <$> getNth lstack' j
lv <- getNth level v
when (0 < lv) $ setNth an'seen v 1
loopOnLits $ i + 1
loopOnLits 2
setNth an'seen x 0
loopOnTrail $ i - 1
loopOnTrail =<< if tls <= rl then return (trs - 1) else getNth trailLim (rl + 1)
-- | M114:
-- propagate : [void] -> [Clause+]
--
-- __Description:__
-- Porpagates all enqueued facts. If a conflict arises, the conflicting clause is returned.
-- otherwise CRef_undef.
--
-- __Post-conditions:__
-- * the propagation queue is empty, even if there was a conflict.
--
-- memo: @propagate@ is invoked by @search@,`simpleDB` and `solve` | 1,978 | analyzeFinal Solver{..} confl skipFirst = do
reset conflicts
rl <- get' rootLevel
unless (rl == 0) $ do
n <- get' confl
let lstack = lits confl
loopOnConfl :: Int -> IO ()
loopOnConfl ((<= n) -> False) = return ()
loopOnConfl i = do
(x :: Var) <- lit2var <$> getNth lstack i
lvl <- getNth level x
when (0 < lvl) $ setNth an'seen x 1
loopOnConfl $ i + 1
loopOnConfl $ if skipFirst then 2 else 1
tls <- get' trailLim
trs <- get' trail
tlz <- getNth trailLim 1
let loopOnTrail :: Int -> IO ()
loopOnTrail ((tlz <=) -> False) = return ()
loopOnTrail i = do
(l :: Lit) <- getNth trail (i + 1)
let (x :: Var) = lit2var l
saw <- getNth an'seen x
when (saw == 1) $ do
(r :: Clause) <- getNth reason x
if r == NullClause
then pushTo conflicts (negateLit l)
else do
k <- get' r
let lstack' = lits r
loopOnLits :: Int -> IO ()
loopOnLits ((<= k) -> False) = return ()
loopOnLits j = do
(v :: Var) <- lit2var <$> getNth lstack' j
lv <- getNth level v
when (0 < lv) $ setNth an'seen v 1
loopOnLits $ i + 1
loopOnLits 2
setNth an'seen x 0
loopOnTrail $ i - 1
loopOnTrail =<< if tls <= rl then return (trs - 1) else getNth trailLim (rl + 1)
-- | M114:
-- propagate : [void] -> [Clause+]
--
-- __Description:__
-- Porpagates all enqueued facts. If a conflict arises, the conflicting clause is returned.
-- otherwise CRef_undef.
--
-- __Post-conditions:__
-- * the propagation queue is empty, even if there was a conflict.
--
-- memo: @propagate@ is invoked by @search@,`simpleDB` and `solve` | 1,928 | false | true | 0 | 29 | 758 | 647 | 310 | 337 | null | null |
thalerjonathan/phd | thesis/code/sugarscape/src/SugarScape/Agent/Common.hs | gpl-3.0 | mrs :: Double -- ^ sugar-wealth of agent
-> Double -- ^ spice-wealth of agent
-> Double -- ^ sugar-metabolism of agent
-> Double -- ^ spice-metabolism of agent
-> Double -- ^ mrs value: less than 1 the agent values sugar more, and spice otherwise
mrs w1 w2 m1 m2 = (w2 / m2) / (w1 / m1) | 312 | mrs :: Double -- ^ sugar-wealth of agent
-> Double -- ^ spice-wealth of agent
-> Double -- ^ sugar-metabolism of agent
-> Double -- ^ spice-metabolism of agent
-> Double
mrs w1 w2 m1 m2 = (w2 / m2) / (w1 / m1) | 233 | mrs w1 w2 m1 m2 = (w2 / m2) / (w1 / m1) | 39 | true | true | 0 | 10 | 84 | 65 | 34 | 31 | null | null |
ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/compare_5.hs | mit | primCmpNat (Succ x) Zero = GT | 29 | primCmpNat (Succ x) Zero = GT | 29 | primCmpNat (Succ x) Zero = GT | 29 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
markflorisson/hpack | testrepo/bytestring-0.10.4.1/Data/ByteString/Builder/Prim/ASCII.hs | bsd-3-clause | floatHexFixed :: FixedPrim Float
floatHexFixed = encodeFloatViaWord32F word32HexFixed | 85 | floatHexFixed :: FixedPrim Float
floatHexFixed = encodeFloatViaWord32F word32HexFixed | 85 | floatHexFixed = encodeFloatViaWord32F word32HexFixed | 52 | false | true | 0 | 5 | 7 | 17 | 8 | 9 | null | null |
ivanmoore/seedy | lib/Pelias.hs | gpl-3.0 | check JBool = checkBool . strip | 38 | check JBool = checkBool . strip | 38 | check JBool = checkBool . strip | 38 | false | false | 1 | 5 | 12 | 16 | 6 | 10 | null | null |
aufheben/Y86 | Simulator/src/Simulator/Util.hs | mit | formatInstr (Cmovl ra rb) = irr "cmovl" ra rb | 48 | formatInstr (Cmovl ra rb) = irr "cmovl" ra rb | 48 | formatInstr (Cmovl ra rb) = irr "cmovl" ra rb | 48 | false | false | 0 | 7 | 11 | 24 | 11 | 13 | null | null |
Chatanga/kage | src/Graphics/Buffer.hs | mit | ----------------------------------------------------------------------------------------------------
{-
GLSL: layout(location = 0) in vec3 vertexPosition;
or
Haskell: attribLocation program "vertexPosition" $= AttribLocation 0
-}
pointLocation = 0 | 248 | pointLocation = 0 | 17 | pointLocation = 0 | 17 | true | false | 0 | 4 | 21 | 8 | 5 | 3 | null | null |
cornell-pl/HsAdapton | weak-hashtables/src/Data/HashTable/Weak/Internal/Utils.hs | bsd-3-clause | whichBucket :: Int -> Int -> Int
whichBucket !h !sz = o
where
!o = h `mod` sz
------------------------------------------------------------------------------ | 164 | whichBucket :: Int -> Int -> Int
whichBucket !h !sz = o
where
!o = h `mod` sz
------------------------------------------------------------------------------ | 164 | whichBucket !h !sz = o
where
!o = h `mod` sz
------------------------------------------------------------------------------ | 131 | false | true | 0 | 6 | 26 | 52 | 24 | 28 | null | null |
JustusAdam/bitbucket-github-migrate | src/Migrate/Internal/Types.hs | bsd-3-clause | get :: TransferMonad r w w
get = TransferMonad (lift ask >>= readMVar . writableRef) | 84 | get :: TransferMonad r w w
get = TransferMonad (lift ask >>= readMVar . writableRef) | 84 | get = TransferMonad (lift ask >>= readMVar . writableRef) | 57 | false | true | 0 | 9 | 14 | 35 | 17 | 18 | null | null |
z0isch/advent-of-code | src/Day7.hs | bsd-3-clause | parseOr = Or <$> parseAtom <* string " OR " <*> parseAtom | 57 | parseOr = Or <$> parseAtom <* string " OR " <*> parseAtom | 57 | parseOr = Or <$> parseAtom <* string " OR " <*> parseAtom | 57 | false | false | 5 | 5 | 11 | 27 | 11 | 16 | null | null |
fmapfmapfmap/amazonka | amazonka-rds/gen/Network/AWS/RDS/DescribeEventCategories.hs | mpl-2.0 | -- | Creates a value of 'DescribeEventCategories' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'decSourceType'
--
-- * 'decFilters'
describeEventCategories
:: DescribeEventCategories
describeEventCategories =
DescribeEventCategories'
{ _decSourceType = Nothing
, _decFilters = Nothing
} | 394 | describeEventCategories
:: DescribeEventCategories
describeEventCategories =
DescribeEventCategories'
{ _decSourceType = Nothing
, _decFilters = Nothing
} | 174 | describeEventCategories =
DescribeEventCategories'
{ _decSourceType = Nothing
, _decFilters = Nothing
} | 119 | true | true | 1 | 7 | 72 | 39 | 23 | 16 | null | null |
eklavya/Idris-dev | src/Idris/Docs.hs | bsd-3-clause | pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
nest 4 (prettyName True nsFlag [] n
<+> colon
<+> pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
, not (T.isPrefixOf (T.pack "__") n') ] infixes ty
-- show doc
<$> renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc
-- show fixity
<$> maybe empty (\f -> text (show f) <> line) f
-- show arguments doc
<> let argshow = showArgs args [] in
(if not (null argshow)
then nest 4 $ text "Arguments:" <$> vsep argshow
else empty)
-- show totality status
<> let totality = getTotality in
(if totalityFlag && not (null totality)
then line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
else empty))
where
ppo = ppOptionIst ist
infixes = idris_infixes ist
-- Recurse over and show the Function's Documented arguments
showArgs ((n, ty, Exp {}, Just d):args) bnd = -- Explicitly bound.
bindingOf n False
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, False):bnd)
showArgs ((n, ty, Constraint {}, Just d):args) bnd = -- Interface constraints.
text "Interface constraint"
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, Imp {}, Just d):args) bnd = -- Implicit arguments.
text "(implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, TacImp{}, Just d):args) bnd = -- Tacit implicits
text "(auto implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, _, _, _):args) bnd = -- Anything else
showArgs args ((n, True):bnd)
showArgs [] _ = [] -- end of arguments
getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist) | 2,403 | pprintFD :: IState -> Bool -> Bool -> FunDoc -> Doc OutputAnnotation
pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
nest 4 (prettyName True nsFlag [] n
<+> colon
<+> pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
, not (T.isPrefixOf (T.pack "__") n') ] infixes ty
-- show doc
<$> renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc
-- show fixity
<$> maybe empty (\f -> text (show f) <> line) f
-- show arguments doc
<> let argshow = showArgs args [] in
(if not (null argshow)
then nest 4 $ text "Arguments:" <$> vsep argshow
else empty)
-- show totality status
<> let totality = getTotality in
(if totalityFlag && not (null totality)
then line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
else empty))
where
ppo = ppOptionIst ist
infixes = idris_infixes ist
-- Recurse over and show the Function's Documented arguments
showArgs ((n, ty, Exp {}, Just d):args) bnd = -- Explicitly bound.
bindingOf n False
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, False):bnd)
showArgs ((n, ty, Constraint {}, Just d):args) bnd = -- Interface constraints.
text "Interface constraint"
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, Imp {}, Just d):args) bnd = -- Implicit arguments.
text "(implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, TacImp{}, Just d):args) bnd = -- Tacit implicits
text "(auto implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, _, _, _):args) bnd = -- Anything else
showArgs args ((n, True):bnd)
showArgs [] _ = [] -- end of arguments
getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist) | 2,403 | pprintFD ist totalityFlag nsFlag (FD n doc args ty f) =
nest 4 (prettyName True nsFlag [] n
<+> colon
<+> pprintPTerm ppo [] [ n | (n@(UN n'),_,_,_) <- args
, not (T.isPrefixOf (T.pack "__") n') ] infixes ty
-- show doc
<$> renderDocstring (renderDocTerm (pprintDelab ist) (normaliseAll (tt_ctxt ist) [])) doc
-- show fixity
<$> maybe empty (\f -> text (show f) <> line) f
-- show arguments doc
<> let argshow = showArgs args [] in
(if not (null argshow)
then nest 4 $ text "Arguments:" <$> vsep argshow
else empty)
-- show totality status
<> let totality = getTotality in
(if totalityFlag && not (null totality)
then line <> (vsep . map (\t -> text "The function is" <+> t) $ totality)
else empty))
where
ppo = ppOptionIst ist
infixes = idris_infixes ist
-- Recurse over and show the Function's Documented arguments
showArgs ((n, ty, Exp {}, Just d):args) bnd = -- Explicitly bound.
bindingOf n False
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, False):bnd)
showArgs ((n, ty, Constraint {}, Just d):args) bnd = -- Interface constraints.
text "Interface constraint"
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, Imp {}, Just d):args) bnd = -- Implicit arguments.
text "(implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, ty, TacImp{}, Just d):args) bnd = -- Tacit implicits
text "(auto implicit)"
<+> bindingOf n True
<+> colon
<+> pprintPTerm ppo bnd [] infixes ty
<> showDoc ist d
<> line : showArgs args ((n, True):bnd)
showArgs ((n, _, _, _):args) bnd = -- Anything else
showArgs args ((n, True):bnd)
showArgs [] _ = [] -- end of arguments
getTotality = map (text . show) $ lookupTotal n (tt_ctxt ist) | 2,334 | false | true | 45 | 22 | 848 | 898 | 449 | 449 | null | null |
joelburget/haste-compiler | src/Data/JSTarget/Optimize.hs | bsd-3-clause | fromThunk :: Exp -> Maybe Stm
fromThunk (Thunk _ body) = Just body | 66 | fromThunk :: Exp -> Maybe Stm
fromThunk (Thunk _ body) = Just body | 66 | fromThunk (Thunk _ body) = Just body | 36 | false | true | 0 | 7 | 12 | 32 | 15 | 17 | null | null |
bergmark/hakyll | src/Hakyll/Core/Compiler.hs | bsd-3-clause | --------------------------------------------------------------------------------
-- | Get the extension of the underlying identifier. Returns something like
-- @".html"@
getUnderlyingExtension :: Compiler String
getUnderlyingExtension = takeExtension . toFilePath <$> getUnderlying | 281 | getUnderlyingExtension :: Compiler String
getUnderlyingExtension = takeExtension . toFilePath <$> getUnderlying | 111 | getUnderlyingExtension = takeExtension . toFilePath <$> getUnderlying | 69 | true | true | 1 | 6 | 25 | 29 | 14 | 15 | null | null |
wincent/docvim | lib/Text/Docvim/Util.hs | mit | -- | Parse and compile a list of strings containing a translation units.
compileUnits :: [String] -> Either ParseError Node
compileUnits inputs = do
parsed <- mapM parseUnit inputs
return $ compile parsed
-- | Convenience function: Parse and compile a list of strings containing
-- translation units, but always returns a string even in the case of an error. | 363 | compileUnits :: [String] -> Either ParseError Node
compileUnits inputs = do
parsed <- mapM parseUnit inputs
return $ compile parsed
-- | Convenience function: Parse and compile a list of strings containing
-- translation units, but always returns a string even in the case of an error. | 290 | compileUnits inputs = do
parsed <- mapM parseUnit inputs
return $ compile parsed
-- | Convenience function: Parse and compile a list of strings containing
-- translation units, but always returns a string even in the case of an error. | 239 | true | true | 0 | 8 | 64 | 51 | 25 | 26 | null | null |
mboes/language-arm | Language/ARM/Instr.hs | gpl-3.0 | sign :: Part -> Int -> Int -> Word32 -> CC0
sign which start end bits = K7 f g where
f k k' s | range (start + base) (end + base) s == bits = k k' s
| otherwise = k' s
g k k' s = k k' (setRange (start + base) (end + base) bits s)
base = fromEnum which `shiftL` 4 | 279 | sign :: Part -> Int -> Int -> Word32 -> CC0
sign which start end bits = K7 f g where
f k k' s | range (start + base) (end + base) s == bits = k k' s
| otherwise = k' s
g k k' s = k k' (setRange (start + base) (end + base) bits s)
base = fromEnum which `shiftL` 4 | 279 | sign which start end bits = K7 f g where
f k k' s | range (start + base) (end + base) s == bits = k k' s
| otherwise = k' s
g k k' s = k k' (setRange (start + base) (end + base) bits s)
base = fromEnum which `shiftL` 4 | 235 | false | true | 0 | 13 | 83 | 160 | 79 | 81 | null | null |
fatlazycat/eventjournal | test/EventTests.hs | bsd-3-clause | specTests :: IO TestTree
specTests = testGroup "event tests" <$> sequence [serialization] | 89 | specTests :: IO TestTree
specTests = testGroup "event tests" <$> sequence [serialization] | 89 | specTests = testGroup "event tests" <$> sequence [serialization] | 64 | false | true | 0 | 7 | 11 | 27 | 13 | 14 | null | null |
kowey/pandoc-old | src/Text/Pandoc/Blocks.hs | gpl-2.0 | breakLines :: Int -- ^ Maximum length of lines.
-> [String] -- ^ List of lines.
-> [String]
breakLines _ [] = [] | 139 | breakLines :: Int -- ^ Maximum length of lines.
-> [String] -- ^ List of lines.
-> [String]
breakLines _ [] = [] | 139 | breakLines _ [] = [] | 20 | false | true | 0 | 7 | 49 | 36 | 20 | 16 | null | null |
sgillespie/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | -------------------
-- the SrcLoc returned are for the whole declarations, not just the names
hsDataFamInstBinders :: DataFamInstDecl name -> ([Located name], [LFieldOcc name])
hsDataFamInstBinders (DataFamInstDecl { dfid_defn = defn })
= hsDataDefnBinders defn | 263 | hsDataFamInstBinders :: DataFamInstDecl name -> ([Located name], [LFieldOcc name])
hsDataFamInstBinders (DataFamInstDecl { dfid_defn = defn })
= hsDataDefnBinders defn | 169 | hsDataFamInstBinders (DataFamInstDecl { dfid_defn = defn })
= hsDataDefnBinders defn | 86 | true | true | 0 | 9 | 34 | 56 | 30 | 26 | null | null |
badp/ganeti | src/Ganeti/Query/Instance.hs | gpl-2.0 | getSecondaryNodeAttribute :: (J.JSON a)
=> (Node -> a)
-> ConfigData
-> Instance
-> ResultEntry
getSecondaryNodeAttribute getter cfg inst =
rsErrorNoData $ map (J.showJSON . getter) <$> getSecondaryNodes cfg inst | 318 | getSecondaryNodeAttribute :: (J.JSON a)
=> (Node -> a)
-> ConfigData
-> Instance
-> ResultEntry
getSecondaryNodeAttribute getter cfg inst =
rsErrorNoData $ map (J.showJSON . getter) <$> getSecondaryNodes cfg inst | 318 | getSecondaryNodeAttribute getter cfg inst =
rsErrorNoData $ map (J.showJSON . getter) <$> getSecondaryNodes cfg inst | 118 | false | true | 0 | 10 | 134 | 73 | 37 | 36 | null | null |
jezen/jezenthomas.com | src/Main.hs | gpl-3.0 | publishedGroupField ::
String -- name
-> [Item String] -- posts
-> Context String -- Post context
-> Context String -- output context
publishedGroupField name posts postContext = listField name groupCtx $ do
traverse extractTime posts
>>= mapM makeItem . fmap merge . groupByYear
where
groupCtx = field "year" (return . show . getYear . fst . itemBody)
<> listFieldWith "posts" postContext (return . snd . itemBody)
merge :: [(UTCTime, Item a)] -> (UTCTime, [Item a])
merge gs = (fst (head gs), snd <$> sortByTime gs)
groupByYear :: [(UTCTime, Item a)] -> [[(UTCTime, Item a)]]
groupByYear = groupBy (\(a, _) (b, _) -> getYear a == getYear b)
sortByTime :: [(UTCTime, a)] -> [(UTCTime, a)]
sortByTime = sortOn (Down . fst)
getYear :: UTCTime -> Integer
getYear time = year
where (year, _, _) = (toGregorian . utctDay) time
extractTime :: Item a -> Compiler (UTCTime, Item a)
extractTime item = getItemUTC defaultTimeLocale (itemIdentifier item)
>>= \time -> pure (time, item) | 1,122 | publishedGroupField ::
String -- name
-> [Item String] -- posts
-> Context String -- Post context
-> Context String
publishedGroupField name posts postContext = listField name groupCtx $ do
traverse extractTime posts
>>= mapM makeItem . fmap merge . groupByYear
where
groupCtx = field "year" (return . show . getYear . fst . itemBody)
<> listFieldWith "posts" postContext (return . snd . itemBody)
merge :: [(UTCTime, Item a)] -> (UTCTime, [Item a])
merge gs = (fst (head gs), snd <$> sortByTime gs)
groupByYear :: [(UTCTime, Item a)] -> [[(UTCTime, Item a)]]
groupByYear = groupBy (\(a, _) (b, _) -> getYear a == getYear b)
sortByTime :: [(UTCTime, a)] -> [(UTCTime, a)]
sortByTime = sortOn (Down . fst)
getYear :: UTCTime -> Integer
getYear time = year
where (year, _, _) = (toGregorian . utctDay) time
extractTime :: Item a -> Compiler (UTCTime, Item a)
extractTime item = getItemUTC defaultTimeLocale (itemIdentifier item)
>>= \time -> pure (time, item) | 1,102 | publishedGroupField name posts postContext = listField name groupCtx $ do
traverse extractTime posts
>>= mapM makeItem . fmap merge . groupByYear
where
groupCtx = field "year" (return . show . getYear . fst . itemBody)
<> listFieldWith "posts" postContext (return . snd . itemBody)
merge :: [(UTCTime, Item a)] -> (UTCTime, [Item a])
merge gs = (fst (head gs), snd <$> sortByTime gs)
groupByYear :: [(UTCTime, Item a)] -> [[(UTCTime, Item a)]]
groupByYear = groupBy (\(a, _) (b, _) -> getYear a == getYear b)
sortByTime :: [(UTCTime, a)] -> [(UTCTime, a)]
sortByTime = sortOn (Down . fst)
getYear :: UTCTime -> Integer
getYear time = year
where (year, _, _) = (toGregorian . utctDay) time
extractTime :: Item a -> Compiler (UTCTime, Item a)
extractTime item = getItemUTC defaultTimeLocale (itemIdentifier item)
>>= \time -> pure (time, item) | 960 | true | true | 9 | 11 | 306 | 458 | 228 | 230 | null | null |
ZjMNZHgG5jMXw/privacy-option | Semantics/POL/Valuation.hs | bsd-3-clause | valuate c@(Data _ _) = selfInformation c | 41 | valuate c@(Data _ _) = selfInformation c | 41 | valuate c@(Data _ _) = selfInformation c | 41 | false | false | 0 | 8 | 7 | 23 | 11 | 12 | null | null |
diffusionkinetics/open | postgresql-simple-expr/lib/Database/PostgreSQL/Simple/FakeRows.hs | mit | selectFKsAsMap :: forall m parent.
(MonadConnection m, HasKey parent, FromRow parent,
KeyField (Key parent), Typeable (Foreign parent))
=> Int -> String -> Bool -> m [Map String Dynamic]
selectFKsAsMap n childFld isPartOfKey = do
keys <- selectFKs @m @parent n isPartOfKey
let toMap k = M.insert childFld (toDyn (Foreign k :: Foreign parent)) M.empty
return $ map toMap keys | 387 | selectFKsAsMap :: forall m parent.
(MonadConnection m, HasKey parent, FromRow parent,
KeyField (Key parent), Typeable (Foreign parent))
=> Int -> String -> Bool -> m [Map String Dynamic]
selectFKsAsMap n childFld isPartOfKey = do
keys <- selectFKs @m @parent n isPartOfKey
let toMap k = M.insert childFld (toDyn (Foreign k :: Foreign parent)) M.empty
return $ map toMap keys | 387 | selectFKsAsMap n childFld isPartOfKey = do
keys <- selectFKs @m @parent n isPartOfKey
let toMap k = M.insert childFld (toDyn (Foreign k :: Foreign parent)) M.empty
return $ map toMap keys | 193 | false | true | 0 | 14 | 71 | 165 | 80 | 85 | null | null |
ArthurClune/pastewatch | tests/pastetests.hs | gpl-3.0 | runStackOverflowTest (site, url) = TestCase $ assertEqual "Testing stackoverflow" TESTED runCheck
where
runCheck = fst3 $ unsafePerformIO $
handle (\StackOverflow -> return (STACK_OVERFLOW, Nothing, Nothing))
$ doCheck site url (checkContent alertRe)
fst3 (a, _, _) = a | 298 | runStackOverflowTest (site, url) = TestCase $ assertEqual "Testing stackoverflow" TESTED runCheck
where
runCheck = fst3 $ unsafePerformIO $
handle (\StackOverflow -> return (STACK_OVERFLOW, Nothing, Nothing))
$ doCheck site url (checkContent alertRe)
fst3 (a, _, _) = a | 298 | runStackOverflowTest (site, url) = TestCase $ assertEqual "Testing stackoverflow" TESTED runCheck
where
runCheck = fst3 $ unsafePerformIO $
handle (\StackOverflow -> return (STACK_OVERFLOW, Nothing, Nothing))
$ doCheck site url (checkContent alertRe)
fst3 (a, _, _) = a | 298 | false | false | 0 | 11 | 65 | 99 | 52 | 47 | null | null |
deech/fltkhs-demos | src/Examples/make-tree.hs | mit | main :: IO ()
main = do
win' <- windowNew (Size (Width 500) (Height 500)) Nothing (Just "FLTK Tree Window")
begin win'
tree' <- treeNew (toRectangle (50,50,200,200)) (Just "Tree")
rootLabel tree' "Root Label With Items"
prefs' <- treePrefsNew
forM_ [0..(9 :: Int)] $ \_ -> do
item' <- treeItemNew prefs'
setLabel item' "test"
addAt tree' "test" item'
end win'
showWidget win'
_ <- FL.run
return () | 429 | main :: IO ()
main = do
win' <- windowNew (Size (Width 500) (Height 500)) Nothing (Just "FLTK Tree Window")
begin win'
tree' <- treeNew (toRectangle (50,50,200,200)) (Just "Tree")
rootLabel tree' "Root Label With Items"
prefs' <- treePrefsNew
forM_ [0..(9 :: Int)] $ \_ -> do
item' <- treeItemNew prefs'
setLabel item' "test"
addAt tree' "test" item'
end win'
showWidget win'
_ <- FL.run
return () | 429 | main = do
win' <- windowNew (Size (Width 500) (Height 500)) Nothing (Just "FLTK Tree Window")
begin win'
tree' <- treeNew (toRectangle (50,50,200,200)) (Just "Tree")
rootLabel tree' "Root Label With Items"
prefs' <- treePrefsNew
forM_ [0..(9 :: Int)] $ \_ -> do
item' <- treeItemNew prefs'
setLabel item' "test"
addAt tree' "test" item'
end win'
showWidget win'
_ <- FL.run
return () | 415 | false | true | 0 | 12 | 97 | 196 | 90 | 106 | null | null |
tibbe/ghc | compiler/nativeGen/X86/CodeGen.hs | bsd-3-clause | genCCall dflags _ (PrimTarget MO_Memset) _
[dst,
CmmLit (CmmInt c _),
CmmLit (CmmInt n _),
CmmLit (CmmInt align _)]
| fromInteger insns <= maxInlineMemsetInsns dflags && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
return $ code_dst dst_r `appOL` go dst_r (fromInteger n)
where
(size, val) = case align .&. 3 of
2 -> (II16, c2)
0 -> (II32, c4)
_ -> (II8, c)
c2 = c `shiftL` 8 .|. c
c4 = c2 `shiftL` 16 .|. c2
-- The number of instructions we will generate (approx). We need 1
-- instructions per move.
insns = (n + sizeBytes - 1) `div` sizeBytes
-- The size of each move, in bytes.
sizeBytes :: Integer
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Integer -> OrdList Instr
go dst i
-- TODO: Add movabs instruction and support 64-bit sets.
| i >= sizeBytes = -- This might be smaller than the below sizes
unitOL (MOV size (OpImm (ImmInteger val)) (OpAddr dst_addr)) `appOL`
go dst (i - sizeBytes)
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpImm (ImmInteger c4)) (OpAddr dst_addr)) `appOL`
go dst (i - 4)
| i >= 2 =
unitOL (MOV II16 (OpImm (ImmInteger c2)) (OpAddr dst_addr)) `appOL`
go dst (i - 2)
| i >= 1 =
unitOL (MOV II8 (OpImm (ImmInteger c)) (OpAddr dst_addr)) `appOL`
go dst (i - 1)
| otherwise = nilOL
where
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 1,667 | genCCall dflags _ (PrimTarget MO_Memset) _
[dst,
CmmLit (CmmInt c _),
CmmLit (CmmInt n _),
CmmLit (CmmInt align _)]
| fromInteger insns <= maxInlineMemsetInsns dflags && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
return $ code_dst dst_r `appOL` go dst_r (fromInteger n)
where
(size, val) = case align .&. 3 of
2 -> (II16, c2)
0 -> (II32, c4)
_ -> (II8, c)
c2 = c `shiftL` 8 .|. c
c4 = c2 `shiftL` 16 .|. c2
-- The number of instructions we will generate (approx). We need 1
-- instructions per move.
insns = (n + sizeBytes - 1) `div` sizeBytes
-- The size of each move, in bytes.
sizeBytes :: Integer
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Integer -> OrdList Instr
go dst i
-- TODO: Add movabs instruction and support 64-bit sets.
| i >= sizeBytes = -- This might be smaller than the below sizes
unitOL (MOV size (OpImm (ImmInteger val)) (OpAddr dst_addr)) `appOL`
go dst (i - sizeBytes)
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpImm (ImmInteger c4)) (OpAddr dst_addr)) `appOL`
go dst (i - 4)
| i >= 2 =
unitOL (MOV II16 (OpImm (ImmInteger c2)) (OpAddr dst_addr)) `appOL`
go dst (i - 2)
| i >= 1 =
unitOL (MOV II8 (OpImm (ImmInteger c)) (OpAddr dst_addr)) `appOL`
go dst (i - 1)
| otherwise = nilOL
where
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 1,667 | genCCall dflags _ (PrimTarget MO_Memset) _
[dst,
CmmLit (CmmInt c _),
CmmLit (CmmInt n _),
CmmLit (CmmInt align _)]
| fromInteger insns <= maxInlineMemsetInsns dflags && align .&. 3 == 0 = do
code_dst <- getAnyReg dst
dst_r <- getNewRegNat size
return $ code_dst dst_r `appOL` go dst_r (fromInteger n)
where
(size, val) = case align .&. 3 of
2 -> (II16, c2)
0 -> (II32, c4)
_ -> (II8, c)
c2 = c `shiftL` 8 .|. c
c4 = c2 `shiftL` 16 .|. c2
-- The number of instructions we will generate (approx). We need 1
-- instructions per move.
insns = (n + sizeBytes - 1) `div` sizeBytes
-- The size of each move, in bytes.
sizeBytes :: Integer
sizeBytes = fromIntegral (sizeInBytes size)
go :: Reg -> Integer -> OrdList Instr
go dst i
-- TODO: Add movabs instruction and support 64-bit sets.
| i >= sizeBytes = -- This might be smaller than the below sizes
unitOL (MOV size (OpImm (ImmInteger val)) (OpAddr dst_addr)) `appOL`
go dst (i - sizeBytes)
| i >= 4 = -- Will never happen on 32-bit
unitOL (MOV II32 (OpImm (ImmInteger c4)) (OpAddr dst_addr)) `appOL`
go dst (i - 4)
| i >= 2 =
unitOL (MOV II16 (OpImm (ImmInteger c2)) (OpAddr dst_addr)) `appOL`
go dst (i - 2)
| i >= 1 =
unitOL (MOV II8 (OpImm (ImmInteger c)) (OpAddr dst_addr)) `appOL`
go dst (i - 1)
| otherwise = nilOL
where
dst_addr = AddrBaseIndex (EABaseReg dst) EAIndexNone
(ImmInteger (n - i)) | 1,667 | false | false | 7 | 12 | 570 | 648 | 314 | 334 | null | null |
brendanhay/gogol | gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs | mpl-2.0 | -- | Progress metadata for all videos specified in \`AnnotateVideoRequest\`.
gcvvavpcAnnotationProgress :: Lens' GoogleCloudVideointelligenceV1_AnnotateVideoProgress [GoogleCloudVideointelligenceV1_VideoAnnotationProgress]
gcvvavpcAnnotationProgress
= lens _gcvvavpcAnnotationProgress
(\ s a -> s{_gcvvavpcAnnotationProgress = a})
. _Default
. _Coerce | 371 | gcvvavpcAnnotationProgress :: Lens' GoogleCloudVideointelligenceV1_AnnotateVideoProgress [GoogleCloudVideointelligenceV1_VideoAnnotationProgress]
gcvvavpcAnnotationProgress
= lens _gcvvavpcAnnotationProgress
(\ s a -> s{_gcvvavpcAnnotationProgress = a})
. _Default
. _Coerce | 294 | gcvvavpcAnnotationProgress
= lens _gcvvavpcAnnotationProgress
(\ s a -> s{_gcvvavpcAnnotationProgress = a})
. _Default
. _Coerce | 148 | true | true | 0 | 11 | 49 | 53 | 28 | 25 | null | null |
wavewave/lhc-analysis-collection | heavyhiggs/firstcut.hs | gpl-3.0 | checkl :: PhyEventNoTauNoBJet -> Bool
checkl ev = let etalst = leptonetas ev
in (not . null . filter (\x -> abs x < 1.5)) etalst | 140 | checkl :: PhyEventNoTauNoBJet -> Bool
checkl ev = let etalst = leptonetas ev
in (not . null . filter (\x -> abs x < 1.5)) etalst | 140 | checkl ev = let etalst = leptonetas ev
in (not . null . filter (\x -> abs x < 1.5)) etalst | 102 | false | true | 0 | 14 | 37 | 64 | 31 | 33 | null | null |
haskell-pkg-janitors/feed | Text/Atom/Feed.hs | bsd-3-clause | nullEntry :: Text -- ^entryId
-> TextContent -- ^entryTitle
-> Date -- ^entryUpdated
-> Entry
nullEntry i t u = Entry
{ entryId = i
, entryTitle = t
, entryUpdated = u
, entryAuthors = []
, entryCategories = []
, entryContent = Nothing
, entryContributor = []
, entryLinks = []
, entryPublished = Nothing
, entryRights = Nothing
, entrySource = Nothing
, entrySummary = Nothing
, entryInReplyTo = Nothing
, entryInReplyTotal = Nothing
, entryAttrs = []
, entryOther = []
} | 683 | nullEntry :: Text -- ^entryId
-> TextContent -- ^entryTitle
-> Date -- ^entryUpdated
-> Entry
nullEntry i t u = Entry
{ entryId = i
, entryTitle = t
, entryUpdated = u
, entryAuthors = []
, entryCategories = []
, entryContent = Nothing
, entryContributor = []
, entryLinks = []
, entryPublished = Nothing
, entryRights = Nothing
, entrySource = Nothing
, entrySummary = Nothing
, entryInReplyTo = Nothing
, entryInReplyTotal = Nothing
, entryAttrs = []
, entryOther = []
} | 683 | nullEntry i t u = Entry
{ entryId = i
, entryTitle = t
, entryUpdated = u
, entryAuthors = []
, entryCategories = []
, entryContent = Nothing
, entryContributor = []
, entryLinks = []
, entryPublished = Nothing
, entryRights = Nothing
, entrySource = Nothing
, entrySummary = Nothing
, entryInReplyTo = Nothing
, entryInReplyTotal = Nothing
, entryAttrs = []
, entryOther = []
} | 559 | false | true | 0 | 7 | 296 | 143 | 89 | 54 | null | null |
ghcjs/jsaddle-dom | src/JSDOM/Generated/SVGPathSegCurvetoCubicSmoothAbs.hs | mit | -- | <https://developer.mozilla.org/en-US/docs/Web/API/SVGPathSegCurvetoCubicSmoothAbs.x2 Mozilla SVGPathSegCurvetoCubicSmoothAbs.x2 documentation>
setX2 ::
(MonadDOM m) => SVGPathSegCurvetoCubicSmoothAbs -> Float -> m ()
setX2 self val = liftDOM (self ^. jss "x2" (toJSVal val)) | 286 | setX2 ::
(MonadDOM m) => SVGPathSegCurvetoCubicSmoothAbs -> Float -> m ()
setX2 self val = liftDOM (self ^. jss "x2" (toJSVal val)) | 137 | setX2 self val = liftDOM (self ^. jss "x2" (toJSVal val)) | 57 | true | true | 0 | 10 | 34 | 60 | 30 | 30 | null | null |
HackSoc/fresher-signup | Main.hs | mit | draw :: State -> Widget
draw (ed, p, s) = vCenter $ hCenter (hLimit 47 hacksoc) <=> hCenter (pad form) where
hacksoc = vBox
[ str "╦ ╦ ╦ ╔══╣"
, str "║ ║ ║ ║"
, str "╠═══╣ ╔═╗ ╔══╗ ║ ╔ ╚══╗ ╔══╗ ╔══╗"
, str "║ ║ ╔═╣ ║ ╠═╣ ║ ║ ║ ║"
, str "╩ ╩ ╚═╩ ╚══╝ ╩ ╚ ╠══╝ ╚══╝ ╚══╝"
, str " the " <+> withAttr "cs" (str "computer science") <+> str " society"
]
form = field Email (pad $ str "Email address:") email <=> field Paid (str "Paid:") paid <=> pad button where
-- form fields
email = border . hLimit 30 . vLimit 1 $ renderEditor ed
paid = str (if p then "[X]" else "[ ]")
button = select Submit $ str "[submit]"
-- formatting
field sel title widget = select sel title <+> str " " <+> widget
select sel
| s == sel = withAttr "select"
| otherwise = id
pad = translateBy $ Location (0, 1) | 906 | draw :: State -> Widget
draw (ed, p, s) = vCenter $ hCenter (hLimit 47 hacksoc) <=> hCenter (pad form) where
hacksoc = vBox
[ str "╦ ╦ ╦ ╔══╣"
, str "║ ║ ║ ║"
, str "╠═══╣ ╔═╗ ╔══╗ ║ ╔ ╚══╗ ╔══╗ ╔══╗"
, str "║ ║ ╔═╣ ║ ╠═╣ ║ ║ ║ ║"
, str "╩ ╩ ╚═╩ ╚══╝ ╩ ╚ ╠══╝ ╚══╝ ╚══╝"
, str " the " <+> withAttr "cs" (str "computer science") <+> str " society"
]
form = field Email (pad $ str "Email address:") email <=> field Paid (str "Paid:") paid <=> pad button where
-- form fields
email = border . hLimit 30 . vLimit 1 $ renderEditor ed
paid = str (if p then "[X]" else "[ ]")
button = select Submit $ str "[submit]"
-- formatting
field sel title widget = select sel title <+> str " " <+> widget
select sel
| s == sel = withAttr "select"
| otherwise = id
pad = translateBy $ Location (0, 1) | 906 | draw (ed, p, s) = vCenter $ hCenter (hLimit 47 hacksoc) <=> hCenter (pad form) where
hacksoc = vBox
[ str "╦ ╦ ╦ ╔══╣"
, str "║ ║ ║ ║"
, str "╠═══╣ ╔═╗ ╔══╗ ║ ╔ ╚══╗ ╔══╗ ╔══╗"
, str "║ ║ ╔═╣ ║ ╠═╣ ║ ║ ║ ║"
, str "╩ ╩ ╚═╩ ╚══╝ ╩ ╚ ╠══╝ ╚══╝ ╚══╝"
, str " the " <+> withAttr "cs" (str "computer science") <+> str " society"
]
form = field Email (pad $ str "Email address:") email <=> field Paid (str "Paid:") paid <=> pad button where
-- form fields
email = border . hLimit 30 . vLimit 1 $ renderEditor ed
paid = str (if p then "[X]" else "[ ]")
button = select Submit $ str "[submit]"
-- formatting
field sel title widget = select sel title <+> str " " <+> widget
select sel
| s == sel = withAttr "select"
| otherwise = id
pad = translateBy $ Location (0, 1) | 882 | false | true | 0 | 13 | 295 | 309 | 152 | 157 | null | null |
kishoredbn/barrelfish | hake/Main.hs | mit | reePath o BFSrcTree "root" path hakepath =
relPath (opt_bfsourcedir o) path hakepath
| 89 | treePath o BFSrcTree "root" path hakepath =
relPath (opt_bfsourcedir o) path hakepath | 89 | treePath o BFSrcTree "root" path hakepath =
relPath (opt_bfsourcedir o) path hakepath | 89 | false | false | 0 | 7 | 16 | 30 | 14 | 16 | null | null |
gridaphobe/ghc | compiler/typecheck/TcGenDeriv.hs | bsd-3-clause | gen_Lift_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Lift_binds loc tycon
| null data_cons = (unitBag (L loc $ mkFunBind (L loc lift_RDR)
[mkMatch [nlWildPat] errorMsg_Expr
(noLoc emptyLocalBinds)])
, emptyBag)
| otherwise = (unitBag lift_bind, emptyBag)
where
errorMsg_Expr = nlHsVar error_RDR `nlHsApp` nlHsLit
(mkHsString $ "Can't lift value of empty datatype " ++ tycon_str)
lift_bind = mk_FunBind loc lift_RDR (map pats_etc data_cons)
data_cons = tyConDataCons tycon
tycon_str = occNameString . nameOccName . tyConName $ tycon
pats_etc data_con
= ([con_pat], lift_Expr)
where
con_pat = nlConVarPat data_con_RDR as_needed
data_con_RDR = getRdrName data_con
con_arity = dataConSourceArity data_con
as_needed = take con_arity as_RDRs
lifted_as = zipWithEqual "mk_lift_app" mk_lift_app
tys_needed as_needed
tycon_name = tyConName tycon
is_infix = dataConIsInfix data_con
tys_needed = dataConOrigArgTys data_con
mk_lift_app ty a
| not (isUnLiftedType ty) = nlHsApp (nlHsVar lift_RDR)
(nlHsVar a)
| otherwise = nlHsApp (nlHsVar litE_RDR)
(primLitOp (mkBoxExp (nlHsVar a)))
where (primLitOp, mkBoxExp) = primLitOps "Lift" tycon ty
pkg_name = unitIdString . moduleUnitId
. nameModule $ tycon_name
mod_name = moduleNameString . moduleName . nameModule $ tycon_name
con_name = occNameString . nameOccName . dataConName $ data_con
conE_Expr = nlHsApp (nlHsVar conE_RDR)
(nlHsApps mkNameG_dRDR
(map (nlHsLit . mkHsString)
[pkg_name, mod_name, con_name]))
lift_Expr
| is_infix = nlHsApps infixApp_RDR [a1, conE_Expr, a2]
| otherwise = foldl mk_appE_app conE_Expr lifted_as
(a1:a2:_) = lifted_as | 2,255 | gen_Lift_binds :: SrcSpan -> TyCon -> (LHsBinds RdrName, BagDerivStuff)
gen_Lift_binds loc tycon
| null data_cons = (unitBag (L loc $ mkFunBind (L loc lift_RDR)
[mkMatch [nlWildPat] errorMsg_Expr
(noLoc emptyLocalBinds)])
, emptyBag)
| otherwise = (unitBag lift_bind, emptyBag)
where
errorMsg_Expr = nlHsVar error_RDR `nlHsApp` nlHsLit
(mkHsString $ "Can't lift value of empty datatype " ++ tycon_str)
lift_bind = mk_FunBind loc lift_RDR (map pats_etc data_cons)
data_cons = tyConDataCons tycon
tycon_str = occNameString . nameOccName . tyConName $ tycon
pats_etc data_con
= ([con_pat], lift_Expr)
where
con_pat = nlConVarPat data_con_RDR as_needed
data_con_RDR = getRdrName data_con
con_arity = dataConSourceArity data_con
as_needed = take con_arity as_RDRs
lifted_as = zipWithEqual "mk_lift_app" mk_lift_app
tys_needed as_needed
tycon_name = tyConName tycon
is_infix = dataConIsInfix data_con
tys_needed = dataConOrigArgTys data_con
mk_lift_app ty a
| not (isUnLiftedType ty) = nlHsApp (nlHsVar lift_RDR)
(nlHsVar a)
| otherwise = nlHsApp (nlHsVar litE_RDR)
(primLitOp (mkBoxExp (nlHsVar a)))
where (primLitOp, mkBoxExp) = primLitOps "Lift" tycon ty
pkg_name = unitIdString . moduleUnitId
. nameModule $ tycon_name
mod_name = moduleNameString . moduleName . nameModule $ tycon_name
con_name = occNameString . nameOccName . dataConName $ data_con
conE_Expr = nlHsApp (nlHsVar conE_RDR)
(nlHsApps mkNameG_dRDR
(map (nlHsLit . mkHsString)
[pkg_name, mod_name, con_name]))
lift_Expr
| is_infix = nlHsApps infixApp_RDR [a1, conE_Expr, a2]
| otherwise = foldl mk_appE_app conE_Expr lifted_as
(a1:a2:_) = lifted_as | 2,255 | gen_Lift_binds loc tycon
| null data_cons = (unitBag (L loc $ mkFunBind (L loc lift_RDR)
[mkMatch [nlWildPat] errorMsg_Expr
(noLoc emptyLocalBinds)])
, emptyBag)
| otherwise = (unitBag lift_bind, emptyBag)
where
errorMsg_Expr = nlHsVar error_RDR `nlHsApp` nlHsLit
(mkHsString $ "Can't lift value of empty datatype " ++ tycon_str)
lift_bind = mk_FunBind loc lift_RDR (map pats_etc data_cons)
data_cons = tyConDataCons tycon
tycon_str = occNameString . nameOccName . tyConName $ tycon
pats_etc data_con
= ([con_pat], lift_Expr)
where
con_pat = nlConVarPat data_con_RDR as_needed
data_con_RDR = getRdrName data_con
con_arity = dataConSourceArity data_con
as_needed = take con_arity as_RDRs
lifted_as = zipWithEqual "mk_lift_app" mk_lift_app
tys_needed as_needed
tycon_name = tyConName tycon
is_infix = dataConIsInfix data_con
tys_needed = dataConOrigArgTys data_con
mk_lift_app ty a
| not (isUnLiftedType ty) = nlHsApp (nlHsVar lift_RDR)
(nlHsVar a)
| otherwise = nlHsApp (nlHsVar litE_RDR)
(primLitOp (mkBoxExp (nlHsVar a)))
where (primLitOp, mkBoxExp) = primLitOps "Lift" tycon ty
pkg_name = unitIdString . moduleUnitId
. nameModule $ tycon_name
mod_name = moduleNameString . moduleName . nameModule $ tycon_name
con_name = occNameString . nameOccName . dataConName $ data_con
conE_Expr = nlHsApp (nlHsVar conE_RDR)
(nlHsApps mkNameG_dRDR
(map (nlHsLit . mkHsString)
[pkg_name, mod_name, con_name]))
lift_Expr
| is_infix = nlHsApps infixApp_RDR [a1, conE_Expr, a2]
| otherwise = foldl mk_appE_app conE_Expr lifted_as
(a1:a2:_) = lifted_as | 2,183 | false | true | 2 | 14 | 855 | 541 | 272 | 269 | null | null |
DanielOberg/case-in-point | dist/build/autogen/Paths_case_in_point.hs | bsd-3-clause | getLibDir = catch (getEnv "case_in_point_libdir") (\_ -> return libdir) | 71 | getLibDir = catch (getEnv "case_in_point_libdir") (\_ -> return libdir) | 71 | getLibDir = catch (getEnv "case_in_point_libdir") (\_ -> return libdir) | 71 | false | false | 0 | 8 | 8 | 28 | 14 | 14 | null | null |
gambogi/tyle | Tyle/Parsers.hs | mit | application :: Parser Expr
application = try $ do
t0 <- term
spaces
t1 <- term
return (App t0 t1) | 105 | application :: Parser Expr
application = try $ do
t0 <- term
spaces
t1 <- term
return (App t0 t1) | 105 | application = try $ do
t0 <- term
spaces
t1 <- term
return (App t0 t1) | 78 | false | true | 0 | 10 | 27 | 49 | 22 | 27 | null | null |
kebertx/GoFu | src/Go/Move.hs | bsd-3-clause | -- Convert a property to a valid move
fromProperty :: Property -> Move
fromProperty (Property label values)
| label == "AB" = Add Black coords
| label == "AE" = Add Empty coords
| label == "AW" = Add White coords
| label == "B" = if null coords then Pass Black else Move Black $ head coords
| label == "W" = if null coords then Pass White else Move White $ head coords
| otherwise = Pass Empty
where coords = concatMap fromValue values
-- Convert a node to a list of valid moves | 508 | fromProperty :: Property -> Move
fromProperty (Property label values)
| label == "AB" = Add Black coords
| label == "AE" = Add Empty coords
| label == "AW" = Add White coords
| label == "B" = if null coords then Pass Black else Move Black $ head coords
| label == "W" = if null coords then Pass White else Move White $ head coords
| otherwise = Pass Empty
where coords = concatMap fromValue values
-- Convert a node to a list of valid moves | 470 | fromProperty (Property label values)
| label == "AB" = Add Black coords
| label == "AE" = Add Empty coords
| label == "AW" = Add White coords
| label == "B" = if null coords then Pass Black else Move Black $ head coords
| label == "W" = if null coords then Pass White else Move White $ head coords
| otherwise = Pass Empty
where coords = concatMap fromValue values
-- Convert a node to a list of valid moves | 437 | true | true | 5 | 8 | 125 | 176 | 82 | 94 | null | null |
sdiehl/ghc | compiler/typecheck/TcEvidence.hs | bsd-3-clause | emptyTcEvBinds :: TcEvBinds
emptyTcEvBinds = EvBinds emptyBag | 61 | emptyTcEvBinds :: TcEvBinds
emptyTcEvBinds = EvBinds emptyBag | 61 | emptyTcEvBinds = EvBinds emptyBag | 33 | false | true | 0 | 6 | 6 | 21 | 8 | 13 | null | null |
MattWis/smallEmail | smallEmail/Test.hs | mit | subject1 = "Google Account: access for less secure apps has been enabled" | 73 | subject1 = "Google Account: access for less secure apps has been enabled" | 73 | subject1 = "Google Account: access for less secure apps has been enabled" | 73 | false | false | 1 | 5 | 11 | 10 | 3 | 7 | null | null |
laMudri/bridge-go | Main.hs | gpl-2.0 | external ∷ Index → (Point → Bool) → Point → Bool
external size f q = not (f q) ∧ case find (\(Space ps _) → q S.∈ ps)
(S.elems (falseSpaces size f)) of
Just s → externalSpace s
Nothing → error "Eh?" | 316 | external ∷ Index → (Point → Bool) → Point → Bool
external size f q = not (f q) ∧ case find (\(Space ps _) → q S.∈ ps)
(S.elems (falseSpaces size f)) of
Just s → externalSpace s
Nothing → error "Eh?" | 314 | external size f q = not (f q) ∧ case find (\(Space ps _) → q S.∈ ps)
(S.elems (falseSpaces size f)) of
Just s → externalSpace s
Nothing → error "Eh?" | 265 | false | true | 0 | 11 | 160 | 123 | 59 | 64 | null | null |
juodaspaulius/clafer-old-customBNFC | src/Language/Clafer/Intermediate/ResolverName.hs | mit | isIEClafer :: IElement -> Bool
isIEClafer (IEClafer _) = True | 61 | isIEClafer :: IElement -> Bool
isIEClafer (IEClafer _) = True | 61 | isIEClafer (IEClafer _) = True | 30 | false | true | 0 | 9 | 9 | 30 | 13 | 17 | null | null |
haslab/SecreC | src/Language/SecreC/Transformation/Simplify.hs | gpl-3.0 | simplifyProcedureDeclaration :: SimplifyG loc m ProcedureDeclaration
simplifyProcedureDeclaration (OperatorDeclaration l ret op args ctx anns body) = do
(ss0,ret') <- simplifyReturnTypeSpecifier True ret
(ss1,ctx') <- simplifyTemplateContext ctx
anns' <- simplifyProcedureAnns anns
body' <- simplifyStatements Nothing body
ctxanns <- stmtsAnns (ss0++ss1)
ctxanns' <- concatMapM (procAnn False) ctxanns
returnS (OperatorDeclaration l ret' op args ctx' (anns'++ctxanns') body') | 503 | simplifyProcedureDeclaration :: SimplifyG loc m ProcedureDeclaration
simplifyProcedureDeclaration (OperatorDeclaration l ret op args ctx anns body) = do
(ss0,ret') <- simplifyReturnTypeSpecifier True ret
(ss1,ctx') <- simplifyTemplateContext ctx
anns' <- simplifyProcedureAnns anns
body' <- simplifyStatements Nothing body
ctxanns <- stmtsAnns (ss0++ss1)
ctxanns' <- concatMapM (procAnn False) ctxanns
returnS (OperatorDeclaration l ret' op args ctx' (anns'++ctxanns') body') | 503 | simplifyProcedureDeclaration (OperatorDeclaration l ret op args ctx anns body) = do
(ss0,ret') <- simplifyReturnTypeSpecifier True ret
(ss1,ctx') <- simplifyTemplateContext ctx
anns' <- simplifyProcedureAnns anns
body' <- simplifyStatements Nothing body
ctxanns <- stmtsAnns (ss0++ss1)
ctxanns' <- concatMapM (procAnn False) ctxanns
returnS (OperatorDeclaration l ret' op args ctx' (anns'++ctxanns') body') | 434 | false | true | 0 | 11 | 81 | 161 | 76 | 85 | null | null |
pparkkin/eta | compiler/ETA/BasicTypes/SrcLoc.hs | bsd-3-clause | realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc
realSrcSpanEnd s = mkRealSrcLoc (srcSpanFile s)
(srcSpanEndLine s)
(srcSpanEndCol s) | 192 | realSrcSpanEnd :: RealSrcSpan -> RealSrcLoc
realSrcSpanEnd s = mkRealSrcLoc (srcSpanFile s)
(srcSpanEndLine s)
(srcSpanEndCol s) | 192 | realSrcSpanEnd s = mkRealSrcLoc (srcSpanFile s)
(srcSpanEndLine s)
(srcSpanEndCol s) | 148 | false | true | 0 | 7 | 78 | 43 | 21 | 22 | null | null |
sapek/pandoc | src/Text/Pandoc/Writers/ICML.hs | gpl-2.0 | -- | Wrap a list of inline elements in an ICML Paragraph Style
parStyle :: WriterOptions -> Style -> [Inline] -> WS Doc
parStyle opts style lst =
let slipIn x y = if null y
then x
else x ++ " > " ++ y
stlStr = foldr slipIn [] $ reverse style
stl = if null stlStr
then ""
else "ParagraphStyle/" ++ stlStr
attrs = ("AppliedParagraphStyle", stl)
attrs' = if firstListItemName `elem` style
then let ats = attrs : [("NumberingContinue", "false")]
begins = filter (isPrefixOf beginsWithName) style
in if null begins
then ats
else let i = maybe "" id $ stripPrefix beginsWithName $ head begins
in ("NumberingStartAt", i) : ats
else [attrs]
in do
content <- inlinesToICML opts [] lst
let cont = inTags True "ParagraphStyleRange" attrs'
$ mappend content $ selfClosingTag "Br" []
state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
-- | Wrap a Doc in an ICML Character Style. | 1,234 | parStyle :: WriterOptions -> Style -> [Inline] -> WS Doc
parStyle opts style lst =
let slipIn x y = if null y
then x
else x ++ " > " ++ y
stlStr = foldr slipIn [] $ reverse style
stl = if null stlStr
then ""
else "ParagraphStyle/" ++ stlStr
attrs = ("AppliedParagraphStyle", stl)
attrs' = if firstListItemName `elem` style
then let ats = attrs : [("NumberingContinue", "false")]
begins = filter (isPrefixOf beginsWithName) style
in if null begins
then ats
else let i = maybe "" id $ stripPrefix beginsWithName $ head begins
in ("NumberingStartAt", i) : ats
else [attrs]
in do
content <- inlinesToICML opts [] lst
let cont = inTags True "ParagraphStyleRange" attrs'
$ mappend content $ selfClosingTag "Br" []
state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
-- | Wrap a Doc in an ICML Character Style. | 1,171 | parStyle opts style lst =
let slipIn x y = if null y
then x
else x ++ " > " ++ y
stlStr = foldr slipIn [] $ reverse style
stl = if null stlStr
then ""
else "ParagraphStyle/" ++ stlStr
attrs = ("AppliedParagraphStyle", stl)
attrs' = if firstListItemName `elem` style
then let ats = attrs : [("NumberingContinue", "false")]
begins = filter (isPrefixOf beginsWithName) style
in if null begins
then ats
else let i = maybe "" id $ stripPrefix beginsWithName $ head begins
in ("NumberingStartAt", i) : ats
else [attrs]
in do
content <- inlinesToICML opts [] lst
let cont = inTags True "ParagraphStyleRange" attrs'
$ mappend content $ selfClosingTag "Br" []
state $ \st -> (cont, st{ blockStyles = Set.insert stlStr $ blockStyles st })
-- | Wrap a Doc in an ICML Character Style. | 1,114 | true | true | 0 | 19 | 502 | 324 | 166 | 158 | null | null |
gizmo-mk0/kartofwar-server | src/Common.hs | unlicense | waypointToCoord (MovingUnit mf _ _ _) = mf | 42 | waypointToCoord (MovingUnit mf _ _ _) = mf | 42 | waypointToCoord (MovingUnit mf _ _ _) = mf | 42 | false | false | 0 | 7 | 7 | 21 | 10 | 11 | null | null |
rvion/stack | src/Stack/Package.hs | bsd-3-clause | readPackage :: (MonadLogger m, MonadIO m, MonadThrow m, MonadCatch m)
=> PackageConfig
-> Path Abs File
-> m ([PWarning],Package)
readPackage packageConfig cabalfp =
do (warnings,gpkg) <- readPackageUnresolved cabalfp
return (warnings,resolvePackage packageConfig gpkg)
-- | Reads and exposes the package information, from a ByteString | 379 | readPackage :: (MonadLogger m, MonadIO m, MonadThrow m, MonadCatch m)
=> PackageConfig
-> Path Abs File
-> m ([PWarning],Package)
readPackage packageConfig cabalfp =
do (warnings,gpkg) <- readPackageUnresolved cabalfp
return (warnings,resolvePackage packageConfig gpkg)
-- | Reads and exposes the package information, from a ByteString | 379 | readPackage packageConfig cabalfp =
do (warnings,gpkg) <- readPackageUnresolved cabalfp
return (warnings,resolvePackage packageConfig gpkg)
-- | Reads and exposes the package information, from a ByteString | 213 | false | true | 0 | 10 | 86 | 102 | 52 | 50 | null | null |
keera-studios/hsQt | Qtc/Enums/Core/QChar.hs | bsd-2-clause | eDual :: Joining
eDual
= ieJoining $ 1 | 40 | eDual :: Joining
eDual
= ieJoining $ 1 | 40 | eDual
= ieJoining $ 1 | 23 | false | true | 0 | 6 | 9 | 18 | 8 | 10 | null | null |
maciej-bendkowski/boltzmann-brain | Data/Boltzmann/System/Utils.hs | bsd-3-clause | -- | Detects whether the given system, satisfying H(0,0) = 0
-- and having a nilpotent Jacobian matrix, admits zero coordinates
-- in its solution. See also the 0-coord subroutine of Pivoteau et al.
zeroCoordinates :: System a -> Bool
zeroCoordinates sys = zeroCoordinates' sys m f
where f = M.fromSet (const Zero) $ types sys
m = size sys | 357 | zeroCoordinates :: System a -> Bool
zeroCoordinates sys = zeroCoordinates' sys m f
where f = M.fromSet (const Zero) $ types sys
m = size sys | 154 | zeroCoordinates sys = zeroCoordinates' sys m f
where f = M.fromSet (const Zero) $ types sys
m = size sys | 118 | true | true | 1 | 8 | 77 | 65 | 32 | 33 | null | null |
kearnh/HToyRayTracer | src/Scene.hs | bsd-3-clause | elemObj :: String -> [RTObject] -> Bool
elemObj k tab = elem k $ (map fst $ readObjs tab) | 89 | elemObj :: String -> [RTObject] -> Bool
elemObj k tab = elem k $ (map fst $ readObjs tab) | 89 | elemObj k tab = elem k $ (map fst $ readObjs tab) | 49 | false | true | 2 | 8 | 18 | 54 | 24 | 30 | null | null |
yu-i9/HaSC | src/HaSC/Prim/Semantic.hs | mit | exprTypeCheck (A_MultiExpr es) = liftM last (mapM exprTypeCheck es) | 70 | exprTypeCheck (A_MultiExpr es) = liftM last (mapM exprTypeCheck es) | 70 | exprTypeCheck (A_MultiExpr es) = liftM last (mapM exprTypeCheck es) | 70 | false | false | 0 | 7 | 11 | 29 | 13 | 16 | null | null |
GaloisInc/halvm-ghc | compiler/typecheck/FunDeps.hs | bsd-3-clause | oclose :: [PredType] -> TyCoVarSet -> TyCoVarSet
-- See Note [The liberal coverage condition]
oclose preds fixed_tvs
| null tv_fds = fixed_tvs -- Fast escape hatch for common case.
| otherwise = fixVarSet extend fixed_tvs
where
extend fixed_tvs = foldl add fixed_tvs tv_fds
where
add fixed_tvs (ls,rs)
| ls `subVarSet` fixed_tvs = fixed_tvs `unionVarSet` closeOverKinds rs
| otherwise = fixed_tvs
-- closeOverKinds: see Note [Closing over kinds in coverage]
tv_fds :: [(TyCoVarSet,TyCoVarSet)]
tv_fds = [ (tyCoVarsOfTypes ls, tyCoVarsOfTypes rs)
| pred <- preds
, pred' <- pred : transSuperClasses pred
-- Look for fundeps in superclasses too
, (ls, rs) <- determined pred' ]
determined :: PredType -> [([Type],[Type])]
determined pred
= case classifyPredType pred of
EqPred NomEq t1 t2 -> [([t1],[t2]), ([t2],[t1])]
ClassPred cls tys -> [ instFD fd cls_tvs tys
| let (cls_tvs, cls_fds) = classTvsFds cls
, fd <- cls_fds ]
_ -> []
{-
************************************************************************
* *
Check that a new instance decl is OK wrt fundeps
* *
************************************************************************
Here is the bad case:
class C a b | a->b where ...
instance C Int Bool where ...
instance C Int Char where ...
The point is that a->b, so Int in the first parameter must uniquely
determine the second. In general, given the same class decl, and given
instance C s1 s2 where ...
instance C t1 t2 where ...
Then the criterion is: if U=unify(s1,t1) then U(s2) = U(t2).
Matters are a little more complicated if there are free variables in
the s2/t2.
class D a b c | a -> b
instance D a b => D [(a,a)] [b] Int
instance D a b => D [a] [b] Bool
The instance decls don't overlap, because the third parameter keeps
them separate. But we want to make sure that given any constraint
D s1 s2 s3
if s1 matches
Note [Bogus consistency check]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In checkFunDeps we check that a new ClsInst is consistent with all the
ClsInsts in the environment.
The bogus aspect is discussed in Trac #10675. Currenty it if the two
types are *contradicatory*, using (isNothing . tcUnifyTys). But all
the papers say we should check if the two types are *equal* thus
not (substTys subst rtys1 `eqTypes` substTys subst rtys2)
For now I'm leaving the bogus form because that's the way it has
been for years.
-} | 2,849 | oclose :: [PredType] -> TyCoVarSet -> TyCoVarSet
oclose preds fixed_tvs
| null tv_fds = fixed_tvs -- Fast escape hatch for common case.
| otherwise = fixVarSet extend fixed_tvs
where
extend fixed_tvs = foldl add fixed_tvs tv_fds
where
add fixed_tvs (ls,rs)
| ls `subVarSet` fixed_tvs = fixed_tvs `unionVarSet` closeOverKinds rs
| otherwise = fixed_tvs
-- closeOverKinds: see Note [Closing over kinds in coverage]
tv_fds :: [(TyCoVarSet,TyCoVarSet)]
tv_fds = [ (tyCoVarsOfTypes ls, tyCoVarsOfTypes rs)
| pred <- preds
, pred' <- pred : transSuperClasses pred
-- Look for fundeps in superclasses too
, (ls, rs) <- determined pred' ]
determined :: PredType -> [([Type],[Type])]
determined pred
= case classifyPredType pred of
EqPred NomEq t1 t2 -> [([t1],[t2]), ([t2],[t1])]
ClassPred cls tys -> [ instFD fd cls_tvs tys
| let (cls_tvs, cls_fds) = classTvsFds cls
, fd <- cls_fds ]
_ -> []
{-
************************************************************************
* *
Check that a new instance decl is OK wrt fundeps
* *
************************************************************************
Here is the bad case:
class C a b | a->b where ...
instance C Int Bool where ...
instance C Int Char where ...
The point is that a->b, so Int in the first parameter must uniquely
determine the second. In general, given the same class decl, and given
instance C s1 s2 where ...
instance C t1 t2 where ...
Then the criterion is: if U=unify(s1,t1) then U(s2) = U(t2).
Matters are a little more complicated if there are free variables in
the s2/t2.
class D a b c | a -> b
instance D a b => D [(a,a)] [b] Int
instance D a b => D [a] [b] Bool
The instance decls don't overlap, because the third parameter keeps
them separate. But we want to make sure that given any constraint
D s1 s2 s3
if s1 matches
Note [Bogus consistency check]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In checkFunDeps we check that a new ClsInst is consistent with all the
ClsInsts in the environment.
The bogus aspect is discussed in Trac #10675. Currenty it if the two
types are *contradicatory*, using (isNothing . tcUnifyTys). But all
the papers say we should check if the two types are *equal* thus
not (substTys subst rtys1 `eqTypes` substTys subst rtys2)
For now I'm leaving the bogus form because that's the way it has
been for years.
-} | 2,804 | oclose preds fixed_tvs
| null tv_fds = fixed_tvs -- Fast escape hatch for common case.
| otherwise = fixVarSet extend fixed_tvs
where
extend fixed_tvs = foldl add fixed_tvs tv_fds
where
add fixed_tvs (ls,rs)
| ls `subVarSet` fixed_tvs = fixed_tvs `unionVarSet` closeOverKinds rs
| otherwise = fixed_tvs
-- closeOverKinds: see Note [Closing over kinds in coverage]
tv_fds :: [(TyCoVarSet,TyCoVarSet)]
tv_fds = [ (tyCoVarsOfTypes ls, tyCoVarsOfTypes rs)
| pred <- preds
, pred' <- pred : transSuperClasses pred
-- Look for fundeps in superclasses too
, (ls, rs) <- determined pred' ]
determined :: PredType -> [([Type],[Type])]
determined pred
= case classifyPredType pred of
EqPred NomEq t1 t2 -> [([t1],[t2]), ([t2],[t1])]
ClassPred cls tys -> [ instFD fd cls_tvs tys
| let (cls_tvs, cls_fds) = classTvsFds cls
, fd <- cls_fds ]
_ -> []
{-
************************************************************************
* *
Check that a new instance decl is OK wrt fundeps
* *
************************************************************************
Here is the bad case:
class C a b | a->b where ...
instance C Int Bool where ...
instance C Int Char where ...
The point is that a->b, so Int in the first parameter must uniquely
determine the second. In general, given the same class decl, and given
instance C s1 s2 where ...
instance C t1 t2 where ...
Then the criterion is: if U=unify(s1,t1) then U(s2) = U(t2).
Matters are a little more complicated if there are free variables in
the s2/t2.
class D a b c | a -> b
instance D a b => D [(a,a)] [b] Int
instance D a b => D [a] [b] Bool
The instance decls don't overlap, because the third parameter keeps
them separate. But we want to make sure that given any constraint
D s1 s2 s3
if s1 matches
Note [Bogus consistency check]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In checkFunDeps we check that a new ClsInst is consistent with all the
ClsInsts in the environment.
The bogus aspect is discussed in Trac #10675. Currenty it if the two
types are *contradicatory*, using (isNothing . tcUnifyTys). But all
the papers say we should check if the two types are *equal* thus
not (substTys subst rtys1 `eqTypes` substTys subst rtys2)
For now I'm leaving the bogus form because that's the way it has
been for years.
-} | 2,755 | true | true | 3 | 13 | 898 | 338 | 177 | 161 | null | null |
thinkpad20/s3-streams | tests/Network/AWS/Tests.hs | mit | runTest :: IO ()
runTest = do
cmd <- testCommand
let creq = canonicalRequest cmd
assertEqual creq correctCanonRequest "canonical request"
s2s <- stringToSign cmd
assertEqual s2s correctStringToSign "string to sign"
sig <- v4Signature cmd
assertEqual sig correctSignature "signature"
req <- awsRequest cmd
corReq <- correctRequest
assertEqual (show req :: ByteString) (show corReq) "request" | 410 | runTest :: IO ()
runTest = do
cmd <- testCommand
let creq = canonicalRequest cmd
assertEqual creq correctCanonRequest "canonical request"
s2s <- stringToSign cmd
assertEqual s2s correctStringToSign "string to sign"
sig <- v4Signature cmd
assertEqual sig correctSignature "signature"
req <- awsRequest cmd
corReq <- correctRequest
assertEqual (show req :: ByteString) (show corReq) "request" | 410 | runTest = do
cmd <- testCommand
let creq = canonicalRequest cmd
assertEqual creq correctCanonRequest "canonical request"
s2s <- stringToSign cmd
assertEqual s2s correctStringToSign "string to sign"
sig <- v4Signature cmd
assertEqual sig correctSignature "signature"
req <- awsRequest cmd
corReq <- correctRequest
assertEqual (show req :: ByteString) (show corReq) "request" | 393 | false | true | 0 | 10 | 72 | 127 | 55 | 72 | null | null |
alexbaluta/courseography | dependencies/HaXml-1.25.3/src/Text/XML/HaXml/ParseLazy.hs | gpl-3.0 | entitydef :: XParser EntityDef
entitydef =
oneOf' [ ("entityvalue", entityvalue >>= return . DefEntityValue)
, ("external", do eid <- externalid
ndd <- maybe ndatadecl
return (DefExternalID eid ndd))
] | 294 | entitydef :: XParser EntityDef
entitydef =
oneOf' [ ("entityvalue", entityvalue >>= return . DefEntityValue)
, ("external", do eid <- externalid
ndd <- maybe ndatadecl
return (DefExternalID eid ndd))
] | 294 | entitydef =
oneOf' [ ("entityvalue", entityvalue >>= return . DefEntityValue)
, ("external", do eid <- externalid
ndd <- maybe ndatadecl
return (DefExternalID eid ndd))
] | 263 | false | true | 1 | 12 | 121 | 78 | 37 | 41 | null | null |
kadena-io/pact | src/Pact/Types/Term.hs | bsd-3-clause | termEq1 _ (TLiteral a _) (TLiteral b _) = a == b | 48 | termEq1 _ (TLiteral a _) (TLiteral b _) = a == b | 48 | termEq1 _ (TLiteral a _) (TLiteral b _) = a == b | 48 | false | false | 0 | 7 | 11 | 33 | 16 | 17 | null | null |
j5b/ps-pc | Parser_test.hs | gpl-3.0 | parsimpletests = maplabel "Simple parser tests" [partest1, partest2, partest3,
partest4, partest5, partest6,
partest7, partest8, partest9] | 239 | parsimpletests = maplabel "Simple parser tests" [partest1, partest2, partest3,
partest4, partest5, partest6,
partest7, partest8, partest9] | 239 | parsimpletests = maplabel "Simple parser tests" [partest1, partest2, partest3,
partest4, partest5, partest6,
partest7, partest8, partest9] | 239 | false | false | 0 | 6 | 115 | 38 | 23 | 15 | null | null |
PaulGustafson/stringnet | Test.hs | mit | rightT (TensorM a b) = b | 24 | rightT (TensorM a b) = b | 24 | rightT (TensorM a b) = b | 24 | false | false | 0 | 7 | 5 | 17 | 8 | 9 | null | null |
bergmark/hlint | data/Default.hs | bsd-3-clause | error = maximumBy compare ==> maximum | 37 | error = maximumBy compare ==> maximum | 37 | error = maximumBy compare ==> maximum | 37 | false | false | 0 | 6 | 5 | 13 | 6 | 7 | null | null |
rvion/lamdu | Lamdu/GUI/TypeView.hs | gpl-3.0 | makeTFun :: MonadA m => ParentPrecedence -> Type -> Type -> M m View
makeTFun parentPrecedence a b =
case a of
T.TRecord T.CEmpty -> [text "◗ "]
_ ->
[ splitMake (ParentPrecedence 1) a
, text " → "
]
++ [splitMake (ParentPrecedence 0) b]
& sequence
<&> hbox
>>= parens parentPrecedence (MyPrecedence 0)
>>= addValPadding | 376 | makeTFun :: MonadA m => ParentPrecedence -> Type -> Type -> M m View
makeTFun parentPrecedence a b =
case a of
T.TRecord T.CEmpty -> [text "◗ "]
_ ->
[ splitMake (ParentPrecedence 1) a
, text " → "
]
++ [splitMake (ParentPrecedence 0) b]
& sequence
<&> hbox
>>= parens parentPrecedence (MyPrecedence 0)
>>= addValPadding | 376 | makeTFun parentPrecedence a b =
case a of
T.TRecord T.CEmpty -> [text "◗ "]
_ ->
[ splitMake (ParentPrecedence 1) a
, text " → "
]
++ [splitMake (ParentPrecedence 0) b]
& sequence
<&> hbox
>>= parens parentPrecedence (MyPrecedence 0)
>>= addValPadding | 307 | false | true | 0 | 16 | 112 | 136 | 66 | 70 | null | null |
dmp1ce/DMSS | src-test/CLITest.hs | unlicense | datadirCreated :: Assertion
datadirCreated = withTemporaryTestDirectory tempDir
( \homedir -> do
let newDatadir = homedir ++ "/test"
-- Simulate a list user command which will tigger data directory creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id IdList))
-- Verify data directory was created
pathExists <- doesPathExist newDatadir
assertBool (newDatadir ++ " directory has been created.") pathExists
-- Simulate a create user command which will tigger data database creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id (IdCreate (Just "new user") (Just "Password"))))
-- Verify database was created
let sqlFile = newDatadir ++ "/.local/share/dmss/dmss.sqlite"
dataExists <- doesFileExist sqlFile
assertBool (sqlFile ++ " database has been created.") dataExists
) | 842 | datadirCreated :: Assertion
datadirCreated = withTemporaryTestDirectory tempDir
( \homedir -> do
let newDatadir = homedir ++ "/test"
-- Simulate a list user command which will tigger data directory creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id IdList))
-- Verify data directory was created
pathExists <- doesPathExist newDatadir
assertBool (newDatadir ++ " directory has been created.") pathExists
-- Simulate a create user command which will tigger data database creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id (IdCreate (Just "new user") (Just "Password"))))
-- Verify database was created
let sqlFile = newDatadir ++ "/.local/share/dmss/dmss.sqlite"
dataExists <- doesFileExist sqlFile
assertBool (sqlFile ++ " database has been created.") dataExists
) | 842 | datadirCreated = withTemporaryTestDirectory tempDir
( \homedir -> do
let newDatadir = homedir ++ "/test"
-- Simulate a list user command which will tigger data directory creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id IdList))
-- Verify data directory was created
pathExists <- doesPathExist newDatadir
assertBool (newDatadir ++ " directory has been created.") pathExists
-- Simulate a create user command which will tigger data database creation.
process (Cli (Just newDatadir) cliPort SilentOff (Id (IdCreate (Just "new user") (Just "Password"))))
-- Verify database was created
let sqlFile = newDatadir ++ "/.local/share/dmss/dmss.sqlite"
dataExists <- doesFileExist sqlFile
assertBool (sqlFile ++ " database has been created.") dataExists
) | 814 | false | true | 0 | 17 | 160 | 185 | 89 | 96 | null | null |
yav/monadlib | src/MonadLib/Derive.hs | mit | -- | Derive the implementation of '>>=' from 'Monad'.
derive_bind :: (Monad m) => Iso m n -> n a -> (a -> n b) -> n b
derive_bind iso m k = close iso ((open iso m) >>= \x -> open iso (k x)) | 189 | derive_bind :: (Monad m) => Iso m n -> n a -> (a -> n b) -> n b
derive_bind iso m k = close iso ((open iso m) >>= \x -> open iso (k x)) | 135 | derive_bind iso m k = close iso ((open iso m) >>= \x -> open iso (k x)) | 71 | true | true | 0 | 11 | 44 | 97 | 48 | 49 | null | null |
robbertkrebbers/fewdigits | Data/Real/DReal.hs | bsd-2-clause | dplusCts :: Dyadic :=> Dyadic :=> Dyadic
dplusCts = mkUniformCts id dplusBaseCts | 80 | dplusCts :: Dyadic :=> Dyadic :=> Dyadic
dplusCts = mkUniformCts id dplusBaseCts | 80 | dplusCts = mkUniformCts id dplusBaseCts | 39 | false | true | 0 | 6 | 11 | 24 | 12 | 12 | null | null |
holzensp/ghc | libraries/base/GHC/IO/Handle/Types.hs | bsd-3-clause | checkHandleInvariants h_ = do
bbuf <- readIORef (haByteBuffer h_)
checkBuffer bbuf
cbuf <- readIORef (haCharBuffer h_)
checkBuffer cbuf
when (isWriteBuffer cbuf && not (isEmptyBuffer cbuf)) $
error ("checkHandleInvariants: char write buffer non-empty: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
when (isWriteBuffer bbuf /= isWriteBuffer cbuf) $
error ("checkHandleInvariants: buffer modes differ: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
#else
checkHandleInvariants _ = return ()
#endif
-- ---------------------------------------------------------------------------
-- Buffering modes
-- | Three kinds of buffering are supported: line-buffering,
-- block-buffering or no-buffering. These modes have the following
-- effects. For output, items are written out, or /flushed/,
-- from the internal buffer according to the buffer mode:
--
-- * /line-buffering/: the entire output buffer is flushed
-- whenever a newline is output, the buffer overflows,
-- a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /block-buffering/: the entire buffer is written out whenever it
-- overflows, a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /no-buffering/: output is written immediately, and never stored
-- in the buffer.
--
-- An implementation is free to flush the buffer more frequently,
-- but not less frequently, than specified above.
-- The output buffer is emptied as soon as it has been written out.
--
-- Similarly, input occurs according to the buffer mode for the handle:
--
-- * /line-buffering/: when the buffer for the handle is not empty,
-- the next item is obtained from the buffer; otherwise, when the
-- buffer is empty, characters up to and including the next newline
-- character are read into the buffer. No characters are available
-- until the newline character is available or the buffer is full.
--
-- * /block-buffering/: when the buffer for the handle becomes empty,
-- the next block of data is read into the buffer.
--
-- * /no-buffering/: the next input item is read and returned.
-- The 'System.IO.hLookAhead' operation implies that even a no-buffered
-- handle may require a one-character buffer.
--
-- The default buffering mode when a handle is opened is
-- implementation-dependent and may depend on the file system object
-- which is attached to that handle.
-- For most implementations, physical files will normally be block-buffered
-- and terminals will normally be line-buffered. | 2,546 | checkHandleInvariants h_ = do
bbuf <- readIORef (haByteBuffer h_)
checkBuffer bbuf
cbuf <- readIORef (haCharBuffer h_)
checkBuffer cbuf
when (isWriteBuffer cbuf && not (isEmptyBuffer cbuf)) $
error ("checkHandleInvariants: char write buffer non-empty: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
when (isWriteBuffer bbuf /= isWriteBuffer cbuf) $
error ("checkHandleInvariants: buffer modes differ: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
#else
checkHandleInvariants _ = return ()
#endif
-- ---------------------------------------------------------------------------
-- Buffering modes
-- | Three kinds of buffering are supported: line-buffering,
-- block-buffering or no-buffering. These modes have the following
-- effects. For output, items are written out, or /flushed/,
-- from the internal buffer according to the buffer mode:
--
-- * /line-buffering/: the entire output buffer is flushed
-- whenever a newline is output, the buffer overflows,
-- a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /block-buffering/: the entire buffer is written out whenever it
-- overflows, a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /no-buffering/: output is written immediately, and never stored
-- in the buffer.
--
-- An implementation is free to flush the buffer more frequently,
-- but not less frequently, than specified above.
-- The output buffer is emptied as soon as it has been written out.
--
-- Similarly, input occurs according to the buffer mode for the handle:
--
-- * /line-buffering/: when the buffer for the handle is not empty,
-- the next item is obtained from the buffer; otherwise, when the
-- buffer is empty, characters up to and including the next newline
-- character are read into the buffer. No characters are available
-- until the newline character is available or the buffer is full.
--
-- * /block-buffering/: when the buffer for the handle becomes empty,
-- the next block of data is read into the buffer.
--
-- * /no-buffering/: the next input item is read and returned.
-- The 'System.IO.hLookAhead' operation implies that even a no-buffered
-- handle may require a one-character buffer.
--
-- The default buffering mode when a handle is opened is
-- implementation-dependent and may depend on the file system object
-- which is attached to that handle.
-- For most implementations, physical files will normally be block-buffered
-- and terminals will normally be line-buffered. | 2,546 | checkHandleInvariants h_ = do
bbuf <- readIORef (haByteBuffer h_)
checkBuffer bbuf
cbuf <- readIORef (haCharBuffer h_)
checkBuffer cbuf
when (isWriteBuffer cbuf && not (isEmptyBuffer cbuf)) $
error ("checkHandleInvariants: char write buffer non-empty: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
when (isWriteBuffer bbuf /= isWriteBuffer cbuf) $
error ("checkHandleInvariants: buffer modes differ: " ++
summaryBuffer bbuf ++ ", " ++ summaryBuffer cbuf)
#else
checkHandleInvariants _ = return ()
#endif
-- ---------------------------------------------------------------------------
-- Buffering modes
-- | Three kinds of buffering are supported: line-buffering,
-- block-buffering or no-buffering. These modes have the following
-- effects. For output, items are written out, or /flushed/,
-- from the internal buffer according to the buffer mode:
--
-- * /line-buffering/: the entire output buffer is flushed
-- whenever a newline is output, the buffer overflows,
-- a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /block-buffering/: the entire buffer is written out whenever it
-- overflows, a 'System.IO.hFlush' is issued, or the handle is closed.
--
-- * /no-buffering/: output is written immediately, and never stored
-- in the buffer.
--
-- An implementation is free to flush the buffer more frequently,
-- but not less frequently, than specified above.
-- The output buffer is emptied as soon as it has been written out.
--
-- Similarly, input occurs according to the buffer mode for the handle:
--
-- * /line-buffering/: when the buffer for the handle is not empty,
-- the next item is obtained from the buffer; otherwise, when the
-- buffer is empty, characters up to and including the next newline
-- character are read into the buffer. No characters are available
-- until the newline character is available or the buffer is full.
--
-- * /block-buffering/: when the buffer for the handle becomes empty,
-- the next block of data is read into the buffer.
--
-- * /no-buffering/: the next input item is read and returned.
-- The 'System.IO.hLookAhead' operation implies that even a no-buffered
-- handle may require a one-character buffer.
--
-- The default buffering mode when a handle is opened is
-- implementation-dependent and may depend on the file system object
-- which is attached to that handle.
-- For most implementations, physical files will normally be block-buffered
-- and terminals will normally be line-buffered. | 2,546 | false | false | 0 | 13 | 463 | 196 | 110 | 86 | null | null |
josuf107/Adverb | Adverb/Common.hs | gpl-3.0 | ceremonially = id | 17 | ceremonially = id | 17 | ceremonially = id | 17 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
siddhanathan/ghc | compiler/prelude/TysWiredIn.hs | bsd-3-clause | justDataCon :: DataCon
justDataCon = pcDataCon justDataConName alpha_tyvar [alphaTy] maybeTyCon | 95 | justDataCon :: DataCon
justDataCon = pcDataCon justDataConName alpha_tyvar [alphaTy] maybeTyCon | 95 | justDataCon = pcDataCon justDataConName alpha_tyvar [alphaTy] maybeTyCon | 72 | false | true | 0 | 6 | 9 | 23 | 12 | 11 | null | null |
beni55/haste-compiler | libraries/ghc-7.8/base/Data/Bits.hs | bsd-3-clause | -- | Default implementation for 'testBit'.
--
-- Note that: @testBitDefault x i = (x .&. bit i) /= 0@
testBitDefault :: (Bits a, Num a) => a -> Int -> Bool
testBitDefault x i = (x .&. bit i) /= 0 | 196 | testBitDefault :: (Bits a, Num a) => a -> Int -> Bool
testBitDefault x i = (x .&. bit i) /= 0 | 94 | testBitDefault x i = (x .&. bit i) /= 0 | 39 | true | true | 0 | 8 | 42 | 56 | 30 | 26 | null | null |
DanielSchuessler/hstri | THUtil.hs | gpl-3.0 | inheritPretty
:: (Convertible accessor ExpQ,
Convertible sub TypeQ,
Convertible super TypeQ) =>
sub -> super -> accessor -> Q [Dec]
inheritPretty = inheritSingleArgClass ''Pretty ['pretty] [] | 210 | inheritPretty
:: (Convertible accessor ExpQ,
Convertible sub TypeQ,
Convertible super TypeQ) =>
sub -> super -> accessor -> Q [Dec]
inheritPretty = inheritSingleArgClass ''Pretty ['pretty] [] | 210 | inheritPretty = inheritSingleArgClass ''Pretty ['pretty] [] | 59 | false | true | 0 | 11 | 44 | 76 | 38 | 38 | null | null |
spechub/Hets | CommonLogic/Tools.hs | gpl-2.0 | nonToplevelNames :: TERM -> Set NAME
nonToplevelNames trm = case trm of
Name_term _ -> Set.empty
Comment_term t _ _ -> nonToplevelNames t
_ -> indvC_term trm
-- | retrieves the individual constants from a term | 234 | nonToplevelNames :: TERM -> Set NAME
nonToplevelNames trm = case trm of
Name_term _ -> Set.empty
Comment_term t _ _ -> nonToplevelNames t
_ -> indvC_term trm
-- | retrieves the individual constants from a term | 234 | nonToplevelNames trm = case trm of
Name_term _ -> Set.empty
Comment_term t _ _ -> nonToplevelNames t
_ -> indvC_term trm
-- | retrieves the individual constants from a term | 197 | false | true | 0 | 8 | 60 | 65 | 30 | 35 | null | null |
imalsogreg/Haskell-Lens-Tutorial-Library | src/Control/Lens/Tutorial.hs | bsd-3-clause | shiftAtomX :: Atom -> Atom
shiftAtomX = over (point . x) (+ 1) | 62 | shiftAtomX :: Atom -> Atom
shiftAtomX = over (point . x) (+ 1) | 62 | shiftAtomX = over (point . x) (+ 1) | 35 | false | true | 0 | 7 | 12 | 31 | 17 | 14 | null | null |
brendanhay/gogol | gogol-videointelligence/gen/Network/Google/VideoIntelligence/Types/Product.hs | mpl-2.0 | -- | Information corresponding to all frames where this object track appears.
-- Non-streaming batch mode: it may be one or multiple ObjectTrackingFrame
-- messages in frames. Streaming mode: it can only be one
-- ObjectTrackingFrame message in frames.
gcvvota2Frames :: Lens' GoogleCloudVideointelligenceV1p1beta1_ObjectTrackingAnnotation [GoogleCloudVideointelligenceV1p1beta1_ObjectTrackingFrame]
gcvvota2Frames
= lens _gcvvota2Frames
(\ s a -> s{_gcvvota2Frames = a})
. _Default
. _Coerce | 512 | gcvvota2Frames :: Lens' GoogleCloudVideointelligenceV1p1beta1_ObjectTrackingAnnotation [GoogleCloudVideointelligenceV1p1beta1_ObjectTrackingFrame]
gcvvota2Frames
= lens _gcvvota2Frames
(\ s a -> s{_gcvvota2Frames = a})
. _Default
. _Coerce | 259 | gcvvota2Frames
= lens _gcvvota2Frames
(\ s a -> s{_gcvvota2Frames = a})
. _Default
. _Coerce | 112 | true | true | 0 | 11 | 78 | 56 | 31 | 25 | null | null |
kvelicka/frag | src/Raybox.hs | gpl-2.0 | -- tests if a ray intersects a box
rayBox :: (Double,Double,Double) -> (Double,Double,Double) ->
(Double,Double,Double) -> (Double,Double,Double) -> Bool
rayBox (rayOx,rayOy,rayOz) (rayDx,rayDy,rayDz) (minx,miny,minz)(maxx,maxy,maxz)
| (rayOx,rayOy,rayOz) == (rayDx,rayDy,rayDz) = False
| otherwise =
case ((txmin > tymax) || (tymin > txmax)) of
True -> False
_ -> intersectz
where (txmin,txmax) = getT rayOx rayDx minx maxx
(tymin,tymax) = getT rayOy rayDy miny maxy
(tzmin,tzmax) = getT rayOz rayDz minz maxz
intersectz =
not (((max txmin tymin) > tzmax) || (tzmin > (min txmax tymax))) | 703 | rayBox :: (Double,Double,Double) -> (Double,Double,Double) ->
(Double,Double,Double) -> (Double,Double,Double) -> Bool
rayBox (rayOx,rayOy,rayOz) (rayDx,rayDy,rayDz) (minx,miny,minz)(maxx,maxy,maxz)
| (rayOx,rayOy,rayOz) == (rayDx,rayDy,rayDz) = False
| otherwise =
case ((txmin > tymax) || (tymin > txmax)) of
True -> False
_ -> intersectz
where (txmin,txmax) = getT rayOx rayDx minx maxx
(tymin,tymax) = getT rayOy rayDy miny maxy
(tzmin,tzmax) = getT rayOz rayDz minz maxz
intersectz =
not (((max txmin tymin) > tzmax) || (tzmin > (min txmax tymax))) | 666 | rayBox (rayOx,rayOy,rayOz) (rayDx,rayDy,rayDz) (minx,miny,minz)(maxx,maxy,maxz)
| (rayOx,rayOy,rayOz) == (rayDx,rayDy,rayDz) = False
| otherwise =
case ((txmin > tymax) || (tymin > txmax)) of
True -> False
_ -> intersectz
where (txmin,txmax) = getT rayOx rayDx minx maxx
(tymin,tymax) = getT rayOy rayDy miny maxy
(tzmin,tzmax) = getT rayOz rayDz minz maxz
intersectz =
not (((max txmin tymin) > tzmax) || (tzmin > (min txmax tymax))) | 530 | true | true | 1 | 11 | 197 | 305 | 167 | 138 | null | null |
GaloisInc/halvm-ghc | compiler/typecheck/FamInst.hs | bsd-3-clause | -- | Build error message for equation that has a bare type variable in the RHS
-- but LHS pattern is not a bare type variable.
bareVariableInRHSErr :: [Type] -> InjErrorBuilder -> CoAxBranch
-> (SDoc, SrcSpan)
bareVariableInRHSErr tys errorBuilder famInst
= errorBuilder (injectivityErrorHerald True $$
text "RHS of injective type family equation is a bare" <+>
text "type variable" $$
text "but these LHS type and kind patterns are not bare" <+>
text "variables:" <+> pprQuotedList tys) [famInst] | 592 | bareVariableInRHSErr :: [Type] -> InjErrorBuilder -> CoAxBranch
-> (SDoc, SrcSpan)
bareVariableInRHSErr tys errorBuilder famInst
= errorBuilder (injectivityErrorHerald True $$
text "RHS of injective type family equation is a bare" <+>
text "type variable" $$
text "but these LHS type and kind patterns are not bare" <+>
text "variables:" <+> pprQuotedList tys) [famInst] | 465 | bareVariableInRHSErr tys errorBuilder famInst
= errorBuilder (injectivityErrorHerald True $$
text "RHS of injective type family equation is a bare" <+>
text "type variable" $$
text "but these LHS type and kind patterns are not bare" <+>
text "variables:" <+> pprQuotedList tys) [famInst] | 361 | true | true | 0 | 12 | 172 | 96 | 46 | 50 | null | null |
mydaum/cabal | cabal-install/Distribution/Client/Configure.hs | bsd-3-clause | isRelaxDeps RelaxDepsAll = True | 36 | isRelaxDeps RelaxDepsAll = True | 36 | isRelaxDeps RelaxDepsAll = True | 36 | false | false | 0 | 5 | 8 | 9 | 4 | 5 | null | null |
gennady-em/haskel | src/E_Yi.hs | gpl-2.0 | releaseSignals :: IO ()
releaseSignals =
sequence_ $ flip map [sigINT, sigPIPE, sigHUP, sigABRT, sigTERM]
(\sig -> installHandler sig Default Nothing) | 170 | releaseSignals :: IO ()
releaseSignals =
sequence_ $ flip map [sigINT, sigPIPE, sigHUP, sigABRT, sigTERM]
(\sig -> installHandler sig Default Nothing) | 170 | releaseSignals =
sequence_ $ flip map [sigINT, sigPIPE, sigHUP, sigABRT, sigTERM]
(\sig -> installHandler sig Default Nothing) | 146 | false | true | 2 | 8 | 40 | 66 | 32 | 34 | null | null |
chowells79/breakout | src/Main.hs | gpl-2.0 | windowAndRenderer :: String -> CInt -> CInt -> Word32 -> Word32
-> IO (Either String (Window, Renderer))
windowAndRenderer title width height wFlags rFlags =
withCString title $ \name -> runEitherT $ do
w <- nullCheck $ createWindow
name
SDL_WINDOWPOS_CENTERED
SDL_WINDOWPOS_CENTERED
width
height
wFlags
r <- nullCheck $ createRenderer w (-1) rFlags
return (w, r) | 561 | windowAndRenderer :: String -> CInt -> CInt -> Word32 -> Word32
-> IO (Either String (Window, Renderer))
windowAndRenderer title width height wFlags rFlags =
withCString title $ \name -> runEitherT $ do
w <- nullCheck $ createWindow
name
SDL_WINDOWPOS_CENTERED
SDL_WINDOWPOS_CENTERED
width
height
wFlags
r <- nullCheck $ createRenderer w (-1) rFlags
return (w, r) | 561 | windowAndRenderer title width height wFlags rFlags =
withCString title $ \name -> runEitherT $ do
w <- nullCheck $ createWindow
name
SDL_WINDOWPOS_CENTERED
SDL_WINDOWPOS_CENTERED
width
height
wFlags
r <- nullCheck $ createRenderer w (-1) rFlags
return (w, r) | 438 | false | true | 0 | 14 | 251 | 134 | 66 | 68 | null | null |
solidsnack/cassava | Data/Csv/Conversion.hs | bsd-3-clause | -- | Run a 'Parser', returning either @'Left' errMsg@ or @'Right'
-- result@. Forces the value in the 'Left' or 'Right' constructors to
-- weak head normal form.
--
-- You most likely won't need to use this function directly, but it's
-- included for completeness.
runParser :: Parser a -> Either String a
runParser p = unParser p left right
where
left !errMsg = Left errMsg
right !x = Right x
| 404 | runParser :: Parser a -> Either String a
runParser p = unParser p left right
where
left !errMsg = Left errMsg
right !x = Right x
| 139 | runParser p = unParser p left right
where
left !errMsg = Left errMsg
right !x = Right x
| 98 | true | true | 1 | 6 | 82 | 66 | 33 | 33 | null | null |
abakst/liquidhaskell | tests/pos/test1.hs | bsd-3-clause | myabs x = if x > 0 then x else 0 - x | 36 | myabs x = if x > 0 then x else 0 - x | 36 | myabs x = if x > 0 then x else 0 - x | 36 | false | false | 0 | 6 | 12 | 25 | 13 | 12 | null | null |
Teaspot-Studio/netwire | Control/Wire/Core.hs | bsd-3-clause | lstrict :: (a, b) -> (a, b)
lstrict (x, y) = x `seq` (x, y) | 59 | lstrict :: (a, b) -> (a, b)
lstrict (x, y) = x `seq` (x, y) | 59 | lstrict (x, y) = x `seq` (x, y) | 31 | false | true | 0 | 6 | 14 | 48 | 29 | 19 | null | null |
chadbrewbaker/shellcheck | shellcheck.hs | gpl-3.0 | getOption (Flag var val:_) name | name == var = return val | 58 | getOption (Flag var val:_) name | name == var = return val | 58 | getOption (Flag var val:_) name | name == var = return val | 58 | false | false | 0 | 8 | 11 | 36 | 16 | 20 | null | null |
hpacheco/jasminv | src/Language/Jasmin/Parser/Parser.hs | gpl-3.0 | quantifiedExpr :: MonadIO m => ParserT m (Pexpr_r Position)
quantifiedExpr = ann $ apA4 quantifier (sepBy1 annargNoExpr (tok COMMA)) (tok SEMICOLON) pexpr (\x1 x2 x3 x4 -> QuantifiedExpr x1 x2 x4) | 196 | quantifiedExpr :: MonadIO m => ParserT m (Pexpr_r Position)
quantifiedExpr = ann $ apA4 quantifier (sepBy1 annargNoExpr (tok COMMA)) (tok SEMICOLON) pexpr (\x1 x2 x3 x4 -> QuantifiedExpr x1 x2 x4) | 196 | quantifiedExpr = ann $ apA4 quantifier (sepBy1 annargNoExpr (tok COMMA)) (tok SEMICOLON) pexpr (\x1 x2 x3 x4 -> QuantifiedExpr x1 x2 x4) | 136 | false | true | 0 | 10 | 30 | 85 | 42 | 43 | null | null |
acowley/ghc | compiler/utils/Bag.hs | bsd-3-clause | mapAndUnzipBagM :: Monad m => (a -> m (b,c)) -> Bag a -> m (Bag b, Bag c)
mapAndUnzipBagM _ EmptyBag = return (EmptyBag, EmptyBag) | 137 | mapAndUnzipBagM :: Monad m => (a -> m (b,c)) -> Bag a -> m (Bag b, Bag c)
mapAndUnzipBagM _ EmptyBag = return (EmptyBag, EmptyBag) | 137 | mapAndUnzipBagM _ EmptyBag = return (EmptyBag, EmptyBag) | 63 | false | true | 0 | 10 | 31 | 74 | 37 | 37 | null | null |
fmapfmapfmap/amazonka | amazonka-s3/gen/Network/AWS/S3/CreateMultipartUpload.hs | mpl-2.0 | -- | Specifies the AWS KMS key ID to use for object encryption. All GET and
-- PUT requests for an object protected by AWS KMS will fail if not made
-- via SSL or using SigV4. Documentation on configuring any of the
-- officially supported AWS SDKs and CLI can be found at
-- http:\/\/docs.aws.amazon.com\/AmazonS3\/latest\/dev\/UsingAWSSDK.html#specify-signature-version
cmuSSEKMSKeyId :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSEKMSKeyId = lens _cmuSSEKMSKeyId (\ s a -> s{_cmuSSEKMSKeyId = a}) . mapping _Sensitive | 523 | cmuSSEKMSKeyId :: Lens' CreateMultipartUpload (Maybe Text)
cmuSSEKMSKeyId = lens _cmuSSEKMSKeyId (\ s a -> s{_cmuSSEKMSKeyId = a}) . mapping _Sensitive | 151 | cmuSSEKMSKeyId = lens _cmuSSEKMSKeyId (\ s a -> s{_cmuSSEKMSKeyId = a}) . mapping _Sensitive | 92 | true | true | 0 | 10 | 75 | 57 | 32 | 25 | null | null |
wdanilo/data-rtuple | src/Data/RTuple/Class.hs | apache-2.0 | zip5 _ Null _ _ _ = Null | 76 | zip5 _ Null _ _ _ = Null | 76 | zip5 _ Null _ _ _ = Null | 76 | false | false | 1 | 5 | 59 | 17 | 8 | 9 | null | null |
hansroland/reflex-dom-brownies | samples/canvas01.hs | bsd-3-clause | main :: IO ()
main = mainWidget $ do
el "h2" $ text "A first canvas example"
evPostBuild <- getPostBuild
evRed <- button "Red"
evGreen <- button "Green"
el "br" blank
let evImg = leftmost [greenPixels <$ evPostBuild, redPixels <$ evRed, greenPixels <$ evGreen]
let attr = "width" =: "256" <> "height" =: "256"
canvas <- pixelCanvasAttr attr evImg
return ()
{-
mouseEvent <- wrapDomEvent
(_element_raw canvas)
(onEventName Mousemove)
mouseOffsetXY
let mouseXYToString (x,y) = "X = " ++ show x ++ ";Y = " ++ show y
t <- holdDyn "" (T.pack.mouseXYToString <$> mouseEvent)
el "div" $ dynText t
-}
return ()
-- Pure user user functions ------------------------------------------------------------------------------
-- Function applied to every index pair | 803 | main :: IO ()
main = mainWidget $ do
el "h2" $ text "A first canvas example"
evPostBuild <- getPostBuild
evRed <- button "Red"
evGreen <- button "Green"
el "br" blank
let evImg = leftmost [greenPixels <$ evPostBuild, redPixels <$ evRed, greenPixels <$ evGreen]
let attr = "width" =: "256" <> "height" =: "256"
canvas <- pixelCanvasAttr attr evImg
return ()
{-
mouseEvent <- wrapDomEvent
(_element_raw canvas)
(onEventName Mousemove)
mouseOffsetXY
let mouseXYToString (x,y) = "X = " ++ show x ++ ";Y = " ++ show y
t <- holdDyn "" (T.pack.mouseXYToString <$> mouseEvent)
el "div" $ dynText t
-}
return ()
-- Pure user user functions ------------------------------------------------------------------------------
-- Function applied to every index pair | 803 | main = mainWidget $ do
el "h2" $ text "A first canvas example"
evPostBuild <- getPostBuild
evRed <- button "Red"
evGreen <- button "Green"
el "br" blank
let evImg = leftmost [greenPixels <$ evPostBuild, redPixels <$ evRed, greenPixels <$ evGreen]
let attr = "width" =: "256" <> "height" =: "256"
canvas <- pixelCanvasAttr attr evImg
return ()
{-
mouseEvent <- wrapDomEvent
(_element_raw canvas)
(onEventName Mousemove)
mouseOffsetXY
let mouseXYToString (x,y) = "X = " ++ show x ++ ";Y = " ++ show y
t <- holdDyn "" (T.pack.mouseXYToString <$> mouseEvent)
el "div" $ dynText t
-}
return ()
-- Pure user user functions ------------------------------------------------------------------------------
-- Function applied to every index pair | 789 | false | true | 0 | 13 | 168 | 153 | 70 | 83 | null | null |
hesiod/OpenGL | src/Graphics/Rendering/OpenGL/GL/PixelRectangles/Convolution.hs | bsd-3-clause | convolutionFilterBias :: ConvolutionTarget -> StateVar (Color4 GLfloat)
convolutionFilterBias = convolutionC4f ConvolutionFilterBias | 132 | convolutionFilterBias :: ConvolutionTarget -> StateVar (Color4 GLfloat)
convolutionFilterBias = convolutionC4f ConvolutionFilterBias | 132 | convolutionFilterBias = convolutionC4f ConvolutionFilterBias | 60 | false | true | 0 | 8 | 10 | 27 | 13 | 14 | null | null |
three/codeworld | codeworld-base/src/Internal/Prelude.hs | apache-2.0 | -- | Gives the longest prefix of a list for which a condition is true.
--
-- For example, `while([2,4,5,6], even) = [2,4]`.
while :: ([a], a -> Truth) -> [a]
while (xs, p) = P.takeWhile p xs | 190 | while :: ([a], a -> Truth) -> [a]
while (xs, p) = P.takeWhile p xs | 66 | while (xs, p) = P.takeWhile p xs | 32 | true | true | 0 | 7 | 37 | 50 | 29 | 21 | null | null |
briansteffens/basm | src/Elf.hs | gpl-2.0 | sectionSymbolIndex :: [Symbol] -> String -> Int
sectionSymbolIndex symbols sectionName = do
let test sym = case relation sym of
RelatedSection s -> s == sectionName
_ -> False
case indexOf test symbols of
Nothing -> error("Section symbol " ++ sectionName ++ " not found")
Just i -> i
-- Get the index of a symbol by its name | 403 | sectionSymbolIndex :: [Symbol] -> String -> Int
sectionSymbolIndex symbols sectionName = do
let test sym = case relation sym of
RelatedSection s -> s == sectionName
_ -> False
case indexOf test symbols of
Nothing -> error("Section symbol " ++ sectionName ++ " not found")
Just i -> i
-- Get the index of a symbol by its name | 403 | sectionSymbolIndex symbols sectionName = do
let test sym = case relation sym of
RelatedSection s -> s == sectionName
_ -> False
case indexOf test symbols of
Nothing -> error("Section symbol " ++ sectionName ++ " not found")
Just i -> i
-- Get the index of a symbol by its name | 355 | false | true | 0 | 13 | 137 | 107 | 51 | 56 | null | null |
j-mueller/hldb | webapp/VirtualHom/Svg.hs | bsd-3-clause | -- | The @onmouseout@ attribute.
onmouseout :: AttrTag
onmouseout = makeAttribute "onmouseout" | 94 | onmouseout :: AttrTag
onmouseout = makeAttribute "onmouseout" | 61 | onmouseout = makeAttribute "onmouseout" | 39 | true | true | 0 | 5 | 11 | 15 | 8 | 7 | null | null |
HJvT/com | System/Win32/Com/Automation.hs | bsd-3-clause | sizeofVARENUM :: Word32
sizeofVARENUM = sizeofInt16 | 51 | sizeofVARENUM :: Word32
sizeofVARENUM = sizeofInt16 | 51 | sizeofVARENUM = sizeofInt16 | 27 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
brendanhay/gogol | gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Locations/WorkflowTemplates/TestIAMPermissions.hs | mpl-2.0 | -- | Creates a value of 'ProjectsLocationsWorkflowTemplatesTestIAMPermissions' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'plwttipXgafv'
--
-- * 'plwttipUploadProtocol'
--
-- * 'plwttipAccessToken'
--
-- * 'plwttipUploadType'
--
-- * 'plwttipPayload'
--
-- * 'plwttipResource'
--
-- * 'plwttipCallback'
projectsLocationsWorkflowTemplatesTestIAMPermissions
:: TestIAMPermissionsRequest -- ^ 'plwttipPayload'
-> Text -- ^ 'plwttipResource'
-> ProjectsLocationsWorkflowTemplatesTestIAMPermissions
projectsLocationsWorkflowTemplatesTestIAMPermissions pPlwttipPayload_ pPlwttipResource_ =
ProjectsLocationsWorkflowTemplatesTestIAMPermissions'
{ _plwttipXgafv = Nothing
, _plwttipUploadProtocol = Nothing
, _plwttipAccessToken = Nothing
, _plwttipUploadType = Nothing
, _plwttipPayload = pPlwttipPayload_
, _plwttipResource = pPlwttipResource_
, _plwttipCallback = Nothing
} | 1,004 | projectsLocationsWorkflowTemplatesTestIAMPermissions
:: TestIAMPermissionsRequest -- ^ 'plwttipPayload'
-> Text -- ^ 'plwttipResource'
-> ProjectsLocationsWorkflowTemplatesTestIAMPermissions
projectsLocationsWorkflowTemplatesTestIAMPermissions pPlwttipPayload_ pPlwttipResource_ =
ProjectsLocationsWorkflowTemplatesTestIAMPermissions'
{ _plwttipXgafv = Nothing
, _plwttipUploadProtocol = Nothing
, _plwttipAccessToken = Nothing
, _plwttipUploadType = Nothing
, _plwttipPayload = pPlwttipPayload_
, _plwttipResource = pPlwttipResource_
, _plwttipCallback = Nothing
} | 611 | projectsLocationsWorkflowTemplatesTestIAMPermissions pPlwttipPayload_ pPlwttipResource_ =
ProjectsLocationsWorkflowTemplatesTestIAMPermissions'
{ _plwttipXgafv = Nothing
, _plwttipUploadProtocol = Nothing
, _plwttipAccessToken = Nothing
, _plwttipUploadType = Nothing
, _plwttipPayload = pPlwttipPayload_
, _plwttipResource = pPlwttipResource_
, _plwttipCallback = Nothing
} | 408 | true | true | 0 | 8 | 150 | 96 | 62 | 34 | null | null |
junnf/Functional-Programming | codes/control.hs | unlicense | third (_, _, z) = z | 20 | third (_, _, z) = z | 20 | third (_, _, z) = z | 20 | false | false | 0 | 5 | 6 | 19 | 10 | 9 | null | null |
atsukotakahashi/wi | src/library/Yi/Window.hs | gpl-2.0 | dummyWindow :: BufferRef -> Window
dummyWindow b = Window False b [] 0 0 emptyRegion def 0 Nothing | 98 | dummyWindow :: BufferRef -> Window
dummyWindow b = Window False b [] 0 0 emptyRegion def 0 Nothing | 98 | dummyWindow b = Window False b [] 0 0 emptyRegion def 0 Nothing | 63 | false | true | 0 | 7 | 17 | 45 | 20 | 25 | null | null |
omefire/megaparsec | Text/Megaparsec/Lexer.hs | bsd-2-clause | integer :: Stream s m Char => ParsecT s u m Integer
integer = decimal <?> "integer" | 83 | integer :: Stream s m Char => ParsecT s u m Integer
integer = decimal <?> "integer" | 83 | integer = decimal <?> "integer" | 31 | false | true | 0 | 6 | 16 | 35 | 17 | 18 | null | null |
bartavelle/hslogstash | Data/Conduit/Misc.hs | bsd-3-clause | -- | Converts a stream of [a] into a stream of (Flush a). This is done by
-- sending a Flush when the input is the empty list, or that we reached
-- a certain threshold
simpleConcatFlush :: (Monad m) => Int -> Conduit [a] m (Flush a)
simpleConcatFlush mx = concatFlush 0 sendf
where
sendf curx ev = do
yield (Chunk ev)
if curx >= (mx - 1)
then yield Flush >> return 0
else return (curx+1)
-- | This is a more general version of 'simpleConcatFlush', where you
-- provide your own fold. | 553 | simpleConcatFlush :: (Monad m) => Int -> Conduit [a] m (Flush a)
simpleConcatFlush mx = concatFlush 0 sendf
where
sendf curx ev = do
yield (Chunk ev)
if curx >= (mx - 1)
then yield Flush >> return 0
else return (curx+1)
-- | This is a more general version of 'simpleConcatFlush', where you
-- provide your own fold. | 384 | simpleConcatFlush mx = concatFlush 0 sendf
where
sendf curx ev = do
yield (Chunk ev)
if curx >= (mx - 1)
then yield Flush >> return 0
else return (curx+1)
-- | This is a more general version of 'simpleConcatFlush', where you
-- provide your own fold. | 319 | true | true | 0 | 12 | 163 | 119 | 61 | 58 | null | null |
mmarx/jebediah | src/Jebediah/JACK.hs | gpl-3.0 | process :: JM.Port Input -> JM.Port Output -> TQueue EventList -> TQueue EventList -> NFrames -> ExceptionalT Errno IO ()
process inp out iq oq nf = do
mEvents <- lift $ atomically $ tryReadTQueue oq
writeEventsToPort out nf $ fromMaybe EL.empty mEvents
iEvents <- readEventsFromPort inp nf
lift $ atomically $ writeTQueue iq iEvents | 341 | process :: JM.Port Input -> JM.Port Output -> TQueue EventList -> TQueue EventList -> NFrames -> ExceptionalT Errno IO ()
process inp out iq oq nf = do
mEvents <- lift $ atomically $ tryReadTQueue oq
writeEventsToPort out nf $ fromMaybe EL.empty mEvents
iEvents <- readEventsFromPort inp nf
lift $ atomically $ writeTQueue iq iEvents | 341 | process inp out iq oq nf = do
mEvents <- lift $ atomically $ tryReadTQueue oq
writeEventsToPort out nf $ fromMaybe EL.empty mEvents
iEvents <- readEventsFromPort inp nf
lift $ atomically $ writeTQueue iq iEvents | 219 | false | true | 0 | 11 | 62 | 132 | 59 | 73 | null | null |
jsavatgy/hatupist | hatupist-104.hs | gpl-2.0 | readInt :: String -> IO Int
readInt s = readIO s | 48 | readInt :: String -> IO Int
readInt s = readIO s | 48 | readInt s = readIO s | 20 | false | true | 0 | 6 | 10 | 24 | 11 | 13 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.