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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
green-haskell/ghc
|
compiler/basicTypes/OccName.hs
|
bsd-3-clause
|
mkMaxTagOcc = mk_simple_deriv varName "$maxtag_"
| 57
|
mkMaxTagOcc = mk_simple_deriv varName "$maxtag_"
| 57
|
mkMaxTagOcc = mk_simple_deriv varName "$maxtag_"
| 57
| false
| false
| 0
| 5
| 13
| 11
| 5
| 6
| null | null |
robrix/surface
|
src/Parser.hs
|
bsd-3-clause
|
var :: (Monad m, TokenParsing m) => m Expr
var = Expr.var <$> name
<?> "variable"
| 96
|
var :: (Monad m, TokenParsing m) => m Expr
var = Expr.var <$> name
<?> "variable"
| 96
|
var = Expr.var <$> name
<?> "variable"
| 53
| false
| true
| 0
| 7
| 30
| 45
| 21
| 24
| null | null |
oldmanmike/ghc
|
compiler/main/DynFlags.hs
|
bsd-3-clause
|
-- | Hide a 'FlagSpec' from being displayed in @--show-options@.
--
-- This is for example useful for flags that are obsolete, but should not
-- (yet) be deprecated for compatibility reasons.
hideFlag :: (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag (dep, fs) = (dep, fs { flagSpecGhcMode = HiddenFlag })
| 322
|
hideFlag :: (Deprecation, FlagSpec a) -> (Deprecation, FlagSpec a)
hideFlag (dep, fs) = (dep, fs { flagSpecGhcMode = HiddenFlag })
| 130
|
hideFlag (dep, fs) = (dep, fs { flagSpecGhcMode = HiddenFlag })
| 63
| true
| true
| 1
| 8
| 51
| 64
| 36
| 28
| null | null |
KommuSoft/dep-software
|
Dep.hs
|
gpl-3.0
|
commands :: [Command]
commands = [
Cmnd (Desc "expand" "Takes as input a combinatorial table and expands the combinatorial table (don't care expansion)." IOCT IOCT) (toProg (expand :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "reduce" "Takes as input a combinatorial table and reduces it by placing don't cares at the input side." IOCT IOCT) (toProg (reduce :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "lookup" "Takes as input a combinatorial table and as query a bit sequence (optionally with don't cares)." IOCT IOBS) (toProgQ (btlookupThJust :: BitThSeq -> CombTable -> BitThSeq)) Nothing,
Cmnd (Desc "showKarnaugh" "Takes as input a combinatorial table and prints the corresponding Karnaugh card(s)." IOCT IOKC) (toProg KC) (Just runShowKarnaugh),
Cmnd (Desc "synthetize" "Generate a sum-of-products for the given combinatorial table." IOCT IOKC) (toProg synthetize) (Just runSynthetize),
Cmnd (Desc "minimize-fsm" "Minimize the given finite state machine to a finite state machine with a minimum amount of states. This commands works on both Moore and Mealy machines." IOMST IOMST) (toProg (concatReduceFSM :: FSM String BitThSeq BitThSeq -> FSM String BitThSeq BitThSeq)) (Just runMinimizeFsm),
Cmnd (Desc "generate-gray" "Generate for the given number, the sequence of Gray codes with the given number of bits." IOInt IOBSs) (toProg graySequence) Nothing,
Cmnd (Desc "compile-cisc" "Compile the CISC assembler-language input to CISC machine code." IOCisc IOBin) (toProgB (id :: CiscProgram -> CiscProgram)) Nothing
]
| 1,598
|
commands :: [Command]
commands = [
Cmnd (Desc "expand" "Takes as input a combinatorial table and expands the combinatorial table (don't care expansion)." IOCT IOCT) (toProg (expand :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "reduce" "Takes as input a combinatorial table and reduces it by placing don't cares at the input side." IOCT IOCT) (toProg (reduce :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "lookup" "Takes as input a combinatorial table and as query a bit sequence (optionally with don't cares)." IOCT IOBS) (toProgQ (btlookupThJust :: BitThSeq -> CombTable -> BitThSeq)) Nothing,
Cmnd (Desc "showKarnaugh" "Takes as input a combinatorial table and prints the corresponding Karnaugh card(s)." IOCT IOKC) (toProg KC) (Just runShowKarnaugh),
Cmnd (Desc "synthetize" "Generate a sum-of-products for the given combinatorial table." IOCT IOKC) (toProg synthetize) (Just runSynthetize),
Cmnd (Desc "minimize-fsm" "Minimize the given finite state machine to a finite state machine with a minimum amount of states. This commands works on both Moore and Mealy machines." IOMST IOMST) (toProg (concatReduceFSM :: FSM String BitThSeq BitThSeq -> FSM String BitThSeq BitThSeq)) (Just runMinimizeFsm),
Cmnd (Desc "generate-gray" "Generate for the given number, the sequence of Gray codes with the given number of bits." IOInt IOBSs) (toProg graySequence) Nothing,
Cmnd (Desc "compile-cisc" "Compile the CISC assembler-language input to CISC machine code." IOCisc IOBin) (toProgB (id :: CiscProgram -> CiscProgram)) Nothing
]
| 1,598
|
commands = [
Cmnd (Desc "expand" "Takes as input a combinatorial table and expands the combinatorial table (don't care expansion)." IOCT IOCT) (toProg (expand :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "reduce" "Takes as input a combinatorial table and reduces it by placing don't cares at the input side." IOCT IOCT) (toProg (reduce :: CombTable -> CombTable)) Nothing,
Cmnd (Desc "lookup" "Takes as input a combinatorial table and as query a bit sequence (optionally with don't cares)." IOCT IOBS) (toProgQ (btlookupThJust :: BitThSeq -> CombTable -> BitThSeq)) Nothing,
Cmnd (Desc "showKarnaugh" "Takes as input a combinatorial table and prints the corresponding Karnaugh card(s)." IOCT IOKC) (toProg KC) (Just runShowKarnaugh),
Cmnd (Desc "synthetize" "Generate a sum-of-products for the given combinatorial table." IOCT IOKC) (toProg synthetize) (Just runSynthetize),
Cmnd (Desc "minimize-fsm" "Minimize the given finite state machine to a finite state machine with a minimum amount of states. This commands works on both Moore and Mealy machines." IOMST IOMST) (toProg (concatReduceFSM :: FSM String BitThSeq BitThSeq -> FSM String BitThSeq BitThSeq)) (Just runMinimizeFsm),
Cmnd (Desc "generate-gray" "Generate for the given number, the sequence of Gray codes with the given number of bits." IOInt IOBSs) (toProg graySequence) Nothing,
Cmnd (Desc "compile-cisc" "Compile the CISC assembler-language input to CISC machine code." IOCisc IOBin) (toProgB (id :: CiscProgram -> CiscProgram)) Nothing
]
| 1,576
| false
| true
| 0
| 11
| 287
| 324
| 167
| 157
| null | null |
UBMLtonGroup/timberc
|
src/Type2.hs
|
bsd-3-clause
|
t2Exp env (ETempl x tx te c) = do (s,t,c) <- t2Cmd (setSelf x tx (addTEnv te env)) c
return (s, R (tClass t), ETempl x tx te c)
| 167
|
t2Exp env (ETempl x tx te c) = do (s,t,c) <- t2Cmd (setSelf x tx (addTEnv te env)) c
return (s, R (tClass t), ETempl x tx te c)
| 167
|
t2Exp env (ETempl x tx te c) = do (s,t,c) <- t2Cmd (setSelf x tx (addTEnv te env)) c
return (s, R (tClass t), ETempl x tx te c)
| 167
| false
| false
| 0
| 12
| 68
| 95
| 47
| 48
| null | null |
ulricha/dsh
|
src/Database/DSH/CL/Opt/GroupJoin.hs
|
bsd-3-clause
|
mergeGroupJoinSpineQualsT :: Expr -> TransformC CL (NL Qual, Expr)
mergeGroupJoinSpineQualsT h = readerT $ \cl -> case cl of
QualsCL (BindQ x (NestJoinP ty p xs ys) :* _) ->
do
let joinElemTy = tupleElemTypes $ elemT ty
(Just (gjName, agg), qsCl) <- statefulT Nothing
$ childT QualsTail
$ searchAggQualsR (take 1 joinElemTy) M.empty x
let (gjOp, gjElemTy) = mkGroupJoin agg p xs ys
scopeNames <- S.insert x <$> inScopeNamesT
qs' <- constT $ projectM qsCl
let (qs'', h') = substCompE scopeNames x (Var (TupleT gjElemTy) gjName) qs' h
pure (BindQ gjName gjOp :* qs'', h')
<+
do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x (NestJoinP ty p xs ys) :* qs', h')
QualsCL (BindQ x xs :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x xs :* qs', h')
QualsCL (GuardQ p :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (GuardQ p :* qs', h')
_ -> fail "no match"
-- | Introduce a new groupaggr operator by merging one particular aggregate from
-- the comprehension qualifiers into a group operator.
| 1,414
|
mergeGroupJoinSpineQualsT :: Expr -> TransformC CL (NL Qual, Expr)
mergeGroupJoinSpineQualsT h = readerT $ \cl -> case cl of
QualsCL (BindQ x (NestJoinP ty p xs ys) :* _) ->
do
let joinElemTy = tupleElemTypes $ elemT ty
(Just (gjName, agg), qsCl) <- statefulT Nothing
$ childT QualsTail
$ searchAggQualsR (take 1 joinElemTy) M.empty x
let (gjOp, gjElemTy) = mkGroupJoin agg p xs ys
scopeNames <- S.insert x <$> inScopeNamesT
qs' <- constT $ projectM qsCl
let (qs'', h') = substCompE scopeNames x (Var (TupleT gjElemTy) gjName) qs' h
pure (BindQ gjName gjOp :* qs'', h')
<+
do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x (NestJoinP ty p xs ys) :* qs', h')
QualsCL (BindQ x xs :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x xs :* qs', h')
QualsCL (GuardQ p :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (GuardQ p :* qs', h')
_ -> fail "no match"
-- | Introduce a new groupaggr operator by merging one particular aggregate from
-- the comprehension qualifiers into a group operator.
| 1,414
|
mergeGroupJoinSpineQualsT h = readerT $ \cl -> case cl of
QualsCL (BindQ x (NestJoinP ty p xs ys) :* _) ->
do
let joinElemTy = tupleElemTypes $ elemT ty
(Just (gjName, agg), qsCl) <- statefulT Nothing
$ childT QualsTail
$ searchAggQualsR (take 1 joinElemTy) M.empty x
let (gjOp, gjElemTy) = mkGroupJoin agg p xs ys
scopeNames <- S.insert x <$> inScopeNamesT
qs' <- constT $ projectM qsCl
let (qs'', h') = substCompE scopeNames x (Var (TupleT gjElemTy) gjName) qs' h
pure (BindQ gjName gjOp :* qs'', h')
<+
do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x (NestJoinP ty p xs ys) :* qs', h')
QualsCL (BindQ x xs :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (BindQ x xs :* qs', h')
QualsCL (GuardQ p :* _) -> do
(qs', h') <- childT QualsTail (mergeGroupJoinSpineQualsT h)
pure (GuardQ p :* qs', h')
_ -> fail "no match"
-- | Introduce a new groupaggr operator by merging one particular aggregate from
-- the comprehension qualifiers into a group operator.
| 1,347
| false
| true
| 20
| 10
| 518
| 435
| 225
| 210
| null | null |
verement/etamoo
|
src/MOO/Task.hs
|
bsd-3-clause
|
setBuiltinProperty (oid, obj) "r" bit = do
checkPermission (objectOwner obj)
modifyObject' oid $ \obj -> obj { objectPermR = truthOf bit }
| 142
|
setBuiltinProperty (oid, obj) "r" bit = do
checkPermission (objectOwner obj)
modifyObject' oid $ \obj -> obj { objectPermR = truthOf bit }
| 142
|
setBuiltinProperty (oid, obj) "r" bit = do
checkPermission (objectOwner obj)
modifyObject' oid $ \obj -> obj { objectPermR = truthOf bit }
| 142
| false
| false
| 0
| 11
| 25
| 57
| 28
| 29
| null | null |
dysinger/amazonka
|
amazonka-ec2/gen/Network/AWS/EC2/Types.hs
|
mpl-2.0
|
-- | 'RequestSpotLaunchSpecification' constructor.
--
-- The fields accessible through corresponding lenses are:
--
-- * 'rslsAddressingType' @::@ 'Maybe' 'Text'
--
-- * 'rslsBlockDeviceMappings' @::@ ['BlockDeviceMapping']
--
-- * 'rslsEbsOptimized' @::@ 'Maybe' 'Bool'
--
-- * 'rslsIamInstanceProfile' @::@ 'Maybe' 'IamInstanceProfileSpecification'
--
-- * 'rslsImageId' @::@ 'Maybe' 'Text'
--
-- * 'rslsInstanceType' @::@ 'Maybe' 'InstanceType'
--
-- * 'rslsKernelId' @::@ 'Maybe' 'Text'
--
-- * 'rslsKeyName' @::@ 'Maybe' 'Text'
--
-- * 'rslsMonitoring' @::@ 'Maybe' 'RunInstancesMonitoringEnabled'
--
-- * 'rslsNetworkInterfaces' @::@ ['InstanceNetworkInterfaceSpecification']
--
-- * 'rslsPlacement' @::@ 'Maybe' 'SpotPlacement'
--
-- * 'rslsRamdiskId' @::@ 'Maybe' 'Text'
--
-- * 'rslsSecurityGroupIds' @::@ ['Text']
--
-- * 'rslsSecurityGroups' @::@ ['Text']
--
-- * 'rslsSubnetId' @::@ 'Maybe' 'Text'
--
-- * 'rslsUserData' @::@ 'Maybe' 'Text'
--
requestSpotLaunchSpecification :: RequestSpotLaunchSpecification
requestSpotLaunchSpecification = RequestSpotLaunchSpecification
{ _rslsImageId = Nothing
, _rslsKeyName = Nothing
, _rslsSecurityGroups = mempty
, _rslsUserData = Nothing
, _rslsAddressingType = Nothing
, _rslsInstanceType = Nothing
, _rslsPlacement = Nothing
, _rslsKernelId = Nothing
, _rslsRamdiskId = Nothing
, _rslsBlockDeviceMappings = mempty
, _rslsSubnetId = Nothing
, _rslsNetworkInterfaces = mempty
, _rslsIamInstanceProfile = Nothing
, _rslsEbsOptimized = Nothing
, _rslsMonitoring = Nothing
, _rslsSecurityGroupIds = mempty
}
| 1,742
|
requestSpotLaunchSpecification :: RequestSpotLaunchSpecification
requestSpotLaunchSpecification = RequestSpotLaunchSpecification
{ _rslsImageId = Nothing
, _rslsKeyName = Nothing
, _rslsSecurityGroups = mempty
, _rslsUserData = Nothing
, _rslsAddressingType = Nothing
, _rslsInstanceType = Nothing
, _rslsPlacement = Nothing
, _rslsKernelId = Nothing
, _rslsRamdiskId = Nothing
, _rslsBlockDeviceMappings = mempty
, _rslsSubnetId = Nothing
, _rslsNetworkInterfaces = mempty
, _rslsIamInstanceProfile = Nothing
, _rslsEbsOptimized = Nothing
, _rslsMonitoring = Nothing
, _rslsSecurityGroupIds = mempty
}
| 786
|
requestSpotLaunchSpecification = RequestSpotLaunchSpecification
{ _rslsImageId = Nothing
, _rslsKeyName = Nothing
, _rslsSecurityGroups = mempty
, _rslsUserData = Nothing
, _rslsAddressingType = Nothing
, _rslsInstanceType = Nothing
, _rslsPlacement = Nothing
, _rslsKernelId = Nothing
, _rslsRamdiskId = Nothing
, _rslsBlockDeviceMappings = mempty
, _rslsSubnetId = Nothing
, _rslsNetworkInterfaces = mempty
, _rslsIamInstanceProfile = Nothing
, _rslsEbsOptimized = Nothing
, _rslsMonitoring = Nothing
, _rslsSecurityGroupIds = mempty
}
| 721
| true
| true
| 0
| 7
| 376
| 149
| 108
| 41
| null | null |
23Skidoo/erp
|
ERP.hs
|
gpl-3.0
|
checkBindings :: (Monad m) => [Binding] -> m Bool
checkBindings [] = return True
| 80
|
checkBindings :: (Monad m) => [Binding] -> m Bool
checkBindings [] = return True
| 80
|
checkBindings [] = return True
| 30
| false
| true
| 0
| 7
| 13
| 38
| 19
| 19
| null | null |
jinjor/poorscript
|
src/Generator.hs
|
mit
|
separateTopStatements :: [A.TopStatement] -> ([A.ModuleName], [A.Statement])
separateTopStatements topStatements =
separateMap (\topStatement -> case topStatement of
A.Import name -> Left name
A.Statement s -> Right s
) topStatements
| 245
|
separateTopStatements :: [A.TopStatement] -> ([A.ModuleName], [A.Statement])
separateTopStatements topStatements =
separateMap (\topStatement -> case topStatement of
A.Import name -> Left name
A.Statement s -> Right s
) topStatements
| 245
|
separateTopStatements topStatements =
separateMap (\topStatement -> case topStatement of
A.Import name -> Left name
A.Statement s -> Right s
) topStatements
| 168
| false
| true
| 0
| 12
| 38
| 85
| 43
| 42
| null | null |
4ZP6Capstone2015/ampersand
|
src/Database/Design/Ampersand/FSpec/Switchboard.hs
|
gpl-3.0
|
sbDiagram :: FSpec -> SwitchBdDiagram
sbDiagram fSpec
= SBdgrm
{ sbName = name fSpec
, sbdotGraph
= DotGraph { strictGraph = False
, directedGraph = True
, graphID = Just (Str (fromString "Switchboard"))
, graphStatements
= DotStmts { attrStmts = [GraphAttrs [Splines SplineEdges, RankDir FromLeft]]
, subGraphs = []
, nodeStmts = inEvNodes++conjNodes++ecaNodes++outEvNods
, edgeStmts = edgesEvCj++edgesCjEc++edgesEcEv
}
}
}
where
fsb = fSwitchboard fSpec
--DESCR -> The relations from which changes can come
inEvNodes = [ DotNode { nodeID = nameINode eventsIn ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsIn
]
--DESCR -> All conjuncts
conjNodes = [ DotNode { nodeID = nameCNode (fsbConjs fsb) (rul,c)
, nodeAttributes = [Style [SItem Filled []], FillColor [WC(X11Color (colorRule rul)) Nothing], (Label . StrLabel . fromString . name) rul]
}
| (rul,c)<-fsbConjs fsb]
--DESCR -> All ECA rules
ecaNodes = [ DotNode { nodeID = nameENode (fsbECAs fsb) eca
, nodeAttributes = if isBlk (ecaAction eca)
then [Style [SItem Filled []], FillColor [WC(X11Color Red)Nothing], (Label . StrLabel . fromString) ("ERR #"++show (ecaNum eca))]
else [(Label . StrLabel . fromString. showADL) eca]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))]
--DESCR -> The relations to which changes are made
outEvNods = [ DotNode { nodeID = nameONode eventsOut ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsOut
]
--DESCR -> Each edge represents an insert between a relation on the left and a term on the right to which the relation contributes to an insert.
edgesEvCj = [ DotEdge { fromNode = nameINode eventsIn ev
, toNode = nameCNode (fsbConjs fsb) (rul,c)
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, ev<-eventsIn, eDcl ev `elem` relsUsedIn c]
edgesCjEc = [ DotEdge { fromNode = nameCNode (fsbConjs fsb) (rul,c)
, toNode = nameENode (fsbECAs fsb) eca
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, eca<-fsbECAs fsb, not (isBlk (ecaAction eca)), rul `elem` concat [r | (_,r)<-paMotiv (ecaAction eca)] ]
edgesEcEv = nub
[ DotEdge { fromNode = nameENode (fsbECAs fsb) eca
, toNode = nameONode eventsOut (On tOp rel)
, edgeAttributes = [Dir Forward]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))
, On tOp rel<-eventsFrom (ecaAction eca)
]
nameINode = nmLkp fSpec "in_"
nameCNode = nmLkp fSpec "cj_"
nameENode = nmLkp fSpec "eca_"
nameONode = nmLkp fSpec "out_"
eventsIn = nub [ecaTriggr eca | eca<-fsbECAs fsb, not (isBlk (ecaAction eca)) ]
eventsOut = nub [evt | eca<-fsbECAs fsb, let act=ecaAction eca, not (isBlk act), evt<-eventsFrom act]
| 3,822
|
sbDiagram :: FSpec -> SwitchBdDiagram
sbDiagram fSpec
= SBdgrm
{ sbName = name fSpec
, sbdotGraph
= DotGraph { strictGraph = False
, directedGraph = True
, graphID = Just (Str (fromString "Switchboard"))
, graphStatements
= DotStmts { attrStmts = [GraphAttrs [Splines SplineEdges, RankDir FromLeft]]
, subGraphs = []
, nodeStmts = inEvNodes++conjNodes++ecaNodes++outEvNods
, edgeStmts = edgesEvCj++edgesCjEc++edgesEcEv
}
}
}
where
fsb = fSwitchboard fSpec
--DESCR -> The relations from which changes can come
inEvNodes = [ DotNode { nodeID = nameINode eventsIn ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsIn
]
--DESCR -> All conjuncts
conjNodes = [ DotNode { nodeID = nameCNode (fsbConjs fsb) (rul,c)
, nodeAttributes = [Style [SItem Filled []], FillColor [WC(X11Color (colorRule rul)) Nothing], (Label . StrLabel . fromString . name) rul]
}
| (rul,c)<-fsbConjs fsb]
--DESCR -> All ECA rules
ecaNodes = [ DotNode { nodeID = nameENode (fsbECAs fsb) eca
, nodeAttributes = if isBlk (ecaAction eca)
then [Style [SItem Filled []], FillColor [WC(X11Color Red)Nothing], (Label . StrLabel . fromString) ("ERR #"++show (ecaNum eca))]
else [(Label . StrLabel . fromString. showADL) eca]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))]
--DESCR -> The relations to which changes are made
outEvNods = [ DotNode { nodeID = nameONode eventsOut ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsOut
]
--DESCR -> Each edge represents an insert between a relation on the left and a term on the right to which the relation contributes to an insert.
edgesEvCj = [ DotEdge { fromNode = nameINode eventsIn ev
, toNode = nameCNode (fsbConjs fsb) (rul,c)
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, ev<-eventsIn, eDcl ev `elem` relsUsedIn c]
edgesCjEc = [ DotEdge { fromNode = nameCNode (fsbConjs fsb) (rul,c)
, toNode = nameENode (fsbECAs fsb) eca
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, eca<-fsbECAs fsb, not (isBlk (ecaAction eca)), rul `elem` concat [r | (_,r)<-paMotiv (ecaAction eca)] ]
edgesEcEv = nub
[ DotEdge { fromNode = nameENode (fsbECAs fsb) eca
, toNode = nameONode eventsOut (On tOp rel)
, edgeAttributes = [Dir Forward]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))
, On tOp rel<-eventsFrom (ecaAction eca)
]
nameINode = nmLkp fSpec "in_"
nameCNode = nmLkp fSpec "cj_"
nameENode = nmLkp fSpec "eca_"
nameONode = nmLkp fSpec "out_"
eventsIn = nub [ecaTriggr eca | eca<-fsbECAs fsb, not (isBlk (ecaAction eca)) ]
eventsOut = nub [evt | eca<-fsbECAs fsb, let act=ecaAction eca, not (isBlk act), evt<-eventsFrom act]
| 3,822
|
sbDiagram fSpec
= SBdgrm
{ sbName = name fSpec
, sbdotGraph
= DotGraph { strictGraph = False
, directedGraph = True
, graphID = Just (Str (fromString "Switchboard"))
, graphStatements
= DotStmts { attrStmts = [GraphAttrs [Splines SplineEdges, RankDir FromLeft]]
, subGraphs = []
, nodeStmts = inEvNodes++conjNodes++ecaNodes++outEvNods
, edgeStmts = edgesEvCj++edgesCjEc++edgesEcEv
}
}
}
where
fsb = fSwitchboard fSpec
--DESCR -> The relations from which changes can come
inEvNodes = [ DotNode { nodeID = nameINode eventsIn ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsIn
]
--DESCR -> All conjuncts
conjNodes = [ DotNode { nodeID = nameCNode (fsbConjs fsb) (rul,c)
, nodeAttributes = [Style [SItem Filled []], FillColor [WC(X11Color (colorRule rul)) Nothing], (Label . StrLabel . fromString . name) rul]
}
| (rul,c)<-fsbConjs fsb]
--DESCR -> All ECA rules
ecaNodes = [ DotNode { nodeID = nameENode (fsbECAs fsb) eca
, nodeAttributes = if isBlk (ecaAction eca)
then [Style [SItem Filled []], FillColor [WC(X11Color Red)Nothing], (Label . StrLabel . fromString) ("ERR #"++show (ecaNum eca))]
else [(Label . StrLabel . fromString. showADL) eca]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))]
--DESCR -> The relations to which changes are made
outEvNods = [ DotNode { nodeID = nameONode eventsOut ev
, nodeAttributes = [Label (StrLabel (fromString (show (eSrt ev)++" "++showADL (eDcl ev))))]
}
| ev<-eventsOut
]
--DESCR -> Each edge represents an insert between a relation on the left and a term on the right to which the relation contributes to an insert.
edgesEvCj = [ DotEdge { fromNode = nameINode eventsIn ev
, toNode = nameCNode (fsbConjs fsb) (rul,c)
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, ev<-eventsIn, eDcl ev `elem` relsUsedIn c]
edgesCjEc = [ DotEdge { fromNode = nameCNode (fsbConjs fsb) (rul,c)
, toNode = nameENode (fsbECAs fsb) eca
, edgeAttributes = [Dir Forward]
}
| (rul,c)<-fsbConjs fsb, eca<-fsbECAs fsb, not (isBlk (ecaAction eca)), rul `elem` concat [r | (_,r)<-paMotiv (ecaAction eca)] ]
edgesEcEv = nub
[ DotEdge { fromNode = nameENode (fsbECAs fsb) eca
, toNode = nameONode eventsOut (On tOp rel)
, edgeAttributes = [Dir Forward]
}
| eca<-fsbECAs fsb, not (isBlk (ecaAction eca))
, On tOp rel<-eventsFrom (ecaAction eca)
]
nameINode = nmLkp fSpec "in_"
nameCNode = nmLkp fSpec "cj_"
nameENode = nmLkp fSpec "eca_"
nameONode = nmLkp fSpec "out_"
eventsIn = nub [ecaTriggr eca | eca<-fsbECAs fsb, not (isBlk (ecaAction eca)) ]
eventsOut = nub [evt | eca<-fsbECAs fsb, let act=ecaAction eca, not (isBlk act), evt<-eventsFrom act]
| 3,784
| false
| true
| 0
| 21
| 1,567
| 1,111
| 586
| 525
| null | null |
forste/haReFork
|
tools/interp/HaskellCoreLite1.3.hs
|
bsd-3-clause
|
ifV test thenM elseM =
do { BV b <- test
; if b then thenM else elseM
}
| 83
|
ifV test thenM elseM =
do { BV b <- test
; if b then thenM else elseM
}
| 83
|
ifV test thenM elseM =
do { BV b <- test
; if b then thenM else elseM
}
| 83
| false
| false
| 0
| 8
| 30
| 37
| 19
| 18
| null | null |
iu-parfunc/haskell-hpx
|
mockups/StaticRep.hs
|
bsd-3-clause
|
lookupStaticPtr :: forall a. Typeable a
=> StaticRep -> IO (Either StaticLookupException (StaticPtr a))
lookupStaticPtr (StaticRep sk (STR tr)) =
if typeRep (Proxy :: Proxy a) == tr
then do mbSP <- unsafeLookupStaticPtr sk
return $ case mbSP of
Nothing -> Left NotInTable
Just sp -> Right sp
else return $ Left WrongType
| 395
|
lookupStaticPtr :: forall a. Typeable a
=> StaticRep -> IO (Either StaticLookupException (StaticPtr a))
lookupStaticPtr (StaticRep sk (STR tr)) =
if typeRep (Proxy :: Proxy a) == tr
then do mbSP <- unsafeLookupStaticPtr sk
return $ case mbSP of
Nothing -> Left NotInTable
Just sp -> Right sp
else return $ Left WrongType
| 395
|
lookupStaticPtr (StaticRep sk (STR tr)) =
if typeRep (Proxy :: Proxy a) == tr
then do mbSP <- unsafeLookupStaticPtr sk
return $ case mbSP of
Nothing -> Left NotInTable
Just sp -> Right sp
else return $ Left WrongType
| 275
| false
| true
| 0
| 12
| 127
| 134
| 64
| 70
| null | null |
michaelgwelch/bacnet
|
src/BACnet/Reader.hs
|
mit
|
accum :: (Int,Int) -> Word8 -> (Int,Int)
accum (accv,accl) w = (accv * 256 + fromIntegral w, accl+1)
| 100
|
accum :: (Int,Int) -> Word8 -> (Int,Int)
accum (accv,accl) w = (accv * 256 + fromIntegral w, accl+1)
| 100
|
accum (accv,accl) w = (accv * 256 + fromIntegral w, accl+1)
| 59
| false
| true
| 0
| 9
| 17
| 69
| 36
| 33
| null | null |
rueshyna/gogol
|
gogol-adexchange-buyer/gen/Network/Google/AdExchangeBuyer/Types/Product.hs
|
mpl-2.0
|
-- | When an proposal is in an accepted state, indicates whether the buyer
-- has signed off Once both sides have signed off on a deal, the proposal
-- can be finalized by the seller. (buyer-readonly)
pHasSellerSignedOff :: Lens' Proposal (Maybe Bool)
pHasSellerSignedOff
= lens _pHasSellerSignedOff
(\ s a -> s{_pHasSellerSignedOff = a})
| 346
|
pHasSellerSignedOff :: Lens' Proposal (Maybe Bool)
pHasSellerSignedOff
= lens _pHasSellerSignedOff
(\ s a -> s{_pHasSellerSignedOff = a})
| 145
|
pHasSellerSignedOff
= lens _pHasSellerSignedOff
(\ s a -> s{_pHasSellerSignedOff = a})
| 94
| true
| true
| 0
| 8
| 61
| 51
| 27
| 24
| null | null |
vincenthz/hs-foundation
|
basement/Basement/UArray/Base.hs
|
bsd-3-clause
|
onBackendPrim :: PrimMonad prim
=> (Block ty -> prim a)
-> (FinalPtr ty -> prim a)
-> UArray ty
-> prim a
onBackendPrim onBa _ (UArray _ _ (UArrayBA ba)) = onBa ba
| 228
|
onBackendPrim :: PrimMonad prim
=> (Block ty -> prim a)
-> (FinalPtr ty -> prim a)
-> UArray ty
-> prim a
onBackendPrim onBa _ (UArray _ _ (UArrayBA ba)) = onBa ba
| 228
|
onBackendPrim onBa _ (UArray _ _ (UArrayBA ba)) = onBa ba
| 66
| false
| true
| 0
| 10
| 97
| 88
| 41
| 47
| null | null |
vdweegen/UvA-Software_Testing
|
Lab5/Willem/Lecture5'.hs
|
gpl-3.0
|
constraints :: Sudoku -> [Constraint]
constraints s = sortBy length3rd
[(r,c, freeAtPos s (r,c) allConstrnt) | (r,c) <- openPositions s ]
| 141
|
constraints :: Sudoku -> [Constraint]
constraints s = sortBy length3rd
[(r,c, freeAtPos s (r,c) allConstrnt) | (r,c) <- openPositions s ]
| 141
|
constraints s = sortBy length3rd
[(r,c, freeAtPos s (r,c) allConstrnt) | (r,c) <- openPositions s ]
| 103
| false
| true
| 0
| 8
| 24
| 69
| 37
| 32
| null | null |
kazu-yamamoto/webserver
|
Network/Web/Server/Basic.hs
|
bsd-3-clause
|
tryRedirectFile :: BasicConfig -> URI -> FilePath -> String -> IO (Maybe Response)
tryRedirectFile cnf ruri file lang = do
let file' = file ++ lang
minfo <- info cnf file'
case minfo of
Nothing -> return Nothing
Just _ -> return $ Just (responseRedirect ruri)
----------------------------------------------------------------
| 350
|
tryRedirectFile :: BasicConfig -> URI -> FilePath -> String -> IO (Maybe Response)
tryRedirectFile cnf ruri file lang = do
let file' = file ++ lang
minfo <- info cnf file'
case minfo of
Nothing -> return Nothing
Just _ -> return $ Just (responseRedirect ruri)
----------------------------------------------------------------
| 350
|
tryRedirectFile cnf ruri file lang = do
let file' = file ++ lang
minfo <- info cnf file'
case minfo of
Nothing -> return Nothing
Just _ -> return $ Just (responseRedirect ruri)
----------------------------------------------------------------
| 267
| false
| true
| 0
| 14
| 72
| 114
| 52
| 62
| null | null |
ekmett/wxHaskell
|
samples/contrib/GLCanvas.hs
|
lgpl-2.1
|
main :: IO()
main = start gui
| 30
|
main :: IO()
main = start gui
| 29
|
main = start gui
| 16
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
UCSD-PL/nano-js
|
Language/Nano/Typecheck/Subst.hs
|
bsd-3-clause
|
unify θ t (TVar α _) = varAsn θ α t
| 54
|
unify θ t (TVar α _) = varAsn θ α t
| 54
|
unify θ t (TVar α _) = varAsn θ α t
| 54
| false
| false
| 0
| 6
| 29
| 31
| 13
| 18
| null | null |
lpeterse/crprover
|
SequenceCalculus.hs
|
gpl-2.0
|
lastStep (OrElim1 _ _)= "∨-Elim"
| 32
|
lastStep (OrElim1 _ _)= "∨-Elim"
| 32
|
lastStep (OrElim1 _ _)= "∨-Elim"
| 32
| false
| false
| 0
| 6
| 4
| 18
| 8
| 10
| null | null |
mbg/monadic-state-hierarchies
|
Language/MSH/CodeGen/Interop.hs
|
mit
|
-- | Configuration for the Haskell parser
parseMode :: Exts.ParseMode
parseMode = Exts.ParseMode "" Haskell2010 extensions True True Nothing True
| 145
|
parseMode :: Exts.ParseMode
parseMode = Exts.ParseMode "" Haskell2010 extensions True True Nothing True
| 103
|
parseMode = Exts.ParseMode "" Haskell2010 extensions True True Nothing True
| 75
| true
| true
| 0
| 7
| 19
| 37
| 17
| 20
| null | null |
xkollar/tor-openshift
|
utils/manifestgen/main.hs
|
agpl-3.0
|
parseAndSortVersions :: String -> [String]
parseAndSortVersions = map snd . sort . map (annotatel $ parseVer) . lines
| 117
|
parseAndSortVersions :: String -> [String]
parseAndSortVersions = map snd . sort . map (annotatel $ parseVer) . lines
| 117
|
parseAndSortVersions = map snd . sort . map (annotatel $ parseVer) . lines
| 74
| false
| true
| 0
| 9
| 17
| 43
| 22
| 21
| null | null |
janschulz/pandoc
|
src/Text/Pandoc/Writers/CommonMark.hs
|
gpl-2.0
|
blockToNodes (RawBlock fmt xs)
| fmt == Format "html" = (node (HTML_BLOCK (T.pack xs)) [] :)
| otherwise = (node (CUSTOM_BLOCK (T.pack xs) (T.empty)) [] :)
| 159
|
blockToNodes (RawBlock fmt xs)
| fmt == Format "html" = (node (HTML_BLOCK (T.pack xs)) [] :)
| otherwise = (node (CUSTOM_BLOCK (T.pack xs) (T.empty)) [] :)
| 159
|
blockToNodes (RawBlock fmt xs)
| fmt == Format "html" = (node (HTML_BLOCK (T.pack xs)) [] :)
| otherwise = (node (CUSTOM_BLOCK (T.pack xs) (T.empty)) [] :)
| 159
| false
| false
| 1
| 12
| 29
| 95
| 47
| 48
| null | null |
VictorDenisov/cluedo
|
src/Test/AllTests.hs
|
gpl-2.0
|
testParseCardReply_Peacock :: Assertion
testParseCardReply_Peacock =
(Just $ Model.CardReply Model.Peacock) @=? Model.parseCardReply "Peacock"
| 146
|
testParseCardReply_Peacock :: Assertion
testParseCardReply_Peacock =
(Just $ Model.CardReply Model.Peacock) @=? Model.parseCardReply "Peacock"
| 146
|
testParseCardReply_Peacock =
(Just $ Model.CardReply Model.Peacock) @=? Model.parseCardReply "Peacock"
| 106
| false
| true
| 0
| 9
| 15
| 34
| 17
| 17
| null | null |
sbditto85/parsedsltest
|
src/Algebra.hs
|
apache-2.0
|
concatStringConcat identStorage (StrIdent (Ident fromIdent)) =
MAP.lookupDefault "" fromIdent identStorage
| 108
|
concatStringConcat identStorage (StrIdent (Ident fromIdent)) =
MAP.lookupDefault "" fromIdent identStorage
| 108
|
concatStringConcat identStorage (StrIdent (Ident fromIdent)) =
MAP.lookupDefault "" fromIdent identStorage
| 108
| false
| false
| 0
| 9
| 11
| 32
| 15
| 17
| null | null |
keithodulaigh/Hets
|
Common/Keywords.hs
|
gpl-2.0
|
-- | partial continuous function arrow
pContFun :: String
pContFun = minusS ++ pFun
| 83
|
pContFun :: String
pContFun = minusS ++ pFun
| 44
|
pContFun = minusS ++ pFun
| 25
| true
| true
| 0
| 5
| 13
| 16
| 9
| 7
| null | null |
johnjcamilleri/maltese-functional-morphology
|
lib/Dictionary.hs
|
lgpl-3.0
|
--json_list :: String -> [String] -> String
--json_list field values = quote field ++ ":[" ++ (concat (intersperse ", " (map quote values))) ++ "]"
-- | Create word identifier.
construct_name :: String -> String -> String -> String -> String
construct_name stem typ inhs para =
case para of
[] -> nospace $ stem++"_"++typ++ inhs'
para -> nospace $ stem++"_"++typ++ inhs' ++ "_" ++para
where
inhs' = if null inhs then "" else "_" ++ inhs
nospace = map (\c -> if (c==' ') then '_' else c)
| 505
|
construct_name :: String -> String -> String -> String -> String
construct_name stem typ inhs para =
case para of
[] -> nospace $ stem++"_"++typ++ inhs'
para -> nospace $ stem++"_"++typ++ inhs' ++ "_" ++para
where
inhs' = if null inhs then "" else "_" ++ inhs
nospace = map (\c -> if (c==' ') then '_' else c)
| 327
|
construct_name stem typ inhs para =
case para of
[] -> nospace $ stem++"_"++typ++ inhs'
para -> nospace $ stem++"_"++typ++ inhs' ++ "_" ++para
where
inhs' = if null inhs then "" else "_" ++ inhs
nospace = map (\c -> if (c==' ') then '_' else c)
| 262
| true
| true
| 2
| 13
| 107
| 163
| 81
| 82
| null | null |
ademinn/JavaWithClasses
|
src/Native.hs
|
bsd-3-clause
|
writeLong :: Method
writeLong = writeMethod "writeLong" TLong
| 61
|
writeLong :: Method
writeLong = writeMethod "writeLong" TLong
| 61
|
writeLong = writeMethod "writeLong" TLong
| 41
| false
| true
| 0
| 6
| 7
| 23
| 9
| 14
| null | null |
keithodulaigh/Hets
|
HasCASL/TypeAna.hs
|
gpl-2.0
|
-- | check for unbound (or if False for too many) type variables
unboundTypevars :: Bool -> [TypeArg] -> Type -> [Diagnosis]
unboundTypevars b args ty =
let fvs = freeTVarIds ty
argIds = map getTypeVar args
restVars1 = fvs List.\\ argIds
restVars2 = argIds List.\\ fvs
in (if null restVars1 then []
else [mkDiag Error ("unbound type variable(s)\n "
++ showSepList ("," ++) showId
restVars1 " in") ty])
++ if b || null restVars2 then [] else
[mkDiag Warning ("ignoring unused variable(s)\n "
++ showSepList ("," ++) showId
restVars2 " in") ty]
| 738
|
unboundTypevars :: Bool -> [TypeArg] -> Type -> [Diagnosis]
unboundTypevars b args ty =
let fvs = freeTVarIds ty
argIds = map getTypeVar args
restVars1 = fvs List.\\ argIds
restVars2 = argIds List.\\ fvs
in (if null restVars1 then []
else [mkDiag Error ("unbound type variable(s)\n "
++ showSepList ("," ++) showId
restVars1 " in") ty])
++ if b || null restVars2 then [] else
[mkDiag Warning ("ignoring unused variable(s)\n "
++ showSepList ("," ++) showId
restVars2 " in") ty]
| 673
|
unboundTypevars b args ty =
let fvs = freeTVarIds ty
argIds = map getTypeVar args
restVars1 = fvs List.\\ argIds
restVars2 = argIds List.\\ fvs
in (if null restVars1 then []
else [mkDiag Error ("unbound type variable(s)\n "
++ showSepList ("," ++) showId
restVars1 " in") ty])
++ if b || null restVars2 then [] else
[mkDiag Warning ("ignoring unused variable(s)\n "
++ showSepList ("," ++) showId
restVars2 " in") ty]
| 613
| true
| true
| 0
| 15
| 288
| 180
| 95
| 85
| null | null |
OS2World/DEV-UTIL-HUGS
|
demos/GLUT/examples/RedBook/Hello.hs
|
bsd-3-clause
|
main :: IO ()
main = do
getArgsAndInitialize
initialDisplayMode $= [ SingleBuffered, RGBMode ]
initialWindowSize $= Size 250 250
initialWindowPosition $= Position 100 100
createWindow "hello"
myInit
displayCallback $= display
mainLoop
| 258
|
main :: IO ()
main = do
getArgsAndInitialize
initialDisplayMode $= [ SingleBuffered, RGBMode ]
initialWindowSize $= Size 250 250
initialWindowPosition $= Position 100 100
createWindow "hello"
myInit
displayCallback $= display
mainLoop
| 258
|
main = do
getArgsAndInitialize
initialDisplayMode $= [ SingleBuffered, RGBMode ]
initialWindowSize $= Size 250 250
initialWindowPosition $= Position 100 100
createWindow "hello"
myInit
displayCallback $= display
mainLoop
| 244
| false
| true
| 0
| 8
| 54
| 81
| 34
| 47
| null | null |
beni55/cryptol
|
src/Cryptol/Transform/MonoValues.hs
|
bsd-3-clause
|
splitTApp e0 n = let (e1,ts) = splitTy e0 []
in (e1, ts, n)
where
splitTy (ETApp e t) ts = splitTy e (t:ts)
splitTy e ts = (e,ts)
| 184
|
splitTApp e0 n = let (e1,ts) = splitTy e0 []
in (e1, ts, n)
where
splitTy (ETApp e t) ts = splitTy e (t:ts)
splitTy e ts = (e,ts)
| 184
|
splitTApp e0 n = let (e1,ts) = splitTy e0 []
in (e1, ts, n)
where
splitTy (ETApp e t) ts = splitTy e (t:ts)
splitTy e ts = (e,ts)
| 184
| false
| false
| 0
| 10
| 83
| 94
| 48
| 46
| null | null |
pheaver/BitVector
|
Data/BitVector/BitVector1.hs
|
bsd-3-clause
|
fromBitsLE = Bits . maybeReverse LittleEndian
| 45
|
fromBitsLE = Bits . maybeReverse LittleEndian
| 45
|
fromBitsLE = Bits . maybeReverse LittleEndian
| 45
| false
| false
| 2
| 5
| 5
| 17
| 6
| 11
| null | null |
glutamate/probably-baysig
|
src/Math/Probably/Utils.hs
|
bsd-3-clause
|
i :: (Integral a, Num b) => a -> b
fi = fromIntegral
| 53
|
fi :: (Integral a, Num b) => a -> b
fi = fromIntegral
| 53
|
fi = fromIntegral
| 17
| false
| true
| 0
| 8
| 13
| 36
| 17
| 19
| null | null |
reflex-frp/reflex-dom
|
reflex-dom-core/src/Reflex/Dom/Main.hs
|
bsd-3-clause
|
runApp' :: (t ~ DomTimeline) => (forall x. AppInput t -> Widget x (AppOutput t)) -> JSM ()
runApp' app = withJSContextSingleton $ \jsSing -> do
doc <- currentDocumentUnchecked
body <- getBodyUnchecked doc
win <- getDefaultViewUnchecked doc
rec o <- attachWidget body jsSing $ do
w <- wrapWindow win $ _appOutput_windowConfig o
app $ AppInput
{ _appInput_window = w
}
return ()
| 424
|
runApp' :: (t ~ DomTimeline) => (forall x. AppInput t -> Widget x (AppOutput t)) -> JSM ()
runApp' app = withJSContextSingleton $ \jsSing -> do
doc <- currentDocumentUnchecked
body <- getBodyUnchecked doc
win <- getDefaultViewUnchecked doc
rec o <- attachWidget body jsSing $ do
w <- wrapWindow win $ _appOutput_windowConfig o
app $ AppInput
{ _appInput_window = w
}
return ()
| 424
|
runApp' app = withJSContextSingleton $ \jsSing -> do
doc <- currentDocumentUnchecked
body <- getBodyUnchecked doc
win <- getDefaultViewUnchecked doc
rec o <- attachWidget body jsSing $ do
w <- wrapWindow win $ _appOutput_windowConfig o
app $ AppInput
{ _appInput_window = w
}
return ()
| 333
| false
| true
| 0
| 17
| 109
| 159
| 73
| 86
| null | null |
aoanthony/independentfunctionalsemantics
|
src/Main.hs
|
bsd-3-clause
|
a5 = (A,5)
| 10
|
a5 = (A,5)
| 10
|
a5 = (A,5)
| 10
| false
| false
| 0
| 5
| 2
| 12
| 7
| 5
| null | null |
kwibus/myLang
|
tests/TestEval.hs
|
bsd-3-clause
|
hasRelation _ [_] = property True
| 33
|
hasRelation _ [_] = property True
| 33
|
hasRelation _ [_] = property True
| 33
| false
| false
| 1
| 5
| 5
| 19
| 8
| 11
| null | null |
uws-eresearch/docx2pandoc
|
src/Text/Pandoc/Readers/DocX.hs
|
gpl-2.0
|
divCorrectPreReduce :: [Block] -> [Block]
divCorrectPreReduce = concatMap divCorrectPreReduce'
| 94
|
divCorrectPreReduce :: [Block] -> [Block]
divCorrectPreReduce = concatMap divCorrectPreReduce'
| 94
|
divCorrectPreReduce = concatMap divCorrectPreReduce'
| 52
| false
| true
| 0
| 6
| 8
| 24
| 13
| 11
| null | null |
phischu/fragnix
|
tests/packages/scotty/Data.Text.Lazy.hs
|
bsd-3-clause
|
-- | /O(n)/ Right-justify a string to the given length, using the
-- specified fill character on the left. Performs replacement on
-- invalid scalar values.
--
-- Examples:
--
-- > justifyRight 7 'x' "bar" == "xxxxbar"
-- > justifyRight 3 'x' "foobar" == "foobar"
justifyRight :: Int64 -> Char -> Text -> Text
justifyRight k c t
| len >= k = t
| otherwise = replicateChar (k-len) c `append` t
where len = length t
| 429
|
justifyRight :: Int64 -> Char -> Text -> Text
justifyRight k c t
| len >= k = t
| otherwise = replicateChar (k-len) c `append` t
where len = length t
| 161
|
justifyRight k c t
| len >= k = t
| otherwise = replicateChar (k-len) c `append` t
where len = length t
| 115
| true
| true
| 1
| 9
| 93
| 100
| 49
| 51
| null | null |
beni55/ghcjs
|
src/Gen2/Optimizer.hs
|
mit
|
subStats :: Traversal' JStat JStat
subStats f (IfStat e s1 s2) = IfStat e <$> f s1 <*> f s2
| 91
|
subStats :: Traversal' JStat JStat
subStats f (IfStat e s1 s2) = IfStat e <$> f s1 <*> f s2
| 91
|
subStats f (IfStat e s1 s2) = IfStat e <$> f s1 <*> f s2
| 56
| false
| true
| 0
| 7
| 19
| 48
| 22
| 26
| null | null |
drhodes/jade2hdl
|
src/Jade/Signal.hs
|
bsd-3-clause
|
getBundle (Signal (Just b) _ _) = b
| 35
|
getBundle (Signal (Just b) _ _) = b
| 35
|
getBundle (Signal (Just b) _ _) = b
| 35
| false
| false
| 0
| 9
| 7
| 25
| 12
| 13
| null | null |
ku-fpg/blank-canvas
|
wiki-suite/Draw_Device.hs
|
bsd-3-clause
|
-- (600,200)
main :: IO ()
main = blankCanvas 3000 $ \ context -> do -- start blank canvas on port 3000
send context $ do -- send commands to this specific context
moveTo(50,50)
lineTo(200,100)
lineWidth 10
strokeStyle "red"
stroke() -- this draws the ink into the canvas
drawImage(context,[50,50])
wiki $ snapShot context "images/Draw_Device.png"
wiki $ close context
| 524
|
main :: IO ()
main = blankCanvas 3000 $ \ context -> do -- start blank canvas on port 3000
send context $ do -- send commands to this specific context
moveTo(50,50)
lineTo(200,100)
lineWidth 10
strokeStyle "red"
stroke() -- this draws the ink into the canvas
drawImage(context,[50,50])
wiki $ snapShot context "images/Draw_Device.png"
wiki $ close context
| 510
|
main = blankCanvas 3000 $ \ context -> do -- start blank canvas on port 3000
send context $ do -- send commands to this specific context
moveTo(50,50)
lineTo(200,100)
lineWidth 10
strokeStyle "red"
stroke() -- this draws the ink into the canvas
drawImage(context,[50,50])
wiki $ snapShot context "images/Draw_Device.png"
wiki $ close context
| 496
| true
| true
| 0
| 14
| 213
| 126
| 60
| 66
| null | null |
sthiele/hasple
|
ASP.hs
|
gpl-3.0
|
showlist :: (Show a) => [a] -> String
showlist a = showlist' a ""
| 65
|
showlist :: (Show a) => [a] -> String
showlist a = showlist' a ""
| 65
|
showlist a = showlist' a ""
| 27
| false
| true
| 0
| 7
| 13
| 35
| 18
| 17
| null | null |
christiaanb/ghc
|
compiler/simplCore/SimplUtils.hs
|
bsd-3-clause
|
-------------------
contResultType :: SimplCont -> OutType
contResultType (Stop ty _) = ty
| 107
|
contResultType :: SimplCont -> OutType
contResultType (Stop ty _) = ty
| 87
|
contResultType (Stop ty _) = ty
| 48
| true
| true
| 0
| 7
| 28
| 27
| 14
| 13
| null | null |
jgraydus/circuits
|
src/Circuits/Bus.hs
|
gpl-3.0
|
writeBus :: Bus -> Word -> IO ()
writeBus (Bus ws n) w = do
if w >= 2^n then error $ "value " ++ (show w) ++ " is too large for " ++ (show n) ++ " bit bus"
else forM_ [0..(n-1)] (\i -> set (ws !! i) (testBit w i))
| 217
|
writeBus :: Bus -> Word -> IO ()
writeBus (Bus ws n) w = do
if w >= 2^n then error $ "value " ++ (show w) ++ " is too large for " ++ (show n) ++ " bit bus"
else forM_ [0..(n-1)] (\i -> set (ws !! i) (testBit w i))
| 217
|
writeBus (Bus ws n) w = do
if w >= 2^n then error $ "value " ++ (show w) ++ " is too large for " ++ (show n) ++ " bit bus"
else forM_ [0..(n-1)] (\i -> set (ws !! i) (testBit w i))
| 184
| false
| true
| 0
| 13
| 56
| 133
| 68
| 65
| null | null |
kmels/hledger
|
hledger-lib/Hledger/Query.hs
|
gpl-3.0
|
queryDateSpans' (Date span) = [span]
| 36
|
queryDateSpans' (Date span) = [span]
| 36
|
queryDateSpans' (Date span) = [span]
| 36
| false
| false
| 0
| 6
| 4
| 19
| 9
| 10
| null | null |
BioHaskell/bioace
|
src/Bio/Alignment/Ace.hs
|
gpl-3.0
|
rseq :: AceParser (Sequence, Gaps)
rseq = do
(rn,_len,_,_) <- rd
(s,gaps) <- return . (\x -> extractGaps $ SeqData {unSD = x}) =<< sdata
-- when (B.length s == fromIntegral len) $ (fail "Incorrect sequence length!")
-- todo: fix gaps!
many1 blank
qa
ds
many blank
return (Seq (SeqLabel {unSL = rn}) s Nothing,gaps) -- huh?
-- | parse each read (RD, QA, DS)
-- Vector NTI appears to insert solitary RDs, sometimes even without any sequence data!?
-- This is not supported at this point.
| 508
|
rseq :: AceParser (Sequence, Gaps)
rseq = do
(rn,_len,_,_) <- rd
(s,gaps) <- return . (\x -> extractGaps $ SeqData {unSD = x}) =<< sdata
-- when (B.length s == fromIntegral len) $ (fail "Incorrect sequence length!")
-- todo: fix gaps!
many1 blank
qa
ds
many blank
return (Seq (SeqLabel {unSL = rn}) s Nothing,gaps) -- huh?
-- | parse each read (RD, QA, DS)
-- Vector NTI appears to insert solitary RDs, sometimes even without any sequence data!?
-- This is not supported at this point.
| 508
|
rseq = do
(rn,_len,_,_) <- rd
(s,gaps) <- return . (\x -> extractGaps $ SeqData {unSD = x}) =<< sdata
-- when (B.length s == fromIntegral len) $ (fail "Incorrect sequence length!")
-- todo: fix gaps!
many1 blank
qa
ds
many blank
return (Seq (SeqLabel {unSL = rn}) s Nothing,gaps) -- huh?
-- | parse each read (RD, QA, DS)
-- Vector NTI appears to insert solitary RDs, sometimes even without any sequence data!?
-- This is not supported at this point.
| 473
| false
| true
| 0
| 15
| 109
| 140
| 74
| 66
| null | null |
gridaphobe/ghc
|
compiler/hsSyn/HsUtils.hs
|
bsd-3-clause
|
collectLocalBinders EmptyLocalBinds = []
| 43
|
collectLocalBinders EmptyLocalBinds = []
| 43
|
collectLocalBinders EmptyLocalBinds = []
| 43
| false
| false
| 0
| 5
| 6
| 11
| 5
| 6
| null | null |
rueshyna/gogol
|
gogol-partners/gen/Network/Google/Resource/Partners/Companies/Get.hs
|
mpl-2.0
|
-- | OAuth bearer token.
cgBearerToken :: Lens' CompaniesGet (Maybe Text)
cgBearerToken
= lens _cgBearerToken
(\ s a -> s{_cgBearerToken = a})
| 150
|
cgBearerToken :: Lens' CompaniesGet (Maybe Text)
cgBearerToken
= lens _cgBearerToken
(\ s a -> s{_cgBearerToken = a})
| 125
|
cgBearerToken
= lens _cgBearerToken
(\ s a -> s{_cgBearerToken = a})
| 76
| true
| true
| 0
| 8
| 29
| 49
| 25
| 24
| null | null |
tomtitchener/RealSimpleMusic
|
tests/Music/UtilsTest.hs
|
cc0-1.0
|
propMajorScaleIntervals :: PitchClass -> Property
propMajorScaleIntervals tonic =
pitchClassInMajorScaleRange tonic ==>
testMajorScaleIntervals (fromRight' (majorScale tonic))
| 182
|
propMajorScaleIntervals :: PitchClass -> Property
propMajorScaleIntervals tonic =
pitchClassInMajorScaleRange tonic ==>
testMajorScaleIntervals (fromRight' (majorScale tonic))
| 182
|
propMajorScaleIntervals tonic =
pitchClassInMajorScaleRange tonic ==>
testMajorScaleIntervals (fromRight' (majorScale tonic))
| 132
| false
| true
| 0
| 9
| 21
| 46
| 20
| 26
| null | null |
nvasilakis/pandoc
|
src/Text/Pandoc/Readers/HTML.hs
|
gpl-2.0
|
parseListStyleType :: String -> ListNumberStyle
parseListStyleType "lower-roman" = LowerRoman
| 93
|
parseListStyleType :: String -> ListNumberStyle
parseListStyleType "lower-roman" = LowerRoman
| 93
|
parseListStyleType "lower-roman" = LowerRoman
| 45
| false
| true
| 0
| 5
| 8
| 22
| 10
| 12
| null | null |
black0range/Smutt
|
src/Smutt/Util/URL/Refined.hs
|
mit
|
encode :: (URL.Serializable s) => URL s -> URL s
encode url = url{
scheme = URL.encode $ scheme url,
username = URL.encode $ username url,
password = URL.encode $ password url,
host = URL.encode $ host url,
path = map URL.encode $ path url,
query = map (\ (k,v) -> (URL.encode k, URL.encode v)) $ query url
}
| 324
|
encode :: (URL.Serializable s) => URL s -> URL s
encode url = url{
scheme = URL.encode $ scheme url,
username = URL.encode $ username url,
password = URL.encode $ password url,
host = URL.encode $ host url,
path = map URL.encode $ path url,
query = map (\ (k,v) -> (URL.encode k, URL.encode v)) $ query url
}
| 324
|
encode url = url{
scheme = URL.encode $ scheme url,
username = URL.encode $ username url,
password = URL.encode $ password url,
host = URL.encode $ host url,
path = map URL.encode $ path url,
query = map (\ (k,v) -> (URL.encode k, URL.encode v)) $ query url
}
| 275
| false
| true
| 0
| 13
| 74
| 161
| 84
| 77
| null | null |
phischu/fragnix
|
builtins/base/GHC.Event.PSQ.hs
|
bsd-3-clause
|
rbalanceRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a
rbalanceRight k p v l m r
| size' (left l) > size' (right l) = rsingleRight k p v l m r
| otherwise = rdoubleRight k p v l m r
| 231
|
rbalanceRight :: Key -> Prio -> a -> LTree a -> Key -> LTree a -> LTree a
rbalanceRight k p v l m r
| size' (left l) > size' (right l) = rsingleRight k p v l m r
| otherwise = rdoubleRight k p v l m r
| 231
|
rbalanceRight k p v l m r
| size' (left l) > size' (right l) = rsingleRight k p v l m r
| otherwise = rdoubleRight k p v l m r
| 157
| false
| true
| 1
| 11
| 81
| 118
| 55
| 63
| null | null |
markusle/husky
|
test/CalculatorTest.hs
|
gpl-3.0
|
simpleTest24 :: GoodTestCase
simpleTest24 = ("-3+-4", DblResult (-7))
| 69
|
simpleTest24 :: GoodTestCase
simpleTest24 = ("-3+-4", DblResult (-7))
| 69
|
simpleTest24 = ("-3+-4", DblResult (-7))
| 40
| false
| true
| 0
| 8
| 7
| 25
| 14
| 11
| null | null |
underhilllabs/project-euler-in-haskell
|
primes.hs
|
mit
|
fifthDigs :: [Char] -> Int
fifthDigs [] = 0
| 43
|
fifthDigs :: [Char] -> Int
fifthDigs [] = 0
| 43
|
fifthDigs [] = 0
| 16
| false
| true
| 0
| 8
| 8
| 29
| 13
| 16
| null | null |
ibawt/hdns
|
test/Spec.hs
|
gpl-3.0
|
readFromFile :: String -> IO Message
readFromFile a = do
b <- B.readFile a
readPacket b
| 91
|
readFromFile :: String -> IO Message
readFromFile a = do
b <- B.readFile a
readPacket b
| 91
|
readFromFile a = do
b <- B.readFile a
readPacket b
| 54
| false
| true
| 0
| 9
| 19
| 39
| 17
| 22
| null | null |
dbp/karamaan-opaleye
|
Karamaan/Opaleye/Operators/Numeric.hs
|
bsd-3-clause
|
abs :: NumUnOp a
abs = unOpArr (PrimQuery.UnOpOther "@") "abs"
| 62
|
abs :: NumUnOp a
abs = unOpArr (PrimQuery.UnOpOther "@") "abs"
| 62
|
abs = unOpArr (PrimQuery.UnOpOther "@") "abs"
| 45
| false
| true
| 0
| 8
| 9
| 27
| 13
| 14
| null | null |
cpdurham/accelerate-camera-sandbox
|
src/Fluid/Pipe.hs
|
bsd-3-clause
|
simple
:: (Acc DensityField, Acc VelocityField)
-> Acc (Pic,DensityField,VelocityField)
simple (df,vf) =
let
pic =
A.map
(\x ->
let
c = floatToWord8 $ (255*) $ 0 `A.max` x `A.min` 1
in
A.lift (c,c,c)
) normDf
normDf =
let
(ydim,xdim) = A.unlift $ A.unindex2 $ A.shape df :: (Exp Int, Exp Int)
mVal = the (A.sum df) / (A.fromIntegral $ xdim*ydim)
in
A.map (/mVal) df
in
A.lift (pic,df,vf)
| 516
|
simple
:: (Acc DensityField, Acc VelocityField)
-> Acc (Pic,DensityField,VelocityField)
simple (df,vf) =
let
pic =
A.map
(\x ->
let
c = floatToWord8 $ (255*) $ 0 `A.max` x `A.min` 1
in
A.lift (c,c,c)
) normDf
normDf =
let
(ydim,xdim) = A.unlift $ A.unindex2 $ A.shape df :: (Exp Int, Exp Int)
mVal = the (A.sum df) / (A.fromIntegral $ xdim*ydim)
in
A.map (/mVal) df
in
A.lift (pic,df,vf)
| 516
|
simple (df,vf) =
let
pic =
A.map
(\x ->
let
c = floatToWord8 $ (255*) $ 0 `A.max` x `A.min` 1
in
A.lift (c,c,c)
) normDf
normDf =
let
(ydim,xdim) = A.unlift $ A.unindex2 $ A.shape df :: (Exp Int, Exp Int)
mVal = the (A.sum df) / (A.fromIntegral $ xdim*ydim)
in
A.map (/mVal) df
in
A.lift (pic,df,vf)
| 424
| false
| true
| 2
| 20
| 195
| 245
| 128
| 117
| null | null |
kmilner/tamarin-prover
|
src/Web/Types.hs
|
gpl-3.0
|
-- | Remove an underscore prefix. It holds that
--
-- > unprefixUnderscore . prefixWithUnderscore = id
--
-- The inverted composition holds for all strings except the empty string and
-- strings starting with an underscore.
unprefixUnderscore :: String -> String
unprefixUnderscore "_" = ""
| 303
|
unprefixUnderscore :: String -> String
unprefixUnderscore "_" = ""
| 79
|
unprefixUnderscore "_" = ""
| 40
| true
| true
| 0
| 5
| 58
| 24
| 15
| 9
| null | null |
snoyberg/ghc
|
compiler/backpack/RnModIface.hs
|
bsd-3-clause
|
rnIfaceExpr (IfaceTick tickish expr) = IfaceTick tickish <$> rnIfaceExpr expr
| 77
|
rnIfaceExpr (IfaceTick tickish expr) = IfaceTick tickish <$> rnIfaceExpr expr
| 77
|
rnIfaceExpr (IfaceTick tickish expr) = IfaceTick tickish <$> rnIfaceExpr expr
| 77
| false
| false
| 0
| 7
| 9
| 27
| 12
| 15
| null | null |
v0lkan/learning-haskell
|
session-archive/002-lambda-curry.hs
|
mit
|
flip' :: (a -> b -> c) -> b -> a -> c
flip' f = \x y -> f y x
| 62
|
flip' :: (a -> b -> c) -> b -> a -> c
flip' f = \x y -> f y x
| 61
|
flip' f = \x y -> f y x
| 23
| false
| true
| 0
| 8
| 22
| 49
| 25
| 24
| null | null |
krapsh/kraps-haskell
|
src/Spark/Core/Internal/OpFunctions.hs
|
apache-2.0
|
_jsonShowSGO :: SemiGroupOperator -> Text
_jsonShowSGO (OpaqueSemiGroupLaw so) = soName so
| 90
|
_jsonShowSGO :: SemiGroupOperator -> Text
_jsonShowSGO (OpaqueSemiGroupLaw so) = soName so
| 90
|
_jsonShowSGO (OpaqueSemiGroupLaw so) = soName so
| 48
| false
| true
| 0
| 9
| 10
| 33
| 14
| 19
| null | null |
sdiehl/ghc
|
compiler/nativeGen/X86/Ppr.hs
|
bsd-3-clause
|
pprRegReg :: PtrString -> Reg -> Reg -> SDoc
pprRegReg name reg1 reg2
= sdocWithPlatform $ \platform ->
hcat [
pprMnemonic_ name,
pprReg (archWordFormat (target32Bit platform)) reg1,
comma,
pprReg (archWordFormat (target32Bit platform)) reg2
]
| 285
|
pprRegReg :: PtrString -> Reg -> Reg -> SDoc
pprRegReg name reg1 reg2
= sdocWithPlatform $ \platform ->
hcat [
pprMnemonic_ name,
pprReg (archWordFormat (target32Bit platform)) reg1,
comma,
pprReg (archWordFormat (target32Bit platform)) reg2
]
| 285
|
pprRegReg name reg1 reg2
= sdocWithPlatform $ \platform ->
hcat [
pprMnemonic_ name,
pprReg (archWordFormat (target32Bit platform)) reg1,
comma,
pprReg (archWordFormat (target32Bit platform)) reg2
]
| 240
| false
| true
| 0
| 13
| 75
| 91
| 46
| 45
| null | null |
michaelt/series
|
notes/pipeprelude.hs
|
bsd-3-clause
|
{-| Transform a unidirectional 'Pipe' to a bidirectional 'Proxy'
> generalize (f >-> g) = generalize f >+> generalize g
>
> generalize cat = pull
-}
generalize :: Monad m => Pipe a b m r -> x -> Proxy x a x b m r
generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn
where
up () = do
x <- lift get
request x
dn a = do
x <- respond a
lift $ put x
| 396
|
generalize :: Monad m => Pipe a b m r -> x -> Proxy x a x b m r
generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn
where
up () = do
x <- lift get
request x
dn a = do
x <- respond a
lift $ put x
| 246
|
generalize p x0 = evalStateP x0 $ up >\\ hoist lift p //> dn
where
up () = do
x <- lift get
request x
dn a = do
x <- respond a
lift $ put x
| 182
| true
| true
| 2
| 8
| 127
| 141
| 60
| 81
| null | null |
IanConnolly/distributed-process-aws
|
src/Control/Distributed/Process/Backend/AWS.hs
|
bsd-3-clause
|
-- | Terminate a node started with 'spawnNodeOnVM'
terminateNode :: NodeId -> Process ()
terminateNode nid = nsendRemote nid "$awsBackendServiceProcess" ServiceProcessTerminate
| 176
|
terminateNode :: NodeId -> Process ()
terminateNode nid = nsendRemote nid "$awsBackendServiceProcess" ServiceProcessTerminate
| 125
|
terminateNode nid = nsendRemote nid "$awsBackendServiceProcess" ServiceProcessTerminate
| 87
| true
| true
| 0
| 7
| 20
| 31
| 15
| 16
| null | null |
quchen/fgl
|
Data/Graph/Inductive/Graph.hs
|
bsd-3-clause
|
-- | Remove multiple 'Edge's from the 'Graph'.
delEdges :: (DynGraph gr) => [Edge] -> gr a b -> gr a b
delEdges es g = foldl' (flip delEdge) g es
| 145
|
delEdges :: (DynGraph gr) => [Edge] -> gr a b -> gr a b
delEdges es g = foldl' (flip delEdge) g es
| 98
|
delEdges es g = foldl' (flip delEdge) g es
| 42
| true
| true
| 0
| 8
| 30
| 60
| 30
| 30
| null | null |
ezrakilty/narc
|
Database/Narc/Eval.hs
|
bsd-2-clause
|
eval env (Abs x n, q) = (VAbs x n env')
where env' = filter (\(a,b) -> a `elem` fvs n) env
| 94
|
eval env (Abs x n, q) = (VAbs x n env')
where env' = filter (\(a,b) -> a `elem` fvs n) env
| 94
|
eval env (Abs x n, q) = (VAbs x n env')
where env' = filter (\(a,b) -> a `elem` fvs n) env
| 94
| false
| false
| 1
| 8
| 25
| 75
| 36
| 39
| null | null |
mettekou/ghc
|
compiler/prelude/ForeignCall.hs
|
bsd-3-clause
|
{-
Generate the gcc attribute corresponding to the given
calling convention (used by PprAbsC):
-}
ccallConvAttribute :: CCallConv -> SDoc
ccallConvAttribute StdCallConv = text "__attribute__((__stdcall__))"
| 213
|
ccallConvAttribute :: CCallConv -> SDoc
ccallConvAttribute StdCallConv = text "__attribute__((__stdcall__))"
| 114
|
ccallConvAttribute StdCallConv = text "__attribute__((__stdcall__))"
| 74
| true
| true
| 0
| 5
| 31
| 22
| 11
| 11
| null | null |
jfischoff/async-extras
|
src/Control/Concurrent/Async/Lifted/Extra.hs
|
bsd-3-clause
|
fixAsyncOnWithUnmask :: (MonadFix m, MonadBaseControl IO m)
=> Int -> (Async (StM m a) -> (forall b . m b -> m b) -> m a)
-> m (Async (StM m a))
fixAsyncOnWithUnmask cpu f = mdo
this <- asyncWithUnmask $ f this
return this
-- | Create an async that is linked to a parent. If the parent
-- dies so does this async
| 368
|
fixAsyncOnWithUnmask :: (MonadFix m, MonadBaseControl IO m)
=> Int -> (Async (StM m a) -> (forall b . m b -> m b) -> m a)
-> m (Async (StM m a))
fixAsyncOnWithUnmask cpu f = mdo
this <- asyncWithUnmask $ f this
return this
-- | Create an async that is linked to a parent. If the parent
-- dies so does this async
| 368
|
fixAsyncOnWithUnmask cpu f = mdo
this <- asyncWithUnmask $ f this
return this
-- | Create an async that is linked to a parent. If the parent
-- dies so does this async
| 179
| false
| true
| 0
| 15
| 120
| 128
| 61
| 67
| null | null |
asi1024/WXCS
|
src/App.hs
|
mit
|
getId :: Sq.Entity a -> Text
getId ent = let Right key = Sq.fromPersistValue . Sq.unKey $ Sq.entityKey ent in key
| 113
|
getId :: Sq.Entity a -> Text
getId ent = let Right key = Sq.fromPersistValue . Sq.unKey $ Sq.entityKey ent in key
| 113
|
getId ent = let Right key = Sq.fromPersistValue . Sq.unKey $ Sq.entityKey ent in key
| 84
| false
| true
| 0
| 11
| 20
| 59
| 26
| 33
| null | null |
SuperDrew/sql-server-gen
|
src/Database/SqlServer/Definition/DataType.hs
|
bsd-2-clause
|
nullOptions :: Type -> Maybe NullStorageOptions
nullOptions t = maybe Nothing nullStorageFromStorageOptions (storageOptions t)
| 126
|
nullOptions :: Type -> Maybe NullStorageOptions
nullOptions t = maybe Nothing nullStorageFromStorageOptions (storageOptions t)
| 126
|
nullOptions t = maybe Nothing nullStorageFromStorageOptions (storageOptions t)
| 78
| false
| true
| 0
| 7
| 13
| 39
| 17
| 22
| null | null |
mb21/qua-kit
|
apps/hs/qua-server/src/Handler/Mooc/SubmitProposal.hs
|
mit
|
completelyNewOne :: ByteString -> ByteString -> Text -> Handler (Maybe ScenarioId)
completelyNewOne img geometry desc = runMaybeT $ do
userId <- MaybeT maybeAuthId
medxResId <- lift $ getsSafeSession userSessionEdxResourceId
scpId <- MaybeT $ getsSafeSession userSessionCustomExerciseId
MaybeT . runDB . runMaybeT $ do
medxGrading <- case medxResId of
Nothing -> return Nothing
Just ri -> lift . getBy $ EdxGradeKeys ri userId
t <- liftIO getCurrentTime
let sc = Scenario
userId
scpId
img
geometry
desc
t
scId <- lift $ insert sc
void . lift . insert $ CurrentScenario scId
(scenarioAuthorId sc)
(scenarioTaskId sc)
(scenarioDescription sc)
(entityKey <$> medxGrading)
Nothing
(scenarioLastUpdate sc)
return scId
| 1,029
|
completelyNewOne :: ByteString -> ByteString -> Text -> Handler (Maybe ScenarioId)
completelyNewOne img geometry desc = runMaybeT $ do
userId <- MaybeT maybeAuthId
medxResId <- lift $ getsSafeSession userSessionEdxResourceId
scpId <- MaybeT $ getsSafeSession userSessionCustomExerciseId
MaybeT . runDB . runMaybeT $ do
medxGrading <- case medxResId of
Nothing -> return Nothing
Just ri -> lift . getBy $ EdxGradeKeys ri userId
t <- liftIO getCurrentTime
let sc = Scenario
userId
scpId
img
geometry
desc
t
scId <- lift $ insert sc
void . lift . insert $ CurrentScenario scId
(scenarioAuthorId sc)
(scenarioTaskId sc)
(scenarioDescription sc)
(entityKey <$> medxGrading)
Nothing
(scenarioLastUpdate sc)
return scId
| 1,029
|
completelyNewOne img geometry desc = runMaybeT $ do
userId <- MaybeT maybeAuthId
medxResId <- lift $ getsSafeSession userSessionEdxResourceId
scpId <- MaybeT $ getsSafeSession userSessionCustomExerciseId
MaybeT . runDB . runMaybeT $ do
medxGrading <- case medxResId of
Nothing -> return Nothing
Just ri -> lift . getBy $ EdxGradeKeys ri userId
t <- liftIO getCurrentTime
let sc = Scenario
userId
scpId
img
geometry
desc
t
scId <- lift $ insert sc
void . lift . insert $ CurrentScenario scId
(scenarioAuthorId sc)
(scenarioTaskId sc)
(scenarioDescription sc)
(entityKey <$> medxGrading)
Nothing
(scenarioLastUpdate sc)
return scId
| 946
| false
| true
| 0
| 16
| 419
| 251
| 115
| 136
| null | null |
azadbolour/boardgame
|
haskell-server/test/BoardGame/Server/Domain/HopelessBlanksSpec2.hs
|
agpl-3.0
|
getDictionary :: IO WordDictionary
getDictionary = do
Right dictionary <- runExceptT $ readDictionary "test" "data" 2
return dictionary
| 139
|
getDictionary :: IO WordDictionary
getDictionary = do
Right dictionary <- runExceptT $ readDictionary "test" "data" 2
return dictionary
| 139
|
getDictionary = do
Right dictionary <- runExceptT $ readDictionary "test" "data" 2
return dictionary
| 104
| false
| true
| 1
| 10
| 21
| 45
| 18
| 27
| null | null |
alisdair/H99P
|
src/Lists.hs
|
mit
|
dupli :: [a] -> [a]
dupli = concatMap . replicate $ 2
| 53
|
dupli :: [a] -> [a]
dupli = concatMap . replicate $ 2
| 53
|
dupli = concatMap . replicate $ 2
| 33
| false
| true
| 0
| 8
| 11
| 36
| 17
| 19
| null | null |
wavewave/HROOT-generate
|
HROOT-generate/lib/HROOT/Data/Core/Class.hs
|
gpl-3.0
|
----------------
-- starting D --
----------------
tDatime :: Class
tDatime =
coreclass "TDatime" [deletable]
[ Constructor [int "year", int "month", int "day", int "hour", int "min", int "sec"] Nothing
, Virtual uint_ "Convert" [bool "toGMT"] Nothing
, NonVirtual int_ "GetDay" [] Nothing
, NonVirtual int_ "GetHour" [] Nothing
, NonVirtual int_ "GetMinute" [] Nothing
, NonVirtual int_ "GetSecond" [] Nothing
, NonVirtual int_ "GetYear" [] Nothing
, NonVirtual int_ "GetMonth" [] Nothing
, Virtual void_ "Set" [uint "tloc" ] (Just "setTDatime")
]
| 580
|
tDatime :: Class
tDatime =
coreclass "TDatime" [deletable]
[ Constructor [int "year", int "month", int "day", int "hour", int "min", int "sec"] Nothing
, Virtual uint_ "Convert" [bool "toGMT"] Nothing
, NonVirtual int_ "GetDay" [] Nothing
, NonVirtual int_ "GetHour" [] Nothing
, NonVirtual int_ "GetMinute" [] Nothing
, NonVirtual int_ "GetSecond" [] Nothing
, NonVirtual int_ "GetYear" [] Nothing
, NonVirtual int_ "GetMonth" [] Nothing
, Virtual void_ "Set" [uint "tloc" ] (Just "setTDatime")
]
| 528
|
tDatime =
coreclass "TDatime" [deletable]
[ Constructor [int "year", int "month", int "day", int "hour", int "min", int "sec"] Nothing
, Virtual uint_ "Convert" [bool "toGMT"] Nothing
, NonVirtual int_ "GetDay" [] Nothing
, NonVirtual int_ "GetHour" [] Nothing
, NonVirtual int_ "GetMinute" [] Nothing
, NonVirtual int_ "GetSecond" [] Nothing
, NonVirtual int_ "GetYear" [] Nothing
, NonVirtual int_ "GetMonth" [] Nothing
, Virtual void_ "Set" [uint "tloc" ] (Just "setTDatime")
]
| 511
| true
| true
| 0
| 9
| 113
| 203
| 100
| 103
| null | null |
MostAwesomeDude/gemstone
|
Gemstone/Color.hs
|
mit
|
red, green, blue :: RGB
red = Color3 255 0 0
| 44
|
red, green, blue :: RGB
red = Color3 255 0 0
| 44
|
red = Color3 255 0 0
| 20
| false
| true
| 3
| 5
| 10
| 29
| 13
| 16
| null | null |
ekmett/ghc
|
ghc/GhciTags.hs
|
bsd-3-clause
|
-- get tag info, for later translation into Vim or Emacs style
tagInfo :: DynFlags -> PrintUnqualified -> Bool -> Char -> Name -> RealSrcLoc
-> TagInfo
tagInfo dflags unqual exported kind name loc
= TagInfo exported kind
(showSDocForUser dflags unqual $ pprOccName (nameOccName name))
(showSDocForUser dflags unqual $ ftext (srcLocFile loc))
(srcLocLine loc) (srcLocCol loc) Nothing
| 418
|
tagInfo :: DynFlags -> PrintUnqualified -> Bool -> Char -> Name -> RealSrcLoc
-> TagInfo
tagInfo dflags unqual exported kind name loc
= TagInfo exported kind
(showSDocForUser dflags unqual $ pprOccName (nameOccName name))
(showSDocForUser dflags unqual $ ftext (srcLocFile loc))
(srcLocLine loc) (srcLocCol loc) Nothing
| 355
|
tagInfo dflags unqual exported kind name loc
= TagInfo exported kind
(showSDocForUser dflags unqual $ pprOccName (nameOccName name))
(showSDocForUser dflags unqual $ ftext (srcLocFile loc))
(srcLocLine loc) (srcLocCol loc) Nothing
| 258
| true
| true
| 0
| 10
| 92
| 118
| 58
| 60
| null | null |
oldmanmike/ghc
|
compiler/cmm/CmmUtils.hs
|
bsd-3-clause
|
mkStgWordCLit :: DynFlags -> StgWord -> CmmLit
mkStgWordCLit dflags wd = CmmInt (fromStgWord wd) (wordWidth dflags)
| 115
|
mkStgWordCLit :: DynFlags -> StgWord -> CmmLit
mkStgWordCLit dflags wd = CmmInt (fromStgWord wd) (wordWidth dflags)
| 115
|
mkStgWordCLit dflags wd = CmmInt (fromStgWord wd) (wordWidth dflags)
| 68
| false
| true
| 0
| 7
| 15
| 41
| 20
| 21
| null | null |
heades/Agda-LLS
|
Source/ALL/Languages/TypeErrors.hs
|
bsd-3-clause
|
readTypeError (ZeroTypeError a) = "Type error: "++runPrettyType a++" must be of type Nat."
| 90
|
readTypeError (ZeroTypeError a) = "Type error: "++runPrettyType a++" must be of type Nat."
| 90
|
readTypeError (ZeroTypeError a) = "Type error: "++runPrettyType a++" must be of type Nat."
| 90
| false
| false
| 0
| 7
| 12
| 26
| 12
| 14
| null | null |
kim/amazonka
|
amazonka-elastictranscoder/gen/Network/AWS/ElasticTranscoder/Types.hs
|
mpl-2.0
|
-- | Specify one of the following values to control scaling of the output album
-- art:
--
-- 'Fit:' Elastic Transcoder scales the output art so it matches the value
-- that you specified in either 'MaxWidth' or 'MaxHeight' without exceeding the
-- other value. 'Fill:' Elastic Transcoder scales the output art so it matches
-- the value that you specified in either 'MaxWidth' or 'MaxHeight' and matches or
-- exceeds the other value. Elastic Transcoder centers the output art and then
-- crops it in the dimension (if any) that exceeds the maximum value. 'Stretch:'
-- Elastic Transcoder stretches the output art to match the values that you
-- specified for 'MaxWidth' and 'MaxHeight'. If the relative proportions of the
-- input art and the output art are different, the output art will be distorted.
-- 'Keep:' Elastic Transcoder does not scale the output art. If either dimension
-- of the input art exceeds the values that you specified for 'MaxWidth' and 'MaxHeight', Elastic Transcoder crops the output art. 'ShrinkToFit:' Elastic Transcoder
-- scales the output art down so that its dimensions match the values that you
-- specified for at least one of 'MaxWidth' and 'MaxHeight' without exceeding either
-- value. If you specify this option, Elastic Transcoder does not scale the art
-- up. 'ShrinkToFill' Elastic Transcoder scales the output art down so that its
-- dimensions match the values that you specified for at least one of 'MaxWidth'
-- and 'MaxHeight' without dropping below either value. If you specify this
-- option, Elastic Transcoder does not scale the art up.
aSizingPolicy :: Lens' Artwork (Maybe Text)
aSizingPolicy = lens _aSizingPolicy (\s a -> s { _aSizingPolicy = a })
| 1,708
|
aSizingPolicy :: Lens' Artwork (Maybe Text)
aSizingPolicy = lens _aSizingPolicy (\s a -> s { _aSizingPolicy = a })
| 114
|
aSizingPolicy = lens _aSizingPolicy (\s a -> s { _aSizingPolicy = a })
| 70
| true
| true
| 0
| 9
| 288
| 66
| 45
| 21
| null | null |
rueshyna/gogol
|
gogol-people/gen/Network/Google/People/Types/Product.hs
|
mpl-2.0
|
-- | Creates a value of 'Interest' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'iValue'
--
-- * 'iMetadata'
interest
:: Interest
interest =
Interest'
{ _iValue = Nothing
, _iMetadata = Nothing
}
| 303
|
interest
:: Interest
interest =
Interest'
{ _iValue = Nothing
, _iMetadata = Nothing
}
| 106
|
interest =
Interest'
{ _iValue = Nothing
, _iMetadata = Nothing
}
| 81
| true
| true
| 0
| 6
| 72
| 32
| 22
| 10
| null | null |
2015-Fall-UPT-PLDA/homework
|
02/your_full_name_here.hs
|
mit
|
-----------------------------------------------------------
-- the function that we test. since we always start out with an EmptyEnv.
interpret :: Expr -> Val
interpret expr = evaluate expr EmptyEnv
| 198
|
interpret :: Expr -> Val
interpret expr = evaluate expr EmptyEnv
| 64
|
interpret expr = evaluate expr EmptyEnv
| 39
| true
| true
| 0
| 5
| 25
| 25
| 13
| 12
| null | null |
afcowie/vaultaire
|
lib/Vaultaire/Writer.hs
|
bsd-3-clause
|
processPoints :: MonadState BatchState m
=> Word64 -- ^ Offset
-> ByteString -- ^ Raw message
-> (DayMap, DayMap) -- ^ (simple daymap, extended daymap)
-> Origin -- ^ Origin to write to
-> TimeStamp -- ^ Latest simple timestamp
-> TimeStamp -- ^ Latest extended timestamp
-> m (Int, Int) -- ^ Number of (simple, extended) points processed
processPoints offset message day_maps origin latest_simple latest_ext
| fromIntegral offset >= S.length message = do
modify (\s -> s { latestSimple = latest_simple
, latestExtended = latest_ext })
return (0,0)
| otherwise = do
let (address, time, payload) = runUnpacking (parseMessageAt offset) message
let (simple_epoch, simple_buckets) = lookupFirst time (fst day_maps)
-- The LSB of the address lets us know if it is an extended message or
-- not. Set means extended.
if isAddressExtended address
then do
let len = fromIntegral payload
let str | len == 0 = "" -- will fail bounds check without this
| otherwise =
runUnpacking (getBytesAt (offset + 24) len) message
let (ext_epoch, ext_buckets) = lookupFirst time (snd day_maps)
let ext_bucket = calculateBucketNumber ext_buckets address
appendExtended ext_epoch ext_bucket address time len str
let !t | time > latest_ext = time
| otherwise = latest_ext
(s,e) <- processPoints (offset + 24 + len) message day_maps origin latest_simple t
return (s,e+1)
else do
let message_bytes = runUnpacking (getBytesAt offset 24) message
let simple_bucket = calculateBucketNumber simple_buckets address
appendSimple simple_epoch simple_bucket message_bytes
let !t | time > latest_simple = time
| otherwise = latest_simple
(s,e) <- processPoints (offset + 24) message day_maps origin t latest_ext
return (s+1,e)
-- | Unpacks a message starting from the given offset. If it corresponds
-- to a simple point, the 'Payload' will be the value; if extended,
-- the 'Payload' will be the number of bytes in the value.
| 2,498
|
processPoints :: MonadState BatchState m
=> Word64 -- ^ Offset
-> ByteString -- ^ Raw message
-> (DayMap, DayMap) -- ^ (simple daymap, extended daymap)
-> Origin -- ^ Origin to write to
-> TimeStamp -- ^ Latest simple timestamp
-> TimeStamp -- ^ Latest extended timestamp
-> m (Int, Int)
processPoints offset message day_maps origin latest_simple latest_ext
| fromIntegral offset >= S.length message = do
modify (\s -> s { latestSimple = latest_simple
, latestExtended = latest_ext })
return (0,0)
| otherwise = do
let (address, time, payload) = runUnpacking (parseMessageAt offset) message
let (simple_epoch, simple_buckets) = lookupFirst time (fst day_maps)
-- The LSB of the address lets us know if it is an extended message or
-- not. Set means extended.
if isAddressExtended address
then do
let len = fromIntegral payload
let str | len == 0 = "" -- will fail bounds check without this
| otherwise =
runUnpacking (getBytesAt (offset + 24) len) message
let (ext_epoch, ext_buckets) = lookupFirst time (snd day_maps)
let ext_bucket = calculateBucketNumber ext_buckets address
appendExtended ext_epoch ext_bucket address time len str
let !t | time > latest_ext = time
| otherwise = latest_ext
(s,e) <- processPoints (offset + 24 + len) message day_maps origin latest_simple t
return (s,e+1)
else do
let message_bytes = runUnpacking (getBytesAt offset 24) message
let simple_bucket = calculateBucketNumber simple_buckets address
appendSimple simple_epoch simple_bucket message_bytes
let !t | time > latest_simple = time
| otherwise = latest_simple
(s,e) <- processPoints (offset + 24) message day_maps origin t latest_ext
return (s+1,e)
-- | Unpacks a message starting from the given offset. If it corresponds
-- to a simple point, the 'Payload' will be the value; if extended,
-- the 'Payload' will be the number of bytes in the value.
| 2,442
|
processPoints offset message day_maps origin latest_simple latest_ext
| fromIntegral offset >= S.length message = do
modify (\s -> s { latestSimple = latest_simple
, latestExtended = latest_ext })
return (0,0)
| otherwise = do
let (address, time, payload) = runUnpacking (parseMessageAt offset) message
let (simple_epoch, simple_buckets) = lookupFirst time (fst day_maps)
-- The LSB of the address lets us know if it is an extended message or
-- not. Set means extended.
if isAddressExtended address
then do
let len = fromIntegral payload
let str | len == 0 = "" -- will fail bounds check without this
| otherwise =
runUnpacking (getBytesAt (offset + 24) len) message
let (ext_epoch, ext_buckets) = lookupFirst time (snd day_maps)
let ext_bucket = calculateBucketNumber ext_buckets address
appendExtended ext_epoch ext_bucket address time len str
let !t | time > latest_ext = time
| otherwise = latest_ext
(s,e) <- processPoints (offset + 24 + len) message day_maps origin latest_simple t
return (s,e+1)
else do
let message_bytes = runUnpacking (getBytesAt offset 24) message
let simple_bucket = calculateBucketNumber simple_buckets address
appendSimple simple_epoch simple_bucket message_bytes
let !t | time > latest_simple = time
| otherwise = latest_simple
(s,e) <- processPoints (offset + 24) message day_maps origin t latest_ext
return (s+1,e)
-- | Unpacks a message starting from the given offset. If it corresponds
-- to a simple point, the 'Payload' will be the value; if extended,
-- the 'Payload' will be the number of bytes in the value.
| 2,010
| true
| true
| 0
| 19
| 907
| 556
| 269
| 287
| null | null |
facebookincubator/duckling
|
Duckling/Time/RO/Rules.hs
|
bsd-3-clause
|
ruleHhmmss :: Rule
ruleHhmmss = Rule
{ name = "hh:mm:ss"
, pattern =
[ regex "((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)[:.]([0-5]\\d)"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:ss:_)):_) -> do
h <- parseInt hh
m <- parseInt mm
s <- parseInt ss
tt $ hourMinuteSecond True h m s
_ -> Nothing
}
| 381
|
ruleHhmmss :: Rule
ruleHhmmss = Rule
{ name = "hh:mm:ss"
, pattern =
[ regex "((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)[:.]([0-5]\\d)"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:ss:_)):_) -> do
h <- parseInt hh
m <- parseInt mm
s <- parseInt ss
tt $ hourMinuteSecond True h m s
_ -> Nothing
}
| 381
|
ruleHhmmss = Rule
{ name = "hh:mm:ss"
, pattern =
[ regex "((?:[01]?\\d)|(?:2[0-3]))[:.]([0-5]\\d)[:.]([0-5]\\d)"
]
, prod = \tokens -> case tokens of
(Token RegexMatch (GroupMatch (hh:mm:ss:_)):_) -> do
h <- parseInt hh
m <- parseInt mm
s <- parseInt ss
tt $ hourMinuteSecond True h m s
_ -> Nothing
}
| 362
| false
| true
| 0
| 20
| 113
| 147
| 71
| 76
| null | null |
osa1/rho-torrent
|
test/Rho/BitfieldSpec.hs
|
bsd-3-clause
|
spec :: Spec
spec = do
describe "bitfield properties" $ do
modifyMaxSuccess (const 1000) $ prop "random generation from bytestring and bit checking" $ \bs ->
ioProperty $ do
bf <- BF.fromBS (B.pack bs) (length bs * 8)
rets <- zipWithM (\byteIdx byte ->
forM [0..7] $ \bitIdx -> do
bfRet <- BF.test bf (byteIdx * 8 + bitIdx)
return $ bfRet == testBit byte (7 - bitIdx)) [0..] bs
return $ and (concat rets)
modifyMaxSuccess (const 1000) $ prop "random generation from indexes and bit checking" $
\(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.fromBitIdxs idxs' (maximum idxs' + 1)
avails <- BF.availableBits bf
missings <- BF.missingBits bf
return $ (avails == idxs) .&&. (avails `S.intersection` missings == S.empty)
modifyMaxSuccess (const 1000) $ prop "set and test" $ \(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.empty (maximum idxs' + 1)
forM_ idxs' (BF.set bf)
tests <- forM idxs' (BF.test bf)
negTests <- forM [0..maximum idxs'] $ \idx -> if S.member idx idxs
then return True
else not <$> BF.test bf idx
return $ and tests .&&. and negTests
modifyMaxSuccess (const 1000) $ prop "bytestring conversions" $ \ws ->
ioProperty $ do
let bs = B.pack ws
bf <- BF.fromBS bs (B.length bs * 8)
bs' <- BF.toBS bf
return $ bs' == bs
fromHUnitTest $ TestLabel "ByteString conversion -- extra bits should be 0" $ TestCase $ do
bf <- BF.fromBitIdxs [0..8] 9
bs <- BF.toBS bf
assertEqual "generated ByteString is wrong" (B.pack [0xFF, 0x80]) bs
fromHUnitTest $ TestLabel "setting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.set bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "set didn't fail" ret
fromHUnitTest $ TestLabel "getting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.test bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "test didn't fail" ret
describe "bitfield edge cases (extra trailing zero bits)" $ do
fromHUnitTest $ TestLabel "extra bits should be ignored" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0xFF]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertBool "missings are not empty" (S.null missings)
assertEqual "available bits are wrong" (S.fromList [0..9]) avails
fromHUnitTest $ TestLabel "all bits up to extra bits should count" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0x00]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertEqual "missing bits are wrong" (S.fromList [8, 9]) missings
assertEqual "available bits are wrong" (S.fromList [0..7]) avails
describe "checkRange" $ do
fromHUnitTest $ TestLabel "checkRange from bitIdxs (out-of-range bits)" $ TestCase $ do
bf <- BF.fromBitIdxs [4..20] 10
ret1 <- BF.checkRange bf 4 30
assertBool "range check is wrong" ret1
| 3,366
|
spec :: Spec
spec = do
describe "bitfield properties" $ do
modifyMaxSuccess (const 1000) $ prop "random generation from bytestring and bit checking" $ \bs ->
ioProperty $ do
bf <- BF.fromBS (B.pack bs) (length bs * 8)
rets <- zipWithM (\byteIdx byte ->
forM [0..7] $ \bitIdx -> do
bfRet <- BF.test bf (byteIdx * 8 + bitIdx)
return $ bfRet == testBit byte (7 - bitIdx)) [0..] bs
return $ and (concat rets)
modifyMaxSuccess (const 1000) $ prop "random generation from indexes and bit checking" $
\(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.fromBitIdxs idxs' (maximum idxs' + 1)
avails <- BF.availableBits bf
missings <- BF.missingBits bf
return $ (avails == idxs) .&&. (avails `S.intersection` missings == S.empty)
modifyMaxSuccess (const 1000) $ prop "set and test" $ \(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.empty (maximum idxs' + 1)
forM_ idxs' (BF.set bf)
tests <- forM idxs' (BF.test bf)
negTests <- forM [0..maximum idxs'] $ \idx -> if S.member idx idxs
then return True
else not <$> BF.test bf idx
return $ and tests .&&. and negTests
modifyMaxSuccess (const 1000) $ prop "bytestring conversions" $ \ws ->
ioProperty $ do
let bs = B.pack ws
bf <- BF.fromBS bs (B.length bs * 8)
bs' <- BF.toBS bf
return $ bs' == bs
fromHUnitTest $ TestLabel "ByteString conversion -- extra bits should be 0" $ TestCase $ do
bf <- BF.fromBitIdxs [0..8] 9
bs <- BF.toBS bf
assertEqual "generated ByteString is wrong" (B.pack [0xFF, 0x80]) bs
fromHUnitTest $ TestLabel "setting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.set bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "set didn't fail" ret
fromHUnitTest $ TestLabel "getting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.test bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "test didn't fail" ret
describe "bitfield edge cases (extra trailing zero bits)" $ do
fromHUnitTest $ TestLabel "extra bits should be ignored" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0xFF]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertBool "missings are not empty" (S.null missings)
assertEqual "available bits are wrong" (S.fromList [0..9]) avails
fromHUnitTest $ TestLabel "all bits up to extra bits should count" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0x00]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertEqual "missing bits are wrong" (S.fromList [8, 9]) missings
assertEqual "available bits are wrong" (S.fromList [0..7]) avails
describe "checkRange" $ do
fromHUnitTest $ TestLabel "checkRange from bitIdxs (out-of-range bits)" $ TestCase $ do
bf <- BF.fromBitIdxs [4..20] 10
ret1 <- BF.checkRange bf 4 30
assertBool "range check is wrong" ret1
| 3,366
|
spec = do
describe "bitfield properties" $ do
modifyMaxSuccess (const 1000) $ prop "random generation from bytestring and bit checking" $ \bs ->
ioProperty $ do
bf <- BF.fromBS (B.pack bs) (length bs * 8)
rets <- zipWithM (\byteIdx byte ->
forM [0..7] $ \bitIdx -> do
bfRet <- BF.test bf (byteIdx * 8 + bitIdx)
return $ bfRet == testBit byte (7 - bitIdx)) [0..] bs
return $ and (concat rets)
modifyMaxSuccess (const 1000) $ prop "random generation from indexes and bit checking" $
\(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.fromBitIdxs idxs' (maximum idxs' + 1)
avails <- BF.availableBits bf
missings <- BF.missingBits bf
return $ (avails == idxs) .&&. (avails `S.intersection` missings == S.empty)
modifyMaxSuccess (const 1000) $ prop "set and test" $ \(Idxs idxs) -> ioProperty $ do
let idxs' = S.toList idxs
bf <- BF.empty (maximum idxs' + 1)
forM_ idxs' (BF.set bf)
tests <- forM idxs' (BF.test bf)
negTests <- forM [0..maximum idxs'] $ \idx -> if S.member idx idxs
then return True
else not <$> BF.test bf idx
return $ and tests .&&. and negTests
modifyMaxSuccess (const 1000) $ prop "bytestring conversions" $ \ws ->
ioProperty $ do
let bs = B.pack ws
bf <- BF.fromBS bs (B.length bs * 8)
bs' <- BF.toBS bf
return $ bs' == bs
fromHUnitTest $ TestLabel "ByteString conversion -- extra bits should be 0" $ TestCase $ do
bf <- BF.fromBitIdxs [0..8] 9
bs <- BF.toBS bf
assertEqual "generated ByteString is wrong" (B.pack [0xFF, 0x80]) bs
fromHUnitTest $ TestLabel "setting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.set bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "set didn't fail" ret
fromHUnitTest $ TestLabel "getting invalid bit should fail with error" $ TestCase $ do
bf <- BF.empty 0
ret <- catch (BF.test bf 0 >> return False) (\(_ :: ErrorCall) -> return True)
assertBool "test didn't fail" ret
describe "bitfield edge cases (extra trailing zero bits)" $ do
fromHUnitTest $ TestLabel "extra bits should be ignored" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0xFF]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertBool "missings are not empty" (S.null missings)
assertEqual "available bits are wrong" (S.fromList [0..9]) avails
fromHUnitTest $ TestLabel "all bits up to extra bits should count" $ TestCase $ do
bf <- BF.fromBS (B.pack [0xFF, 0x00]) 10
missings <- BF.missingBits bf
avails <- BF.availableBits bf
assertEqual "missing bits are wrong" (S.fromList [8, 9]) missings
assertEqual "available bits are wrong" (S.fromList [0..7]) avails
describe "checkRange" $ do
fromHUnitTest $ TestLabel "checkRange from bitIdxs (out-of-range bits)" $ TestCase $ do
bf <- BF.fromBitIdxs [4..20] 10
ret1 <- BF.checkRange bf 4 30
assertBool "range check is wrong" ret1
| 3,353
| false
| true
| 0
| 27
| 1,035
| 1,163
| 537
| 626
| null | null |
rjregenold/chutes-and-ladders
|
Game/ChutesAndLadders/Player.hs
|
mit
|
playerBoxes :: [Player] -> [(Int, Box)]
playerBoxes ps = map f ps' where
ps' = groupPlayers ps
f x = foldr g (0, nullBox) x
g x acc = (currentIndex x, punctuateH left (char ' ') . noNulls $ boxes x ++ [snd acc])
| 217
|
playerBoxes :: [Player] -> [(Int, Box)]
playerBoxes ps = map f ps' where
ps' = groupPlayers ps
f x = foldr g (0, nullBox) x
g x acc = (currentIndex x, punctuateH left (char ' ') . noNulls $ boxes x ++ [snd acc])
| 217
|
playerBoxes ps = map f ps' where
ps' = groupPlayers ps
f x = foldr g (0, nullBox) x
g x acc = (currentIndex x, punctuateH left (char ' ') . noNulls $ boxes x ++ [snd acc])
| 177
| false
| true
| 0
| 13
| 49
| 117
| 60
| 57
| null | null |
apyrgio/ganeti
|
src/Ganeti/Constants.hs
|
bsd-2-clause
|
hvKvmFlag :: String
hvKvmFlag = "kvm_flag"
| 42
|
hvKvmFlag :: String
hvKvmFlag = "kvm_flag"
| 42
|
hvKvmFlag = "kvm_flag"
| 22
| false
| true
| 0
| 4
| 5
| 11
| 6
| 5
| null | null |
bhamrick/fixalgs
|
Data/FAlgebra/Tree/Zipper.hs
|
bsd-3-clause
|
up :: FAlgebra (TreeF a) t => TreeZip a t -> TreeZip a t
up (TreeZip t p) = case coalg p of
Root -> TreeZip t p
LBranch a t' p' -> TreeZip (branch a t t') p'
RBranch a t' p' -> TreeZip (branch a t' t) p'
-- Zippers have a natural F-Coalgebra structure
-- This allows us to use `left` and `right` for zippers as well.
| 329
|
up :: FAlgebra (TreeF a) t => TreeZip a t -> TreeZip a t
up (TreeZip t p) = case coalg p of
Root -> TreeZip t p
LBranch a t' p' -> TreeZip (branch a t t') p'
RBranch a t' p' -> TreeZip (branch a t' t) p'
-- Zippers have a natural F-Coalgebra structure
-- This allows us to use `left` and `right` for zippers as well.
| 329
|
up (TreeZip t p) = case coalg p of
Root -> TreeZip t p
LBranch a t' p' -> TreeZip (branch a t t') p'
RBranch a t' p' -> TreeZip (branch a t' t) p'
-- Zippers have a natural F-Coalgebra structure
-- This allows us to use `left` and `right` for zippers as well.
| 272
| false
| true
| 0
| 10
| 82
| 131
| 61
| 70
| null | null |
zenhack/haskell-capnp
|
lib/Capnp/Bits.hs
|
mit
|
-- | Convert bits to bytes. Rounds up.
bitsToBytesCeil :: BitCount -> ByteCount
bitsToBytesCeil (BitCount n) = ByteCount ((n + 7) `div` 8)
| 138
|
bitsToBytesCeil :: BitCount -> ByteCount
bitsToBytesCeil (BitCount n) = ByteCount ((n + 7) `div` 8)
| 99
|
bitsToBytesCeil (BitCount n) = ByteCount ((n + 7) `div` 8)
| 58
| true
| true
| 0
| 9
| 22
| 48
| 25
| 23
| null | null |
dylex/wai
|
warp/test/HTTP.hs
|
mit
|
sendGETwH :: String -> [Header] -> IO (Response String)
sendGETwH url hdr = unResult $ simpleHTTP $ (getRequest url) { rqHeaders = hdr }
| 136
|
sendGETwH :: String -> [Header] -> IO (Response String)
sendGETwH url hdr = unResult $ simpleHTTP $ (getRequest url) { rqHeaders = hdr }
| 136
|
sendGETwH url hdr = unResult $ simpleHTTP $ (getRequest url) { rqHeaders = hdr }
| 80
| false
| true
| 0
| 9
| 23
| 58
| 30
| 28
| null | null |
meteogrid/bindings-gdal
|
tests/OGRSpec.hs
|
bsd-3-clause
|
main :: IO ()
main = hspec spec
| 31
|
main :: IO ()
main = hspec spec
| 31
|
main = hspec spec
| 17
| false
| true
| 0
| 6
| 7
| 19
| 9
| 10
| null | null |
kylcarte/qclib
|
src/.Db.hs
|
bsd-3-clause
|
fldPPrefersEmail = "prefersemail"
| 33
|
fldPPrefersEmail = "prefersemail"
| 33
|
fldPPrefersEmail = "prefersemail"
| 33
| false
| false
| 0
| 4
| 2
| 6
| 3
| 3
| null | null |
ghcjs/jsaddle-dom
|
src/JSDOM/Generated/Document.hs
|
mit
|
-- | <https://developer.mozilla.org/en-US/docs/Web/API/Document Mozilla Document documentation>
newDocument :: (MonadDOM m) => m Document
newDocument = liftDOM (Document <$> new (jsg "Document") ())
| 199
|
newDocument :: (MonadDOM m) => m Document
newDocument = liftDOM (Document <$> new (jsg "Document") ())
| 102
|
newDocument = liftDOM (Document <$> new (jsg "Document") ())
| 60
| true
| true
| 0
| 10
| 22
| 47
| 24
| 23
| null | null |
andorp/bead
|
src/Bead/Controller/UserStories.hs
|
bsd-3-clause
|
nonAdministratedAssignment = msg_UserStoryError_NonAdministratedAssignment "This assignment is not administrated by you."
| 121
|
nonAdministratedAssignment = msg_UserStoryError_NonAdministratedAssignment "This assignment is not administrated by you."
| 121
|
nonAdministratedAssignment = msg_UserStoryError_NonAdministratedAssignment "This assignment is not administrated by you."
| 121
| false
| false
| 0
| 5
| 9
| 9
| 4
| 5
| null | null |
flocc-net/flocc
|
v0.1/Compiler/Types/DepTypeAssignment.hs
|
apache-2.0
|
applyTermSubst :: TyTerm -> TyTerm -> TyTerm -> TyTerm
applyTermSubst a b c = case c of
_ | a == c -> b
Term t l -> Term t $ map (applyTermSubst a b) l
other -> other
-- |Pretty print type scheme
| 203
|
applyTermSubst :: TyTerm -> TyTerm -> TyTerm -> TyTerm
applyTermSubst a b c = case c of
_ | a == c -> b
Term t l -> Term t $ map (applyTermSubst a b) l
other -> other
-- |Pretty print type scheme
| 203
|
applyTermSubst a b c = case c of
_ | a == c -> b
Term t l -> Term t $ map (applyTermSubst a b) l
other -> other
-- |Pretty print type scheme
| 148
| false
| true
| 0
| 11
| 51
| 94
| 43
| 51
| null | null |
xu-hao/QueryArrow
|
QueryArrow-common/src/QueryArrow/Syntax/Term.hs
|
bsd-3-clause
|
cartProds :: Ord a => [Set (Set a)] -> Set (Set a)
cartProds = foldl cartProd (Set.singleton bottom)
| 100
|
cartProds :: Ord a => [Set (Set a)] -> Set (Set a)
cartProds = foldl cartProd (Set.singleton bottom)
| 100
|
cartProds = foldl cartProd (Set.singleton bottom)
| 49
| false
| true
| 0
| 11
| 17
| 62
| 28
| 34
| null | null |
Fuuzetsu/haddock
|
haddock-api/src/Haddock/Backends/Xhtml/Decl.hs
|
bsd-2-clause
|
ppr_mono_ty _ (HsTyLit n) _ _ _ = ppr_tylit n
| 45
|
ppr_mono_ty _ (HsTyLit n) _ _ _ = ppr_tylit n
| 45
|
ppr_mono_ty _ (HsTyLit n) _ _ _ = ppr_tylit n
| 45
| false
| false
| 0
| 7
| 9
| 26
| 12
| 14
| null | null |
wilbowma/accelerate
|
Data/Array/Accelerate/Interpreter.hs
|
bsd-3-clause
|
evalFromIntegral :: IntegralType a -> NumType b -> a -> b
evalFromIntegral ta (IntegralNumType tb)
| IntegralDict <- integralDict ta
, IntegralDict <- integralDict tb = fromIntegral
| 185
|
evalFromIntegral :: IntegralType a -> NumType b -> a -> b
evalFromIntegral ta (IntegralNumType tb)
| IntegralDict <- integralDict ta
, IntegralDict <- integralDict tb = fromIntegral
| 185
|
evalFromIntegral ta (IntegralNumType tb)
| IntegralDict <- integralDict ta
, IntegralDict <- integralDict tb = fromIntegral
| 127
| false
| true
| 0
| 9
| 30
| 64
| 29
| 35
| null | null |
rahulmutt/ghcvm
|
compiler/Eta/SimplCore/CoreMonad.hs
|
bsd-3-clause
|
write :: CoreWriter -> CoreM ()
write w = CoreM (\s -> return ((), s, w))
| 73
|
write :: CoreWriter -> CoreM ()
write w = CoreM (\s -> return ((), s, w))
| 73
|
write w = CoreM (\s -> return ((), s, w))
| 41
| false
| true
| 0
| 10
| 15
| 53
| 26
| 27
| null | null |
AndreasVoellmy/openflow
|
src/Network/Data/OF13/Message.hs
|
bsd-3-clause
|
toField hasMask 25 =
(\x y -> OXM { oxmOFField = ARP_THA x y, oxmHasMask = hasMask }) <$>
getEthernetAddress <*> if hasMask then getEthernetAddress else return (-1)
| 169
|
toField hasMask 25 =
(\x y -> OXM { oxmOFField = ARP_THA x y, oxmHasMask = hasMask }) <$>
getEthernetAddress <*> if hasMask then getEthernetAddress else return (-1)
| 169
|
toField hasMask 25 =
(\x y -> OXM { oxmOFField = ARP_THA x y, oxmHasMask = hasMask }) <$>
getEthernetAddress <*> if hasMask then getEthernetAddress else return (-1)
| 169
| false
| false
| 0
| 11
| 32
| 64
| 35
| 29
| null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.