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
shayan-najd/HsParser
OutputableInstances.hs
gpl-3.0
ppr_expr (HsSpliceE s) = pprSplice s
44
ppr_expr (HsSpliceE s) = pprSplice s
44
ppr_expr (HsSpliceE s) = pprSplice s
44
false
false
0
6
13
19
8
11
null
null
jwiegley/ghc-release
utils/hsc2hs/CrossCodegen.hs
gpl-3.0
testFail :: SourcePos -> String -> TestMonad a testFail (SourcePos file line) s = testFail' (file ++ ":" ++ show line ++ " " ++ s)
130
testFail :: SourcePos -> String -> TestMonad a testFail (SourcePos file line) s = testFail' (file ++ ":" ++ show line ++ " " ++ s)
130
testFail (SourcePos file line) s = testFail' (file ++ ":" ++ show line ++ " " ++ s)
83
false
true
0
10
25
64
30
34
null
null
schell/odin
odin-engine/src/Odin/Engine.hs
mit
getMousePosition :: Mutate Ui m => m (V2 Int) getMousePosition = uiMousePos <$> get
83
getMousePosition :: Mutate Ui m => m (V2 Int) getMousePosition = uiMousePos <$> get
83
getMousePosition = uiMousePos <$> get
37
false
true
0
9
13
39
17
22
null
null
DavidEichmann/boger-banana
src/Reactive/Banana/BOGRE.hs
bsd-3-clause
-- |Gets a 'Behavior' or random values. This can be called multiple times to get multiple different random 'Behavior's: -- -- @ -- r1B <- getRandomB -- r2B <- getRandomB -- @ -- -- In this case @r1B@ and @r2B@ will be 2 separately generated randome values. -- Note that values will be generated according to how 'a' is defined as an instance of the 'Random' class. getRandomB :: (Frameworks t, Random a) => Moment t (Behavior t a) getRandomB = fromPoll randomIO
461
getRandomB :: (Frameworks t, Random a) => Moment t (Behavior t a) getRandomB = fromPoll randomIO
96
getRandomB = fromPoll randomIO
30
true
true
0
9
82
57
31
26
null
null
tokiwoousaka/ttask
src/Data/TTask/Types/Part.hs
bsd-3-clause
statusToList' :: TStatus -> [TStatusRecord] statusToList' (TStatusOne x) = [x]
78
statusToList' :: TStatus -> [TStatusRecord] statusToList' (TStatusOne x) = [x]
78
statusToList' (TStatusOne x) = [x]
34
false
true
0
6
9
34
17
17
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Elements/Interactive.hs
bsd-3-clause
-- | A short-hand notion for @ el \"details\" ... @ detailsN ∷ forall t m a. DomBuilder t m ⇒ m a → m a detailsN children = snd <$> detailsN' children
150
detailsN ∷ forall t m a. DomBuilder t m ⇒ m a → m a detailsN children = snd <$> detailsN' children
98
detailsN children = snd <$> detailsN' children
46
true
true
0
8
32
48
24
24
null
null
Dridus/embot
src/Embot/Slack.hs
bsd-3-clause
asChannelID :: ID Chat -> Maybe (ID Channel) asChannelID = asTypedID
68
asChannelID :: ID Chat -> Maybe (ID Channel) asChannelID = asTypedID
68
asChannelID = asTypedID
23
false
true
0
8
10
27
13
14
null
null
flyrry/phonypony
src/StupidBot/Goal.hs
mit
amWinning :: State -> Bool amWinning s = let enemies = getEnemies s me = stateHero s in 2 * (heroMineCount me) > (maximum $ map heroMineCount enemies)
165
amWinning :: State -> Bool amWinning s = let enemies = getEnemies s me = stateHero s in 2 * (heroMineCount me) > (maximum $ map heroMineCount enemies)
165
amWinning s = let enemies = getEnemies s me = stateHero s in 2 * (heroMineCount me) > (maximum $ map heroMineCount enemies)
138
false
true
1
9
42
73
33
40
null
null
rueshyna/gogol
gogol-container/gen/Network/Google/Resource/Container/Projects/Zones/Clusters/NodePools/SetManagement.hs
mpl-2.0
-- | OAuth access token. pzcnpsmAccessToken :: Lens' ProjectsZonesClustersNodePoolsSetManagement (Maybe Text) pzcnpsmAccessToken = lens _pzcnpsmAccessToken (\ s a -> s{_pzcnpsmAccessToken = a})
201
pzcnpsmAccessToken :: Lens' ProjectsZonesClustersNodePoolsSetManagement (Maybe Text) pzcnpsmAccessToken = lens _pzcnpsmAccessToken (\ s a -> s{_pzcnpsmAccessToken = a})
176
pzcnpsmAccessToken = lens _pzcnpsmAccessToken (\ s a -> s{_pzcnpsmAccessToken = a})
91
true
true
1
9
29
52
25
27
null
null
Dronte/Operads
examples/example.hs
bsd-3-clause
gbn2 = stepInitialOperadicBuchberger 4 gb1 gbn1
47
gbn2 = stepInitialOperadicBuchberger 4 gb1 gbn1
47
gbn2 = stepInitialOperadicBuchberger 4 gb1 gbn1
47
false
false
0
5
5
13
6
7
null
null
nikivazou/verified_string_matching
src/Proofs/DistributeToSM.hs
bsd-3-clause
mergeNewIndices :: RString -> RString -> RString -> Proof {-@ mergeNewIndices :: tg:RString -> x1:RStringNE -> x2:RStringNE -> {append (makeSMIndices x1 tg) (makeNewIndices x1 x2 tg) == makeIndices (x1 <+> x2) tg 0 (stringLen x1 - 1)} @-} mergeNewIndices tg x1 x2 | stringLen tg < 2 = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` N ==. makeIndices x1 tg 0 hi ? appendNil (makeIndices x1 tg 0 hi) ==. makeIndices x tg 0 hi ? concatMakeIndices 0 hi tg x1 x2 *** QED | stringLen x1 < stringLen tg = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. N `append` makeIndices x tg 0 hi ? makeIndicesNull x1 tg 0 hi ==. makeIndices x tg 0 hi *** QED | otherwise {- stringLen tg <= stringLen x1 -} = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeIndices x tg lo hi ==. makeIndices x tg 0 mid `append` makeIndices x tg (mid+1) hi ? catIndices x1 x2 tg 0 hi ==. makeIndices x tg 0 hi ? mergeIndices x tg 0 mid hi *** QED where x = x1 <+> x2 lo = maxInt (mid+1) 0 mid = stringLen x1 - stringLen tg hi = stringLen x1 - 1 #else distributestoSM :: forall (target :: Symbol). (KnownSymbol target) => SM target -> RString -> RString -> Proof {-@ distributestoSM :: SM target -> x1:RString -> x2:RString -> {toSM (x1 <+> x2) == (toSM x1) <> (toSM x2)} @-} distributestoSM _ _ _ = trivial #endif
1,734
mergeNewIndices :: RString -> RString -> RString -> Proof mergeNewIndices tg x1 x2 | stringLen tg < 2 = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` N ==. makeIndices x1 tg 0 hi ? appendNil (makeIndices x1 tg 0 hi) ==. makeIndices x tg 0 hi ? concatMakeIndices 0 hi tg x1 x2 *** QED | stringLen x1 < stringLen tg = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. N `append` makeIndices x tg 0 hi ? makeIndicesNull x1 tg 0 hi ==. makeIndices x tg 0 hi *** QED | otherwise {- stringLen tg <= stringLen x1 -} = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeIndices x tg lo hi ==. makeIndices x tg 0 mid `append` makeIndices x tg (mid+1) hi ? catIndices x1 x2 tg 0 hi ==. makeIndices x tg 0 hi ? mergeIndices x tg 0 mid hi *** QED where x = x1 <+> x2 lo = maxInt (mid+1) 0 mid = stringLen x1 - stringLen tg hi = stringLen x1 - 1 #else distributestoSM :: forall (target :: Symbol). (KnownSymbol target) => SM target -> RString -> RString -> Proof {-@ distributestoSM :: SM target -> x1:RString -> x2:RString -> {toSM (x1 <+> x2) == (toSM x1) <> (toSM x2)} @-} distributestoSM _ _ _ = trivial #endif
1,550
mergeNewIndices tg x1 x2 | stringLen tg < 2 = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` N ==. makeIndices x1 tg 0 hi ? appendNil (makeIndices x1 tg 0 hi) ==. makeIndices x tg 0 hi ? concatMakeIndices 0 hi tg x1 x2 *** QED | stringLen x1 < stringLen tg = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. N `append` makeIndices x tg 0 hi ? makeIndicesNull x1 tg 0 hi ==. makeIndices x tg 0 hi *** QED | otherwise {- stringLen tg <= stringLen x1 -} = makeSMIndices x1 tg `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeNewIndices x1 x2 tg ==. makeIndices x1 tg 0 hi `append` makeIndices x tg lo hi ==. makeIndices x tg 0 mid `append` makeIndices x tg (mid+1) hi ? catIndices x1 x2 tg 0 hi ==. makeIndices x tg 0 hi ? mergeIndices x tg 0 mid hi *** QED where x = x1 <+> x2 lo = maxInt (mid+1) 0 mid = stringLen x1 - stringLen tg hi = stringLen x1 - 1 #else distributestoSM :: forall (target :: Symbol). (KnownSymbol target) => SM target -> RString -> RString -> Proof {-@ distributestoSM :: SM target -> x1:RString -> x2:RString -> {toSM (x1 <+> x2) == (toSM x1) <> (toSM x2)} @-} distributestoSM _ _ _ = trivial #endif
1,492
true
true
21
12
475
498
248
250
null
null
tcrayford/hitcask
Database/Hitcask/Get.hs
bsd-3-clause
get :: Hitcask -> Key -> IO (Maybe Value) get h key = liftM removeDeletion $ readValue h key
92
get :: Hitcask -> Key -> IO (Maybe Value) get h key = liftM removeDeletion $ readValue h key
92
get h key = liftM removeDeletion $ readValue h key
50
false
true
0
9
18
49
22
27
null
null
wavewave/lhc-analysis-collection
exe/2013-07-22-SimplifiedSUSYlep.hs
gpl-3.0
p_squark :: DDecay p_squark = d ( squarkL, [ p_chargino, t jets ] )
68
p_squark :: DDecay p_squark = d ( squarkL, [ p_chargino, t jets ] )
67
p_squark = d ( squarkL, [ p_chargino, t jets ] )
48
false
true
0
8
14
29
16
13
null
null
wiggly/functional-pokering
src/ParallelMain.hs
mit
calcEquity :: Int -> Int -> [Card] -> [HoleCards] -> [ShowdownTally] calcEquity min max deck hands = let usedCards = foldr (\(HoleCards x y) acc -> x:y:acc ) [] hands deckx = standardDeck \\ usedCards generator = generateBoard deck boards = [ generator i | i <- [min..max] ] blankTallies = replicate (length hands) blankTally in foldl' go blankTallies boards where go total board = zipWith addTally (pokerEquity board hands) $!! total
612
calcEquity :: Int -> Int -> [Card] -> [HoleCards] -> [ShowdownTally] calcEquity min max deck hands = let usedCards = foldr (\(HoleCards x y) acc -> x:y:acc ) [] hands deckx = standardDeck \\ usedCards generator = generateBoard deck boards = [ generator i | i <- [min..max] ] blankTallies = replicate (length hands) blankTally in foldl' go blankTallies boards where go total board = zipWith addTally (pokerEquity board hands) $!! total
612
calcEquity min max deck hands = let usedCards = foldr (\(HoleCards x y) acc -> x:y:acc ) [] hands deckx = standardDeck \\ usedCards generator = generateBoard deck boards = [ generator i | i <- [min..max] ] blankTallies = replicate (length hands) blankTally in foldl' go blankTallies boards where go total board = zipWith addTally (pokerEquity board hands) $!! total
543
false
true
0
13
249
190
95
95
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Identifies what kind of resource this is. Value: the fixed string -- \"\`content#productStatus\`\" ppKind :: Lens' ProductStatus (Maybe Text) ppKind = lens _ppKind (\ s a -> s{_ppKind = a})
194
ppKind :: Lens' ProductStatus (Maybe Text) ppKind = lens _ppKind (\ s a -> s{_ppKind = a})
90
ppKind = lens _ppKind (\ s a -> s{_ppKind = a})
47
true
true
0
9
31
47
26
21
null
null
Mr-Click/PFQ
Development/SimpleBuilder.hs
gpl-2.0
-- Predefined commands cabalConfigure = BareCmd "runhaskell Setup configure --user"
84
cabalConfigure = BareCmd "runhaskell Setup configure --user"
60
cabalConfigure = BareCmd "runhaskell Setup configure --user"
60
true
false
1
5
10
13
5
8
null
null
caperren/Archives
OSU Coursework/CS 381 - Programming Language Fundamentals/Homework 4/StackRank.perrenc.hs
gpl-3.0
cmd Swap (n:k:s) = Just (k:n:s)
35
cmd Swap (n:k:s) = Just (k:n:s)
35
cmd Swap (n:k:s) = Just (k:n:s)
35
false
false
0
8
9
38
18
20
null
null
olorin/amazonka
amazonka-ml/gen/Network/AWS/MachineLearning/Types/Product.hs
mpl-2.0
-- | Undocumented member. pmProperties :: Lens' PerformanceMetrics (HashMap Text Text) pmProperties = lens _pmProperties (\ s a -> s{_pmProperties = a}) . _Default . _Map
170
pmProperties :: Lens' PerformanceMetrics (HashMap Text Text) pmProperties = lens _pmProperties (\ s a -> s{_pmProperties = a}) . _Default . _Map
144
pmProperties = lens _pmProperties (\ s a -> s{_pmProperties = a}) . _Default . _Map
83
true
true
0
11
25
56
30
26
null
null
franckrasolo/pepino
core/src/Pepino/Renderers/Ansi.hs
bsd-3-clause
asDocs :: (Pretty a) => [a] -> Doc asDocs xs = vsep (map pretty xs) <> linebreak
80
asDocs :: (Pretty a) => [a] -> Doc asDocs xs = vsep (map pretty xs) <> linebreak
80
asDocs xs = vsep (map pretty xs) <> linebreak
45
false
true
0
8
16
45
23
22
null
null
iblumenfeld/saw-core
src/Verifier/SAW/Simulator/Value.hs
bsd-3-clause
apply :: Monad m => Value m b w e -> Thunk m b w e -> m (Value m b w e) apply (VFun f) x = f x
94
apply :: Monad m => Value m b w e -> Thunk m b w e -> m (Value m b w e) apply (VFun f) x = f x
94
apply (VFun f) x = f x
22
false
true
0
10
29
73
34
39
null
null
crzysdrs/griddle
src/Steam/BinVDF.hs
gpl-2.0
jsonVDF _ = error "JSONVDF Type Should Not Be Emitted"
54
jsonVDF _ = error "JSONVDF Type Should Not Be Emitted"
54
jsonVDF _ = error "JSONVDF Type Should Not Be Emitted"
54
false
false
0
5
9
12
5
7
null
null
shlevy/ghc
compiler/basicTypes/Literal.hs
bsd-3-clause
mapLitValue _ f (LitInteger i t) = mkLitInteger (f i) t
60
mapLitValue _ f (LitInteger i t) = mkLitInteger (f i) t
60
mapLitValue _ f (LitInteger i t) = mkLitInteger (f i) t
60
false
false
1
7
15
34
15
19
null
null
kawu/dawg
src/Data/DAWG/Static.hs
bsd-2-clause
freeze :: D.DAWG a b -> DAWG a () b freeze d = flip DAWG 0 . V.fromList $ map (N.fromDyn newID . oldBy) (M.elems (inverse old2new)) where -- Map from old to new identifiers. The root identifier is mapped to 0. old2new = M.fromList $ (D.root d, 0) : zip (nodeIDs d) [1..] newID = (M.!) old2new -- List of node IDs without the root ID. nodeIDs = filter (/= D.root d) . map fst . M.assocs . G.nodeMap . D.graph -- Non-frozen node by given identifier. oldBy i = G.nodeBy i (D.graph d) -- | Inverse of the map.
560
freeze :: D.DAWG a b -> DAWG a () b freeze d = flip DAWG 0 . V.fromList $ map (N.fromDyn newID . oldBy) (M.elems (inverse old2new)) where -- Map from old to new identifiers. The root identifier is mapped to 0. old2new = M.fromList $ (D.root d, 0) : zip (nodeIDs d) [1..] newID = (M.!) old2new -- List of node IDs without the root ID. nodeIDs = filter (/= D.root d) . map fst . M.assocs . G.nodeMap . D.graph -- Non-frozen node by given identifier. oldBy i = G.nodeBy i (D.graph d) -- | Inverse of the map.
560
freeze d = flip DAWG 0 . V.fromList $ map (N.fromDyn newID . oldBy) (M.elems (inverse old2new)) where -- Map from old to new identifiers. The root identifier is mapped to 0. old2new = M.fromList $ (D.root d, 0) : zip (nodeIDs d) [1..] newID = (M.!) old2new -- List of node IDs without the root ID. nodeIDs = filter (/= D.root d) . map fst . M.assocs . G.nodeMap . D.graph -- Non-frozen node by given identifier. oldBy i = G.nodeBy i (D.graph d) -- | Inverse of the map.
524
false
true
0
12
155
204
103
101
null
null
uduki/hsQt
Qtc/Enums/Gui/QAbstractItemView.hs
bsd-2-clause
eMovePageUp :: CursorAction eMovePageUp = ieCursorAction $ 6
62
eMovePageUp :: CursorAction eMovePageUp = ieCursorAction $ 6
62
eMovePageUp = ieCursorAction $ 6
34
false
true
0
6
9
18
8
10
null
null
snowleopard/alga
src/Algebra/Graph/Labelled.hs
mit
-- | Extract the 'Context' of a subgraph specified by a given predicate. Returns -- @Nothing@ if the specified subgraph is empty. -- -- @ -- context ('const' False) x == Nothing -- context (== 1) ('edge' e 1 2) == if e == 'zero' then Just ('Context' [] []) else Just ('Context' [ ] [(e,2)]) -- context (== 2) ('edge' e 1 2) == if e == 'zero' then Just ('Context' [] []) else Just ('Context' [(e,1)] [ ]) -- context ('const' True ) ('edge' e 1 2) == if e == 'zero' then Just ('Context' [] []) else Just ('Context' [(e,1)] [(e,2)]) -- context (== 4) (3 * 1 * 4 * 1 * 5) == Just ('Context' [('one',3), ('one',1)] [('one',1), ('one',5)]) -- @ context :: (Eq e, Monoid e) => (a -> Bool) -> Graph e a -> Maybe (Context e a) context p g | ok f = Just $ Context (Exts.toList $ is f) (Exts.toList $ os f) | otherwise = Nothing where f = focus p g
928
context :: (Eq e, Monoid e) => (a -> Bool) -> Graph e a -> Maybe (Context e a) context p g | ok f = Just $ Context (Exts.toList $ is f) (Exts.toList $ os f) | otherwise = Nothing where f = focus p g
221
context p g | ok f = Just $ Context (Exts.toList $ is f) (Exts.toList $ os f) | otherwise = Nothing where f = focus p g
142
true
true
2
11
263
143
71
72
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_ALPHA32F_ARB :: GLenum gl_ALPHA32F_ARB = 0x8816
50
gl_ALPHA32F_ARB :: GLenum gl_ALPHA32F_ARB = 0x8816
50
gl_ALPHA32F_ARB = 0x8816
24
false
true
0
4
5
11
6
5
null
null
spacekitteh/compdata
src/Data/Comp/Derive/Utils.hs
bsd-3-clause
{-| This function abstracts away @newtype@ declaration, it turns them into @data@ declarations. -} abstractNewtype :: Info -> Info abstractNewtype (TyConI (NewtypeD cxt name args constr derive)) = TyConI (DataD cxt name args [constr] derive)
249
abstractNewtype :: Info -> Info abstractNewtype (TyConI (NewtypeD cxt name args constr derive)) = TyConI (DataD cxt name args [constr] derive)
146
abstractNewtype (TyConI (NewtypeD cxt name args constr derive)) = TyConI (DataD cxt name args [constr] derive)
114
true
true
0
8
42
63
31
32
null
null
ihc/futhark
src/Futhark/Representation/Primitive.hs
isc
primByteSize (FloatType t) = floatByteSize t
44
primByteSize (FloatType t) = floatByteSize t
44
primByteSize (FloatType t) = floatByteSize t
44
false
false
0
7
5
18
8
10
null
null
Enzo-Liu/cis194
src/TypeClass04.hs
bsd-3-clause
joinList xs (y:ys) = y ++ xs ++ joinList xs ys
46
joinList xs (y:ys) = y ++ xs ++ joinList xs ys
46
joinList xs (y:ys) = y ++ xs ++ joinList xs ys
46
false
false
2
6
10
34
15
19
null
null
MauriceIsAG/HaskellScratch
.stack-work/intero/intero12244UuP.hs
bsd-3-clause
repli :: [a] -> Int -> [a] repli [] _ = []
42
repli :: [a] -> Int -> [a] repli [] _ = []
42
repli [] _ = []
15
false
true
0
9
11
40
19
21
null
null
yannxia-self/code-war-hasekell-training
Reverse_list_recursively.hs
gpl-3.0
revR :: [Int] -> [Int] revR [] = []
35
revR :: [Int] -> [Int] revR [] = []
35
revR [] = []
12
false
true
0
8
8
34
16
18
null
null
noteed/rescoyl-checks
bin/rescoyl-checks.hs
bsd-3-clause
step r (ImageLayerPushed [i]) = Just -- TODO The official registry accepts re-pushing the json. --( checkPushImageJson 200 "Push correct image json." r i ( checkPushImageChecksum 200 "Push correct image checksum." r i , ImagesPushed )
242
step r (ImageLayerPushed [i]) = Just -- TODO The official registry accepts re-pushing the json. --( checkPushImageJson 200 "Push correct image json." r i ( checkPushImageChecksum 200 "Push correct image checksum." r i , ImagesPushed )
242
step r (ImageLayerPushed [i]) = Just -- TODO The official registry accepts re-pushing the json. --( checkPushImageJson 200 "Push correct image json." r i ( checkPushImageChecksum 200 "Push correct image checksum." r i , ImagesPushed )
242
false
false
0
8
43
40
21
19
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/LT_5.hs
mit
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
primCmpInt (Neg Zero) (Neg Zero) = EQ
37
false
false
0
6
6
25
11
14
null
null
PIWEEK/halisp
src/Core.hs
gpl-3.0
strDelim = char '"'
19
strDelim = char '"'
19
strDelim = char '"'
19
false
false
1
5
3
13
4
9
null
null
olsner/ghc
libraries/base/Data/Functor/Classes.hs
bsd-3-clause
-- | @'readData' p@ is a parser for datatypes where each alternative -- begins with a data constructor. It parses the constructor and -- passes it to @p@. Parsers for various constructors can be constructed -- with 'readUnaryWith' and 'readBinaryWith', and combined with -- '(<|>)' from the 'Alternative' class. -- -- @since 4.10.0.0 readData :: ReadPrec a -> ReadPrec a readData reader = parens $ prec 10 reader
414
readData :: ReadPrec a -> ReadPrec a readData reader = parens $ prec 10 reader
78
readData reader = parens $ prec 10 reader
41
true
true
0
6
69
40
22
18
null
null
drhodes/jade2hdl
src/Jade/TopLevel.hs
bsd-3-clause
terminalsOverlapP (Terminal (Coord3 x1 y1 _) _) (Terminal (Coord3 x2 y2 _) _) = (x1,y1) == (x2,y2)
101
terminalsOverlapP (Terminal (Coord3 x1 y1 _) _) (Terminal (Coord3 x2 y2 _) _) = (x1,y1) == (x2,y2)
101
terminalsOverlapP (Terminal (Coord3 x1 y1 _) _) (Terminal (Coord3 x2 y2 _) _) = (x1,y1) == (x2,y2)
101
false
false
1
9
19
67
33
34
null
null
tonymorris/java-character
src/Language/Java/Character/IsSpaceChar.hs
bsd-3-clause
isSpaceCharSet :: (Num a, Enum a, Ord a) => Diet a isSpaceCharSet = let r = [ [32] , [160] , [5760] , [6158] , [8192..8203] , [8232..8233] , [8239] , [8287] , [12288] ] in S.fromList . concat $ r
305
isSpaceCharSet :: (Num a, Enum a, Ord a) => Diet a isSpaceCharSet = let r = [ [32] , [160] , [5760] , [6158] , [8192..8203] , [8232..8233] , [8239] , [8287] , [12288] ] in S.fromList . concat $ r
305
isSpaceCharSet = let r = [ [32] , [160] , [5760] , [6158] , [8192..8203] , [8232..8233] , [8239] , [8287] , [12288] ] in S.fromList . concat $ r
250
false
true
0
10
150
114
66
48
null
null
frelindb/agsyHOL
Check.hs
mit
checkProof :: Int -> Context -> CFormula -> MetaProof -> MetaEnv MPB -- the searchdepth is here only used to limit the number of beta-reductions checkProof searchdepth = checkProofI where checkProofI ctx form prf = getFormHead form $ gheadm (True, prioProof, Nothing) (prCtx ctx >>= \pc -> prCFormula (length ctx) form >>= \pf -> return ("checkProof : " ++ pc ++ " : " ++ pf)) prf $ \prf -> case prf of Intro prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProof.Intro") (compute searchdepth form) $ \(form, _) -> checkIntro ctx form prf Elim hyp prf -> checkHyp ctx hyp $ \focante -> checkProofElim ctx form focante prf RAA prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProof.RAA sidecond") (compute searchdepth form) $ \(form, _) -> case form of HNC _ Bot _ -> err "type not Bot in Raa rule" HNC _ Forall _ -> err "type not Forall in Raa rule" HNC _ Implies _ -> err "type not Implies in Raa rule" _ -> ok ) $ checkProofI (HypExt (CNot form) : ctx) (cl formBot) prf checkHyp :: Context -> MetaHyp -> (CFormula -> MetaEnv MPB) -> MetaEnv MPB checkHyp ctx hyp cnt = gheadm (True, prioHyp, Just (BICtx ctx)) (pbc "checkProof.Elim") hyp $ \(Hyp hyp focante) -> case hyp of AC typ qf prfexi -> andp (checkType (Meta typ)) ( andp (checkForm ctx (NotM $ Map (Meta typ) (NotM Bool)) (Meta qf)) ( andp (checkProofI ctx (cl $ NotM $ C nu Exists [T (Meta typ), F (Meta qf)]) prfexi) (cnt focante))) _ -> cnt focante checkIntro :: Context -> HNFormula -> MetaIntro -> MetaEnv MPB checkIntro ctx form prf = gheadm (True, prioIntro, Just (BIForm form)) (pbc "checkIntro") prf $ \prf -> case prf of OrIl prf -> case form of HNC _ Or [F forml, _] -> checkProofI ctx forml prf _ -> err "Injl : Or" OrIr prf -> case form of HNC _ Or [_, F formr] -> checkProofI ctx formr prf _ -> err "Injr : Or" AndI prfl prfr -> case form of HNC _ And [F forml, F formr] -> andp (checkProofI ctx forml prfl) (checkProofI ctx formr prfr) _ -> err "Pair : And" ExistsI witness prf -> case form of HNC _ Exists [T typ, F qf] -> andp (checkForm ctx typ (Meta witness)) (checkProofI ctx (CApp qf (cl (Meta witness))) prf) _ -> err "PairDep : Exists" ImpliesI prf -> case form of HNC _ Implies [F antef, F succf] -> checkProofI (HypExt antef : ctx) (lift 1 succf) prf _ -> err "Abs : Implies" NotI prf -> case form of HNC _ Not [F antef] -> checkProofI (HypExt antef : ctx) (cl formBot) prf _ -> err "AbsNot : Not" ForallI prf -> case form of HNC _ Forall [T typ, F qf] -> checkProofI (VarExt typ : ctx) (CApp (lift 1 qf) (cl $ NotM $ App nu (Var 0) (NotM ArgNil))) prf _ -> err "AbsDep : Forall" TopI -> case form of HNC _ Top [] -> ok _ -> err "Trivial : Top" EqI prf -> case form of HNC _ Eq [T typ, F lhs, F rhs] -> checkProofEq [] [] ctx typ lhs rhs prf _ -> err "Refl : Eq" checkProofElim :: Context-> CFormula -> CFormula -> MetaProofElim -> MetaEnv MPB checkProofElim ctx form focante prf = gheadm (True, prioProofElim, Nothing) (prCFormula (length ctx) form >>= \pe -> prCFormula (length ctx) focante >>= \pi -> return ("checkProofElim : " ++ pi ++ " -> " ++ pe)) prf $ \prf -> case prf of Use prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProofElim.Use sidecond") (compute searchdepth focante) $ \(focante, _) -> case focante of HNC _ Bot _ -> err "inftype not Bot in Use rule" HNC _ Eq _ -> err "inftype not Eq in Use rule" _ -> ok ) $ checkProofEqSimp [] [] ctx typeBool form focante prf ElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofElim.ElimStep") (compute searchdepth focante) $ \(focante, _) -> checkElimStep ctx form focante prf checkElimStep :: Context -> CFormula -> HNFormula -> MetaElimStep -> MetaEnv MPB checkElimStep ctx form focante prf = gheadm (True, prioElimStep, Just (BIForm focante)) (pbc "checkElimStep") prf $ \prf -> case prf of BotE -> case focante of HNC _ Bot [] -> ok _ -> err "Absurd : Bot" NotE prf -> case focante of HNC _ Not [F antef] -> checkProofI ctx antef prf _ -> err "AppNot : Not" OrE prfl prfr -> case focante of HNC _ Or [F forml, F formr] -> andp (checkProofI (HypExt forml : ctx) (lift 1 form) prfl) (checkProofI (HypExt formr : ctx) (lift 1 form) prfr) _ -> err "Case : Or" NTElimStep prf -> checkNTElimStep ctx focante (checkProofElim ctx form) prf checkProofEqElim :: Context-> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> CFormula -> MetaProofEqElim -> MetaEnv MPB checkProofEqElim ctx typ cont focante prf = gheadm (True, prioProofEqElim, Nothing) (pbc "checkProofEqElim") prf $ \prf -> case prf of UseEq -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont lhs rhs) _ -> err "UseEq : Eq" UseEqSym -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont rhs lhs) _ -> err "UseEqSym : Eq" EqElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofEqElim.EqElimStep") (compute searchdepth focante) $ \(focante, _) -> checkEqElimStep ctx typ cont focante prf checkEqElimStep :: Context -> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> HNFormula -> MetaEqElimStep -> MetaEnv MPB checkEqElimStep ctx typ cont focante prf = gheadm (True, prioEqElimStep, Just (BIForm focante)) (pbc "checkEqElimStep") prf $ \prf -> case prf of NTEqElimStep prf -> checkNTElimStep ctx focante (checkProofEqElim ctx typ cont) prf checkNTElimStep :: Context -> HNFormula -> (CFormula -> a -> MetaEnv MPB) -> NTElimStep a -> MetaEnv MPB checkNTElimStep ctx focante cont prf = case prf of AndEl prf -> case focante of HNC _ And [F forml, _] -> cont forml prf _ -> err "Projl : And" AndEr prf -> case focante of HNC _ And [_, F formr] -> cont formr prf _ -> err "Projr : And" ExistsE prf -> case focante of HNC _ Exists [T typ, F cqf@(Cl env qf)] -> cont (CApp cqf (Cl env $ NotM $ Choice nu typ qf (NotM ArgNil))) prf _ -> err "ProjDep : Exists" ImpliesE prfarg prf -> case focante of HNC _ Implies [F forml, F formr] -> andp (checkProofI ctx forml prfarg) (cont formr prf) _ -> err "AppImp : Implies" ForallE arg prf -> case focante of HNC _ Forall [T typ, F qf] -> andp (checkForm ctx typ (Meta arg)) (cont (CApp qf (cl (Meta arg))) prf) _ -> err "AppDep : Forall" InvBoolExtl prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtl") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx lhs prfarg) (cont rhs prf) _ -> err "InvBoolExtl : Bool" _ -> err "InvBoolExtl : Eq" InvBoolExtr prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtr") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx rhs prfarg) (cont lhs prf) _ -> err "InvBoolExtr : Bool" _ -> err "InvBoolExtr : Eq" InvFunExt arg prf -> case focante of HNC uid Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvFunExt") typ $ \typ -> case typ of Map it ot -> andp (checkForm ctx it (Meta arg)) (cont (CHN (HNC uid Eq [T ot, F (CApp lhs (cl (Meta arg))), F (CApp rhs (cl (Meta arg)))])) prf) _ -> err "InvFunExt : Map" _ -> err "InvFunExt : Eq" checkProofEq :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEq -> MetaEnv MPB checkProofEq luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEq, Nothing) (prCFormula (length ctx) lhs >>= \plhs -> prCFormula (length ctx) rhs >>= \prhs -> return ("checkProofEq " ++ plhs ++ " = " ++ prhs)) prf $ \prf -> case prf of Simp prf -> checkProofEqSimp luids ruids ctx typ lhs rhs prf Step hyp prfelim prfsimp prfeq -> checkHyp ctx hyp $ \focante -> checkProofEqElim ctx typ cont focante prfelim where cont lhs' rhs' = andp (checkProofEqSimp [] [] ctx typ lhs lhs' prfsimp) (checkProofEq [] [] ctx typ rhs' rhs prfeq) BoolExt prf1 prf2 -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.BoolExt") typ $ \typ -> case typ of Bool -> andp (checkProofI (HypExt lhs : ctx) (lift 1 rhs) prf1) (checkProofI (HypExt rhs : ctx) (lift 1 lhs) prf2) _ -> err "BoolExt : Bool" FunExt prf -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.FunExt") typ $ \typ -> case typ of Map it ot -> checkProofEq luids ruids (VarExt it : ctx) ot (CApp (lift 1 lhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) (CApp (lift 1 rhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) prf _ -> err "FunExt : Map" checkProofEqSimp :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp luids ruids ctx typ lhs' rhs' prf = gg lhs' [] rhs' [] where gg lhs lstack rhs rstack = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \lres -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \rres -> case (lres, rres) of (CFail, _) -> err "computation failed" (_, CFail) -> err "computation failed" (CDone lhs _, CDone rhs _) -> checkProofEqSimp2 luids ruids ctx typ lhs rhs prf (CDone lhs _, CBlocked rhs rstack) -> let hh rhs@(Cl env m) rstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm ruids lhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.rig-flex-unify " ++ show ruids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \res -> case res of CFail -> err "computation failed" CDone rhs _ -> checkProofEqSimp2 luids (guid rhs ruids) ctx typ lhs rhs prf CBlocked rhs rstack -> hh rhs rstack in hh rhs rstack (CBlocked lhs lstack, CDone rhs _) -> let hh lhs@(Cl env m) lstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm luids rhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.flex-rig-unify " ++ show luids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \res -> case res of CFail -> err "computation failed" CDone lhs _ -> checkProofEqSimp2 (guid lhs luids) ruids ctx typ lhs rhs prf CBlocked lhs lstack -> hh lhs lstack in hh lhs lstack (CBlocked lhs@(Cl _ (Meta m1)) lstack, CBlocked rhs@(Cl _ (Meta m2)) rstack) -> return $ PDoubleBlocked m1 m2 (gg lhs lstack rhs rstack) guid (HNC (Just uid) _ _) xs = uid : xs guid (HNApp (Just uid) _ _) xs = uid : xs guid _ xs = xs checkProofEqSimp2 :: [Int] -> [Int] -> Context -> MType -> HNFormula -> HNFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp2 luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEqSimp, Just (BIFormHead (pickhead lhs rhs))) (pbc "checkProofEqSimp") prf $ \prf -> case (lhs, rhs, prf) of (HNLam _ typ1 bdy1, HNLam _ typ2 bdy2, SimpLam EMNone prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) ( andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy)) _ -> err "eq lam type mismatch" (HNLam _ typ1 bdy1, HNApp muid elr2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr2 = case elr2 of Var i -> Var (i + 1) Glob g -> Glob g bdy2 = CHN (HNApp muid lelr2 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNLam _ typ1 bdy1, HNChoice muid typ2 qf2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy2 = CHN (HNChoice muid typ2 (lift 1 qf2) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNApp muid elr1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr1 = case elr1 of Var i -> Var (i + 1) Glob g -> Glob g bdy1 = CHN (HNApp muid lelr1 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNChoice muid typ1 qf1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy1 = CHN (HNChoice muid typ1 (lift 1 qf1) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNC _ c1 [T typ1, F qf1], HNC _ c2 [T typ2, F qf2], SimpCons c [prf]) | c1 == c && c2 == c && (c == Forall || c == Exists) -> andp (checkEqType typ1 typ2) (checkProofEq luids ruids ctx (NotM $ Map typ1 (NotM Bool)) qf1 qf2 prf) (HNC _ Eq [T typ1, F lhs1, F rhs1], HNC _ Eq [T typ2, F lhs2, F rhs2], SimpCons Eq [prflhs, prfrhs]) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx typ1 lhs1 lhs2 prflhs) (checkProofEq luids ruids ctx typ1 rhs1 rhs2 prfrhs)) (HNC _ lhsc lhsargs, HNC _ rhsc rhsargs, SimpCons c prfs) | c == lhsc && c == rhsc -> -- Top, Bot, And, Or, Implies, Not chargs lhsargs rhsargs prfs where chargs [] [] [] = ok chargs (F f1 : fs1) (F f2 : fs2) (prf : prfs) = andp (checkProofEq luids ruids ctx typeBool f1 f2 prf) (chargs fs1 fs2 prfs) (HNApp _ elr1 args1, HNApp _ elr2 args2, SimpApp prfs) | eqElr elr1 elr2 -> elrType ctx elr1 $ \ityp -> chargs ityp args1 args2 prfs (HNChoice _ typ1 qf1 args1, HNChoice _ typ2 qf2 args2, SimpChoice prf prfs) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx (NotM $ Map typ1 typeBool) qf1 qf2 prf) (chargs typ1 args1 args2 prfs)) _ -> err "eq head mismatch" where chargs :: MType -> [CArgs] -> [CArgs] -> MetaProofEqs -> MetaEnv MPB chargs typ stack1 stack2 prfs = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack1) $ \stack1 -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack2) $ \stack2 -> case (stack1, stack2) of (HNNil, HNNil) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs False)) (pbc "checkProofEqSimp.app/choice-nil") prfs $ \prfs -> case prfs of PrEqNil -> ok PrEqCons{} -> error "PrEqCons" (HNCons a1 stack1, HNCons a2 stack2) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs True)) (pbc "checkProofEqSimp.app/choice-cons") prfs $ \prfs -> case prfs of PrEqNil -> error "PrEqNil" PrEqCons prf prfs -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.chargs") typ $ \typ -> case typ of Map ityp otyp -> andp (checkProofEq luids ruids ctx ityp a1 a2 prf) (chargs otyp stack1 stack2 prfs) _ -> err "eq app/choice type mismatch" _ -> err "checkProofEqSimp: arg list length mismatch" pickhead (HNLam{}) (HNLam{}) = FHLamLam pickhead (HNLam{}) _ = FHLamApp pickhead _ (HNLam{}) = FHAppLam pickhead (HNC _ c _) _ = FHC c pickhead (HNApp{}) _ = FHApp pickhead (HNChoice{}) _ = FHChoice unifyToEq :: CFormula -> (HNFormula -> MetaEnv MPB) -> MetaEnv MPB unifyToEq f cont = g f [] where g f stack = cheadp (prioUnknownArgs, Nothing) (pbc "unifyToEq.unknownargs") (computei searchdepth False f stack) $ \res -> case res of CFail -> err "computation failed" CDone f _ -> cont f CBlocked f@(Cl env m) stack -> gheadp (False, prioUnifyForm, Just (BIUnifyForm [] (HNC nu Eq [T (error "not used"), F (error "not used"), F (error "not used")]) env)) (pbc "unifyToEq") m $ \_ -> g f stack
17,876
checkProof :: Int -> Context -> CFormula -> MetaProof -> MetaEnv MPB checkProof searchdepth = checkProofI where checkProofI ctx form prf = getFormHead form $ gheadm (True, prioProof, Nothing) (prCtx ctx >>= \pc -> prCFormula (length ctx) form >>= \pf -> return ("checkProof : " ++ pc ++ " : " ++ pf)) prf $ \prf -> case prf of Intro prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProof.Intro") (compute searchdepth form) $ \(form, _) -> checkIntro ctx form prf Elim hyp prf -> checkHyp ctx hyp $ \focante -> checkProofElim ctx form focante prf RAA prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProof.RAA sidecond") (compute searchdepth form) $ \(form, _) -> case form of HNC _ Bot _ -> err "type not Bot in Raa rule" HNC _ Forall _ -> err "type not Forall in Raa rule" HNC _ Implies _ -> err "type not Implies in Raa rule" _ -> ok ) $ checkProofI (HypExt (CNot form) : ctx) (cl formBot) prf checkHyp :: Context -> MetaHyp -> (CFormula -> MetaEnv MPB) -> MetaEnv MPB checkHyp ctx hyp cnt = gheadm (True, prioHyp, Just (BICtx ctx)) (pbc "checkProof.Elim") hyp $ \(Hyp hyp focante) -> case hyp of AC typ qf prfexi -> andp (checkType (Meta typ)) ( andp (checkForm ctx (NotM $ Map (Meta typ) (NotM Bool)) (Meta qf)) ( andp (checkProofI ctx (cl $ NotM $ C nu Exists [T (Meta typ), F (Meta qf)]) prfexi) (cnt focante))) _ -> cnt focante checkIntro :: Context -> HNFormula -> MetaIntro -> MetaEnv MPB checkIntro ctx form prf = gheadm (True, prioIntro, Just (BIForm form)) (pbc "checkIntro") prf $ \prf -> case prf of OrIl prf -> case form of HNC _ Or [F forml, _] -> checkProofI ctx forml prf _ -> err "Injl : Or" OrIr prf -> case form of HNC _ Or [_, F formr] -> checkProofI ctx formr prf _ -> err "Injr : Or" AndI prfl prfr -> case form of HNC _ And [F forml, F formr] -> andp (checkProofI ctx forml prfl) (checkProofI ctx formr prfr) _ -> err "Pair : And" ExistsI witness prf -> case form of HNC _ Exists [T typ, F qf] -> andp (checkForm ctx typ (Meta witness)) (checkProofI ctx (CApp qf (cl (Meta witness))) prf) _ -> err "PairDep : Exists" ImpliesI prf -> case form of HNC _ Implies [F antef, F succf] -> checkProofI (HypExt antef : ctx) (lift 1 succf) prf _ -> err "Abs : Implies" NotI prf -> case form of HNC _ Not [F antef] -> checkProofI (HypExt antef : ctx) (cl formBot) prf _ -> err "AbsNot : Not" ForallI prf -> case form of HNC _ Forall [T typ, F qf] -> checkProofI (VarExt typ : ctx) (CApp (lift 1 qf) (cl $ NotM $ App nu (Var 0) (NotM ArgNil))) prf _ -> err "AbsDep : Forall" TopI -> case form of HNC _ Top [] -> ok _ -> err "Trivial : Top" EqI prf -> case form of HNC _ Eq [T typ, F lhs, F rhs] -> checkProofEq [] [] ctx typ lhs rhs prf _ -> err "Refl : Eq" checkProofElim :: Context-> CFormula -> CFormula -> MetaProofElim -> MetaEnv MPB checkProofElim ctx form focante prf = gheadm (True, prioProofElim, Nothing) (prCFormula (length ctx) form >>= \pe -> prCFormula (length ctx) focante >>= \pi -> return ("checkProofElim : " ++ pi ++ " -> " ++ pe)) prf $ \prf -> case prf of Use prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProofElim.Use sidecond") (compute searchdepth focante) $ \(focante, _) -> case focante of HNC _ Bot _ -> err "inftype not Bot in Use rule" HNC _ Eq _ -> err "inftype not Eq in Use rule" _ -> ok ) $ checkProofEqSimp [] [] ctx typeBool form focante prf ElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofElim.ElimStep") (compute searchdepth focante) $ \(focante, _) -> checkElimStep ctx form focante prf checkElimStep :: Context -> CFormula -> HNFormula -> MetaElimStep -> MetaEnv MPB checkElimStep ctx form focante prf = gheadm (True, prioElimStep, Just (BIForm focante)) (pbc "checkElimStep") prf $ \prf -> case prf of BotE -> case focante of HNC _ Bot [] -> ok _ -> err "Absurd : Bot" NotE prf -> case focante of HNC _ Not [F antef] -> checkProofI ctx antef prf _ -> err "AppNot : Not" OrE prfl prfr -> case focante of HNC _ Or [F forml, F formr] -> andp (checkProofI (HypExt forml : ctx) (lift 1 form) prfl) (checkProofI (HypExt formr : ctx) (lift 1 form) prfr) _ -> err "Case : Or" NTElimStep prf -> checkNTElimStep ctx focante (checkProofElim ctx form) prf checkProofEqElim :: Context-> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> CFormula -> MetaProofEqElim -> MetaEnv MPB checkProofEqElim ctx typ cont focante prf = gheadm (True, prioProofEqElim, Nothing) (pbc "checkProofEqElim") prf $ \prf -> case prf of UseEq -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont lhs rhs) _ -> err "UseEq : Eq" UseEqSym -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont rhs lhs) _ -> err "UseEqSym : Eq" EqElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofEqElim.EqElimStep") (compute searchdepth focante) $ \(focante, _) -> checkEqElimStep ctx typ cont focante prf checkEqElimStep :: Context -> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> HNFormula -> MetaEqElimStep -> MetaEnv MPB checkEqElimStep ctx typ cont focante prf = gheadm (True, prioEqElimStep, Just (BIForm focante)) (pbc "checkEqElimStep") prf $ \prf -> case prf of NTEqElimStep prf -> checkNTElimStep ctx focante (checkProofEqElim ctx typ cont) prf checkNTElimStep :: Context -> HNFormula -> (CFormula -> a -> MetaEnv MPB) -> NTElimStep a -> MetaEnv MPB checkNTElimStep ctx focante cont prf = case prf of AndEl prf -> case focante of HNC _ And [F forml, _] -> cont forml prf _ -> err "Projl : And" AndEr prf -> case focante of HNC _ And [_, F formr] -> cont formr prf _ -> err "Projr : And" ExistsE prf -> case focante of HNC _ Exists [T typ, F cqf@(Cl env qf)] -> cont (CApp cqf (Cl env $ NotM $ Choice nu typ qf (NotM ArgNil))) prf _ -> err "ProjDep : Exists" ImpliesE prfarg prf -> case focante of HNC _ Implies [F forml, F formr] -> andp (checkProofI ctx forml prfarg) (cont formr prf) _ -> err "AppImp : Implies" ForallE arg prf -> case focante of HNC _ Forall [T typ, F qf] -> andp (checkForm ctx typ (Meta arg)) (cont (CApp qf (cl (Meta arg))) prf) _ -> err "AppDep : Forall" InvBoolExtl prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtl") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx lhs prfarg) (cont rhs prf) _ -> err "InvBoolExtl : Bool" _ -> err "InvBoolExtl : Eq" InvBoolExtr prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtr") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx rhs prfarg) (cont lhs prf) _ -> err "InvBoolExtr : Bool" _ -> err "InvBoolExtr : Eq" InvFunExt arg prf -> case focante of HNC uid Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvFunExt") typ $ \typ -> case typ of Map it ot -> andp (checkForm ctx it (Meta arg)) (cont (CHN (HNC uid Eq [T ot, F (CApp lhs (cl (Meta arg))), F (CApp rhs (cl (Meta arg)))])) prf) _ -> err "InvFunExt : Map" _ -> err "InvFunExt : Eq" checkProofEq :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEq -> MetaEnv MPB checkProofEq luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEq, Nothing) (prCFormula (length ctx) lhs >>= \plhs -> prCFormula (length ctx) rhs >>= \prhs -> return ("checkProofEq " ++ plhs ++ " = " ++ prhs)) prf $ \prf -> case prf of Simp prf -> checkProofEqSimp luids ruids ctx typ lhs rhs prf Step hyp prfelim prfsimp prfeq -> checkHyp ctx hyp $ \focante -> checkProofEqElim ctx typ cont focante prfelim where cont lhs' rhs' = andp (checkProofEqSimp [] [] ctx typ lhs lhs' prfsimp) (checkProofEq [] [] ctx typ rhs' rhs prfeq) BoolExt prf1 prf2 -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.BoolExt") typ $ \typ -> case typ of Bool -> andp (checkProofI (HypExt lhs : ctx) (lift 1 rhs) prf1) (checkProofI (HypExt rhs : ctx) (lift 1 lhs) prf2) _ -> err "BoolExt : Bool" FunExt prf -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.FunExt") typ $ \typ -> case typ of Map it ot -> checkProofEq luids ruids (VarExt it : ctx) ot (CApp (lift 1 lhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) (CApp (lift 1 rhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) prf _ -> err "FunExt : Map" checkProofEqSimp :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp luids ruids ctx typ lhs' rhs' prf = gg lhs' [] rhs' [] where gg lhs lstack rhs rstack = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \lres -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \rres -> case (lres, rres) of (CFail, _) -> err "computation failed" (_, CFail) -> err "computation failed" (CDone lhs _, CDone rhs _) -> checkProofEqSimp2 luids ruids ctx typ lhs rhs prf (CDone lhs _, CBlocked rhs rstack) -> let hh rhs@(Cl env m) rstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm ruids lhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.rig-flex-unify " ++ show ruids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \res -> case res of CFail -> err "computation failed" CDone rhs _ -> checkProofEqSimp2 luids (guid rhs ruids) ctx typ lhs rhs prf CBlocked rhs rstack -> hh rhs rstack in hh rhs rstack (CBlocked lhs lstack, CDone rhs _) -> let hh lhs@(Cl env m) lstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm luids rhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.flex-rig-unify " ++ show luids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \res -> case res of CFail -> err "computation failed" CDone lhs _ -> checkProofEqSimp2 (guid lhs luids) ruids ctx typ lhs rhs prf CBlocked lhs lstack -> hh lhs lstack in hh lhs lstack (CBlocked lhs@(Cl _ (Meta m1)) lstack, CBlocked rhs@(Cl _ (Meta m2)) rstack) -> return $ PDoubleBlocked m1 m2 (gg lhs lstack rhs rstack) guid (HNC (Just uid) _ _) xs = uid : xs guid (HNApp (Just uid) _ _) xs = uid : xs guid _ xs = xs checkProofEqSimp2 :: [Int] -> [Int] -> Context -> MType -> HNFormula -> HNFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp2 luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEqSimp, Just (BIFormHead (pickhead lhs rhs))) (pbc "checkProofEqSimp") prf $ \prf -> case (lhs, rhs, prf) of (HNLam _ typ1 bdy1, HNLam _ typ2 bdy2, SimpLam EMNone prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) ( andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy)) _ -> err "eq lam type mismatch" (HNLam _ typ1 bdy1, HNApp muid elr2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr2 = case elr2 of Var i -> Var (i + 1) Glob g -> Glob g bdy2 = CHN (HNApp muid lelr2 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNLam _ typ1 bdy1, HNChoice muid typ2 qf2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy2 = CHN (HNChoice muid typ2 (lift 1 qf2) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNApp muid elr1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr1 = case elr1 of Var i -> Var (i + 1) Glob g -> Glob g bdy1 = CHN (HNApp muid lelr1 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNChoice muid typ1 qf1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy1 = CHN (HNChoice muid typ1 (lift 1 qf1) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNC _ c1 [T typ1, F qf1], HNC _ c2 [T typ2, F qf2], SimpCons c [prf]) | c1 == c && c2 == c && (c == Forall || c == Exists) -> andp (checkEqType typ1 typ2) (checkProofEq luids ruids ctx (NotM $ Map typ1 (NotM Bool)) qf1 qf2 prf) (HNC _ Eq [T typ1, F lhs1, F rhs1], HNC _ Eq [T typ2, F lhs2, F rhs2], SimpCons Eq [prflhs, prfrhs]) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx typ1 lhs1 lhs2 prflhs) (checkProofEq luids ruids ctx typ1 rhs1 rhs2 prfrhs)) (HNC _ lhsc lhsargs, HNC _ rhsc rhsargs, SimpCons c prfs) | c == lhsc && c == rhsc -> -- Top, Bot, And, Or, Implies, Not chargs lhsargs rhsargs prfs where chargs [] [] [] = ok chargs (F f1 : fs1) (F f2 : fs2) (prf : prfs) = andp (checkProofEq luids ruids ctx typeBool f1 f2 prf) (chargs fs1 fs2 prfs) (HNApp _ elr1 args1, HNApp _ elr2 args2, SimpApp prfs) | eqElr elr1 elr2 -> elrType ctx elr1 $ \ityp -> chargs ityp args1 args2 prfs (HNChoice _ typ1 qf1 args1, HNChoice _ typ2 qf2 args2, SimpChoice prf prfs) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx (NotM $ Map typ1 typeBool) qf1 qf2 prf) (chargs typ1 args1 args2 prfs)) _ -> err "eq head mismatch" where chargs :: MType -> [CArgs] -> [CArgs] -> MetaProofEqs -> MetaEnv MPB chargs typ stack1 stack2 prfs = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack1) $ \stack1 -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack2) $ \stack2 -> case (stack1, stack2) of (HNNil, HNNil) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs False)) (pbc "checkProofEqSimp.app/choice-nil") prfs $ \prfs -> case prfs of PrEqNil -> ok PrEqCons{} -> error "PrEqCons" (HNCons a1 stack1, HNCons a2 stack2) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs True)) (pbc "checkProofEqSimp.app/choice-cons") prfs $ \prfs -> case prfs of PrEqNil -> error "PrEqNil" PrEqCons prf prfs -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.chargs") typ $ \typ -> case typ of Map ityp otyp -> andp (checkProofEq luids ruids ctx ityp a1 a2 prf) (chargs otyp stack1 stack2 prfs) _ -> err "eq app/choice type mismatch" _ -> err "checkProofEqSimp: arg list length mismatch" pickhead (HNLam{}) (HNLam{}) = FHLamLam pickhead (HNLam{}) _ = FHLamApp pickhead _ (HNLam{}) = FHAppLam pickhead (HNC _ c _) _ = FHC c pickhead (HNApp{}) _ = FHApp pickhead (HNChoice{}) _ = FHChoice unifyToEq :: CFormula -> (HNFormula -> MetaEnv MPB) -> MetaEnv MPB unifyToEq f cont = g f [] where g f stack = cheadp (prioUnknownArgs, Nothing) (pbc "unifyToEq.unknownargs") (computei searchdepth False f stack) $ \res -> case res of CFail -> err "computation failed" CDone f _ -> cont f CBlocked f@(Cl env m) stack -> gheadp (False, prioUnifyForm, Just (BIUnifyForm [] (HNC nu Eq [T (error "not used"), F (error "not used"), F (error "not used")]) env)) (pbc "unifyToEq") m $ \_ -> g f stack
17,798
checkProof searchdepth = checkProofI where checkProofI ctx form prf = getFormHead form $ gheadm (True, prioProof, Nothing) (prCtx ctx >>= \pc -> prCFormula (length ctx) form >>= \pf -> return ("checkProof : " ++ pc ++ " : " ++ pf)) prf $ \prf -> case prf of Intro prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProof.Intro") (compute searchdepth form) $ \(form, _) -> checkIntro ctx form prf Elim hyp prf -> checkHyp ctx hyp $ \focante -> checkProofElim ctx form focante prf RAA prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProof.RAA sidecond") (compute searchdepth form) $ \(form, _) -> case form of HNC _ Bot _ -> err "type not Bot in Raa rule" HNC _ Forall _ -> err "type not Forall in Raa rule" HNC _ Implies _ -> err "type not Implies in Raa rule" _ -> ok ) $ checkProofI (HypExt (CNot form) : ctx) (cl formBot) prf checkHyp :: Context -> MetaHyp -> (CFormula -> MetaEnv MPB) -> MetaEnv MPB checkHyp ctx hyp cnt = gheadm (True, prioHyp, Just (BICtx ctx)) (pbc "checkProof.Elim") hyp $ \(Hyp hyp focante) -> case hyp of AC typ qf prfexi -> andp (checkType (Meta typ)) ( andp (checkForm ctx (NotM $ Map (Meta typ) (NotM Bool)) (Meta qf)) ( andp (checkProofI ctx (cl $ NotM $ C nu Exists [T (Meta typ), F (Meta qf)]) prfexi) (cnt focante))) _ -> cnt focante checkIntro :: Context -> HNFormula -> MetaIntro -> MetaEnv MPB checkIntro ctx form prf = gheadm (True, prioIntro, Just (BIForm form)) (pbc "checkIntro") prf $ \prf -> case prf of OrIl prf -> case form of HNC _ Or [F forml, _] -> checkProofI ctx forml prf _ -> err "Injl : Or" OrIr prf -> case form of HNC _ Or [_, F formr] -> checkProofI ctx formr prf _ -> err "Injr : Or" AndI prfl prfr -> case form of HNC _ And [F forml, F formr] -> andp (checkProofI ctx forml prfl) (checkProofI ctx formr prfr) _ -> err "Pair : And" ExistsI witness prf -> case form of HNC _ Exists [T typ, F qf] -> andp (checkForm ctx typ (Meta witness)) (checkProofI ctx (CApp qf (cl (Meta witness))) prf) _ -> err "PairDep : Exists" ImpliesI prf -> case form of HNC _ Implies [F antef, F succf] -> checkProofI (HypExt antef : ctx) (lift 1 succf) prf _ -> err "Abs : Implies" NotI prf -> case form of HNC _ Not [F antef] -> checkProofI (HypExt antef : ctx) (cl formBot) prf _ -> err "AbsNot : Not" ForallI prf -> case form of HNC _ Forall [T typ, F qf] -> checkProofI (VarExt typ : ctx) (CApp (lift 1 qf) (cl $ NotM $ App nu (Var 0) (NotM ArgNil))) prf _ -> err "AbsDep : Forall" TopI -> case form of HNC _ Top [] -> ok _ -> err "Trivial : Top" EqI prf -> case form of HNC _ Eq [T typ, F lhs, F rhs] -> checkProofEq [] [] ctx typ lhs rhs prf _ -> err "Refl : Eq" checkProofElim :: Context-> CFormula -> CFormula -> MetaProofElim -> MetaEnv MPB checkProofElim ctx form focante prf = gheadm (True, prioProofElim, Nothing) (prCFormula (length ctx) form >>= \pe -> prCFormula (length ctx) focante >>= \pi -> return ("checkProofElim : " ++ pi ++ " -> " ++ pe)) prf $ \prf -> case prf of Use prf -> andp (cheadp (prioNo, Nothing) (pbc "checkProofElim.Use sidecond") (compute searchdepth focante) $ \(focante, _) -> case focante of HNC _ Bot _ -> err "inftype not Bot in Use rule" HNC _ Eq _ -> err "inftype not Eq in Use rule" _ -> ok ) $ checkProofEqSimp [] [] ctx typeBool form focante prf ElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofElim.ElimStep") (compute searchdepth focante) $ \(focante, _) -> checkElimStep ctx form focante prf checkElimStep :: Context -> CFormula -> HNFormula -> MetaElimStep -> MetaEnv MPB checkElimStep ctx form focante prf = gheadm (True, prioElimStep, Just (BIForm focante)) (pbc "checkElimStep") prf $ \prf -> case prf of BotE -> case focante of HNC _ Bot [] -> ok _ -> err "Absurd : Bot" NotE prf -> case focante of HNC _ Not [F antef] -> checkProofI ctx antef prf _ -> err "AppNot : Not" OrE prfl prfr -> case focante of HNC _ Or [F forml, F formr] -> andp (checkProofI (HypExt forml : ctx) (lift 1 form) prfl) (checkProofI (HypExt formr : ctx) (lift 1 form) prfr) _ -> err "Case : Or" NTElimStep prf -> checkNTElimStep ctx focante (checkProofElim ctx form) prf checkProofEqElim :: Context-> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> CFormula -> MetaProofEqElim -> MetaEnv MPB checkProofEqElim ctx typ cont focante prf = gheadm (True, prioProofEqElim, Nothing) (pbc "checkProofEqElim") prf $ \prf -> case prf of UseEq -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont lhs rhs) _ -> err "UseEq : Eq" UseEqSym -> unifyToEq focante $ \focante -> case focante of HNC _ Eq [T typ', F lhs, F rhs] -> andp (checkEqType typ typ') (cont rhs lhs) _ -> err "UseEqSym : Eq" EqElimStep prf -> cheadp (prioDecompFormUnknown, Just BIComputed) (pbc "checkProofEqElim.EqElimStep") (compute searchdepth focante) $ \(focante, _) -> checkEqElimStep ctx typ cont focante prf checkEqElimStep :: Context -> MType -> (CFormula -> CFormula -> MetaEnv MPB) -> HNFormula -> MetaEqElimStep -> MetaEnv MPB checkEqElimStep ctx typ cont focante prf = gheadm (True, prioEqElimStep, Just (BIForm focante)) (pbc "checkEqElimStep") prf $ \prf -> case prf of NTEqElimStep prf -> checkNTElimStep ctx focante (checkProofEqElim ctx typ cont) prf checkNTElimStep :: Context -> HNFormula -> (CFormula -> a -> MetaEnv MPB) -> NTElimStep a -> MetaEnv MPB checkNTElimStep ctx focante cont prf = case prf of AndEl prf -> case focante of HNC _ And [F forml, _] -> cont forml prf _ -> err "Projl : And" AndEr prf -> case focante of HNC _ And [_, F formr] -> cont formr prf _ -> err "Projr : And" ExistsE prf -> case focante of HNC _ Exists [T typ, F cqf@(Cl env qf)] -> cont (CApp cqf (Cl env $ NotM $ Choice nu typ qf (NotM ArgNil))) prf _ -> err "ProjDep : Exists" ImpliesE prfarg prf -> case focante of HNC _ Implies [F forml, F formr] -> andp (checkProofI ctx forml prfarg) (cont formr prf) _ -> err "AppImp : Implies" ForallE arg prf -> case focante of HNC _ Forall [T typ, F qf] -> andp (checkForm ctx typ (Meta arg)) (cont (CApp qf (cl (Meta arg))) prf) _ -> err "AppDep : Forall" InvBoolExtl prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtl") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx lhs prfarg) (cont rhs prf) _ -> err "InvBoolExtl : Bool" _ -> err "InvBoolExtl : Eq" InvBoolExtr prfarg prf -> case focante of HNC _ Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvBoolExtr") typ $ \typ -> case typ of Bool -> andp (checkProofI ctx rhs prfarg) (cont lhs prf) _ -> err "InvBoolExtr : Bool" _ -> err "InvBoolExtr : Eq" InvFunExt arg prf -> case focante of HNC uid Eq [T typ, F lhs, F rhs] -> gheadp (False, prioUnknownType, Nothing) (pbc "checkNTElimStep.InvFunExt") typ $ \typ -> case typ of Map it ot -> andp (checkForm ctx it (Meta arg)) (cont (CHN (HNC uid Eq [T ot, F (CApp lhs (cl (Meta arg))), F (CApp rhs (cl (Meta arg)))])) prf) _ -> err "InvFunExt : Map" _ -> err "InvFunExt : Eq" checkProofEq :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEq -> MetaEnv MPB checkProofEq luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEq, Nothing) (prCFormula (length ctx) lhs >>= \plhs -> prCFormula (length ctx) rhs >>= \prhs -> return ("checkProofEq " ++ plhs ++ " = " ++ prhs)) prf $ \prf -> case prf of Simp prf -> checkProofEqSimp luids ruids ctx typ lhs rhs prf Step hyp prfelim prfsimp prfeq -> checkHyp ctx hyp $ \focante -> checkProofEqElim ctx typ cont focante prfelim where cont lhs' rhs' = andp (checkProofEqSimp [] [] ctx typ lhs lhs' prfsimp) (checkProofEq [] [] ctx typ rhs' rhs prfeq) BoolExt prf1 prf2 -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.BoolExt") typ $ \typ -> case typ of Bool -> andp (checkProofI (HypExt lhs : ctx) (lift 1 rhs) prf1) (checkProofI (HypExt rhs : ctx) (lift 1 lhs) prf2) _ -> err "BoolExt : Bool" FunExt prf -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEq.FunExt") typ $ \typ -> case typ of Map it ot -> checkProofEq luids ruids (VarExt it : ctx) ot (CApp (lift 1 lhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) (CApp (lift 1 rhs) (cl $ NotM $ App nu (Var 0) $ NotM $ ArgNil)) prf _ -> err "FunExt : Map" checkProofEqSimp :: [Int] -> [Int] -> Context -> MType -> CFormula -> CFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp luids ruids ctx typ lhs' rhs' prf = gg lhs' [] rhs' [] where gg lhs lstack rhs rstack = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \lres -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \rres -> case (lres, rres) of (CFail, _) -> err "computation failed" (_, CFail) -> err "computation failed" (CDone lhs _, CDone rhs _) -> checkProofEqSimp2 luids ruids ctx typ lhs rhs prf (CDone lhs _, CBlocked rhs rstack) -> let hh rhs@(Cl env m) rstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm ruids lhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.rig-flex-unify " ++ show ruids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False rhs rstack) $ \res -> case res of CFail -> err "computation failed" CDone rhs _ -> checkProofEqSimp2 luids (guid rhs ruids) ctx typ lhs rhs prf CBlocked rhs rstack -> hh rhs rstack in hh rhs rstack (CBlocked lhs lstack, CDone rhs _) -> let hh lhs@(Cl env m) lstack = gheadp (False, prioUnifyForm, Just (BIUnifyForm luids rhs env)) (prCFormula (length ctx) lhs' >>= \plhs -> prCFormula (length ctx) rhs' >>= \prhs -> return ("checkProofEqSimp.flex-rig-unify " ++ show luids ++ " " ++ plhs ++ " = " ++ prhs)) m $ \_ -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.unknownargs") (computei searchdepth False lhs lstack) $ \res -> case res of CFail -> err "computation failed" CDone lhs _ -> checkProofEqSimp2 (guid lhs luids) ruids ctx typ lhs rhs prf CBlocked lhs lstack -> hh lhs lstack in hh lhs lstack (CBlocked lhs@(Cl _ (Meta m1)) lstack, CBlocked rhs@(Cl _ (Meta m2)) rstack) -> return $ PDoubleBlocked m1 m2 (gg lhs lstack rhs rstack) guid (HNC (Just uid) _ _) xs = uid : xs guid (HNApp (Just uid) _ _) xs = uid : xs guid _ xs = xs checkProofEqSimp2 :: [Int] -> [Int] -> Context -> MType -> HNFormula -> HNFormula -> MetaProofEqSimp -> MetaEnv MPB checkProofEqSimp2 luids ruids ctx typ lhs rhs prf = gheadm (True, prioProofEqSimp, Just (BIFormHead (pickhead lhs rhs))) (pbc "checkProofEqSimp") prf $ \prf -> case (lhs, rhs, prf) of (HNLam _ typ1 bdy1, HNLam _ typ2 bdy2, SimpLam EMNone prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) ( andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy)) _ -> err "eq lam type mismatch" (HNLam _ typ1 bdy1, HNApp muid elr2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr2 = case elr2 of Var i -> Var (i + 1) Glob g -> Glob g bdy2 = CHN (HNApp muid lelr2 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNLam _ typ1 bdy1, HNChoice muid typ2 qf2 args2, SimpLam EMRight prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ1) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy2 = CHN (HNChoice muid typ2 (lift 1 qf2) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args2 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNApp muid elr1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where lelr1 = case elr1 of Var i -> Var (i + 1) Glob g -> Glob g bdy1 = CHN (HNApp muid lelr1 (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNChoice muid typ1 qf1 args1, HNLam _ typ2 bdy2, SimpLam EMLeft prfbdy) -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.Lam") typ $ \typ -> case typ of Map ityp otyp -> andp (checkEqType ityp typ2) (checkProofEq luids ruids (VarExt ityp : ctx) otyp bdy1 bdy2 prfbdy) _ -> err "eq lam type mismatch" where bdy1 = CHN (HNChoice muid typ1 (lift 1 qf1) (map (\(ClA env x) -> ClA (Lift 1 : env) x) args1 ++ [ClA [] $ NotM $ ArgCons (NotM $ App nu (Var 0) $ NotM ArgNil) (NotM ArgNil)])) (HNC _ c1 [T typ1, F qf1], HNC _ c2 [T typ2, F qf2], SimpCons c [prf]) | c1 == c && c2 == c && (c == Forall || c == Exists) -> andp (checkEqType typ1 typ2) (checkProofEq luids ruids ctx (NotM $ Map typ1 (NotM Bool)) qf1 qf2 prf) (HNC _ Eq [T typ1, F lhs1, F rhs1], HNC _ Eq [T typ2, F lhs2, F rhs2], SimpCons Eq [prflhs, prfrhs]) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx typ1 lhs1 lhs2 prflhs) (checkProofEq luids ruids ctx typ1 rhs1 rhs2 prfrhs)) (HNC _ lhsc lhsargs, HNC _ rhsc rhsargs, SimpCons c prfs) | c == lhsc && c == rhsc -> -- Top, Bot, And, Or, Implies, Not chargs lhsargs rhsargs prfs where chargs [] [] [] = ok chargs (F f1 : fs1) (F f2 : fs2) (prf : prfs) = andp (checkProofEq luids ruids ctx typeBool f1 f2 prf) (chargs fs1 fs2 prfs) (HNApp _ elr1 args1, HNApp _ elr2 args2, SimpApp prfs) | eqElr elr1 elr2 -> elrType ctx elr1 $ \ityp -> chargs ityp args1 args2 prfs (HNChoice _ typ1 qf1 args1, HNChoice _ typ2 qf2 args2, SimpChoice prf prfs) -> andp (checkEqType typ1 typ2) ( andp (checkProofEq luids ruids ctx (NotM $ Map typ1 typeBool) qf1 qf2 prf) (chargs typ1 args1 args2 prfs)) _ -> err "eq head mismatch" where chargs :: MType -> [CArgs] -> [CArgs] -> MetaProofEqs -> MetaEnv MPB chargs typ stack1 stack2 prfs = cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack1) $ \stack1 -> cheadp (prioUnknownArgs, Nothing) (pbc "checkProofEqSimp.app/choice-arg") (getStackHead stack2) $ \stack2 -> case (stack1, stack2) of (HNNil, HNNil) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs False)) (pbc "checkProofEqSimp.app/choice-nil") prfs $ \prfs -> case prfs of PrEqNil -> ok PrEqCons{} -> error "PrEqCons" (HNCons a1 stack1, HNCons a2 stack2) -> gheadm (True, prioProofEqSimp, Just (BISimpArgs True)) (pbc "checkProofEqSimp.app/choice-cons") prfs $ \prfs -> case prfs of PrEqNil -> error "PrEqNil" PrEqCons prf prfs -> gheadp (False, prioUnknownType, Nothing) (pbc "checkProofEqSimp.chargs") typ $ \typ -> case typ of Map ityp otyp -> andp (checkProofEq luids ruids ctx ityp a1 a2 prf) (chargs otyp stack1 stack2 prfs) _ -> err "eq app/choice type mismatch" _ -> err "checkProofEqSimp: arg list length mismatch" pickhead (HNLam{}) (HNLam{}) = FHLamLam pickhead (HNLam{}) _ = FHLamApp pickhead _ (HNLam{}) = FHAppLam pickhead (HNC _ c _) _ = FHC c pickhead (HNApp{}) _ = FHApp pickhead (HNChoice{}) _ = FHChoice unifyToEq :: CFormula -> (HNFormula -> MetaEnv MPB) -> MetaEnv MPB unifyToEq f cont = g f [] where g f stack = cheadp (prioUnknownArgs, Nothing) (pbc "unifyToEq.unknownargs") (computei searchdepth False f stack) $ \res -> case res of CFail -> err "computation failed" CDone f _ -> cont f CBlocked f@(Cl env m) stack -> gheadp (False, prioUnifyForm, Just (BIUnifyForm [] (HNC nu Eq [T (error "not used"), F (error "not used"), F (error "not used")]) env)) (pbc "unifyToEq") m $ \_ -> g f stack
17,729
true
true
14
33
4,673
7,521
3,731
3,790
null
null
sjfloat/dnngraph
NN/Backend/Torch/Codegen.hs
bsd-3-clause
insertContainer :: Name -> Exp -> [Flat Exp] -> Torch Name insertContainer prefix containerModule exps' = do name' <- fresh prefix statements <>+ assign name' containerModule forM_ exps' $ \exp' -> do innerName' <- insert exp' statements <>+ methCall name' "add" [var' innerName'] return name'
309
insertContainer :: Name -> Exp -> [Flat Exp] -> Torch Name insertContainer prefix containerModule exps' = do name' <- fresh prefix statements <>+ assign name' containerModule forM_ exps' $ \exp' -> do innerName' <- insert exp' statements <>+ methCall name' "add" [var' innerName'] return name'
309
insertContainer prefix containerModule exps' = do name' <- fresh prefix statements <>+ assign name' containerModule forM_ exps' $ \exp' -> do innerName' <- insert exp' statements <>+ methCall name' "add" [var' innerName'] return name'
250
false
true
0
15
60
117
51
66
null
null
rodrigo-machado/verigraph
src/library/Data/TypedGraph/Morphism.hs
gpl-3.0
-- | Given a TypedGraphMorphism @/__t__: G1 -> G2/@ and an edgeId @__e__@ in @G1@, it returns the edgeId in @G2@ to which @__e__@ gets mapped applyEdgeId :: TypedGraphMorphism a b -> EdgeId -> Maybe EdgeId applyEdgeId tgm = GM.applyEdgeId (mapping tgm)
252
applyEdgeId :: TypedGraphMorphism a b -> EdgeId -> Maybe EdgeId applyEdgeId tgm = GM.applyEdgeId (mapping tgm)
110
applyEdgeId tgm = GM.applyEdgeId (mapping tgm)
46
true
true
0
7
41
42
20
22
null
null
alanz/Blobs
lib/DData/Set.hs
lgpl-2.1
showSet (x:xs) = showChar '{' . shows x . showTail xs where showTail [] = showChar '}' showTail (x:xs) = showChar ',' . shows x . showTail xs {-------------------------------------------------------------------- Utility functions that return sub-ranges of the original tree. Some functions take a comparison function as argument to allow comparisons against infinite values. A function [cmplo x] should be read as [compare lo x]. [trim cmplo cmphi t] A tree that is either empty or where [cmplo x == LT] and [cmphi x == GT] for the value [x] of the root. [filterGt cmp t] A tree where for all values [k]. [cmp k == LT] [filterLt cmp t] A tree where for all values [k]. [cmp k == GT] [split k t] Returns two trees [l] and [r] where all values in [l] are <[k] and all keys in [r] are >[k]. [splitMember k t] Just like [split] but also returns whether [k] was found in the tree. --------------------------------------------------------------------} {-------------------------------------------------------------------- [trim lo hi t] trims away all subtrees that surely contain no values between the range [lo] to [hi]. The returned tree is either empty or the key of the root is between @lo@ and @hi@. --------------------------------------------------------------------}
1,416
showSet (x:xs) = showChar '{' . shows x . showTail xs where showTail [] = showChar '}' showTail (x:xs) = showChar ',' . shows x . showTail xs {-------------------------------------------------------------------- Utility functions that return sub-ranges of the original tree. Some functions take a comparison function as argument to allow comparisons against infinite values. A function [cmplo x] should be read as [compare lo x]. [trim cmplo cmphi t] A tree that is either empty or where [cmplo x == LT] and [cmphi x == GT] for the value [x] of the root. [filterGt cmp t] A tree where for all values [k]. [cmp k == LT] [filterLt cmp t] A tree where for all values [k]. [cmp k == GT] [split k t] Returns two trees [l] and [r] where all values in [l] are <[k] and all keys in [r] are >[k]. [splitMember k t] Just like [split] but also returns whether [k] was found in the tree. --------------------------------------------------------------------} {-------------------------------------------------------------------- [trim lo hi t] trims away all subtrees that surely contain no values between the range [lo] to [hi]. The returned tree is either empty or the key of the root is between @lo@ and @hi@. --------------------------------------------------------------------}
1,416
showSet (x:xs) = showChar '{' . shows x . showTail xs where showTail [] = showChar '}' showTail (x:xs) = showChar ',' . shows x . showTail xs {-------------------------------------------------------------------- Utility functions that return sub-ranges of the original tree. Some functions take a comparison function as argument to allow comparisons against infinite values. A function [cmplo x] should be read as [compare lo x]. [trim cmplo cmphi t] A tree that is either empty or where [cmplo x == LT] and [cmphi x == GT] for the value [x] of the root. [filterGt cmp t] A tree where for all values [k]. [cmp k == LT] [filterLt cmp t] A tree where for all values [k]. [cmp k == GT] [split k t] Returns two trees [l] and [r] where all values in [l] are <[k] and all keys in [r] are >[k]. [splitMember k t] Just like [split] but also returns whether [k] was found in the tree. --------------------------------------------------------------------} {-------------------------------------------------------------------- [trim lo hi t] trims away all subtrees that surely contain no values between the range [lo] to [hi]. The returned tree is either empty or the key of the root is between @lo@ and @hi@. --------------------------------------------------------------------}
1,416
false
false
0
7
343
83
39
44
null
null
vTurbine/ghc
compiler/hsSyn/HsUtils.hs
bsd-3-clause
nlHsOpApp :: LHsExpr id -> id -> LHsExpr id -> LHsExpr id nlHsOpApp e1 op e2 = noLoc (mkHsOpApp e1 op e2)
105
nlHsOpApp :: LHsExpr id -> id -> LHsExpr id -> LHsExpr id nlHsOpApp e1 op e2 = noLoc (mkHsOpApp e1 op e2)
105
nlHsOpApp e1 op e2 = noLoc (mkHsOpApp e1 op e2)
47
false
true
0
8
21
52
24
28
null
null
da-x/lamdu
test/InferCombinators.hs
gpl-3.0
getField :: ExprWithResumptions -> T.Tag -> ExprWithResumptions getField recordVal tag = mkExprWithResumptions (V.BGetField (V.GetField recordVal tag)) (findTypeOfField tag <$> exprTypeStream recordVal)
214
getField :: ExprWithResumptions -> T.Tag -> ExprWithResumptions getField recordVal tag = mkExprWithResumptions (V.BGetField (V.GetField recordVal tag)) (findTypeOfField tag <$> exprTypeStream recordVal)
214
getField recordVal tag = mkExprWithResumptions (V.BGetField (V.GetField recordVal tag)) (findTypeOfField tag <$> exprTypeStream recordVal)
150
false
true
0
9
32
63
30
33
null
null
ayron/AoC
2016/Day 8/solution.hs
gpl-3.0
-- Function below are to help debug, but not needed print_array :: Screen -> IO () print_array a = putStrLn $ unlines $ chunksOf width $ map show' $ elems a where width = 1 + (snd $ snd $ bounds a)
199
print_array :: Screen -> IO () print_array a = putStrLn $ unlines $ chunksOf width $ map show' $ elems a where width = 1 + (snd $ snd $ bounds a)
147
print_array a = putStrLn $ unlines $ chunksOf width $ map show' $ elems a where width = 1 + (snd $ snd $ bounds a)
116
true
true
0
8
43
75
36
39
null
null
Thell/pandoc
src/Text/Pandoc/Writers/Markdown.hs
gpl-2.0
avoidBadWrapsInList (Space:Str [c]:Space:xs) | c `elem` ['-','*','+'] = Str [' ', c] : Space : avoidBadWrapsInList xs
119
avoidBadWrapsInList (Space:Str [c]:Space:xs) | c `elem` ['-','*','+'] = Str [' ', c] : Space : avoidBadWrapsInList xs
119
avoidBadWrapsInList (Space:Str [c]:Space:xs) | c `elem` ['-','*','+'] = Str [' ', c] : Space : avoidBadWrapsInList xs
119
false
false
0
10
18
71
37
34
null
null
LeviSchuck/cosmic
src/Cosmic/Dust/Value.hs
mit
-- | Describes the constructor given. -- Most of the primitive constructors take just one value. -- -- > expectedPrim = constByPrim PWord64 -- -- Although unlikely, the way to get around 'PUnit' not taking -- any values is to encode it as a function taking a parameter. -- -- > expectedPrim = constByPrim $ \_ -> PUnit -- constByPrim :: (a -> PrimitiveParticle) -> Const Constr b constByPrim f = Const . toConstr $ f undefined
429
constByPrim :: (a -> PrimitiveParticle) -> Const Constr b constByPrim f = Const . toConstr $ f undefined
104
constByPrim f = Const . toConstr $ f undefined
46
true
true
0
7
79
51
30
21
null
null
zachsully/hakaru
haskell/Language/Hakaru/Pretty/Concrete.hs
bsd-3-clause
ppPrimOp p Diff (e1 :* e2 :* End) = ppApply2 p "diff" e1 e2
67
ppPrimOp p Diff (e1 :* e2 :* End) = ppApply2 p "diff" e1 e2
67
ppPrimOp p Diff (e1 :* e2 :* End) = ppApply2 p "diff" e1 e2
67
false
false
0
8
21
36
16
20
null
null
banacorn/formal-language
haskell-legacy/test.hs
mit
propNFA2DFA :: Property propNFA2DFA = do states <- stateTestLimit genStates alphabets <- alphabetTestLimit genAlphabets nfa <- genNFA states alphabets forAll (genLanguage alphabets) (\language -> let dfa = nfa2dfa nfa prop = automatonN nfa language == automaton dfa language || automatonN nfa language /= automaton dfa language in printTestCase (show nfa) prop )
448
propNFA2DFA :: Property propNFA2DFA = do states <- stateTestLimit genStates alphabets <- alphabetTestLimit genAlphabets nfa <- genNFA states alphabets forAll (genLanguage alphabets) (\language -> let dfa = nfa2dfa nfa prop = automatonN nfa language == automaton dfa language || automatonN nfa language /= automaton dfa language in printTestCase (show nfa) prop )
448
propNFA2DFA = do states <- stateTestLimit genStates alphabets <- alphabetTestLimit genAlphabets nfa <- genNFA states alphabets forAll (genLanguage alphabets) (\language -> let dfa = nfa2dfa nfa prop = automatonN nfa language == automaton dfa language || automatonN nfa language /= automaton dfa language in printTestCase (show nfa) prop )
424
false
true
0
17
137
127
58
69
null
null
DavidAlphaFox/bittorrent
src/Network/BitTorrent/Tracker/Message.hs
bsd-3-clause
withError :: ParamParseFailure -> Maybe a -> ParseResult a withError e = maybe (Left e) Right
93
withError :: ParamParseFailure -> Maybe a -> ParseResult a withError e = maybe (Left e) Right
93
withError e = maybe (Left e) Right
34
false
true
0
8
15
44
19
25
null
null
rueshyna/gogol
gogol-logging/gen/Network/Google/Resource/Logging/Projects/Logs/List.hs
mpl-2.0
-- | Creates a value of 'ProjectsLogsList' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'pllParent' -- -- * 'pllXgafv' -- -- * 'pllUploadProtocol' -- -- * 'pllPp' -- -- * 'pllAccessToken' -- -- * 'pllUploadType' -- -- * 'pllBearerToken' -- -- * 'pllPageToken' -- -- * 'pllPageSize' -- -- * 'pllCallback' projectsLogsList :: Text -- ^ 'pllParent' -> ProjectsLogsList projectsLogsList pPllParent_ = ProjectsLogsList' { _pllParent = pPllParent_ , _pllXgafv = Nothing , _pllUploadProtocol = Nothing , _pllPp = True , _pllAccessToken = Nothing , _pllUploadType = Nothing , _pllBearerToken = Nothing , _pllPageToken = Nothing , _pllPageSize = Nothing , _pllCallback = Nothing }
815
projectsLogsList :: Text -- ^ 'pllParent' -> ProjectsLogsList projectsLogsList pPllParent_ = ProjectsLogsList' { _pllParent = pPllParent_ , _pllXgafv = Nothing , _pllUploadProtocol = Nothing , _pllPp = True , _pllAccessToken = Nothing , _pllUploadType = Nothing , _pllBearerToken = Nothing , _pllPageToken = Nothing , _pllPageSize = Nothing , _pllCallback = Nothing }
423
projectsLogsList pPllParent_ = ProjectsLogsList' { _pllParent = pPllParent_ , _pllXgafv = Nothing , _pllUploadProtocol = Nothing , _pllPp = True , _pllAccessToken = Nothing , _pllUploadType = Nothing , _pllBearerToken = Nothing , _pllPageToken = Nothing , _pllPageSize = Nothing , _pllCallback = Nothing }
353
true
true
0
7
178
113
76
37
null
null
sdynerow/Semirings-Library
haskell/Algebra/Constructs/Semidirect.hs
apache-2.0
direct :: (Semiring s, Semiring t) => Matrix s -> Matrix t -> Matrix (Semidirect s t) direct as bs | (order as) == (order bs) = pointwise as bs zipD | otherwise = error "Incompatibles matrice sizes"
214
direct :: (Semiring s, Semiring t) => Matrix s -> Matrix t -> Matrix (Semidirect s t) direct as bs | (order as) == (order bs) = pointwise as bs zipD | otherwise = error "Incompatibles matrice sizes"
214
direct as bs | (order as) == (order bs) = pointwise as bs zipD | otherwise = error "Incompatibles matrice sizes"
128
false
true
0
11
53
106
47
59
null
null
ganeti-github-testing/ganeti-test-1
src/Ganeti/OpCodes.hs
bsd-2-clause
opSummaryVal OpInstanceFailover { opInstanceName = s } = Just s
63
opSummaryVal OpInstanceFailover { opInstanceName = s } = Just s
63
opSummaryVal OpInstanceFailover { opInstanceName = s } = Just s
63
false
false
0
8
9
21
10
11
null
null
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/Tokens.hs
bsd-3-clause
gl_TEXTURE_3D_BINDING_EXT :: GLenum gl_TEXTURE_3D_BINDING_EXT = 0x806A
70
gl_TEXTURE_3D_BINDING_EXT :: GLenum gl_TEXTURE_3D_BINDING_EXT = 0x806A
70
gl_TEXTURE_3D_BINDING_EXT = 0x806A
34
false
true
0
4
5
11
6
5
null
null
oldmanmike/ghc
compiler/typecheck/TcGenDeriv.hs
bsd-3-clause
b_RDR = mkVarUnqual (fsLit "b")
41
b_RDR = mkVarUnqual (fsLit "b")
41
b_RDR = mkVarUnqual (fsLit "b")
41
false
false
0
7
14
15
7
8
null
null
NorfairKing/the-notes
src/Macro/Text.hs
gpl-2.0
quoted :: Note -> Note quoted n = "`" <> n <> "'"
49
quoted :: Note -> Note quoted n = "`" <> n <> "'"
49
quoted n = "`" <> n <> "'"
26
false
true
0
6
12
26
13
13
null
null
mazelife/agilulf
src/Agiluf/Entry.hs
bsd-3-clause
-- | Compare two of entry/meta pairs on their date, descending. compareEntries :: Entry -> Entry -> Ordering compareEntries a b = case (date a) `compare` (date b) of EQ -> EQ GT -> LT LT -> GT
204
compareEntries :: Entry -> Entry -> Ordering compareEntries a b = case (date a) `compare` (date b) of EQ -> EQ GT -> LT LT -> GT
140
compareEntries a b = case (date a) `compare` (date b) of EQ -> EQ GT -> LT LT -> GT
95
true
true
0
8
49
65
34
31
null
null
binarin/learnopengl
src/Camera.hs
bsd-3-clause
camPitch :: Lens' Camera Float camPitch = lens _camPitch $ \c p -> c { _camPitch = clampPitch p }
97
camPitch :: Lens' Camera Float camPitch = lens _camPitch $ \c p -> c { _camPitch = clampPitch p }
97
camPitch = lens _camPitch $ \c p -> c { _camPitch = clampPitch p }
66
false
true
0
9
19
41
21
20
null
null
Cahu/krpc-hs
src/KRPCHS/RemoteTech.hs
gpl-3.0
{- - Whether the vessel has a flight computer on board. -} getCommsHasFlightComputer :: KRPCHS.RemoteTech.Comms -> RPCContext (Bool) getCommsHasFlightComputer thisArg = do let r = makeRequest "RemoteTech" "Comms_get_HasFlightComputer" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
314
getCommsHasFlightComputer :: KRPCHS.RemoteTech.Comms -> RPCContext (Bool) getCommsHasFlightComputer thisArg = do let r = makeRequest "RemoteTech" "Comms_get_HasFlightComputer" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
253
getCommsHasFlightComputer thisArg = do let r = makeRequest "RemoteTech" "Comms_get_HasFlightComputer" [makeArgument 0 thisArg] res <- sendRequest r processResponse res
179
true
true
0
12
50
68
32
36
null
null
akc/gfscript
HOPS/Utils/Parse.hs
bsd-3-clause
parse_ :: Parser t -> ByteString -> Maybe t parse_ f = either (const Nothing) Just . parseOnly f
96
parse_ :: Parser t -> ByteString -> Maybe t parse_ f = either (const Nothing) Just . parseOnly f
96
parse_ f = either (const Nothing) Just . parseOnly f
52
false
true
0
8
18
51
22
29
null
null
sherwoodwang/wxHaskell
wxcore/src/haskell/Graphics/UI/WXCore/WxcTypes.hs
lgpl-2.1
-- marshalling withCSize :: Size -> (CInt -> CInt -> IO a) -> IO a withCSize (Size w h) f = f (toCInt w) (toCInt h)
117
withCSize :: Size -> (CInt -> CInt -> IO a) -> IO a withCSize (Size w h) f = f (toCInt w) (toCInt h)
102
withCSize (Size w h) f = f (toCInt w) (toCInt h)
50
true
true
0
10
27
68
33
35
null
null
coghex/abridgefaraway
src/GLUtil/Font.hs
bsd-3-clause
findLetter BPFONT 'n' = (13, 16)
33
findLetter BPFONT 'n' = (13, 16)
33
findLetter BPFONT 'n' = (13, 16)
33
false
false
0
5
6
19
9
10
null
null
RossMeikleham/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
catchError :: Idris a -> (Err -> Idris a) -> Idris a catchError = liftCatch catchE
82
catchError :: Idris a -> (Err -> Idris a) -> Idris a catchError = liftCatch catchE
82
catchError = liftCatch catchE
29
false
true
0
9
15
38
18
20
null
null
olsner/ghc
testsuite/tests/perf/compiler/T10370.hs
bsd-3-clause
a867 :: IO (); a867 = forever $ putStrLn "a867"
47
a867 :: IO () a867 = forever $ putStrLn "a867"
46
a867 = forever $ putStrLn "a867"
32
false
true
0
6
9
24
12
12
null
null
byorgey/Idris-dev
src/IRTS/Compiler.hs
bsd-3-clause
declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
68
declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
68
declArgs args inl n x = LFun (if inl then [Inline] else []) n args x
68
false
false
1
8
15
46
21
25
null
null
mrd/camfort
src/Camfort/Specification/Units/Monad.hs
apache-2.0
modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver () modifyUnitAliasMap f = modify (\ s -> s { usUnitAliasMap = f (usUnitAliasMap s) })
152
modifyUnitAliasMap :: (UnitAliasMap -> UnitAliasMap) -> UnitSolver () modifyUnitAliasMap f = modify (\ s -> s { usUnitAliasMap = f (usUnitAliasMap s) })
152
modifyUnitAliasMap f = modify (\ s -> s { usUnitAliasMap = f (usUnitAliasMap s) })
82
false
true
0
12
22
58
30
28
null
null
prt2121/haskell-practice
parconc/geturlsfirst.hs
apache-2.0
-- >> -- <<waitAny waitAny :: [Async a] -> IO a waitAny asyncs = atomically $ foldr orElse retry $ map waitSTM asyncs
120
waitAny :: [Async a] -> IO a waitAny asyncs = atomically $ foldr orElse retry $ map waitSTM asyncs
100
waitAny asyncs = atomically $ foldr orElse retry $ map waitSTM asyncs
71
true
true
0
7
25
47
23
24
null
null
paulrzcz/takusen-oracle
Database/Enumerator.hs
bsd-3-clause
|A strict version. This is recommended unless you have a specific need for laziness, -- as the lazy version will gobble stack and heap. -- If you have a large result-set (in the order of 10-100K rows or more), -- it is likely to exhaust the standard 1M GHC stack. -- Whether or not 'result' eats memory depends on what @x@ does: -- if it's a delayed computation then it almost certainly will. -- This includes consing elements onto a list, -- and arithmetic operations (counting, summing, etc). result' :: (Monad m) => IterAct m a result' x = return (Right $! x)
576
result' :: (Monad m) => IterAct m a result' x = return (Right $! x)
67
result' x = return (Right $! x)
31
true
true
3
9
116
88
45
43
null
null
erochest/gh-weekly
src/GhWeekly/Network.hs
apache-2.0
getAllUserRepos :: T.Text -> Github [Value] getAllUserRepos user = concat <$> gh ["/users/", user, "/repos"] [("type", "all")]
130
getAllUserRepos :: T.Text -> Github [Value] getAllUserRepos user = concat <$> gh ["/users/", user, "/repos"] [("type", "all")]
130
getAllUserRepos user = concat <$> gh ["/users/", user, "/repos"] [("type", "all")]
86
false
true
0
8
20
53
29
24
null
null
danse/haskell-opaleye
src/Opaleye/Internal/HaskellDB/Sql/Print.hs
bsd-3-clause
ppAs :: Maybe String -> Doc -> Doc ppAs Nothing expr = expr
64
ppAs :: Maybe String -> Doc -> Doc ppAs Nothing expr = expr
64
ppAs Nothing expr = expr
29
false
true
0
6
17
27
13
14
null
null
xicesky/sky-haskell-playground
src/Sky/Learn/Comonads.hs
bsd-3-clause
toString :: Thermostat Celsius -> String toString (t, f) = show (getCelsius (f t)) ++ " Celsius"
96
toString :: Thermostat Celsius -> String toString (t, f) = show (getCelsius (f t)) ++ " Celsius"
96
toString (t, f) = show (getCelsius (f t)) ++ " Celsius"
55
false
true
0
10
16
46
23
23
null
null
siddhanathan/ghc
compiler/nativeGen/X86/CodeGen.hs
bsd-3-clause
genJump (CmmLit lit) regs = do return (unitOL (JMP (OpImm (litToImm lit)) regs))
82
genJump (CmmLit lit) regs = do return (unitOL (JMP (OpImm (litToImm lit)) regs))
82
genJump (CmmLit lit) regs = do return (unitOL (JMP (OpImm (litToImm lit)) regs))
82
false
false
1
16
14
54
23
31
null
null
brendanhay/gogol
gogol-dataproc/gen/Network/Google/Resource/Dataproc/Projects/Locations/AutoscalingPolicies/SetIAMPolicy.hs
mpl-2.0
-- | JSONP plapsipCallback :: Lens' ProjectsLocationsAutoscalingPoliciesSetIAMPolicy (Maybe Text) plapsipCallback = lens _plapsipCallback (\ s a -> s{_plapsipCallback = a})
180
plapsipCallback :: Lens' ProjectsLocationsAutoscalingPoliciesSetIAMPolicy (Maybe Text) plapsipCallback = lens _plapsipCallback (\ s a -> s{_plapsipCallback = a})
169
plapsipCallback = lens _plapsipCallback (\ s a -> s{_plapsipCallback = a})
82
true
true
0
9
27
48
25
23
null
null
HaskVan/regex-pcre-gsub
src/Text/Regex/PCRE/ByteString/Gsub.hs
mit
------------------------------------------------------------------------------- gsub :: ByteString -> ByteString -> ByteString -> ByteString gsub text match replacement = replaceMatches 0 matches text where matches = (text =~ match :: [MatchText ByteString]) rl = B8.length replacement replaceMatches _ [] text = text replaceMatches accum (m:ms) text = replaceMatches accum' ms text' where (o, l) = snd (m ! 0) (pre, post) = B8.splitAt (o + accum) text accum' = accum + (rl - l + 1) post' = B8.drop l post text' = B8.concat [pre, replacePlaceholder (fst $ m ! 0) match replacement, post'] replacePlaceholder :: ByteString -> ByteString -> ByteString -> ByteString replacePlaceholder expr pattern sub = B8.concat $ B8.zipWith f ('_' `B8.cons` sub) sub where matches = (expr =~ pattern :: [MatchText ByteString]) !! 0 f :: Char -> Char -> ByteString f _ '\\' = B8.empty f '\\' i | isDigit i = fst $ matches ! read [i] | otherwise = B8.pack $ '\\':[i] f _ x = B8.pack [x]
1,126
gsub :: ByteString -> ByteString -> ByteString -> ByteString gsub text match replacement = replaceMatches 0 matches text where matches = (text =~ match :: [MatchText ByteString]) rl = B8.length replacement replaceMatches _ [] text = text replaceMatches accum (m:ms) text = replaceMatches accum' ms text' where (o, l) = snd (m ! 0) (pre, post) = B8.splitAt (o + accum) text accum' = accum + (rl - l + 1) post' = B8.drop l post text' = B8.concat [pre, replacePlaceholder (fst $ m ! 0) match replacement, post'] replacePlaceholder :: ByteString -> ByteString -> ByteString -> ByteString replacePlaceholder expr pattern sub = B8.concat $ B8.zipWith f ('_' `B8.cons` sub) sub where matches = (expr =~ pattern :: [MatchText ByteString]) !! 0 f :: Char -> Char -> ByteString f _ '\\' = B8.empty f '\\' i | isDigit i = fst $ matches ! read [i] | otherwise = B8.pack $ '\\':[i] f _ x = B8.pack [x]
1,045
gsub text match replacement = replaceMatches 0 matches text where matches = (text =~ match :: [MatchText ByteString]) rl = B8.length replacement replaceMatches _ [] text = text replaceMatches accum (m:ms) text = replaceMatches accum' ms text' where (o, l) = snd (m ! 0) (pre, post) = B8.splitAt (o + accum) text accum' = accum + (rl - l + 1) post' = B8.drop l post text' = B8.concat [pre, replacePlaceholder (fst $ m ! 0) match replacement, post'] replacePlaceholder :: ByteString -> ByteString -> ByteString -> ByteString replacePlaceholder expr pattern sub = B8.concat $ B8.zipWith f ('_' `B8.cons` sub) sub where matches = (expr =~ pattern :: [MatchText ByteString]) !! 0 f :: Char -> Char -> ByteString f _ '\\' = B8.empty f '\\' i | isDigit i = fst $ matches ! read [i] | otherwise = B8.pack $ '\\':[i] f _ x = B8.pack [x]
984
true
true
0
12
317
415
214
201
null
null
beni55/texmath
src/Text/TeXMath/Readers/OMML.hs
gpl-2.0
unGroup exps = exps
19
unGroup exps = exps
19
unGroup exps = exps
19
false
false
1
5
3
13
4
9
null
null
bno1/adventofcode_2016
d21/main.hs
mit
puzzleInput1 :: String puzzleInput1 = "abcdefgh"
48
puzzleInput1 :: String puzzleInput1 = "abcdefgh"
48
puzzleInput1 = "abcdefgh"
25
false
true
0
6
5
18
7
11
null
null
kmate/HaRe
old/testing/duplication/RecursionIn1_AstOut.hs
bsd-3-clause
anotherFac 1 = 1
16
anotherFac 1 = 1
16
anotherFac 1 = 1
16
false
false
1
5
3
13
4
9
null
null
adept/hledger
hledger-web/Hledger/Web/Handler/EditR.hs
gpl-3.0
editForm :: FilePath -> Text -> Markup -> MForm Handler (FormResult Text, Widget) editForm f txt = identifyForm "edit" $ \extra -> do (tRes, tView) <- mreq textareaField fs (Just (Textarea txt)) pure (unTextarea <$> tRes, $(widgetFile "edit-form")) where fs = FieldSettings "text" mzero mzero mzero [("class", "form-control"), ("rows", "25")]
358
editForm :: FilePath -> Text -> Markup -> MForm Handler (FormResult Text, Widget) editForm f txt = identifyForm "edit" $ \extra -> do (tRes, tView) <- mreq textareaField fs (Just (Textarea txt)) pure (unTextarea <$> tRes, $(widgetFile "edit-form")) where fs = FieldSettings "text" mzero mzero mzero [("class", "form-control"), ("rows", "25")]
358
editForm f txt = identifyForm "edit" $ \extra -> do (tRes, tView) <- mreq textareaField fs (Just (Textarea txt)) pure (unTextarea <$> tRes, $(widgetFile "edit-form")) where fs = FieldSettings "text" mzero mzero mzero [("class", "form-control"), ("rows", "25")]
276
false
true
3
13
65
158
76
82
null
null
pparkkin/eta
compiler/ETA/CodeGen/Prim.hs
bsd-3-clause
-- TODO: You may have to cast to int or do some extra stuff here -- or maybe instead reference the direct byte array emitPrimOp DataToTagOp [arg] = return [ getTagMethod arg <> iconst jint 1 <> isub ]
216
emitPrimOp DataToTagOp [arg] = return [ getTagMethod arg <> iconst jint 1 <> isub ]
83
emitPrimOp DataToTagOp [arg] = return [ getTagMethod arg <> iconst jint 1 <> isub ]
83
true
false
0
9
54
38
19
19
null
null
plaprade/haskoin
haskoin-node/src/Network/Haskoin/Node/BlockChain.hs
unlicense
peerHeaderSyncFull :: (MonadLoggerIO m, MonadBaseControl IO m) => PeerId -> PeerHost -> NodeT m () peerHeaderSyncFull pid ph = go Nothing where go prevM = peerHeaderSync pid ph prevM >>= \actionM -> case actionM of Just _ -> go actionM Nothing -> do (synced, ourHeight) <- syncedHeight when synced $ $(logInfo) $ formatPid pid ph $ unwords [ "Block headers are in sync with the" , "network at height", show ourHeight ]
574
peerHeaderSyncFull :: (MonadLoggerIO m, MonadBaseControl IO m) => PeerId -> PeerHost -> NodeT m () peerHeaderSyncFull pid ph = go Nothing where go prevM = peerHeaderSync pid ph prevM >>= \actionM -> case actionM of Just _ -> go actionM Nothing -> do (synced, ourHeight) <- syncedHeight when synced $ $(logInfo) $ formatPid pid ph $ unwords [ "Block headers are in sync with the" , "network at height", show ourHeight ]
574
peerHeaderSyncFull pid ph = go Nothing where go prevM = peerHeaderSync pid ph prevM >>= \actionM -> case actionM of Just _ -> go actionM Nothing -> do (synced, ourHeight) <- syncedHeight when synced $ $(logInfo) $ formatPid pid ph $ unwords [ "Block headers are in sync with the" , "network at height", show ourHeight ]
418
false
true
7
9
227
138
71
67
null
null
bhamrick/hsmath
Math/Polynomial/Types.hs
bsd-3-clause
constPoly :: (Eq a, Num a) => a -> P a constPoly c = if c == 0 then P [] else P [c]
83
constPoly :: (Eq a, Num a) => a -> P a constPoly c = if c == 0 then P [] else P [c]
83
constPoly c = if c == 0 then P [] else P [c]
44
false
true
0
7
23
59
30
29
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Elements/Elements.hs
bsd-3-clause
-- | A short-hand notion for @ elDynAttr\' \"em\" ... @ emD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Em → m a → m (Element EventResult (DomBuilderSpace m) t, a) emD' bm = elDynAttr' "em" (A.attrMap <$> bm)
226
emD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Em → m a → m (Element EventResult (DomBuilderSpace m) t, a) emD' bm = elDynAttr' "em" (A.attrMap <$> bm)
170
emD' bm = elDynAttr' "em" (A.attrMap <$> bm)
45
true
true
0
14
46
97
49
48
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Elements/Interactive.hs
bsd-3-clause
-- | A short-hand notion for @ elDynAttr\' \"select\" ... @ selectD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Select → m a → m (Element EventResult (DomBuilderSpace m) t, a) selectD' bm = elDynAttr' "select" (A.attrMap <$> bm)
246
selectD' ∷ forall t m a. (DomBuilder t m, PostBuild t m) ⇒ Dynamic t Select → m a → m (Element EventResult (DomBuilderSpace m) t, a) selectD' bm = elDynAttr' "select" (A.attrMap <$> bm)
186
selectD' bm = elDynAttr' "select" (A.attrMap <$> bm)
53
true
true
0
13
46
93
48
45
null
null
brendanhay/gogol
gogol-shopping-content/gen/Network/Google/ShoppingContent/Types/Product.hs
mpl-2.0
-- | Date on which the shipment has been ready for pickup, in ISO 8601 -- format. Optional and can be provided only if \`status\` is \`ready for -- pickup\`. ousrReadyPickupDate :: Lens' OrdersUpdateShipmentRequest (Maybe Text) ousrReadyPickupDate = lens _ousrReadyPickupDate (\ s a -> s{_ousrReadyPickupDate = a})
322
ousrReadyPickupDate :: Lens' OrdersUpdateShipmentRequest (Maybe Text) ousrReadyPickupDate = lens _ousrReadyPickupDate (\ s a -> s{_ousrReadyPickupDate = a})
164
ousrReadyPickupDate = lens _ousrReadyPickupDate (\ s a -> s{_ousrReadyPickupDate = a})
94
true
true
0
9
54
50
27
23
null
null
michalkonecny/polypaver
src/Numeric/ER/RnToRm/UnitDom/ChebyshevBase/Polynom/Compose.hs
bsd-3-clause
enclCompose :: (B.ERRealBase b, DomainBox box varid Int, Ord box, Show varid, DomainIntBox boxra varid (ERInterval b), DomainBoxMappable boxra boxras varid (ERInterval b) [ERInterval b]) => Int {-^ max degree for result -} -> Int {-^ max approx size for result -} -> ERChebPoly box b {-^ @f@ -} -> varid {-^ variable @v@ to substitute in @f@ -} -> (ERChebPoly box b, ERChebPoly box b) {-^ enclosure of a function @f_v@ to substitute for @v@ that maps @[-1,1]@ into @[-1,1]@ -} -> (ERChebPoly box b, ERChebPoly box b) {-^ lower bound and upper bound -} enclCompose maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = result {------------------------------ The algorithm: separate from the polynomial all terms for each degree of the substituted variable, giving rise to a number of polynomials. These polynomials are then used as coefficients multiplying the enclosure evaluations of the Chebyshev polynomials over the substituted enclosure. -------------------------------} where result = Map.fold (+:) (enclConst 0) $ Map.mapWithKey evalDegree degreePolynomialMap degreePolynomialMap = Map.foldWithKey extractTerm Map.empty coeffs extractTerm term c prevPolynomMap = Map.insertWith Map.union substVarDegree (Map.singleton termNoSubstVar c) prevPolynomMap where substVarDegree = DBox.findWithDefault 0 substVar term termNoSubstVar = DBox.delete substVar term evalDegree degree degreeCoeffs = enclMultiply maxDegree maxSize (substPolyDegrees !! degree) (chplNeg degreePoly, degreePoly) where degreePoly = ERChebPoly degreeCoeffs substPolyDegrees = enclEvalTs maxSize maxDegree substEncl {------------------------------ The following algorithm is quite wasteful when the polynomial contains other variables besides the one being substituted. -------------------------------} --chplComposeWithEncl maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = -- result -- where -- result = -- foldl (+:) (enclConst 0) $ map evalTerm $ Map.toList coeffs -- evalTerm (term, c) = -- enclScale c $ -- foldl (enclMultiply maxDegree maxSize) (enclConst 1) $ -- map evalVar $ DBox.toList term -- evalVar (var, degree) = -- case var == substVar of -- True -> -- substPolyDegrees !! degree -- False -> -- (chplNeg varPoly, varPoly) -- where -- varPoly = -- ERChebPoly $ Map.singleton (DBox.singleton var degree) 1 -- substPolyDegrees = -- enclEvalTs maxSize maxDegree substEncl {-| Compose two polynomials, rounding upwards provided the second polynomial maps [-1,1] into [-1,1]. -}
2,850
enclCompose :: (B.ERRealBase b, DomainBox box varid Int, Ord box, Show varid, DomainIntBox boxra varid (ERInterval b), DomainBoxMappable boxra boxras varid (ERInterval b) [ERInterval b]) => Int {-^ max degree for result -} -> Int {-^ max approx size for result -} -> ERChebPoly box b {-^ @f@ -} -> varid {-^ variable @v@ to substitute in @f@ -} -> (ERChebPoly box b, ERChebPoly box b) {-^ enclosure of a function @f_v@ to substitute for @v@ that maps @[-1,1]@ into @[-1,1]@ -} -> (ERChebPoly box b, ERChebPoly box b) enclCompose maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = result {------------------------------ The algorithm: separate from the polynomial all terms for each degree of the substituted variable, giving rise to a number of polynomials. These polynomials are then used as coefficients multiplying the enclosure evaluations of the Chebyshev polynomials over the substituted enclosure. -------------------------------} where result = Map.fold (+:) (enclConst 0) $ Map.mapWithKey evalDegree degreePolynomialMap degreePolynomialMap = Map.foldWithKey extractTerm Map.empty coeffs extractTerm term c prevPolynomMap = Map.insertWith Map.union substVarDegree (Map.singleton termNoSubstVar c) prevPolynomMap where substVarDegree = DBox.findWithDefault 0 substVar term termNoSubstVar = DBox.delete substVar term evalDegree degree degreeCoeffs = enclMultiply maxDegree maxSize (substPolyDegrees !! degree) (chplNeg degreePoly, degreePoly) where degreePoly = ERChebPoly degreeCoeffs substPolyDegrees = enclEvalTs maxSize maxDegree substEncl {------------------------------ The following algorithm is quite wasteful when the polynomial contains other variables besides the one being substituted. -------------------------------} --chplComposeWithEncl maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = -- result -- where -- result = -- foldl (+:) (enclConst 0) $ map evalTerm $ Map.toList coeffs -- evalTerm (term, c) = -- enclScale c $ -- foldl (enclMultiply maxDegree maxSize) (enclConst 1) $ -- map evalVar $ DBox.toList term -- evalVar (var, degree) = -- case var == substVar of -- True -> -- substPolyDegrees !! degree -- False -> -- (chplNeg varPoly, varPoly) -- where -- varPoly = -- ERChebPoly $ Map.singleton (DBox.singleton var degree) 1 -- substPolyDegrees = -- enclEvalTs maxSize maxDegree substEncl {-| Compose two polynomials, rounding upwards provided the second polynomial maps [-1,1] into [-1,1]. -}
2,805
enclCompose maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = result {------------------------------ The algorithm: separate from the polynomial all terms for each degree of the substituted variable, giving rise to a number of polynomials. These polynomials are then used as coefficients multiplying the enclosure evaluations of the Chebyshev polynomials over the substituted enclosure. -------------------------------} where result = Map.fold (+:) (enclConst 0) $ Map.mapWithKey evalDegree degreePolynomialMap degreePolynomialMap = Map.foldWithKey extractTerm Map.empty coeffs extractTerm term c prevPolynomMap = Map.insertWith Map.union substVarDegree (Map.singleton termNoSubstVar c) prevPolynomMap where substVarDegree = DBox.findWithDefault 0 substVar term termNoSubstVar = DBox.delete substVar term evalDegree degree degreeCoeffs = enclMultiply maxDegree maxSize (substPolyDegrees !! degree) (chplNeg degreePoly, degreePoly) where degreePoly = ERChebPoly degreeCoeffs substPolyDegrees = enclEvalTs maxSize maxDegree substEncl {------------------------------ The following algorithm is quite wasteful when the polynomial contains other variables besides the one being substituted. -------------------------------} --chplComposeWithEncl maxDegree maxSize p@(ERChebPoly coeffs) substVar substEncl = -- result -- where -- result = -- foldl (+:) (enclConst 0) $ map evalTerm $ Map.toList coeffs -- evalTerm (term, c) = -- enclScale c $ -- foldl (enclMultiply maxDegree maxSize) (enclConst 1) $ -- map evalVar $ DBox.toList term -- evalVar (var, degree) = -- case var == substVar of -- True -> -- substPolyDegrees !! degree -- False -> -- (chplNeg varPoly, varPoly) -- where -- varPoly = -- ERChebPoly $ Map.singleton (DBox.singleton var degree) 1 -- substPolyDegrees = -- enclEvalTs maxSize maxDegree substEncl {-| Compose two polynomials, rounding upwards provided the second polynomial maps [-1,1] into [-1,1]. -}
2,217
true
true
0
12
712
361
196
165
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen/GPU/Base.hs
isc
-- | Assign iterations of a for-loop to all threads in the kernel. -- The passed-in function is invoked with the (symbolic) iteration. -- 'threadOperations' will be in effect in the body. For -- multidimensional loops, use 'groupCoverSpace'. kernelLoop :: IntExp t => Imp.TExp t -> Imp.TExp t -> Imp.TExp t -> (Imp.TExp t -> InKernelGen ()) -> InKernelGen () kernelLoop tid num_threads n f = localOps threadOperations $ if n == num_threads then f tid else do -- Compute how many elements this thread is responsible for. -- Formula: (n - tid) / num_threads (rounded up). let elems_for_this = (n - tid) `divUp` num_threads sFor "i" elems_for_this $ \i -> f $ i * num_threads + tid -- | Assign iterations of a for-loop to threads in the workgroup. The -- passed-in function is invoked with the (symbolic) iteration. For -- multidimensional loops, use 'groupCoverSpace'.
933
kernelLoop :: IntExp t => Imp.TExp t -> Imp.TExp t -> Imp.TExp t -> (Imp.TExp t -> InKernelGen ()) -> InKernelGen () kernelLoop tid num_threads n f = localOps threadOperations $ if n == num_threads then f tid else do -- Compute how many elements this thread is responsible for. -- Formula: (n - tid) / num_threads (rounded up). let elems_for_this = (n - tid) `divUp` num_threads sFor "i" elems_for_this $ \i -> f $ i * num_threads + tid -- | Assign iterations of a for-loop to threads in the workgroup. The -- passed-in function is invoked with the (symbolic) iteration. For -- multidimensional loops, use 'groupCoverSpace'.
690
kernelLoop tid num_threads n f = localOps threadOperations $ if n == num_threads then f tid else do -- Compute how many elements this thread is responsible for. -- Formula: (n - tid) / num_threads (rounded up). let elems_for_this = (n - tid) `divUp` num_threads sFor "i" elems_for_this $ \i -> f $ i * num_threads + tid -- | Assign iterations of a for-loop to threads in the workgroup. The -- passed-in function is invoked with the (symbolic) iteration. For -- multidimensional loops, use 'groupCoverSpace'.
561
true
true
0
14
212
167
84
83
null
null
xnning/fcore
lib/PrettyUtils.hs
bsd-2-clause
biglambda = text "/\\"
22
biglambda = text "/\\"
22
biglambda = text "/\\"
22
false
false
1
5
3
13
4
9
null
null
niteria/haddock
haddock-api/src/Haddock/Convert.hs
bsd-2-clause
synifyTyVar :: TyVar -> LHsTyVarBndr Name synifyTyVar tv | isLiftedTypeKind kind = noLoc (UserTyVar (noLoc name)) | otherwise = noLoc (KindedTyVar (noLoc name) (synifyKindSig kind)) where kind = tyVarKind tv name = getName tv --states of what to do with foralls:
289
synifyTyVar :: TyVar -> LHsTyVarBndr Name synifyTyVar tv | isLiftedTypeKind kind = noLoc (UserTyVar (noLoc name)) | otherwise = noLoc (KindedTyVar (noLoc name) (synifyKindSig kind)) where kind = tyVarKind tv name = getName tv --states of what to do with foralls:
289
synifyTyVar tv | isLiftedTypeKind kind = noLoc (UserTyVar (noLoc name)) | otherwise = noLoc (KindedTyVar (noLoc name) (synifyKindSig kind)) where kind = tyVarKind tv name = getName tv --states of what to do with foralls:
247
false
true
2
10
67
95
45
50
null
null
dawedawe/kripkeweb
src/Conf.hs
bsd-3-clause
-- |Default configuration with proxy example. defaultConf :: String defaultConf = "# proxyname = 127.0.0.1\n" ++ "# proxyport = 8118\n" ++ "# dbhost = localhost\n" ++ "# dbport = 5432\n" ++ "# dbuser = postgres\n" ++ "# dbpassword = \n" ++ "# dbname = postgres"
289
defaultConf :: String defaultConf = "# proxyname = 127.0.0.1\n" ++ "# proxyport = 8118\n" ++ "# dbhost = localhost\n" ++ "# dbport = 5432\n" ++ "# dbuser = postgres\n" ++ "# dbpassword = \n" ++ "# dbname = postgres"
243
defaultConf = "# proxyname = 127.0.0.1\n" ++ "# proxyport = 8118\n" ++ "# dbhost = localhost\n" ++ "# dbport = 5432\n" ++ "# dbuser = postgres\n" ++ "# dbpassword = \n" ++ "# dbname = postgres"
221
true
true
0
10
72
36
19
17
null
null
urbanslug/ghc
testsuite/tests/programs/jules_xref2/Main.hs
bsd-3-clause
dispLine k ns = k ++ ":" ++ dispNos ns ++ "\n"
46
dispLine k ns = k ++ ":" ++ dispNos ns ++ "\n"
46
dispLine k ns = k ++ ":" ++ dispNos ns ++ "\n"
46
false
false
0
7
11
26
12
14
null
null
antarestrader/sapphire
LineParser.hs
gpl-3.0
compareLine :: Offset -> LParser (Maybe (Line,Ordering)) compareLine i = do maybe_l <- getLine case maybe_l of Nothing -> return Nothing Just l@(BlankLine _) -> return $ Just (l,EQ) Just l -> return $ Just (l, compare (offset l) i ) -- Using the next line as the starting point, grab a set of equally indented -- lines and put them together into a block.
372
compareLine :: Offset -> LParser (Maybe (Line,Ordering)) compareLine i = do maybe_l <- getLine case maybe_l of Nothing -> return Nothing Just l@(BlankLine _) -> return $ Just (l,EQ) Just l -> return $ Just (l, compare (offset l) i ) -- Using the next line as the starting point, grab a set of equally indented -- lines and put them together into a block.
372
compareLine i = do maybe_l <- getLine case maybe_l of Nothing -> return Nothing Just l@(BlankLine _) -> return $ Just (l,EQ) Just l -> return $ Just (l, compare (offset l) i ) -- Using the next line as the starting point, grab a set of equally indented -- lines and put them together into a block.
315
false
true
0
15
82
122
61
61
null
null
shlevy/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
isCheapUnfolding _ = False
68
isCheapUnfolding _ = False
68
isCheapUnfolding _ = False
68
false
false
0
5
45
9
4
5
null
null
gabesoft/kapi
test/TestHelper.hs
bsd-3-clause
mkId :: RecordId -> Value mkId v = ObjId (read $ unpack v)
58
mkId :: RecordId -> Value mkId v = ObjId (read $ unpack v)
58
mkId v = ObjId (read $ unpack v)
32
false
true
0
8
12
31
15
16
null
null
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/basic_haskell/elem_5.hs
mit
primMulNat Zero (Succ y) = Zero
31
primMulNat Zero (Succ y) = Zero
31
primMulNat Zero (Succ y) = Zero
31
false
false
0
7
5
17
8
9
null
null
andrey013/pluginstest
Plugins/Gallery/Gallery/Manual46.hs
mit
d1 =/= d2 = d1 === strutY 2 === d2
34
d1 =/= d2 = d1 === strutY 2 === d2
34
d1 =/= d2 = d1 === strutY 2 === d2
34
false
false
0
7
9
23
10
13
null
null
andrewmichaud/JustSudoku
test/Sudoku/Control/MoveSpec.hs
bsd-3-clause
spec :: Spec spec = do describe "Move properties:" $ do let set = Set "0" "1" "1" let set2 = Set "3" "4" "5" let check = Check let erase = Erase "0" "1" let erase2 = Erase "0" "4" let reset = Reset let quit = Quit context "Show:" $ do it "should work for Set" $ do show set `shouldBe` "Set \"0\" \"1\" \"1\"" show set2 `shouldBe` "Set \"3\" \"4\" \"5\"" it "should work for Check" $ show check `shouldBe` "Check" it "should work for Erase" $ do show erase `shouldBe` "Erase \"0\" \"1\"" show erase2 `shouldBe` "Erase \"0\" \"4\"" it "should work for Reset" $ show reset `shouldBe` "Reset" it "should work for Quit" $ show quit `shouldBe` "Quit" context "Equality:" $ do it "should hold between moves that are the same." $ do set `shouldBe` set check `shouldBe` check erase `shouldBe` erase reset `shouldBe` reset quit `shouldBe` quit it "should not hold between different kinds of moves." $ do set `shouldNotBe` check set `shouldNotBe` erase set `shouldNotBe` reset set `shouldNotBe` quit check `shouldNotBe` erase check `shouldNotBe` reset check `shouldNotBe` quit erase `shouldNotBe` reset erase `shouldNotBe` quit reset `shouldNotBe` quit it "should not hold between moves with different data members." $ do set `shouldNotBe` set2 erase `shouldNotBe` erase2 describe "MoveError properties:" $ do let r = 100::Int let rs = show r let c = 100::Int let cs = show c let v = 100::Int let vs = show v let squares = singleton $ Loc 1 2 let ssquares = show squares context "Show:" $ do context "NaNError:" $ it "should display correctly." $ show (NaNError "q") `shouldBe` ("Value " ++ "q" ++ " is not a number.") it "OutOfBoundsError should display correctly." $ show (OutOfBoundsError r c) `shouldBe` ("Square (" ++ rs ++ ", " ++ cs ++ ") is out of bounds.") it "InvalidValueError should display correctly." $ show (InvalidValueError v) `shouldBe` ("Value " ++ vs ++ " is invalid.") it "InvalidBoardError should display correctly," $ show (InvalidBoardError squares) `shouldBe` ("Board is invalid. " ++ "Invalid squares: " ++ ssquares) it "OtherError should display correctly." $ show (OtherError "fish") `shouldBe` ("General error: " ++ "fish") it "QuitError." $ show QuitError `shouldBe` "Asked or required to quit!"
3,169
spec :: Spec spec = do describe "Move properties:" $ do let set = Set "0" "1" "1" let set2 = Set "3" "4" "5" let check = Check let erase = Erase "0" "1" let erase2 = Erase "0" "4" let reset = Reset let quit = Quit context "Show:" $ do it "should work for Set" $ do show set `shouldBe` "Set \"0\" \"1\" \"1\"" show set2 `shouldBe` "Set \"3\" \"4\" \"5\"" it "should work for Check" $ show check `shouldBe` "Check" it "should work for Erase" $ do show erase `shouldBe` "Erase \"0\" \"1\"" show erase2 `shouldBe` "Erase \"0\" \"4\"" it "should work for Reset" $ show reset `shouldBe` "Reset" it "should work for Quit" $ show quit `shouldBe` "Quit" context "Equality:" $ do it "should hold between moves that are the same." $ do set `shouldBe` set check `shouldBe` check erase `shouldBe` erase reset `shouldBe` reset quit `shouldBe` quit it "should not hold between different kinds of moves." $ do set `shouldNotBe` check set `shouldNotBe` erase set `shouldNotBe` reset set `shouldNotBe` quit check `shouldNotBe` erase check `shouldNotBe` reset check `shouldNotBe` quit erase `shouldNotBe` reset erase `shouldNotBe` quit reset `shouldNotBe` quit it "should not hold between moves with different data members." $ do set `shouldNotBe` set2 erase `shouldNotBe` erase2 describe "MoveError properties:" $ do let r = 100::Int let rs = show r let c = 100::Int let cs = show c let v = 100::Int let vs = show v let squares = singleton $ Loc 1 2 let ssquares = show squares context "Show:" $ do context "NaNError:" $ it "should display correctly." $ show (NaNError "q") `shouldBe` ("Value " ++ "q" ++ " is not a number.") it "OutOfBoundsError should display correctly." $ show (OutOfBoundsError r c) `shouldBe` ("Square (" ++ rs ++ ", " ++ cs ++ ") is out of bounds.") it "InvalidValueError should display correctly." $ show (InvalidValueError v) `shouldBe` ("Value " ++ vs ++ " is invalid.") it "InvalidBoardError should display correctly," $ show (InvalidBoardError squares) `shouldBe` ("Board is invalid. " ++ "Invalid squares: " ++ ssquares) it "OtherError should display correctly." $ show (OtherError "fish") `shouldBe` ("General error: " ++ "fish") it "QuitError." $ show QuitError `shouldBe` "Asked or required to quit!"
3,169
spec = do describe "Move properties:" $ do let set = Set "0" "1" "1" let set2 = Set "3" "4" "5" let check = Check let erase = Erase "0" "1" let erase2 = Erase "0" "4" let reset = Reset let quit = Quit context "Show:" $ do it "should work for Set" $ do show set `shouldBe` "Set \"0\" \"1\" \"1\"" show set2 `shouldBe` "Set \"3\" \"4\" \"5\"" it "should work for Check" $ show check `shouldBe` "Check" it "should work for Erase" $ do show erase `shouldBe` "Erase \"0\" \"1\"" show erase2 `shouldBe` "Erase \"0\" \"4\"" it "should work for Reset" $ show reset `shouldBe` "Reset" it "should work for Quit" $ show quit `shouldBe` "Quit" context "Equality:" $ do it "should hold between moves that are the same." $ do set `shouldBe` set check `shouldBe` check erase `shouldBe` erase reset `shouldBe` reset quit `shouldBe` quit it "should not hold between different kinds of moves." $ do set `shouldNotBe` check set `shouldNotBe` erase set `shouldNotBe` reset set `shouldNotBe` quit check `shouldNotBe` erase check `shouldNotBe` reset check `shouldNotBe` quit erase `shouldNotBe` reset erase `shouldNotBe` quit reset `shouldNotBe` quit it "should not hold between moves with different data members." $ do set `shouldNotBe` set2 erase `shouldNotBe` erase2 describe "MoveError properties:" $ do let r = 100::Int let rs = show r let c = 100::Int let cs = show c let v = 100::Int let vs = show v let squares = singleton $ Loc 1 2 let ssquares = show squares context "Show:" $ do context "NaNError:" $ it "should display correctly." $ show (NaNError "q") `shouldBe` ("Value " ++ "q" ++ " is not a number.") it "OutOfBoundsError should display correctly." $ show (OutOfBoundsError r c) `shouldBe` ("Square (" ++ rs ++ ", " ++ cs ++ ") is out of bounds.") it "InvalidValueError should display correctly." $ show (InvalidValueError v) `shouldBe` ("Value " ++ vs ++ " is invalid.") it "InvalidBoardError should display correctly," $ show (InvalidBoardError squares) `shouldBe` ("Board is invalid. " ++ "Invalid squares: " ++ ssquares) it "OtherError should display correctly." $ show (OtherError "fish") `shouldBe` ("General error: " ++ "fish") it "QuitError." $ show QuitError `shouldBe` "Asked or required to quit!"
3,156
false
true
0
18
1,327
770
371
399
null
null
kawamuray/ganeti
src/Ganeti/HTools/Program/Hcheck.hs
gpl-2.0
printBool False b = show b
26
printBool False b = show b
26
printBool False b = show b
26
false
false
0
5
5
14
6
8
null
null
rahulmutt/ghcvm
compiler/Eta/Prelude/THNames.hs
bsd-3-clause
mkNameSIdKey = mkPreludeMiscIdUnique 210
48
mkNameSIdKey = mkPreludeMiscIdUnique 210
48
mkNameSIdKey = mkPreludeMiscIdUnique 210
48
false
false
0
5
11
9
4
5
null
null
srush/TextBook
src/Stream.hs
bsd-3-clause
(!^) :: JSObject JSValue -> String -> Integer (!^) obj key = case fromJust $ get_field obj key of JSRational _ rat -> round rat JSString jsstring -> read $ fromJSString $ jsstring
214
(!^) :: JSObject JSValue -> String -> Integer (!^) obj key = case fromJust $ get_field obj key of JSRational _ rat -> round rat JSString jsstring -> read $ fromJSString $ jsstring
214
(!^) obj key = case fromJust $ get_field obj key of JSRational _ rat -> round rat JSString jsstring -> read $ fromJSString $ jsstring
168
false
true
0
9
67
75
37
38
null
null
brendanhay/gogol
gogol-serviceuser/gen/Network/Google/Resource/ServiceUser/Projects/Services/List.hs
mpl-2.0
-- | V1 error format. pslXgafv :: Lens' ProjectsServicesList (Maybe Xgafv) pslXgafv = lens _pslXgafv (\ s a -> s{_pslXgafv = a})
128
pslXgafv :: Lens' ProjectsServicesList (Maybe Xgafv) pslXgafv = lens _pslXgafv (\ s a -> s{_pslXgafv = a})
106
pslXgafv = lens _pslXgafv (\ s a -> s{_pslXgafv = a})
53
true
true
0
9
21
46
25
21
null
null
dicomgrid/dicom-haskell-library
src/Data/DICOM/Object.hs
gpl-3.0
object :: [Element] -> Object object = Object . sortBy (compare `on` elementTag)
80
object :: [Element] -> Object object = Object . sortBy (compare `on` elementTag)
80
object = Object . sortBy (compare `on` elementTag)
50
false
true
0
8
12
34
19
15
null
null