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
mightymoose/liquidhaskell
benchmarks/containers-0.5.0.0/Data/Sequence.hs
bsd-3-clause
addDigits1 m1 (One a) b (Four c d e f) m2 = appendTree2 m1 (node3 a b c) (node3 d e f) m2
93
addDigits1 m1 (One a) b (Four c d e f) m2 = appendTree2 m1 (node3 a b c) (node3 d e f) m2
93
addDigits1 m1 (One a) b (Four c d e f) m2 = appendTree2 m1 (node3 a b c) (node3 d e f) m2
93
false
false
1
7
26
73
31
42
null
null
maurer/ptrace
src/System/PTrace/Types.hs
bsd-3-clause
-- | A null pointer to anything (essentially the equivalent of the C NULL traceNull :: PTracePtr a traceNull = PTP nullPtr
122
traceNull :: PTracePtr a traceNull = PTP nullPtr
48
traceNull = PTP nullPtr
23
true
true
0
5
21
18
9
9
null
null
jsavatgy/talvipaivanseisauksen-ajanlasku
bmt-year.hs
gpl-3.0
getddays t1 t2 = diffDays (lod t1) (lod t2) where lod = (localDay . zonedTimeToLocalTime)
95
getddays t1 t2 = diffDays (lod t1) (lod t2) where lod = (localDay . zonedTimeToLocalTime)
95
getddays t1 t2 = diffDays (lod t1) (lod t2) where lod = (localDay . zonedTimeToLocalTime)
95
false
false
2
7
20
52
21
31
null
null
gspia/reflex-dom-htmlea
lib/src/Reflex/Dom/HTML5/Attrs/Attrs.hs
bsd-3-clause
btButton = attrSetButtonType BTbutton
37
btButton = attrSetButtonType BTbutton
37
btButton = attrSetButtonType BTbutton
37
false
false
1
5
3
12
4
8
null
null
AlbinTheander/oden
test/Oden/Backend/GoBackendSpec.hs
mit
gen :: MonomorphedPackage -> Either CodegenError AST.SourceFile gen pkg = runExcept (runReaderT (genPackage pkg) pkg)
117
gen :: MonomorphedPackage -> Either CodegenError AST.SourceFile gen pkg = runExcept (runReaderT (genPackage pkg) pkg)
117
gen pkg = runExcept (runReaderT (genPackage pkg) pkg)
53
false
true
0
9
14
42
20
22
null
null
jtdaugherty/vty-ui-builder-xml
src/Graphics/Vty/Widgets/Builder/Reader/XML/TH.hs
bsd-3-clause
doQuoteDec :: String -> Q [Dec] doQuoteDec src = do result <- runIO $ readDoc xmlReader "fixme" src case result of Left es -> do forM_ es $ \(msg, _) -> report True $ msg fail "Could not parse input document due to previous errors" Right doc -> do -- This may be the default config already, but this -- way we're explicit in case the defaults ever -- change, since this is what is necessary for the -- splice to work. let config = defaultConfig { generateMain = False , generateInterfaceType = True , generateInterfaceBuilder = True } modResult <- runIO $ generateSourceForDocument config doc coreSpecHandlers case modResult of Left es -> do forM_ es $ report True . show fail "Could not generate module source due to previous errors" Right (Module _ _ _ _ _ _ decls) -> return $ convert decls
1,154
doQuoteDec :: String -> Q [Dec] doQuoteDec src = do result <- runIO $ readDoc xmlReader "fixme" src case result of Left es -> do forM_ es $ \(msg, _) -> report True $ msg fail "Could not parse input document due to previous errors" Right doc -> do -- This may be the default config already, but this -- way we're explicit in case the defaults ever -- change, since this is what is necessary for the -- splice to work. let config = defaultConfig { generateMain = False , generateInterfaceType = True , generateInterfaceBuilder = True } modResult <- runIO $ generateSourceForDocument config doc coreSpecHandlers case modResult of Left es -> do forM_ es $ report True . show fail "Could not generate module source due to previous errors" Right (Module _ _ _ _ _ _ decls) -> return $ convert decls
1,154
doQuoteDec src = do result <- runIO $ readDoc xmlReader "fixme" src case result of Left es -> do forM_ es $ \(msg, _) -> report True $ msg fail "Could not parse input document due to previous errors" Right doc -> do -- This may be the default config already, but this -- way we're explicit in case the defaults ever -- change, since this is what is necessary for the -- splice to work. let config = defaultConfig { generateMain = False , generateInterfaceType = True , generateInterfaceBuilder = True } modResult <- runIO $ generateSourceForDocument config doc coreSpecHandlers case modResult of Left es -> do forM_ es $ report True . show fail "Could not generate module source due to previous errors" Right (Module _ _ _ _ _ _ decls) -> return $ convert decls
1,122
false
true
0
19
505
225
108
117
null
null
orion-42/cellular-automata-2d
Test.hs
mit
getIndex :: Index -> (Int, Int) getIndex (a, b) = (getNonNegative a, getNonNegative b)
86
getIndex :: Index -> (Int, Int) getIndex (a, b) = (getNonNegative a, getNonNegative b)
86
getIndex (a, b) = (getNonNegative a, getNonNegative b)
54
false
true
0
6
13
42
23
19
null
null
andir/ganeti
test/hs/Test/Ganeti/JQueue/Objects.hs
bsd-2-clause
-- | Generates an static, empty job. emptyJob :: (Monad m) => m QueuedJob emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
207
emptyJob :: (Monad m) => m QueuedJob emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
170
emptyJob = do jid0 <- makeJobId 0 return $ QueuedJob jid0 [] justNoTs justNoTs justNoTs Nothing Nothing -- | Generates a job ID.
133
true
true
0
9
41
59
29
30
null
null
green-haskell/ghc
libraries/base/GHC/Conc/Sync.hs
bsd-3-clause
-- |Exception handling within STM actions. catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a catchSTM (STM m) handler = STM $ catchSTM# m handler' where handler' e = case fromException e of Just e' -> unSTM (handler e') Nothing -> raiseIO# e -- | Low-level primitive on which always and alwaysSucceeds are built. -- checkInv differs form these in that (i) the invariant is not -- checked when checkInv is called, only at the end of this and -- subsequent transcations, (ii) the invariant failure is indicated -- by raising an exception.
597
catchSTM :: Exception e => STM a -> (e -> STM a) -> STM a catchSTM (STM m) handler = STM $ catchSTM# m handler' where handler' e = case fromException e of Just e' -> unSTM (handler e') Nothing -> raiseIO# e -- | Low-level primitive on which always and alwaysSucceeds are built. -- checkInv differs form these in that (i) the invariant is not -- checked when checkInv is called, only at the end of this and -- subsequent transcations, (ii) the invariant failure is indicated -- by raising an exception.
554
catchSTM (STM m) handler = STM $ catchSTM# m handler' where handler' e = case fromException e of Just e' -> unSTM (handler e') Nothing -> raiseIO# e -- | Low-level primitive on which always and alwaysSucceeds are built. -- checkInv differs form these in that (i) the invariant is not -- checked when checkInv is called, only at the end of this and -- subsequent transcations, (ii) the invariant failure is indicated -- by raising an exception.
496
true
true
0
12
151
112
55
57
null
null
mrb/tee-io
src/Handler/Output.hs
mit
sendTextDataAck :: MonadIO m => Text -> WebSocketsT m () sendTextDataAck msg = do sendTextData msg void receiveTextData -- Just fixing the type to Text
160
sendTextDataAck :: MonadIO m => Text -> WebSocketsT m () sendTextDataAck msg = do sendTextData msg void receiveTextData -- Just fixing the type to Text
160
sendTextDataAck msg = do sendTextData msg void receiveTextData -- Just fixing the type to Text
103
false
true
0
9
33
50
21
29
null
null
zachsully/hakaru
haskell/Language/Hakaru/Pretty/Maple.hs
bsd-3-clause
mapleMeasureOp Beta = \(e1 :* e2 :* End) -> app2 "BetaD" e1 e2
72
mapleMeasureOp Beta = \(e1 :* e2 :* End) -> app2 "BetaD" e1 e2
72
mapleMeasureOp Beta = \(e1 :* e2 :* End) -> app2 "BetaD" e1 e2
72
false
false
0
8
22
32
16
16
null
null
ezyang/ghc
compiler/nativeGen/PPC/Ppr.hs
bsd-3-clause
pprAddr (AddrRegImm r1 (ImmInteger i)) = hcat [ integer i, char '(', pprReg r1, char ')' ]
92
pprAddr (AddrRegImm r1 (ImmInteger i)) = hcat [ integer i, char '(', pprReg r1, char ')' ]
92
pprAddr (AddrRegImm r1 (ImmInteger i)) = hcat [ integer i, char '(', pprReg r1, char ')' ]
92
false
false
0
9
18
50
24
26
null
null
kawu/feature-structure
src/NLP/FeatureStructure/Join.hs
bsd-2-clause
-- | Merge two nodes under the given identifiers and populate -- queue with new node-pairs which need to be joined. merge :: (Functor m, Monad m, Ord i, Ord f, Eq a) => i -> i -> JoinT i f a m () merge i j = do n <- getNode i m <- getNode j doit n m where doit (Interior p) (Interior q) = do -- TODO: We could probably speed it up by checking if some -- of the pairs have not been already joined. mapM_ push $ joint p q setNode i $ Interior $ M.union p q remNode j >> i `mkReprOf` j doit (Frontier _) (Interior q) | M.null q = remNode j >> i `mkReprOf` j | otherwise = uniFail doit (Interior p) (Frontier _) | M.null p = remNode i >> j `mkReprOf` i | otherwise = uniFail doit (Frontier x) (Frontier y) | x == y = remNode j >> i `mkReprOf` j | otherwise = uniFail joint x y = M.elems $ M.intersectionWith (,) x y -------------------------------------------------------------------- -- Join operations -------------------------------------------------------------------- -- | Join the two given nodes (and more, when necesseary) -- in the feature graph.
1,190
merge :: (Functor m, Monad m, Ord i, Ord f, Eq a) => i -> i -> JoinT i f a m () merge i j = do n <- getNode i m <- getNode j doit n m where doit (Interior p) (Interior q) = do -- TODO: We could probably speed it up by checking if some -- of the pairs have not been already joined. mapM_ push $ joint p q setNode i $ Interior $ M.union p q remNode j >> i `mkReprOf` j doit (Frontier _) (Interior q) | M.null q = remNode j >> i `mkReprOf` j | otherwise = uniFail doit (Interior p) (Frontier _) | M.null p = remNode i >> j `mkReprOf` i | otherwise = uniFail doit (Frontier x) (Frontier y) | x == y = remNode j >> i `mkReprOf` j | otherwise = uniFail joint x y = M.elems $ M.intersectionWith (,) x y -------------------------------------------------------------------- -- Join operations -------------------------------------------------------------------- -- | Join the two given nodes (and more, when necesseary) -- in the feature graph.
1,074
merge i j = do n <- getNode i m <- getNode j doit n m where doit (Interior p) (Interior q) = do -- TODO: We could probably speed it up by checking if some -- of the pairs have not been already joined. mapM_ push $ joint p q setNode i $ Interior $ M.union p q remNode j >> i `mkReprOf` j doit (Frontier _) (Interior q) | M.null q = remNode j >> i `mkReprOf` j | otherwise = uniFail doit (Interior p) (Frontier _) | M.null p = remNode i >> j `mkReprOf` i | otherwise = uniFail doit (Frontier x) (Frontier y) | x == y = remNode j >> i `mkReprOf` j | otherwise = uniFail joint x y = M.elems $ M.intersectionWith (,) x y -------------------------------------------------------------------- -- Join operations -------------------------------------------------------------------- -- | Join the two given nodes (and more, when necesseary) -- in the feature graph.
986
true
true
0
9
336
379
183
196
null
null
urbanslug/ghc
compiler/cmm/CmmExpr.hs
bsd-3-clause
cmmLitType dflags (CmmLabelOff lbl _) = cmmLabelType dflags lbl
64
cmmLitType dflags (CmmLabelOff lbl _) = cmmLabelType dflags lbl
64
cmmLitType dflags (CmmLabelOff lbl _) = cmmLabelType dflags lbl
64
false
false
0
7
9
24
11
13
null
null
redfish64/IrcScanner
src/IrcScanner/KeywordRulesParser.hs
bsd-3-clause
listEitherToEitherLists :: [Either a b] -> a -> Either [a] [b] listEitherToEitherLists lns placeholder = case doit lns (Right []) of Left x -> Left (reverse x) Right y -> Right (reverse y) where doit (Right x : xs) (Right ys) = doit xs (Right (x : ys)) doit (Left y : ys) (Right xs) = doit ys (Left $ y : (fmap (const placeholder) xs)) doit (Right _ : xs) (Left ys) = doit xs (Left $ placeholder : ys) doit (Left y : xs) (Left ys) = doit xs $ Left (y : ys) doit [] r = r
496
listEitherToEitherLists :: [Either a b] -> a -> Either [a] [b] listEitherToEitherLists lns placeholder = case doit lns (Right []) of Left x -> Left (reverse x) Right y -> Right (reverse y) where doit (Right x : xs) (Right ys) = doit xs (Right (x : ys)) doit (Left y : ys) (Right xs) = doit ys (Left $ y : (fmap (const placeholder) xs)) doit (Right _ : xs) (Left ys) = doit xs (Left $ placeholder : ys) doit (Left y : xs) (Left ys) = doit xs $ Left (y : ys) doit [] r = r
496
listEitherToEitherLists lns placeholder = case doit lns (Right []) of Left x -> Left (reverse x) Right y -> Right (reverse y) where doit (Right x : xs) (Right ys) = doit xs (Right (x : ys)) doit (Left y : ys) (Right xs) = doit ys (Left $ y : (fmap (const placeholder) xs)) doit (Right _ : xs) (Left ys) = doit xs (Left $ placeholder : ys) doit (Left y : xs) (Left ys) = doit xs $ Left (y : ys) doit [] r = r
433
false
true
0
11
126
296
145
151
null
null
cawinkelmann/api-server
test/Api/Mappers/ResourceSpec.hs
mit
spec :: Spec spec = beforeAll resetDb $ do describe "find" $ do it "finds a Resource by its ID" $ withRollback $ \q -> do found <- q $ do resource <- fromJust <$> Resource.insert mockResFields Resource.find $ res_id resource res_fields (fromJust found) `shouldBe` mockResFields it "returns Nothing if no Resource with the UUID exists" $ withRollback $ \q -> do results <- q $ Resource.find (ResourceID 9999) results `shouldBe` Nothing describe "findByEmail" $ do it "finds a Resource by its ResourceEmail" $ withRollback $ \q -> do found <- q $ do _ <- Resource.insert mockResFields Resource.findByEmail (res_email mockResFields) found `shouldSatisfy` isJust it "returns Nothing if no Resource with the ResourceEmail exists" $ withRollback $ \q -> do let email = ResourceEmail $ mockEmail "nonexistant@email.com" results <- q $ Resource.findByEmail email results `shouldBe` Nothing describe "insert" $ do it "creates a new Resource" $ withRollback $ \q -> do resource <- q $ fromJust <$> Resource.insert mockResFields res_fields resource `shouldBe` mockResFields it "requires a unique email address" $ withRollback $ \q -> do let res1 = mockResFields { res_name = ResourceName "res1" } res2 = mockResFields { res_name = ResourceName "res2" } badQuery = q $ Resource.insert res1 >> Resource.insert res2 badQuery `shouldThrow` anyException describe "update" $ do it "updates a Resource with the same ID" $ withRollback $ \q -> do let oldres = mockResFields { res_name = ResourceName "old" } newres = mockResFields { res_name = ResourceName "new" } resource <- q $ do old <- fromJust <$> Resource.insert oldres _ <- Resource.update $ old { res_fields = newres } fromJust <$> Resource.find (res_id old) res_fields resource `shouldBe` newres it "returns Nothing if no Resource has the same ResourceID" $ withRollback $ \q -> do let notInDb = Resource (ResourceID 9999) mockResFields found <- q $ Resource.update notInDb found `shouldBe` Nothing
2,210
spec :: Spec spec = beforeAll resetDb $ do describe "find" $ do it "finds a Resource by its ID" $ withRollback $ \q -> do found <- q $ do resource <- fromJust <$> Resource.insert mockResFields Resource.find $ res_id resource res_fields (fromJust found) `shouldBe` mockResFields it "returns Nothing if no Resource with the UUID exists" $ withRollback $ \q -> do results <- q $ Resource.find (ResourceID 9999) results `shouldBe` Nothing describe "findByEmail" $ do it "finds a Resource by its ResourceEmail" $ withRollback $ \q -> do found <- q $ do _ <- Resource.insert mockResFields Resource.findByEmail (res_email mockResFields) found `shouldSatisfy` isJust it "returns Nothing if no Resource with the ResourceEmail exists" $ withRollback $ \q -> do let email = ResourceEmail $ mockEmail "nonexistant@email.com" results <- q $ Resource.findByEmail email results `shouldBe` Nothing describe "insert" $ do it "creates a new Resource" $ withRollback $ \q -> do resource <- q $ fromJust <$> Resource.insert mockResFields res_fields resource `shouldBe` mockResFields it "requires a unique email address" $ withRollback $ \q -> do let res1 = mockResFields { res_name = ResourceName "res1" } res2 = mockResFields { res_name = ResourceName "res2" } badQuery = q $ Resource.insert res1 >> Resource.insert res2 badQuery `shouldThrow` anyException describe "update" $ do it "updates a Resource with the same ID" $ withRollback $ \q -> do let oldres = mockResFields { res_name = ResourceName "old" } newres = mockResFields { res_name = ResourceName "new" } resource <- q $ do old <- fromJust <$> Resource.insert oldres _ <- Resource.update $ old { res_fields = newres } fromJust <$> Resource.find (res_id old) res_fields resource `shouldBe` newres it "returns Nothing if no Resource has the same ResourceID" $ withRollback $ \q -> do let notInDb = Resource (ResourceID 9999) mockResFields found <- q $ Resource.update notInDb found `shouldBe` Nothing
2,210
spec = beforeAll resetDb $ do describe "find" $ do it "finds a Resource by its ID" $ withRollback $ \q -> do found <- q $ do resource <- fromJust <$> Resource.insert mockResFields Resource.find $ res_id resource res_fields (fromJust found) `shouldBe` mockResFields it "returns Nothing if no Resource with the UUID exists" $ withRollback $ \q -> do results <- q $ Resource.find (ResourceID 9999) results `shouldBe` Nothing describe "findByEmail" $ do it "finds a Resource by its ResourceEmail" $ withRollback $ \q -> do found <- q $ do _ <- Resource.insert mockResFields Resource.findByEmail (res_email mockResFields) found `shouldSatisfy` isJust it "returns Nothing if no Resource with the ResourceEmail exists" $ withRollback $ \q -> do let email = ResourceEmail $ mockEmail "nonexistant@email.com" results <- q $ Resource.findByEmail email results `shouldBe` Nothing describe "insert" $ do it "creates a new Resource" $ withRollback $ \q -> do resource <- q $ fromJust <$> Resource.insert mockResFields res_fields resource `shouldBe` mockResFields it "requires a unique email address" $ withRollback $ \q -> do let res1 = mockResFields { res_name = ResourceName "res1" } res2 = mockResFields { res_name = ResourceName "res2" } badQuery = q $ Resource.insert res1 >> Resource.insert res2 badQuery `shouldThrow` anyException describe "update" $ do it "updates a Resource with the same ID" $ withRollback $ \q -> do let oldres = mockResFields { res_name = ResourceName "old" } newres = mockResFields { res_name = ResourceName "new" } resource <- q $ do old <- fromJust <$> Resource.insert oldres _ <- Resource.update $ old { res_fields = newres } fromJust <$> Resource.find (res_id old) res_fields resource `shouldBe` newres it "returns Nothing if no Resource has the same ResourceID" $ withRollback $ \q -> do let notInDb = Resource (ResourceID 9999) mockResFields found <- q $ Resource.update notInDb found `shouldBe` Nothing
2,197
false
true
0
22
575
651
306
345
null
null
dorchard/gram_lang
frontend/src/Language/Granule/Checker/Kinds.hs
bsd-3-clause
mguCoeffectTypesFromCoeffects :: (?globals :: Globals) => Span -> Coeffect -> Coeffect -> Checker (Type, (Coeffect -> Coeffect, Coeffect -> Coeffect)) mguCoeffectTypesFromCoeffects s c1 c2 = do coeffTy1 <- inferCoeffectType s c1 coeffTy2 <- inferCoeffectType s c2 mguCoeffectTypes s coeffTy1 coeffTy2 -- Given a type term, works out if its kind is actually an effect type (promoted) -- if so, returns `Right effTy` where `effTy` is the effect type -- otherwise, returns `Left k` where `k` is the kind of the original type term
550
mguCoeffectTypesFromCoeffects :: (?globals :: Globals) => Span -> Coeffect -> Coeffect -> Checker (Type, (Coeffect -> Coeffect, Coeffect -> Coeffect)) mguCoeffectTypesFromCoeffects s c1 c2 = do coeffTy1 <- inferCoeffectType s c1 coeffTy2 <- inferCoeffectType s c2 mguCoeffectTypes s coeffTy1 coeffTy2 -- Given a type term, works out if its kind is actually an effect type (promoted) -- if so, returns `Right effTy` where `effTy` is the effect type -- otherwise, returns `Left k` where `k` is the kind of the original type term
550
mguCoeffectTypesFromCoeffects s c1 c2 = do coeffTy1 <- inferCoeffectType s c1 coeffTy2 <- inferCoeffectType s c2 mguCoeffectTypes s coeffTy1 coeffTy2 -- Given a type term, works out if its kind is actually an effect type (promoted) -- if so, returns `Right effTy` where `effTy` is the effect type -- otherwise, returns `Left k` where `k` is the kind of the original type term
382
false
true
0
12
106
99
51
48
null
null
ecaustin/haskhol-core
src/HaskHOL/Core/Basics/Stateful.hs
bsd-2-clause
{-| Constructor for boolean conjunctions. Throws a 'HOLException' if the internal call to 'mkBinary' fails. -} mkConj :: (MonadCatch m, ?constsFun :: m (Map Text HOLTerm)) => HOLTerm -> HOLTerm -> m HOLTerm mkConj = mkBinary "/\\"
243
mkConj :: (MonadCatch m, ?constsFun :: m (Map Text HOLTerm)) => HOLTerm -> HOLTerm -> m HOLTerm mkConj = mkBinary "/\\"
127
mkConj = mkBinary "/\\"
23
true
true
0
9
49
52
27
25
null
null
eklavya/Idris-dev
src/Idris/IBC.hs
bsd-3-clause
processFnInfo :: Archive -> Idris () processFnInfo ar = do ds <- getEntry [] "ibc_fninfo" ar mapM_ (\ (n, a) -> setFnInfo n a) ds
137
processFnInfo :: Archive -> Idris () processFnInfo ar = do ds <- getEntry [] "ibc_fninfo" ar mapM_ (\ (n, a) -> setFnInfo n a) ds
137
processFnInfo ar = do ds <- getEntry [] "ibc_fninfo" ar mapM_ (\ (n, a) -> setFnInfo n a) ds
100
false
true
0
11
32
71
33
38
null
null
RyanBeatty/Falcon
test/TestConnectFour/TestBoard.hs
gpl-2.0
--testPlaceSquareInColumn = testGroup "placeSquareInColumn: HUnit Tests" $ -- [ testCase "Tests that placeSquareInColumn n times filles up Column" $ -- ((!! numRows) . iterate (placeSquareInColumn blackSquare)) (replicate numRows emptySquare) @?= replicate numRows blackSquare -- ] -- where -- | HUnit tests for checkWonDiagonals -- | TODO: maybe try to get QuickCheck to auto-generate tests testCheckWonDiagonals = testGroup "checkWonDiagonals: HUnit Tests" $ [ testCase "Check that an empty board is not won on the diagonals" $ checkWonDiagonals redSquare initialBoard @?= False , testCase "check that the board is won if there is four-in-a-row on a main diagonal" $ checkWonDiagonals redSquare mainDiagonalBoard @?= True , testCase "Check that the board is won if ther is four-in-a-row on an antidiagonal" $ checkWonDiagonals blackSquare antiDiagonalBoard @?= True ] where mainDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [emptySquare, emptySquare, emptySquare, redSquare, emptySquare, emptySquare] , [emptySquare, emptySquare, redSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, redSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [redSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , replicate numRows emptySquare ] antiDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [blackSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, blackSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, blackSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, emptySquare, blackSquare, emptySquare, emptySquare] , replicate numRows emptySquare ] -- | Tests that boards that are not full are playable. -- | Boards that are full are not playable
2,344
testCheckWonDiagonals = testGroup "checkWonDiagonals: HUnit Tests" $ [ testCase "Check that an empty board is not won on the diagonals" $ checkWonDiagonals redSquare initialBoard @?= False , testCase "check that the board is won if there is four-in-a-row on a main diagonal" $ checkWonDiagonals redSquare mainDiagonalBoard @?= True , testCase "Check that the board is won if ther is four-in-a-row on an antidiagonal" $ checkWonDiagonals blackSquare antiDiagonalBoard @?= True ] where mainDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [emptySquare, emptySquare, emptySquare, redSquare, emptySquare, emptySquare] , [emptySquare, emptySquare, redSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, redSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [redSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , replicate numRows emptySquare ] antiDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [blackSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, blackSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, blackSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, emptySquare, blackSquare, emptySquare, emptySquare] , replicate numRows emptySquare ] -- | Tests that boards that are not full are playable. -- | Boards that are full are not playable
1,934
testCheckWonDiagonals = testGroup "checkWonDiagonals: HUnit Tests" $ [ testCase "Check that an empty board is not won on the diagonals" $ checkWonDiagonals redSquare initialBoard @?= False , testCase "check that the board is won if there is four-in-a-row on a main diagonal" $ checkWonDiagonals redSquare mainDiagonalBoard @?= True , testCase "Check that the board is won if ther is four-in-a-row on an antidiagonal" $ checkWonDiagonals blackSquare antiDiagonalBoard @?= True ] where mainDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [emptySquare, emptySquare, emptySquare, redSquare, emptySquare, emptySquare] , [emptySquare, emptySquare, redSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, redSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [redSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , replicate numRows emptySquare ] antiDiagonalBoard = [ replicate numRows emptySquare , replicate numRows emptySquare , [blackSquare, emptySquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, blackSquare, emptySquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, blackSquare, emptySquare, emptySquare, emptySquare] , [emptySquare, emptySquare, emptySquare, blackSquare, emptySquare, emptySquare] , replicate numRows emptySquare ] -- | Tests that boards that are not full are playable. -- | Boards that are full are not playable
1,934
true
false
0
9
725
307
185
122
null
null
forked-upstream-packages-for-ghcjs/ghc
testsuite/tests/typecheck/should_fail/T8044.hs
bsd-3-clause
frob _ = XChar
17
frob _ = XChar
17
frob _ = XChar
17
false
false
0
5
6
9
4
5
null
null
erikd/hs-tls
core/Network/TLS/Extra/Cipher.hs
bsd-3-clause
cipher_ECDHE_RSA_AES128CBC_SHA256 :: Cipher cipher_ECDHE_RSA_AES128CBC_SHA256 = Cipher { cipherID = 0xC027 , cipherName = "ECDHE-RSA-AES128CBC-SHA256" , cipherBulk = bulk_aes128 , cipherHash = SHA256 , cipherPRFHash = Just SHA256 , cipherKeyExchange = CipherKeyExchange_ECDHE_RSA , cipherMinVer = Just TLS12 -- RFC 5288 Sec 4 }
405
cipher_ECDHE_RSA_AES128CBC_SHA256 :: Cipher cipher_ECDHE_RSA_AES128CBC_SHA256 = Cipher { cipherID = 0xC027 , cipherName = "ECDHE-RSA-AES128CBC-SHA256" , cipherBulk = bulk_aes128 , cipherHash = SHA256 , cipherPRFHash = Just SHA256 , cipherKeyExchange = CipherKeyExchange_ECDHE_RSA , cipherMinVer = Just TLS12 -- RFC 5288 Sec 4 }
405
cipher_ECDHE_RSA_AES128CBC_SHA256 = Cipher { cipherID = 0xC027 , cipherName = "ECDHE-RSA-AES128CBC-SHA256" , cipherBulk = bulk_aes128 , cipherHash = SHA256 , cipherPRFHash = Just SHA256 , cipherKeyExchange = CipherKeyExchange_ECDHE_RSA , cipherMinVer = Just TLS12 -- RFC 5288 Sec 4 }
361
false
true
0
8
119
66
39
27
null
null
yiannist/ganeti
src/Ganeti/Constants.hs
bsd-2-clause
-- * HTools tag prefixes exTagsPrefix :: String exTagsPrefix = Tags.exTagsPrefix
81
exTagsPrefix :: String exTagsPrefix = Tags.exTagsPrefix
55
exTagsPrefix = Tags.exTagsPrefix
32
true
true
0
5
11
14
8
6
null
null
alexander-at-github/eta
compiler/ETA/Prelude/PrelNames.hs
bsd-3-clause
showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec")
66
showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec")
66
showsPrec_RDR = varQual_RDR gHC_SHOW (fsLit "showsPrec")
66
false
false
1
7
15
20
8
12
null
null
ku-fpg/kansas-amber
System/Hardware/Haskino/Compiler.hs
bsd-3-clause
compileExpr (SinhFloat e) = compileSubExpr "sinh" e
51
compileExpr (SinhFloat e) = compileSubExpr "sinh" e
51
compileExpr (SinhFloat e) = compileSubExpr "sinh" e
51
false
false
0
7
6
20
9
11
null
null
tolysz/prepare-ghcjs
spec-lts8/cabal/cabal-install/Distribution/Client/Dependency/Modular/Message.hs
bsd-3-clause
-- The following are internal failures. They should not occur. In the -- interest of not crashing unnecessarily, we still just print an error -- message though. showFR _ (MalformedFlagChoice qfn) = " (INTERNAL ERROR: MALFORMED FLAG CHOICE: " ++ showQFN qfn ++ ")"
270
showFR _ (MalformedFlagChoice qfn) = " (INTERNAL ERROR: MALFORMED FLAG CHOICE: " ++ showQFN qfn ++ ")"
109
showFR _ (MalformedFlagChoice qfn) = " (INTERNAL ERROR: MALFORMED FLAG CHOICE: " ++ showQFN qfn ++ ")"
109
true
false
1
7
50
34
16
18
null
null
ndmitchell/hlint
src/Hint/List.hs
bsd-3-clause
suggestExpr :: LHsExpr GhcPs -> LHsExpr GhcPs -> [Refactoring R.SrcSpan] suggestExpr o o2 = [Replace Expr (toSSA o) [] (unsafePrettyPrint o2)]
142
suggestExpr :: LHsExpr GhcPs -> LHsExpr GhcPs -> [Refactoring R.SrcSpan] suggestExpr o o2 = [Replace Expr (toSSA o) [] (unsafePrettyPrint o2)]
142
suggestExpr o o2 = [Replace Expr (toSSA o) [] (unsafePrettyPrint o2)]
69
false
true
0
9
20
64
31
33
null
null
mboes/hs-asn1
parse/Data/ASN1/Parse.hs
bsd-3-clause
-- | run the parse monad over a stream and returns the result and the remaining ASN1 Stream. runParseASN1State :: ParseASN1 a -> [ASN1] -> Either String (a,[ASN1]) runParseASN1State f s = case runState (runErrT (runP f)) s of (Left err, _) -> Left err (Right r, l) -> Right (r,l) -- | run the parse monad over a stream and returns the result. -- -- If there's still some asn1 object in the state after calling f, -- an error will be raised.
462
runParseASN1State :: ParseASN1 a -> [ASN1] -> Either String (a,[ASN1]) runParseASN1State f s = case runState (runErrT (runP f)) s of (Left err, _) -> Left err (Right r, l) -> Right (r,l) -- | run the parse monad over a stream and returns the result. -- -- If there's still some asn1 object in the state after calling f, -- an error will be raised.
369
runParseASN1State f s = case runState (runErrT (runP f)) s of (Left err, _) -> Left err (Right r, l) -> Right (r,l) -- | run the parse monad over a stream and returns the result. -- -- If there's still some asn1 object in the state after calling f, -- an error will be raised.
298
true
true
0
10
105
116
61
55
null
null
hvr/vector
Data/Vector/Storable.hs
bsd-3-clause
foldr = G.foldr
15
foldr = G.foldr
15
foldr = G.foldr
15
false
false
1
6
2
12
4
8
null
null
spencerjanssen/cabal2nix
generate-cabal-file.hs
bsd-3-clause
mkExecutable :: NonEmptyString -> [ExecutableField] -> Section mkExecutable exe opt = executable exe $ mainIs (exe++".hs") : opt ++ commonBuildOptions
150
mkExecutable :: NonEmptyString -> [ExecutableField] -> Section mkExecutable exe opt = executable exe $ mainIs (exe++".hs") : opt ++ commonBuildOptions
150
mkExecutable exe opt = executable exe $ mainIs (exe++".hs") : opt ++ commonBuildOptions
87
false
true
0
10
19
52
26
26
null
null
dmuneras/LambdaMethods
src/FuncionesInterfaz.hs
gpl-2.0
acercaDe :: IO () acercaDe = do initGUI windowAyuda <- windowNew set windowAyuda [windowTitle := "Acerca de", windowDefaultWidth := 400, windowDefaultHeight := 400 ] contentPrincipal <- vBoxNew True 10 containerAdd windowAyuda contentPrincipal contentAyuda <- vBoxNew False 0 boxPackStart contentPrincipal contentAyuda PackNatural 0 containerSetBorderWidth contentAyuda 10 ayuda <- labelNew (Just acercaDetext) containerAdd contentAyuda ayuda widgetShowAll windowAyuda onDestroy windowAyuda mainQuit mainGUI
596
acercaDe :: IO () acercaDe = do initGUI windowAyuda <- windowNew set windowAyuda [windowTitle := "Acerca de", windowDefaultWidth := 400, windowDefaultHeight := 400 ] contentPrincipal <- vBoxNew True 10 containerAdd windowAyuda contentPrincipal contentAyuda <- vBoxNew False 0 boxPackStart contentPrincipal contentAyuda PackNatural 0 containerSetBorderWidth contentAyuda 10 ayuda <- labelNew (Just acercaDetext) containerAdd contentAyuda ayuda widgetShowAll windowAyuda onDestroy windowAyuda mainQuit mainGUI
594
acercaDe = do initGUI windowAyuda <- windowNew set windowAyuda [windowTitle := "Acerca de", windowDefaultWidth := 400, windowDefaultHeight := 400 ] contentPrincipal <- vBoxNew True 10 containerAdd windowAyuda contentPrincipal contentAyuda <- vBoxNew False 0 boxPackStart contentPrincipal contentAyuda PackNatural 0 containerSetBorderWidth contentAyuda 10 ayuda <- labelNew (Just acercaDetext) containerAdd contentAyuda ayuda widgetShowAll windowAyuda onDestroy windowAyuda mainQuit mainGUI
576
false
true
0
10
147
154
65
89
null
null
giorgidze/HCodecs
src/Codec/Midi.hs
bsd-3-clause
isProgramChange _ = False
25
isProgramChange _ = False
25
isProgramChange _ = False
25
false
false
0
5
3
9
4
5
null
null
prowdsponsor/esqueleto
src/Database/Esqueleto/Internal/Sql.hs
bsd-3-clause
makeWhere :: IdentInfo -> WhereClause -> (TLB.Builder, [PersistValue]) makeWhere _ NoWhere = mempty
120
makeWhere :: IdentInfo -> WhereClause -> (TLB.Builder, [PersistValue]) makeWhere _ NoWhere = mempty
120
makeWhere _ NoWhere = mempty
49
false
true
0
8
33
35
19
16
null
null
kojiromike/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
{-! deriving instance Binary SyntaxInfo !-} defaultSyntax = Syn [] [] [] [] [] id False False False Nothing 0 initDSL 0 True True
130
defaultSyntax = Syn [] [] [] [] [] id False False False Nothing 0 initDSL 0 True True
85
defaultSyntax = Syn [] [] [] [] [] id False False False Nothing 0 initDSL 0 True True
85
true
false
1
6
24
55
24
31
null
null
HIPERFIT/futhark
src/Futhark/CodeGen/ImpGen/GPU/ToOpenCL.hs
isc
genCUDAPrelude :: T.Text genCUDAPrelude = [untrimming| #define FUTHARK_CUDA #define FUTHARK_F64_ENABLED typedef char int8_t; typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef uint8_t uchar; typedef uint16_t ushort; typedef uint32_t uint; typedef uint64_t ulong; #define __kernel extern "C" __global__ __launch_bounds__(MAX_THREADS_PER_BLOCK) #define __global #define __local #define __private #define __constant #define __write_only #define __read_only static inline int get_group_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch (d) { case 0: return blockIdx.x; case 1: return blockIdx.y; case 2: return blockIdx.z; default: return 0; } } #define get_group_id(d) get_group_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_num_groups_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch(d) { case 0: return gridDim.x; case 1: return gridDim.y; case 2: return gridDim.z; default: return 0; } } #define get_num_groups(d) get_num_groups_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_local_id(int d) { switch (d) { case 0: return threadIdx.x; case 1: return threadIdx.y; case 2: return threadIdx.z; default: return 0; } } static inline int get_local_size(int d) { switch (d) { case 0: return blockDim.x; case 1: return blockDim.y; case 2: return blockDim.z; default: return 0; } } static inline int get_global_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { return get_group_id(d) * get_local_size(d) + get_local_id(d); } #define get_global_id(d) get_global_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_global_size(int block_dim0, int block_dim1, int block_dim2, int d) { return get_num_groups(d) * get_local_size(d); } #define CLK_LOCAL_MEM_FENCE 1 #define CLK_GLOBAL_MEM_FENCE 2 static inline void barrier(int x) { __syncthreads(); } static inline void mem_fence_local() { __threadfence_block(); } static inline void mem_fence_global() { __threadfence(); } #define NAN (0.0/0.0) #define INFINITY (1.0/0.0) extern volatile __shared__ unsigned char shared_mem[]; |] <> halfH <> cScalarDefs <> atomicsH
2,627
genCUDAPrelude :: T.Text genCUDAPrelude = [untrimming| #define FUTHARK_CUDA #define FUTHARK_F64_ENABLED typedef char int8_t; typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef uint8_t uchar; typedef uint16_t ushort; typedef uint32_t uint; typedef uint64_t ulong; #define __kernel extern "C" __global__ __launch_bounds__(MAX_THREADS_PER_BLOCK) #define __global #define __local #define __private #define __constant #define __write_only #define __read_only static inline int get_group_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch (d) { case 0: return blockIdx.x; case 1: return blockIdx.y; case 2: return blockIdx.z; default: return 0; } } #define get_group_id(d) get_group_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_num_groups_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch(d) { case 0: return gridDim.x; case 1: return gridDim.y; case 2: return gridDim.z; default: return 0; } } #define get_num_groups(d) get_num_groups_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_local_id(int d) { switch (d) { case 0: return threadIdx.x; case 1: return threadIdx.y; case 2: return threadIdx.z; default: return 0; } } static inline int get_local_size(int d) { switch (d) { case 0: return blockDim.x; case 1: return blockDim.y; case 2: return blockDim.z; default: return 0; } } static inline int get_global_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { return get_group_id(d) * get_local_size(d) + get_local_id(d); } #define get_global_id(d) get_global_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_global_size(int block_dim0, int block_dim1, int block_dim2, int d) { return get_num_groups(d) * get_local_size(d); } #define CLK_LOCAL_MEM_FENCE 1 #define CLK_GLOBAL_MEM_FENCE 2 static inline void barrier(int x) { __syncthreads(); } static inline void mem_fence_local() { __threadfence_block(); } static inline void mem_fence_global() { __threadfence(); } #define NAN (0.0/0.0) #define INFINITY (1.0/0.0) extern volatile __shared__ unsigned char shared_mem[]; |] <> halfH <> cScalarDefs <> atomicsH
2,627
genCUDAPrelude = [untrimming| #define FUTHARK_CUDA #define FUTHARK_F64_ENABLED typedef char int8_t; typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; typedef uint8_t uchar; typedef uint16_t ushort; typedef uint32_t uint; typedef uint64_t ulong; #define __kernel extern "C" __global__ __launch_bounds__(MAX_THREADS_PER_BLOCK) #define __global #define __local #define __private #define __constant #define __write_only #define __read_only static inline int get_group_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch (d) { case 0: return blockIdx.x; case 1: return blockIdx.y; case 2: return blockIdx.z; default: return 0; } } #define get_group_id(d) get_group_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_num_groups_fn(int block_dim0, int block_dim1, int block_dim2, int d) { switch (d) { case 0: d = block_dim0; break; case 1: d = block_dim1; break; case 2: d = block_dim2; break; } switch(d) { case 0: return gridDim.x; case 1: return gridDim.y; case 2: return gridDim.z; default: return 0; } } #define get_num_groups(d) get_num_groups_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_local_id(int d) { switch (d) { case 0: return threadIdx.x; case 1: return threadIdx.y; case 2: return threadIdx.z; default: return 0; } } static inline int get_local_size(int d) { switch (d) { case 0: return blockDim.x; case 1: return blockDim.y; case 2: return blockDim.z; default: return 0; } } static inline int get_global_id_fn(int block_dim0, int block_dim1, int block_dim2, int d) { return get_group_id(d) * get_local_size(d) + get_local_id(d); } #define get_global_id(d) get_global_id_fn(block_dim0, block_dim1, block_dim2, d) static inline int get_global_size(int block_dim0, int block_dim1, int block_dim2, int d) { return get_num_groups(d) * get_local_size(d); } #define CLK_LOCAL_MEM_FENCE 1 #define CLK_GLOBAL_MEM_FENCE 2 static inline void barrier(int x) { __syncthreads(); } static inline void mem_fence_local() { __threadfence_block(); } static inline void mem_fence_global() { __threadfence(); } #define NAN (0.0/0.0) #define INFINITY (1.0/0.0) extern volatile __shared__ unsigned char shared_mem[]; |] <> halfH <> cScalarDefs <> atomicsH
2,602
false
true
0
7
474
29
17
12
null
null
alexander-at-github/eta
compiler/ETA/HsSyn/HsTypes.hs
bsd-3-clause
ppr_mono_ty :: (OutputableBndr name) => TyPrec -> HsType name -> SDoc ppr_mono_ty ctxt_prec (HsForAllTy exp extra tvs ctxt ty) = maybeParen ctxt_prec FunPrec $ sep [pprHsForAllExtra exp extra tvs ctxt, ppr_mono_lty TopPrec ty]
232
ppr_mono_ty :: (OutputableBndr name) => TyPrec -> HsType name -> SDoc ppr_mono_ty ctxt_prec (HsForAllTy exp extra tvs ctxt ty) = maybeParen ctxt_prec FunPrec $ sep [pprHsForAllExtra exp extra tvs ctxt, ppr_mono_lty TopPrec ty]
232
ppr_mono_ty ctxt_prec (HsForAllTy exp extra tvs ctxt ty) = maybeParen ctxt_prec FunPrec $ sep [pprHsForAllExtra exp extra tvs ctxt, ppr_mono_lty TopPrec ty]
162
false
true
0
8
38
88
41
47
null
null
olorin/amazonka
amazonka-ec2/gen/Network/AWS/EC2/CreateRoute.hs
mpl-2.0
-- | The ID of a NAT instance in your VPC. The operation fails if you specify -- an instance ID unless exactly one network interface is attached. crInstanceId :: Lens' CreateRoute (Maybe Text) crInstanceId = lens _crInstanceId (\ s a -> s{_crInstanceId = a})
258
crInstanceId :: Lens' CreateRoute (Maybe Text) crInstanceId = lens _crInstanceId (\ s a -> s{_crInstanceId = a})
112
crInstanceId = lens _crInstanceId (\ s a -> s{_crInstanceId = a})
65
true
true
0
9
44
47
26
21
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/LambdaFunction.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-function.html#cfn-lambda-function-deadletterconfig lfDeadLetterConfig :: Lens' LambdaFunction (Maybe LambdaFunctionDeadLetterConfig) lfDeadLetterConfig = lens _lambdaFunctionDeadLetterConfig (\s a -> s { _lambdaFunctionDeadLetterConfig = a })
329
lfDeadLetterConfig :: Lens' LambdaFunction (Maybe LambdaFunctionDeadLetterConfig) lfDeadLetterConfig = lens _lambdaFunctionDeadLetterConfig (\s a -> s { _lambdaFunctionDeadLetterConfig = a })
191
lfDeadLetterConfig = lens _lambdaFunctionDeadLetterConfig (\s a -> s { _lambdaFunctionDeadLetterConfig = a })
109
true
true
0
9
21
46
25
21
null
null
Purview/purview
src/Graphics/Forensics/Analyser/LocalCFA.hs
gpl-3.0
getDiagonalVariances :: (Source r1 Float) => Array r1 DIM2 Float -> Vector Float getDiagonalVariances !arr = getDiagonals $ w + h - 1 where (Z :. w :. h) = extent arr {- Get the variance of all diagonals in the array -} {-# INLINE getDiagonals #-} getDiagonals :: Int -> Vector Float getDiagonals s = V.generate s $ variance . getDiagonalAt {- Get a single diagonal at position n in x direction -} {-# INLINE getDiagonalAt #-} getDiagonalAt :: Int -> Vector Float getDiagonalAt n = V.generate d getFromArray where x0 = min n (w - 1) y0 = max 0 (n - w + 1) xN = max 0 (w - h + y0) d = 1 + (x0 - xN) {-# INLINE getFromArray #-} getFromArray :: Int -> Float getFromArray a = arr `unsafeIndex` (Z :. x0 - a :. y0 + a) {-As described in the paper, this computes the mean instead of real variance-}
926
getDiagonalVariances :: (Source r1 Float) => Array r1 DIM2 Float -> Vector Float getDiagonalVariances !arr = getDiagonals $ w + h - 1 where (Z :. w :. h) = extent arr {- Get the variance of all diagonals in the array -} {-# INLINE getDiagonals #-} getDiagonals :: Int -> Vector Float getDiagonals s = V.generate s $ variance . getDiagonalAt {- Get a single diagonal at position n in x direction -} {-# INLINE getDiagonalAt #-} getDiagonalAt :: Int -> Vector Float getDiagonalAt n = V.generate d getFromArray where x0 = min n (w - 1) y0 = max 0 (n - w + 1) xN = max 0 (w - h + y0) d = 1 + (x0 - xN) {-# INLINE getFromArray #-} getFromArray :: Int -> Float getFromArray a = arr `unsafeIndex` (Z :. x0 - a :. y0 + a) {-As described in the paper, this computes the mean instead of real variance-}
926
getDiagonalVariances !arr = getDiagonals $ w + h - 1 where (Z :. w :. h) = extent arr {- Get the variance of all diagonals in the array -} {-# INLINE getDiagonals #-} getDiagonals :: Int -> Vector Float getDiagonals s = V.generate s $ variance . getDiagonalAt {- Get a single diagonal at position n in x direction -} {-# INLINE getDiagonalAt #-} getDiagonalAt :: Int -> Vector Float getDiagonalAt n = V.generate d getFromArray where x0 = min n (w - 1) y0 = max 0 (n - w + 1) xN = max 0 (w - h + y0) d = 1 + (x0 - xN) {-# INLINE getFromArray #-} getFromArray :: Int -> Float getFromArray a = arr `unsafeIndex` (Z :. x0 - a :. y0 + a) {-As described in the paper, this computes the mean instead of real variance-}
822
false
true
10
10
292
295
139
156
null
null
olsner/ghc
compiler/main/GhcMake.hs
bsd-3-clause
typecheckLoop :: DynFlags -> HscEnv -> [ModuleName] -> IO HscEnv typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck (text "typecheckLoop") new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToHpt old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupHpt old_hpt) mods
732
typecheckLoop :: DynFlags -> HscEnv -> [ModuleName] -> IO HscEnv typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck (text "typecheckLoop") new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToHpt old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupHpt old_hpt) mods
732
typecheckLoop dflags hsc_env mods = do debugTraceMsg dflags 2 $ text "Re-typechecking loop: " <> ppr mods new_hpt <- fixIO $ \new_hpt -> do let new_hsc_env = hsc_env{ hsc_HPT = new_hpt } mds <- initIfaceCheck (text "typecheckLoop") new_hsc_env $ mapM (typecheckIface . hm_iface) hmis let new_hpt = addListToHpt old_hpt (zip mods [ hmi{ hm_details = details } | (hmi,details) <- zip hmis mds ]) return new_hpt return hsc_env{ hsc_HPT = new_hpt } where old_hpt = hsc_HPT hsc_env hmis = map (expectJust "typecheckLoop" . lookupHpt old_hpt) mods
667
false
true
0
21
221
231
112
119
null
null
nomeata/incredible
logic/Rules.hs
mit
renameRule :: Rule -> Rule renameRule r = rule' where allVars :: [Var] allVars = S.toList $ S.fromList $ freeVars r ++ localVars r ++ concat [ portScopes p ++ fv (portProp p) | p <- M.elems (ports r) ] (toRename, takenNames) = second (S.fromList . map name2String) $ partition (\n -> name2Integer n > 0) $ allVars candidates :: String -> [String] candidates s = s : [s ++ [a] | a <- ['a'..'z']] ++ [s ++ show n | n <- [(1::Integer)..]] renamed = snd $ mapAccumL go takenNames toRename where go taken n = let n':_ = [ n' | n' <- candidates (name2String n), n' `S.notMember` taken ] in (S.insert n' taken, n') s = zip toRename (map (V . string2Name) renamed) m = M.fromList $ zip toRename (map string2Name renamed) f n = M.findWithDefault n n m rule' = Rule { freeVars = map f (freeVars r) , localVars = map f (freeVars r) , ports = M.map goP (ports r) } goP p = Port { portScopes = map f (portScopes p) , portType = portType p , portProp = substs s (portProp p) }
1,154
renameRule :: Rule -> Rule renameRule r = rule' where allVars :: [Var] allVars = S.toList $ S.fromList $ freeVars r ++ localVars r ++ concat [ portScopes p ++ fv (portProp p) | p <- M.elems (ports r) ] (toRename, takenNames) = second (S.fromList . map name2String) $ partition (\n -> name2Integer n > 0) $ allVars candidates :: String -> [String] candidates s = s : [s ++ [a] | a <- ['a'..'z']] ++ [s ++ show n | n <- [(1::Integer)..]] renamed = snd $ mapAccumL go takenNames toRename where go taken n = let n':_ = [ n' | n' <- candidates (name2String n), n' `S.notMember` taken ] in (S.insert n' taken, n') s = zip toRename (map (V . string2Name) renamed) m = M.fromList $ zip toRename (map string2Name renamed) f n = M.findWithDefault n n m rule' = Rule { freeVars = map f (freeVars r) , localVars = map f (freeVars r) , ports = M.map goP (ports r) } goP p = Port { portScopes = map f (portScopes p) , portType = portType p , portProp = substs s (portProp p) }
1,154
renameRule r = rule' where allVars :: [Var] allVars = S.toList $ S.fromList $ freeVars r ++ localVars r ++ concat [ portScopes p ++ fv (portProp p) | p <- M.elems (ports r) ] (toRename, takenNames) = second (S.fromList . map name2String) $ partition (\n -> name2Integer n > 0) $ allVars candidates :: String -> [String] candidates s = s : [s ++ [a] | a <- ['a'..'z']] ++ [s ++ show n | n <- [(1::Integer)..]] renamed = snd $ mapAccumL go takenNames toRename where go taken n = let n':_ = [ n' | n' <- candidates (name2String n), n' `S.notMember` taken ] in (S.insert n' taken, n') s = zip toRename (map (V . string2Name) renamed) m = M.fromList $ zip toRename (map string2Name renamed) f n = M.findWithDefault n n m rule' = Rule { freeVars = map f (freeVars r) , localVars = map f (freeVars r) , ports = M.map goP (ports r) } goP p = Port { portScopes = map f (portScopes p) , portType = portType p , portProp = substs s (portProp p) }
1,127
false
true
2
14
382
507
257
250
null
null
Enamex/Idris-dev
src/Idris/Core/Unify.hs
bsd-3-clause
recoverable (TType _) (P (TCon _ _) y _) = False
48
recoverable (TType _) (P (TCon _ _) y _) = False
48
recoverable (TType _) (P (TCon _ _) y _) = False
48
false
false
1
8
10
38
17
21
null
null
GaloisInc/halvm-ghc
compiler/coreSyn/TrieMap.hs
bsd-3-clause
xtE (D env (Tick t e)) f m = m { cm_tick = cm_tick m |> xtG (D env e) |>> xtTickish t f }
148
xtE (D env (Tick t e)) f m = m { cm_tick = cm_tick m |> xtG (D env e) |>> xtTickish t f }
148
xtE (D env (Tick t e)) f m = m { cm_tick = cm_tick m |> xtG (D env e) |>> xtTickish t f }
148
false
false
0
11
83
64
31
33
null
null
vlopezj/genifunctors
Data/Generics/Genifunctors.hs
bsd-3-clause
traversePrimitive :: Exp -> Exp traversePrimitive e = VarE 'pure `AppE` e
73
traversePrimitive :: Exp -> Exp traversePrimitive e = VarE 'pure `AppE` e
73
traversePrimitive e = VarE 'pure `AppE` e
41
false
true
0
6
11
28
15
13
null
null
karamellpelle/grid
designer/source/Game/LevelPuzzleMode/Iteration.hs
gpl-3.0
-------------------------------------------------------------------------------- -- iterationPlay -- | setup and play current level iterationBeginPlay :: Iteration LevelPuzzleWorld RunWorld iterationBeginPlay = makeIteration $ \lvl run -> do (lvl', run') <- outputBeginPlay lvl run case levelpuzzleIsComplete lvl' of False -> do lvl'' <- levelpuzzleBeginLevel lvl' -- set tick to world tick of LevelPuzzleWorld tickClockLevelPuzzleModeSet $ worldTick lvl'' iteration iterationPlay lvl'' run' True -> iteration iterationComplete lvl' run'
692
iterationBeginPlay :: Iteration LevelPuzzleWorld RunWorld iterationBeginPlay = makeIteration $ \lvl run -> do (lvl', run') <- outputBeginPlay lvl run case levelpuzzleIsComplete lvl' of False -> do lvl'' <- levelpuzzleBeginLevel lvl' -- set tick to world tick of LevelPuzzleWorld tickClockLevelPuzzleModeSet $ worldTick lvl'' iteration iterationPlay lvl'' run' True -> iteration iterationComplete lvl' run'
556
iterationBeginPlay = makeIteration $ \lvl run -> do (lvl', run') <- outputBeginPlay lvl run case levelpuzzleIsComplete lvl' of False -> do lvl'' <- levelpuzzleBeginLevel lvl' -- set tick to world tick of LevelPuzzleWorld tickClockLevelPuzzleModeSet $ worldTick lvl'' iteration iterationPlay lvl'' run' True -> iteration iterationComplete lvl' run'
498
true
true
0
15
216
108
52
56
null
null
Jonplussed/midi-free
src/Sound/MIDI/Values/Note.hs
gpl-3.0
b4 = Note 59
18
b4 = Note 59
18
b4 = Note 59
18
false
false
0
5
9
9
4
5
null
null
lfritz/python-type-inference
python-type-inference/src/Language/Python/TypeInference/CFG/ToFragment.hs
bsd-3-clause
newFragment :: ProgramPoint -> SrcSpan -> StateT ConversionState TypeInferenceMonad (Label, Fragment) newFragment pp srcSpan = do l <- newLabel pos <- lift $ toPosition srcSpan let f = fragment (Map.singleton l (pp, pos)) Set.empty (Set.singleton l) (Set.singleton l) return (l, f) -- | Like 'newFragment', but don't return the label.
444
newFragment :: ProgramPoint -> SrcSpan -> StateT ConversionState TypeInferenceMonad (Label, Fragment) newFragment pp srcSpan = do l <- newLabel pos <- lift $ toPosition srcSpan let f = fragment (Map.singleton l (pp, pos)) Set.empty (Set.singleton l) (Set.singleton l) return (l, f) -- | Like 'newFragment', but don't return the label.
444
newFragment pp srcSpan = do l <- newLabel pos <- lift $ toPosition srcSpan let f = fragment (Map.singleton l (pp, pos)) Set.empty (Set.singleton l) (Set.singleton l) return (l, f) -- | Like 'newFragment', but don't return the label.
330
false
true
0
13
159
123
61
62
null
null
krisajenkins/BellRinger
src/Render.hs
epl-1.0
marketDataView _ NotFound = span "Data not found. Sadness."
59
marketDataView _ NotFound = span "Data not found. Sadness."
59
marketDataView _ NotFound = span "Data not found. Sadness."
59
false
false
1
5
8
16
6
10
null
null
jgoerzen/dfsbuild
Actions/ConfigFiles.hs
gpl-2.0
getidstring :: DFSEnv -> String getidstring env = printf "DFS: %s %s (%s)" (eget env "name") (eget env "version") (datestr env)
143
getidstring :: DFSEnv -> String getidstring env = printf "DFS: %s %s (%s)" (eget env "name") (eget env "version") (datestr env)
143
getidstring env = printf "DFS: %s %s (%s)" (eget env "name") (eget env "version") (datestr env)
111
false
true
0
7
36
49
24
25
null
null
music-suite/music-score
src/Music/Time/Types.hs
bsd-3-clause
-- | -- Reflect a span through an arbitrary point. -- reflectSpan :: Time -> Span -> Span reflectSpan p = over (onsetAndOffset . both) (reflectThrough p)
153
reflectSpan :: Time -> Span -> Span reflectSpan p = over (onsetAndOffset . both) (reflectThrough p)
99
reflectSpan p = over (onsetAndOffset . both) (reflectThrough p)
63
true
true
0
8
26
49
24
25
null
null
danr/hipspec
examples/old-examples/MergeSort.hs
gpl-3.0
msort (NCons x NNil) = NCons x NNil
35
msort (NCons x NNil) = NCons x NNil
35
msort (NCons x NNil) = NCons x NNil
35
false
false
0
6
7
23
10
13
null
null
mfs/hsdf
Main.hs
gpl-3.0
main = do b <- readFile "/etc/mtab" let d = filter (\a -> "/dev/" `isPrefixOf` (a !! 0)) [words x | x <- lines b] let s = map (take 3) (sortBy (\a b -> compare (a !! 1) (b !! 1)) d) printf "%-25s %-18s %18s %18s %18s %s\n" (color "Mount" 0 33) (color "Type" 0 33) (color "Size" 0 33) (color "Used" 0 33) (color "Avail" 0 33) (color "Space" 0 33) mapM_ printRow s
449
main = do b <- readFile "/etc/mtab" let d = filter (\a -> "/dev/" `isPrefixOf` (a !! 0)) [words x | x <- lines b] let s = map (take 3) (sortBy (\a b -> compare (a !! 1) (b !! 1)) d) printf "%-25s %-18s %18s %18s %18s %s\n" (color "Mount" 0 33) (color "Type" 0 33) (color "Size" 0 33) (color "Used" 0 33) (color "Avail" 0 33) (color "Space" 0 33) mapM_ printRow s
449
main = do b <- readFile "/etc/mtab" let d = filter (\a -> "/dev/" `isPrefixOf` (a !! 0)) [words x | x <- lines b] let s = map (take 3) (sortBy (\a b -> compare (a !! 1) (b !! 1)) d) printf "%-25s %-18s %18s %18s %18s %s\n" (color "Mount" 0 33) (color "Type" 0 33) (color "Size" 0 33) (color "Used" 0 33) (color "Avail" 0 33) (color "Space" 0 33) mapM_ printRow s
449
false
false
1
18
163
215
104
111
null
null
rubik/stack
src/Stack/Docker.hs
bsd-3-clause
-- | Directory where 'stack' executable is bind-mounted in Docker container hostBinDir :: FilePath hostBinDir = "/opt/host/bin"
127
hostBinDir :: FilePath hostBinDir = "/opt/host/bin"
51
hostBinDir = "/opt/host/bin"
28
true
true
0
4
16
12
7
5
null
null
nkartashov/haskell
hw08/Combinators.hs
gpl-2.0
invEndBy :: Parser a -> Parser b -> Parser [b] invEndBy p1 p2 = many $ p1 *> p2
79
invEndBy :: Parser a -> Parser b -> Parser [b] invEndBy p1 p2 = many $ p1 *> p2
79
invEndBy p1 p2 = many $ p1 *> p2
32
false
true
4
9
18
52
23
29
null
null
aavogt/HListPlugin
HListPlugin.hs
mit
ini = do Found _loc hlist <- findImportedModule (mkModuleName "HList") Nothing let hlistTC :: String -> TcPluginM TyCon hlistTC str = tcLookupTyCon =<< lookupOrig hlist (mkTcOcc str) hlength <- hlistTC "HLength" sameLength <- hlistTC "SameLength" hNat <- hlistTC "HNat" hlist <- hlistTC "HList" mapCoerce <- hlistTC "MapCoerce" seenRef <- tcPluginIO (newIORef M.empty) return S { isHLength = (==) hlength, sameLength = sameLength, mapCoerce = mapCoerce, hNat = hNat, hlist = hlist }
561
ini = do Found _loc hlist <- findImportedModule (mkModuleName "HList") Nothing let hlistTC :: String -> TcPluginM TyCon hlistTC str = tcLookupTyCon =<< lookupOrig hlist (mkTcOcc str) hlength <- hlistTC "HLength" sameLength <- hlistTC "SameLength" hNat <- hlistTC "HNat" hlist <- hlistTC "HList" mapCoerce <- hlistTC "MapCoerce" seenRef <- tcPluginIO (newIORef M.empty) return S { isHLength = (==) hlength, sameLength = sameLength, mapCoerce = mapCoerce, hNat = hNat, hlist = hlist }
561
ini = do Found _loc hlist <- findImportedModule (mkModuleName "HList") Nothing let hlistTC :: String -> TcPluginM TyCon hlistTC str = tcLookupTyCon =<< lookupOrig hlist (mkTcOcc str) hlength <- hlistTC "HLength" sameLength <- hlistTC "SameLength" hNat <- hlistTC "HNat" hlist <- hlistTC "HList" mapCoerce <- hlistTC "MapCoerce" seenRef <- tcPluginIO (newIORef M.empty) return S { isHLength = (==) hlength, sameLength = sameLength, mapCoerce = mapCoerce, hNat = hNat, hlist = hlist }
561
false
false
1
14
150
183
85
98
null
null
michael-sloma/panRNA
src/Main.hs
gpl-2.0
getResult (Left e) = error $ "parse error: " ++ show e
54
getResult (Left e) = error $ "parse error: " ++ show e
54
getResult (Left e) = error $ "parse error: " ++ show e
54
false
false
0
7
11
26
12
14
null
null
lih/Alpha
src/Syntax/Parse.hs
bsd-2-clause
mkNode = return . Group . concat
32
mkNode = return . Group . concat
32
mkNode = return . Group . concat
32
false
false
0
6
6
14
7
7
null
null
lpeterse/koka
src/Common/Error.hs
apache-2.0
addWarnings ws err = case err of Error msg ws2 -> Error msg (ws ++ ws2) Ok x ws2 -> Ok x (ws ++ ws2)
119
addWarnings ws err = case err of Error msg ws2 -> Error msg (ws ++ ws2) Ok x ws2 -> Ok x (ws ++ ws2)
119
addWarnings ws err = case err of Error msg ws2 -> Error msg (ws ++ ws2) Ok x ws2 -> Ok x (ws ++ ws2)
119
false
false
1
10
43
65
29
36
null
null
scravy/simplex
src/simplex.hs
gpl-3.0
dirtyExts = [".toc", ".aux", ".log", ".tex", ".out", ".lof", ".ent"]
68
dirtyExts = [".toc", ".aux", ".log", ".tex", ".out", ".lof", ".ent"]
68
dirtyExts = [".toc", ".aux", ".log", ".tex", ".out", ".lof", ".ent"]
68
false
false
1
5
8
30
17
13
null
null
haroldcarr/learn-haskell-coq-ml-etc
haskell/topic/program-structure/juno/app/Main.hs
unlicense
main :: IO () main = run
24
main :: IO () main = run
24
main = run
10
false
true
0
7
6
22
9
13
null
null
mrakgr/futhark
src/Language/Futhark/Attributes.hs
bsd-3-clause
typeOf (UnOp Abs e _) = typeOf e
32
typeOf (UnOp Abs e _) = typeOf e
32
typeOf (UnOp Abs e _) = typeOf e
32
false
false
0
7
7
22
10
12
null
null
brendanhay/gogol
gogol-dns/gen/Network/Google/DNS/Types/Product.hs
mpl-2.0
-- | The presence of this field indicates that this is a managed reverse -- lookup zone and Cloud DNS will resolve reverse lookup queries using -- automatically configured records for VPC resources. This only applies to -- networks listed under private_visibility_config. mzReverseLookupConfig :: Lens' ManagedZone (Maybe ManagedZoneReverseLookupConfig) mzReverseLookupConfig = lens _mzReverseLookupConfig (\ s a -> s{_mzReverseLookupConfig = a})
454
mzReverseLookupConfig :: Lens' ManagedZone (Maybe ManagedZoneReverseLookupConfig) mzReverseLookupConfig = lens _mzReverseLookupConfig (\ s a -> s{_mzReverseLookupConfig = a})
182
mzReverseLookupConfig = lens _mzReverseLookupConfig (\ s a -> s{_mzReverseLookupConfig = a})
100
true
true
0
8
66
52
28
24
null
null
snoyberg/ghc
libraries/base/GHC/Int.hs
bsd-3-clause
(I16# x) `geInt16` (I16# y) = isTrue# (x >=# y)
47
(I16# x) `geInt16` (I16# y) = isTrue# (x >=# y)
47
(I16# x) `geInt16` (I16# y) = isTrue# (x >=# y)
47
false
false
0
7
9
36
18
18
null
null
vladfi1/hs-misc
JavaDAG.hs
mit
main = do encodeParams' <- encodeParams decodeParams' <- decodeParams let params = concat $ collapse_NP (liftA_NP (K . getNodes) encodeParams') ++ collapse_NP (liftA_NP (K . getNodes) decodeParams') let decoder = makeDecoder javaComplete decodeParams' primDecoders let autoEncoder = makeAutoEncoder javaComplete encodeParams' primEncoders decodeParams' primAutoDecoders java <- readFile "Test.java" let Right parsed = parser compilationUnit java putStrLn $ prettyPrint parsed loss <- runAnyAutoEncoder autoEncoder parsed let train = do tape <- newIORef [] resetNode loss error <- evalNodeTape tape loss print error setLearningRate (-0.001) loss backprop =<< readIORef tape traverse learn params traverse (const train) [1..1000] j :: CompilationUnit <- runAnyDecoder decoder =<< defM putStrLn $ prettyPrint j
903
main = do encodeParams' <- encodeParams decodeParams' <- decodeParams let params = concat $ collapse_NP (liftA_NP (K . getNodes) encodeParams') ++ collapse_NP (liftA_NP (K . getNodes) decodeParams') let decoder = makeDecoder javaComplete decodeParams' primDecoders let autoEncoder = makeAutoEncoder javaComplete encodeParams' primEncoders decodeParams' primAutoDecoders java <- readFile "Test.java" let Right parsed = parser compilationUnit java putStrLn $ prettyPrint parsed loss <- runAnyAutoEncoder autoEncoder parsed let train = do tape <- newIORef [] resetNode loss error <- evalNodeTape tape loss print error setLearningRate (-0.001) loss backprop =<< readIORef tape traverse learn params traverse (const train) [1..1000] j :: CompilationUnit <- runAnyDecoder decoder =<< defM putStrLn $ prettyPrint j
903
main = do encodeParams' <- encodeParams decodeParams' <- decodeParams let params = concat $ collapse_NP (liftA_NP (K . getNodes) encodeParams') ++ collapse_NP (liftA_NP (K . getNodes) decodeParams') let decoder = makeDecoder javaComplete decodeParams' primDecoders let autoEncoder = makeAutoEncoder javaComplete encodeParams' primEncoders decodeParams' primAutoDecoders java <- readFile "Test.java" let Right parsed = parser compilationUnit java putStrLn $ prettyPrint parsed loss <- runAnyAutoEncoder autoEncoder parsed let train = do tape <- newIORef [] resetNode loss error <- evalNodeTape tape loss print error setLearningRate (-0.001) loss backprop =<< readIORef tape traverse learn params traverse (const train) [1..1000] j :: CompilationUnit <- runAnyDecoder decoder =<< defM putStrLn $ prettyPrint j
903
false
false
1
17
201
286
123
163
null
null
seanhess/serials
server/Serials/Lib/JWT.hs
mit
claimSet :: JWT a -> JWTClaimsSet claimSet = claims
51
claimSet :: JWT a -> JWTClaimsSet claimSet = claims
51
claimSet = claims
17
false
true
0
6
8
18
9
9
null
null
bergmark/purescript
hierarchy/Main.hs
mit
compile :: FilePath -> Maybe FilePath -> IO () compile input mOutput = do modules <- readInput input case modules of Left err -> U.print err >> exitFailure Right ms -> do for_ ms $ \(P.Module moduleName decls _) -> let name = runModuleName moduleName tcs = filter P.isTypeClassDeclaration decls supers = sort . nub . filter (not . null) $ fmap superClasses tcs prologue = "digraph " ++ name ++ " {\n" body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers) epilogue = "\n}" hier = prologue ++ body ++ epilogue in unless (null supers) $ case mOutput of Just output -> do createDirectoryIfMissing True output U.writeFile (output </> name) hier Nothing -> U.putStrLn hier exitSuccess
860
compile :: FilePath -> Maybe FilePath -> IO () compile input mOutput = do modules <- readInput input case modules of Left err -> U.print err >> exitFailure Right ms -> do for_ ms $ \(P.Module moduleName decls _) -> let name = runModuleName moduleName tcs = filter P.isTypeClassDeclaration decls supers = sort . nub . filter (not . null) $ fmap superClasses tcs prologue = "digraph " ++ name ++ " {\n" body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers) epilogue = "\n}" hier = prologue ++ body ++ epilogue in unless (null supers) $ case mOutput of Just output -> do createDirectoryIfMissing True output U.writeFile (output </> name) hier Nothing -> U.putStrLn hier exitSuccess
860
compile input mOutput = do modules <- readInput input case modules of Left err -> U.print err >> exitFailure Right ms -> do for_ ms $ \(P.Module moduleName decls _) -> let name = runModuleName moduleName tcs = filter P.isTypeClassDeclaration decls supers = sort . nub . filter (not . null) $ fmap superClasses tcs prologue = "digraph " ++ name ++ " {\n" body = intercalate "\n" (concatMap (fmap (\s -> " " ++ show s ++ ";")) supers) epilogue = "\n}" hier = prologue ++ body ++ epilogue in unless (null supers) $ case mOutput of Just output -> do createDirectoryIfMissing True output U.writeFile (output </> name) hier Nothing -> U.putStrLn hier exitSuccess
813
false
true
0
27
280
305
144
161
null
null
mpickering/hackage-server
Distribution/Server/Features/ReverseDependencies/State.hs
bsd-3-clause
-- | Given a dependency (a package name and a version range), find all versions -- in the current package index that satisfy it. selectVersions :: VersionRange -> [Version] -> [Version] selectVersions range versions= filter (flip withinRange range) versions
257
selectVersions :: VersionRange -> [Version] -> [Version] selectVersions range versions= filter (flip withinRange range) versions
128
selectVersions range versions= filter (flip withinRange range) versions
71
true
true
0
7
38
45
24
21
null
null
Cubesoup/Othello
GoodOthello.hs
bsd-2-clause
-- we also need the ability to make a move on the board. We will asuume -- any move given to this function as input is a legal move. make_move :: Board -> Colour -> Posn -> Board make_move brd col pos = foldr consf (replace brd col pos) directions where consf = (\dir board -> flip board col pos dir)
307
make_move :: Board -> Colour -> Posn -> Board make_move brd col pos = foldr consf (replace brd col pos) directions where consf = (\dir board -> flip board col pos dir)
173
make_move brd col pos = foldr consf (replace brd col pos) directions where consf = (\dir board -> flip board col pos dir)
127
true
true
0
7
67
76
39
37
null
null
j-rock/strat
src/Game/Lib/Units/Instances.hs
mit
transport :: Defense -> Attacks -> Mobility -> String -> UnitT transport d a m = Unit d a m can'tCapture defTurn defExperience (defTroopers d) ExtraLarge Air
157
transport :: Defense -> Attacks -> Mobility -> String -> UnitT transport d a m = Unit d a m can'tCapture defTurn defExperience (defTroopers d) ExtraLarge Air
157
transport d a m = Unit d a m can'tCapture defTurn defExperience (defTroopers d) ExtraLarge Air
94
false
true
0
8
26
59
29
30
null
null
andorp/hs-bluesnap
src/Bluesnap/API/Response.hs
gpl-3.0
elementInvoice_status :: XMLParser Xsd.XsdString elementInvoice_status = parseSchemaType "invoice-status"
105
elementInvoice_status :: XMLParser Xsd.XsdString elementInvoice_status = parseSchemaType "invoice-status"
105
elementInvoice_status = parseSchemaType "invoice-status"
56
false
true
0
6
7
19
9
10
null
null
mparusinski/Haskell-number-theory-library
Factoring/Lenstra.hs
gpl-3.0
findHighestPower n p = findHighestPowerAccum bound p 1 where bound = floor $ (fromIntegral n :: Double) / (fromIntegral p :: Double) findHighestPowerAccum bound p accum | accum > bound = accum | otherwise = findHighestPowerAccum bound p (accum * p)
299
findHighestPower n p = findHighestPowerAccum bound p 1 where bound = floor $ (fromIntegral n :: Double) / (fromIntegral p :: Double) findHighestPowerAccum bound p accum | accum > bound = accum | otherwise = findHighestPowerAccum bound p (accum * p)
299
findHighestPower n p = findHighestPowerAccum bound p 1 where bound = floor $ (fromIntegral n :: Double) / (fromIntegral p :: Double) findHighestPowerAccum bound p accum | accum > bound = accum | otherwise = findHighestPowerAccum bound p (accum * p)
299
false
false
3
10
91
98
47
51
null
null
kishoredbn/barrelfish
tools/flounder/Local.hs
mit
local_connect_handler_proto :: String -> C.Unit local_connect_handler_proto ifn = C.GVarDecl C.Extern C.NonConst (C.Function C.NoScope (C.TypeName "errval_t") local_connect_handler_params) (drv_connect_handler_name drvname ifn) Nothing
243
local_connect_handler_proto :: String -> C.Unit local_connect_handler_proto ifn = C.GVarDecl C.Extern C.NonConst (C.Function C.NoScope (C.TypeName "errval_t") local_connect_handler_params) (drv_connect_handler_name drvname ifn) Nothing
243
local_connect_handler_proto ifn = C.GVarDecl C.Extern C.NonConst (C.Function C.NoScope (C.TypeName "errval_t") local_connect_handler_params) (drv_connect_handler_name drvname ifn) Nothing
195
false
true
0
10
27
67
33
34
null
null
marcellussiegburg/autotool
yesod/Handler/AufgabeEinstellungen.hs
gpl-2.0
aufgabeForm :: AufgabeTyp -> Maybe AufgabeFormDaten -> AForm Handler AufgabeFormDaten aufgabeForm aTyp maufgabe = AufgabeFormDaten <$> areq nameField (bfs MsgAufgabeName) (name <$> maufgabe) <*> (fmap unTextarea <$> aopt textareaField (bfs MsgAufgabeHinweis) (fmap Textarea . hinweis <$> maufgabe)) <*> areq (selectFieldList highscores) (bfs MsgAufgabeHighscore) (highscore <$> maufgabe) <*> areq (selectFieldList stati) (bfs MsgAufgabeStatus) (status <$> maufgabe) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeBeginnDatum) (utctDay . beginn <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeBeginnZeit) (timeToTimeOfDay . utctDayTime . beginn <$> maufgabe))) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeEndeDatum) (utctDay . ende <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeEndeZeit) (timeToTimeOfDay . utctDayTime . ende <$> maufgabe))) <* bootstrapSubmit (BootstrapSubmit MsgAufgabeEinstellen "btn-success" []) where nameField = flip checkM textField $ \ n -> do vorlagen <- getVorlagen aTyp let vorlagen' = maybe vorlagen ((flip delete vorlagen) . name) maufgabe if n `elem` vorlagen' then return $ Left MsgAufgabeNameVergeben else return $ Right n
1,365
aufgabeForm :: AufgabeTyp -> Maybe AufgabeFormDaten -> AForm Handler AufgabeFormDaten aufgabeForm aTyp maufgabe = AufgabeFormDaten <$> areq nameField (bfs MsgAufgabeName) (name <$> maufgabe) <*> (fmap unTextarea <$> aopt textareaField (bfs MsgAufgabeHinweis) (fmap Textarea . hinweis <$> maufgabe)) <*> areq (selectFieldList highscores) (bfs MsgAufgabeHighscore) (highscore <$> maufgabe) <*> areq (selectFieldList stati) (bfs MsgAufgabeStatus) (status <$> maufgabe) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeBeginnDatum) (utctDay . beginn <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeBeginnZeit) (timeToTimeOfDay . utctDayTime . beginn <$> maufgabe))) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeEndeDatum) (utctDay . ende <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeEndeZeit) (timeToTimeOfDay . utctDayTime . ende <$> maufgabe))) <* bootstrapSubmit (BootstrapSubmit MsgAufgabeEinstellen "btn-success" []) where nameField = flip checkM textField $ \ n -> do vorlagen <- getVorlagen aTyp let vorlagen' = maybe vorlagen ((flip delete vorlagen) . name) maufgabe if n `elem` vorlagen' then return $ Left MsgAufgabeNameVergeben else return $ Right n
1,365
aufgabeForm aTyp maufgabe = AufgabeFormDaten <$> areq nameField (bfs MsgAufgabeName) (name <$> maufgabe) <*> (fmap unTextarea <$> aopt textareaField (bfs MsgAufgabeHinweis) (fmap Textarea . hinweis <$> maufgabe)) <*> areq (selectFieldList highscores) (bfs MsgAufgabeHighscore) (highscore <$> maufgabe) <*> areq (selectFieldList stati) (bfs MsgAufgabeStatus) (status <$> maufgabe) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeBeginnDatum) (utctDay . beginn <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeBeginnZeit) (timeToTimeOfDay . utctDayTime . beginn <$> maufgabe))) <*> (UTCTime <$> areq (jqueryDayField def) (bfsFormControl MsgAufgabeEndeDatum) (utctDay . ende <$> maufgabe) <*> (timeOfDayToTime <$> areq timeFieldTypeTime (bfs MsgAufgabeEndeZeit) (timeToTimeOfDay . utctDayTime . ende <$> maufgabe))) <* bootstrapSubmit (BootstrapSubmit MsgAufgabeEinstellen "btn-success" []) where nameField = flip checkM textField $ \ n -> do vorlagen <- getVorlagen aTyp let vorlagen' = maybe vorlagen ((flip delete vorlagen) . name) maufgabe if n `elem` vorlagen' then return $ Left MsgAufgabeNameVergeben else return $ Right n
1,279
false
true
19
17
258
449
225
224
null
null
wereHamster/nauva
pkg/hs/nauvad/src/Settings.hs
mit
toRoute :: MonadSnap m => (FilePath, ByteString) -> (ByteString, m ()) toRoute (path, content) = ( BS8.pack path, do -- modifyResponse $ addHeader "Content-Type" "text/html; charset=UTF-8" writeBS content )
230
toRoute :: MonadSnap m => (FilePath, ByteString) -> (ByteString, m ()) toRoute (path, content) = ( BS8.pack path, do -- modifyResponse $ addHeader "Content-Type" "text/html; charset=UTF-8" writeBS content )
230
toRoute (path, content) = ( BS8.pack path, do -- modifyResponse $ addHeader "Content-Type" "text/html; charset=UTF-8" writeBS content )
159
false
true
0
9
52
66
35
31
null
null
olsner/ghc
compiler/basicTypes/BasicTypes.hs
bsd-3-clause
isOneOcc :: OccInfo -> Bool isOneOcc (OneOcc {}) = True
55
isOneOcc :: OccInfo -> Bool isOneOcc (OneOcc {}) = True
55
isOneOcc (OneOcc {}) = True
27
false
true
0
7
9
25
13
12
null
null
ajjaic/Problems99
src/Probs21to30.hs
mit
helper :: [a] -> Maybe (a, [a]) helper [] = Nothing
51
helper :: [a] -> Maybe (a, [a]) helper [] = Nothing
51
helper [] = Nothing
19
false
true
0
8
10
35
19
16
null
null
ghc-android/ghc
compiler/basicTypes/Name.hs
bsd-3-clause
wiredInNameTyThing_maybe _ = Nothing
70
wiredInNameTyThing_maybe _ = Nothing
70
wiredInNameTyThing_maybe _ = Nothing
70
false
false
0
5
37
9
4
5
null
null
plaprade/haskoin
haskoin-core/src/Network/Haskoin/Crypto/ExtendedKeys.hs
unlicense
pathToStr :: DerivPathI t -> String pathToStr p = case p of next :| i -> concat [ pathToStr next, "/", show i, "'" ] next :/ i -> concat [ pathToStr next, "/", show i ] Deriv -> ""
212
pathToStr :: DerivPathI t -> String pathToStr p = case p of next :| i -> concat [ pathToStr next, "/", show i, "'" ] next :/ i -> concat [ pathToStr next, "/", show i ] Deriv -> ""
212
pathToStr p = case p of next :| i -> concat [ pathToStr next, "/", show i, "'" ] next :/ i -> concat [ pathToStr next, "/", show i ] Deriv -> ""
176
false
true
0
10
71
96
46
50
null
null
leksah/yi
src/library/Yi/Editor.hs
gpl-2.0
-- | Swap focused window with the previous one moveWinPrevE :: EditorM () moveWinPrevE = windowsA %= swapFocus PL.previous
122
moveWinPrevE :: EditorM () moveWinPrevE = windowsA %= swapFocus PL.previous
75
moveWinPrevE = windowsA %= swapFocus PL.previous
48
true
true
1
7
18
29
13
16
null
null
lwchkg/sunlight-x
test/code-snippets/haskell.hs
apache-2.0
sepNB g Empty k ys = oneLiner (nilBeside g (reduceDoc rest)) `mkUnion` nilAboveNest False k (reduceDoc (vcat ys)) where rest | g = hsep ys | otherwise = hcat ys
323
sepNB g Empty k ys = oneLiner (nilBeside g (reduceDoc rest)) `mkUnion` nilAboveNest False k (reduceDoc (vcat ys)) where rest | g = hsep ys | otherwise = hcat ys
323
sepNB g Empty k ys = oneLiner (nilBeside g (reduceDoc rest)) `mkUnion` nilAboveNest False k (reduceDoc (vcat ys)) where rest | g = hsep ys | otherwise = hcat ys
323
false
false
0
10
192
86
40
46
null
null
google/ghc-source-gen
src/GHC/SourceGen/Expr.hs
bsd-3-clause
arithSeq :: ArithSeqInfo GhcPs -> HsExpr' arithSeq = #if MIN_VERSION_ghc(8,6,0) withEpAnnNotUsed ArithSeq Nothing
117
arithSeq :: ArithSeqInfo GhcPs -> HsExpr' arithSeq = #if MIN_VERSION_ghc(8,6,0) withEpAnnNotUsed ArithSeq Nothing
117
arithSeq = #if MIN_VERSION_ghc(8,6,0) withEpAnnNotUsed ArithSeq Nothing
75
false
true
0
6
16
24
12
12
null
null
jameshales/voltorb-flip
src/Board.hs
bsd-3-clause
isValidBoard :: Board -> Bool isValidBoard b = bounds (unBoard b) == (minBound, maxBound)
89
isValidBoard :: Board -> Bool isValidBoard b = bounds (unBoard b) == (minBound, maxBound)
89
isValidBoard b = bounds (unBoard b) == (minBound, maxBound)
59
false
true
0
8
13
37
19
18
null
null
jshholland/savannah-wit
src/Board.hs
bsd-3-clause
showFile FileF = 'f'
20
showFile FileF = 'f'
20
showFile FileF = 'f'
20
false
false
1
5
3
13
4
9
null
null
soscpd/bee
root/tests/zguide/examples/Haskell/MDPDef.hs
mit
mdpwRequest = pack "02"
23
mdpwRequest = pack "02"
23
mdpwRequest = pack "02"
23
false
false
0
5
3
9
4
5
null
null
jwiegley/ghc-release
utils/haddock/src/Haddock/Backends/LaTeX.hs
gpl-3.0
string_txt :: TextDetails -> String -> String string_txt (Chr c) s = c:s
75
string_txt :: TextDetails -> String -> String string_txt (Chr c) s = c:s
75
string_txt (Chr c) s = c:s
29
false
true
0
7
15
34
17
17
null
null
HIPERFIT/futhark
src/Futhark/IR/Primitive.hs
isc
-- | A mapping from names of primitive functions to their parameter -- types, their result type, and a function for evaluating them. primFuns :: M.Map String ( [PrimType], PrimType, [PrimValue] -> Maybe PrimValue ) primFuns = M.fromList [ f16 "sqrt16" sqrt, f32 "sqrt32" sqrt, f64 "sqrt64" sqrt, -- f16 "log16" log, f32 "log32" log, f64 "log64" log, -- f16 "log10_16" (logBase 10), f32 "log10_32" (logBase 10), f64 "log10_64" (logBase 10), -- f16 "log2_16" (logBase 2), f32 "log2_32" (logBase 2), f64 "log2_64" (logBase 2), -- f16 "exp16" exp, f32 "exp32" exp, f64 "exp64" exp, -- f16 "sin16" sin, f32 "sin32" sin, f64 "sin64" sin, -- f16 "sinh16" sinh, f32 "sinh32" sinh, f64 "sinh64" sinh, -- f16 "cos16" cos, f32 "cos32" cos, f64 "cos64" cos, -- f16 "cosh16" cosh, f32 "cosh32" cosh, f64 "cosh64" cosh, -- f16 "tan16" tan, f32 "tan32" tan, f64 "tan64" tan, -- f16 "tanh16" tanh, f32 "tanh32" tanh, f64 "tanh64" tanh, -- f16 "asin16" asin, f32 "asin32" asin, f64 "asin64" asin, -- f16 "asinh16" asinh, f32 "asinh32" asinh, f64 "asinh64" asinh, -- f16 "acos16" acos, f32 "acos32" acos, f64 "acos64" acos, -- f16 "acosh16" acosh, f32 "acosh32" acosh, f64 "acosh64" acosh, -- f16 "atan16" atan, f32 "atan32" atan, f64 "atan64" atan, -- f16 "atanh16" atanh, f32 "atanh32" atanh, f64 "atanh64" atanh, -- f16 "round16" $ convFloat . roundFloat . convFloat, f32 "round32" roundFloat, f64 "round64" roundDouble, -- f16 "ceil16" $ convFloat . ceilFloat . convFloat, f32 "ceil32" ceilFloat, f64 "ceil64" ceilDouble, -- f16 "floor16" $ convFloat . floorFloat . convFloat, f32 "floor32" floorFloat, f64 "floor64" floorDouble, -- f16 "gamma16" $ convFloat . tgammaf . convFloat, f32 "gamma32" tgammaf, f64 "gamma64" tgamma, -- f16 "lgamma16" $ convFloat . lgammaf . convFloat, f32 "lgamma32" lgammaf, f64 "lgamma64" lgamma, -- i8 "clz8" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i16 "clz16" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i32 "clz32" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i64 "clz64" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i8 "ctz8" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i16 "ctz16" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i32 "ctz32" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i64 "ctz64" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i8 "popc8" $ IntValue . Int32Value . fromIntegral . popCount, i16 "popc16" $ IntValue . Int32Value . fromIntegral . popCount, i32 "popc32" $ IntValue . Int32Value . fromIntegral . popCount, i64 "popc64" $ IntValue . Int32Value . fromIntegral . popCount, ( "mad_hi8", ( [IntType Int8, IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b), IntValue (Int8Value c)] -> Just $ IntValue . Int8Value $ mad_hi8 (Int8Value a) (Int8Value b) c _ -> Nothing ) ), ( "mad_hi16", ( [IntType Int16, IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b), IntValue (Int16Value c)] -> Just $ IntValue . Int16Value $ mad_hi16 (Int16Value a) (Int16Value b) c _ -> Nothing ) ), ( "mad_hi32", ( [IntType Int32, IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b), IntValue (Int32Value c)] -> Just $ IntValue . Int32Value $ mad_hi32 (Int32Value a) (Int32Value b) c _ -> Nothing ) ), ( "mad_hi64", ( [IntType Int64, IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b), IntValue (Int64Value c)] -> Just $ IntValue . Int64Value $ mad_hi64 (Int64Value a) (Int64Value b) c _ -> Nothing ) ), ( "mul_hi8", ( [IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b)] -> Just $ IntValue . Int8Value $ mul_hi8 (Int8Value a) (Int8Value b) _ -> Nothing ) ), ( "mul_hi16", ( [IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b)] -> Just $ IntValue . Int16Value $ mul_hi16 (Int16Value a) (Int16Value b) _ -> Nothing ) ), ( "mul_hi32", ( [IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b)] -> Just $ IntValue . Int32Value $ mul_hi32 (Int32Value a) (Int32Value b) _ -> Nothing ) ), ( "mul_hi64", ( [IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b)] -> Just $ IntValue . Int64Value $ mul_hi64 (Int64Value a) (Int64Value b) _ -> Nothing ) ), -- ( "atan2_16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ atan2 x y _ -> Nothing ) ), ( "atan2_32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ atan2 x y _ -> Nothing ) ), ( "atan2_64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ atan2 x y _ -> Nothing ) ), -- ( "hypot16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ convFloat $ hypotf (convFloat x) (convFloat y) _ -> Nothing ) ), ( "hypot32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ hypotf x y _ -> Nothing ) ), ( "hypot64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ hypot x y _ -> Nothing ) ), ( "isinf16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isnan16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "to_bits16", ( [FloatType Float16], IntType Int16, \case [FloatValue (Float16Value x)] -> Just $ IntValue $ Int16Value $ fromIntegral $ halfToWord x _ -> Nothing ) ), ( "to_bits32", ( [FloatType Float32], IntType Int32, \case [FloatValue (Float32Value x)] -> Just $ IntValue $ Int32Value $ fromIntegral $ floatToWord x _ -> Nothing ) ), ( "to_bits64", ( [FloatType Float64], IntType Int64, \case [FloatValue (Float64Value x)] -> Just $ IntValue $ Int64Value $ fromIntegral $ doubleToWord x _ -> Nothing ) ), ( "from_bits16", ( [IntType Int16], FloatType Float16, \case [IntValue (Int16Value x)] -> Just $ FloatValue $ Float16Value $ wordToHalf $ fromIntegral x _ -> Nothing ) ), ( "from_bits32", ( [IntType Int32], FloatType Float32, \case [IntValue (Int32Value x)] -> Just $ FloatValue $ Float32Value $ wordToFloat $ fromIntegral x _ -> Nothing ) ), ( "from_bits64", ( [IntType Int64], FloatType Float64, \case [IntValue (Int64Value x)] -> Just $ FloatValue $ Float64Value $ wordToDouble $ fromIntegral x _ -> Nothing ) ), f16_3 "lerp16" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f32_3 "lerp32" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f64_3 "lerp64" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f16_3 "mad16" (\a b c -> a * b + c), f32_3 "mad32" (\a b c -> a * b + c), f64_3 "mad64" (\a b c -> a * b + c), f16_3 "fma16" (\a b c -> a * b + c), f32_3 "fma32" (\a b c -> a * b + c), f64_3 "fma64" (\a b c -> a * b + c) ] where i8 s f = (s, ([IntType Int8], IntType Int32, i8PrimFun f)) i16 s f = (s, ([IntType Int16], IntType Int32, i16PrimFun f)) i32 s f = (s, ([IntType Int32], IntType Int32, i32PrimFun f)) i64 s f = (s, ([IntType Int64], IntType Int32, i64PrimFun f)) f16 s f = (s, ([FloatType Float16], FloatType Float16, f16PrimFun f)) f32 s f = (s, ([FloatType Float32], FloatType Float32, f32PrimFun f)) f64 s f = (s, ([FloatType Float64], FloatType Float64, f64PrimFun f)) f16_3 s f = ( s, ( [FloatType Float16, FloatType Float16, FloatType Float16], FloatType Float16, f16PrimFun3 f ) ) f32_3 s f = ( s, ( [FloatType Float32, FloatType Float32, FloatType Float32], FloatType Float32, f32PrimFun3 f ) ) f64_3 s f = ( s, ( [FloatType Float64, FloatType Float64, FloatType Float64], FloatType Float64, f64PrimFun3 f ) ) i8PrimFun f [IntValue (Int8Value x)] = Just $ f x i8PrimFun _ _ = Nothing i16PrimFun f [IntValue (Int16Value x)] = Just $ f x i16PrimFun _ _ = Nothing i32PrimFun f [IntValue (Int32Value x)] = Just $ f x i32PrimFun _ _ = Nothing i64PrimFun f [IntValue (Int64Value x)] = Just $ f x i64PrimFun _ _ = Nothing f16PrimFun f [FloatValue (Float16Value x)] = Just $ FloatValue $ Float16Value $ f x f16PrimFun _ _ = Nothing f32PrimFun f [FloatValue (Float32Value x)] = Just $ FloatValue $ Float32Value $ f x f32PrimFun _ _ = Nothing f64PrimFun f [FloatValue (Float64Value x)] = Just $ FloatValue $ Float64Value $ f x f64PrimFun _ _ = Nothing f16PrimFun3 f [ FloatValue (Float16Value a), FloatValue (Float16Value b), FloatValue (Float16Value c) ] = Just $ FloatValue $ Float16Value $ f a b c f16PrimFun3 _ _ = Nothing f32PrimFun3 f [ FloatValue (Float32Value a), FloatValue (Float32Value b), FloatValue (Float32Value c) ] = Just $ FloatValue $ Float32Value $ f a b c f32PrimFun3 _ _ = Nothing f64PrimFun3 f [ FloatValue (Float64Value a), FloatValue (Float64Value b), FloatValue (Float64Value c) ] = Just $ FloatValue $ Float64Value $ f a b c f64PrimFun3 _ _ = Nothing -- | Is the given value kind of zero?
13,265
primFuns :: M.Map String ( [PrimType], PrimType, [PrimValue] -> Maybe PrimValue ) primFuns = M.fromList [ f16 "sqrt16" sqrt, f32 "sqrt32" sqrt, f64 "sqrt64" sqrt, -- f16 "log16" log, f32 "log32" log, f64 "log64" log, -- f16 "log10_16" (logBase 10), f32 "log10_32" (logBase 10), f64 "log10_64" (logBase 10), -- f16 "log2_16" (logBase 2), f32 "log2_32" (logBase 2), f64 "log2_64" (logBase 2), -- f16 "exp16" exp, f32 "exp32" exp, f64 "exp64" exp, -- f16 "sin16" sin, f32 "sin32" sin, f64 "sin64" sin, -- f16 "sinh16" sinh, f32 "sinh32" sinh, f64 "sinh64" sinh, -- f16 "cos16" cos, f32 "cos32" cos, f64 "cos64" cos, -- f16 "cosh16" cosh, f32 "cosh32" cosh, f64 "cosh64" cosh, -- f16 "tan16" tan, f32 "tan32" tan, f64 "tan64" tan, -- f16 "tanh16" tanh, f32 "tanh32" tanh, f64 "tanh64" tanh, -- f16 "asin16" asin, f32 "asin32" asin, f64 "asin64" asin, -- f16 "asinh16" asinh, f32 "asinh32" asinh, f64 "asinh64" asinh, -- f16 "acos16" acos, f32 "acos32" acos, f64 "acos64" acos, -- f16 "acosh16" acosh, f32 "acosh32" acosh, f64 "acosh64" acosh, -- f16 "atan16" atan, f32 "atan32" atan, f64 "atan64" atan, -- f16 "atanh16" atanh, f32 "atanh32" atanh, f64 "atanh64" atanh, -- f16 "round16" $ convFloat . roundFloat . convFloat, f32 "round32" roundFloat, f64 "round64" roundDouble, -- f16 "ceil16" $ convFloat . ceilFloat . convFloat, f32 "ceil32" ceilFloat, f64 "ceil64" ceilDouble, -- f16 "floor16" $ convFloat . floorFloat . convFloat, f32 "floor32" floorFloat, f64 "floor64" floorDouble, -- f16 "gamma16" $ convFloat . tgammaf . convFloat, f32 "gamma32" tgammaf, f64 "gamma64" tgamma, -- f16 "lgamma16" $ convFloat . lgammaf . convFloat, f32 "lgamma32" lgammaf, f64 "lgamma64" lgamma, -- i8 "clz8" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i16 "clz16" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i32 "clz32" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i64 "clz64" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i8 "ctz8" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i16 "ctz16" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i32 "ctz32" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i64 "ctz64" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i8 "popc8" $ IntValue . Int32Value . fromIntegral . popCount, i16 "popc16" $ IntValue . Int32Value . fromIntegral . popCount, i32 "popc32" $ IntValue . Int32Value . fromIntegral . popCount, i64 "popc64" $ IntValue . Int32Value . fromIntegral . popCount, ( "mad_hi8", ( [IntType Int8, IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b), IntValue (Int8Value c)] -> Just $ IntValue . Int8Value $ mad_hi8 (Int8Value a) (Int8Value b) c _ -> Nothing ) ), ( "mad_hi16", ( [IntType Int16, IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b), IntValue (Int16Value c)] -> Just $ IntValue . Int16Value $ mad_hi16 (Int16Value a) (Int16Value b) c _ -> Nothing ) ), ( "mad_hi32", ( [IntType Int32, IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b), IntValue (Int32Value c)] -> Just $ IntValue . Int32Value $ mad_hi32 (Int32Value a) (Int32Value b) c _ -> Nothing ) ), ( "mad_hi64", ( [IntType Int64, IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b), IntValue (Int64Value c)] -> Just $ IntValue . Int64Value $ mad_hi64 (Int64Value a) (Int64Value b) c _ -> Nothing ) ), ( "mul_hi8", ( [IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b)] -> Just $ IntValue . Int8Value $ mul_hi8 (Int8Value a) (Int8Value b) _ -> Nothing ) ), ( "mul_hi16", ( [IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b)] -> Just $ IntValue . Int16Value $ mul_hi16 (Int16Value a) (Int16Value b) _ -> Nothing ) ), ( "mul_hi32", ( [IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b)] -> Just $ IntValue . Int32Value $ mul_hi32 (Int32Value a) (Int32Value b) _ -> Nothing ) ), ( "mul_hi64", ( [IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b)] -> Just $ IntValue . Int64Value $ mul_hi64 (Int64Value a) (Int64Value b) _ -> Nothing ) ), -- ( "atan2_16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ atan2 x y _ -> Nothing ) ), ( "atan2_32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ atan2 x y _ -> Nothing ) ), ( "atan2_64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ atan2 x y _ -> Nothing ) ), -- ( "hypot16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ convFloat $ hypotf (convFloat x) (convFloat y) _ -> Nothing ) ), ( "hypot32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ hypotf x y _ -> Nothing ) ), ( "hypot64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ hypot x y _ -> Nothing ) ), ( "isinf16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isnan16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "to_bits16", ( [FloatType Float16], IntType Int16, \case [FloatValue (Float16Value x)] -> Just $ IntValue $ Int16Value $ fromIntegral $ halfToWord x _ -> Nothing ) ), ( "to_bits32", ( [FloatType Float32], IntType Int32, \case [FloatValue (Float32Value x)] -> Just $ IntValue $ Int32Value $ fromIntegral $ floatToWord x _ -> Nothing ) ), ( "to_bits64", ( [FloatType Float64], IntType Int64, \case [FloatValue (Float64Value x)] -> Just $ IntValue $ Int64Value $ fromIntegral $ doubleToWord x _ -> Nothing ) ), ( "from_bits16", ( [IntType Int16], FloatType Float16, \case [IntValue (Int16Value x)] -> Just $ FloatValue $ Float16Value $ wordToHalf $ fromIntegral x _ -> Nothing ) ), ( "from_bits32", ( [IntType Int32], FloatType Float32, \case [IntValue (Int32Value x)] -> Just $ FloatValue $ Float32Value $ wordToFloat $ fromIntegral x _ -> Nothing ) ), ( "from_bits64", ( [IntType Int64], FloatType Float64, \case [IntValue (Int64Value x)] -> Just $ FloatValue $ Float64Value $ wordToDouble $ fromIntegral x _ -> Nothing ) ), f16_3 "lerp16" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f32_3 "lerp32" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f64_3 "lerp64" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f16_3 "mad16" (\a b c -> a * b + c), f32_3 "mad32" (\a b c -> a * b + c), f64_3 "mad64" (\a b c -> a * b + c), f16_3 "fma16" (\a b c -> a * b + c), f32_3 "fma32" (\a b c -> a * b + c), f64_3 "fma64" (\a b c -> a * b + c) ] where i8 s f = (s, ([IntType Int8], IntType Int32, i8PrimFun f)) i16 s f = (s, ([IntType Int16], IntType Int32, i16PrimFun f)) i32 s f = (s, ([IntType Int32], IntType Int32, i32PrimFun f)) i64 s f = (s, ([IntType Int64], IntType Int32, i64PrimFun f)) f16 s f = (s, ([FloatType Float16], FloatType Float16, f16PrimFun f)) f32 s f = (s, ([FloatType Float32], FloatType Float32, f32PrimFun f)) f64 s f = (s, ([FloatType Float64], FloatType Float64, f64PrimFun f)) f16_3 s f = ( s, ( [FloatType Float16, FloatType Float16, FloatType Float16], FloatType Float16, f16PrimFun3 f ) ) f32_3 s f = ( s, ( [FloatType Float32, FloatType Float32, FloatType Float32], FloatType Float32, f32PrimFun3 f ) ) f64_3 s f = ( s, ( [FloatType Float64, FloatType Float64, FloatType Float64], FloatType Float64, f64PrimFun3 f ) ) i8PrimFun f [IntValue (Int8Value x)] = Just $ f x i8PrimFun _ _ = Nothing i16PrimFun f [IntValue (Int16Value x)] = Just $ f x i16PrimFun _ _ = Nothing i32PrimFun f [IntValue (Int32Value x)] = Just $ f x i32PrimFun _ _ = Nothing i64PrimFun f [IntValue (Int64Value x)] = Just $ f x i64PrimFun _ _ = Nothing f16PrimFun f [FloatValue (Float16Value x)] = Just $ FloatValue $ Float16Value $ f x f16PrimFun _ _ = Nothing f32PrimFun f [FloatValue (Float32Value x)] = Just $ FloatValue $ Float32Value $ f x f32PrimFun _ _ = Nothing f64PrimFun f [FloatValue (Float64Value x)] = Just $ FloatValue $ Float64Value $ f x f64PrimFun _ _ = Nothing f16PrimFun3 f [ FloatValue (Float16Value a), FloatValue (Float16Value b), FloatValue (Float16Value c) ] = Just $ FloatValue $ Float16Value $ f a b c f16PrimFun3 _ _ = Nothing f32PrimFun3 f [ FloatValue (Float32Value a), FloatValue (Float32Value b), FloatValue (Float32Value c) ] = Just $ FloatValue $ Float32Value $ f a b c f32PrimFun3 _ _ = Nothing f64PrimFun3 f [ FloatValue (Float64Value a), FloatValue (Float64Value b), FloatValue (Float64Value c) ] = Just $ FloatValue $ Float64Value $ f a b c f64PrimFun3 _ _ = Nothing -- | Is the given value kind of zero?
13,132
primFuns = M.fromList [ f16 "sqrt16" sqrt, f32 "sqrt32" sqrt, f64 "sqrt64" sqrt, -- f16 "log16" log, f32 "log32" log, f64 "log64" log, -- f16 "log10_16" (logBase 10), f32 "log10_32" (logBase 10), f64 "log10_64" (logBase 10), -- f16 "log2_16" (logBase 2), f32 "log2_32" (logBase 2), f64 "log2_64" (logBase 2), -- f16 "exp16" exp, f32 "exp32" exp, f64 "exp64" exp, -- f16 "sin16" sin, f32 "sin32" sin, f64 "sin64" sin, -- f16 "sinh16" sinh, f32 "sinh32" sinh, f64 "sinh64" sinh, -- f16 "cos16" cos, f32 "cos32" cos, f64 "cos64" cos, -- f16 "cosh16" cosh, f32 "cosh32" cosh, f64 "cosh64" cosh, -- f16 "tan16" tan, f32 "tan32" tan, f64 "tan64" tan, -- f16 "tanh16" tanh, f32 "tanh32" tanh, f64 "tanh64" tanh, -- f16 "asin16" asin, f32 "asin32" asin, f64 "asin64" asin, -- f16 "asinh16" asinh, f32 "asinh32" asinh, f64 "asinh64" asinh, -- f16 "acos16" acos, f32 "acos32" acos, f64 "acos64" acos, -- f16 "acosh16" acosh, f32 "acosh32" acosh, f64 "acosh64" acosh, -- f16 "atan16" atan, f32 "atan32" atan, f64 "atan64" atan, -- f16 "atanh16" atanh, f32 "atanh32" atanh, f64 "atanh64" atanh, -- f16 "round16" $ convFloat . roundFloat . convFloat, f32 "round32" roundFloat, f64 "round64" roundDouble, -- f16 "ceil16" $ convFloat . ceilFloat . convFloat, f32 "ceil32" ceilFloat, f64 "ceil64" ceilDouble, -- f16 "floor16" $ convFloat . floorFloat . convFloat, f32 "floor32" floorFloat, f64 "floor64" floorDouble, -- f16 "gamma16" $ convFloat . tgammaf . convFloat, f32 "gamma32" tgammaf, f64 "gamma64" tgamma, -- f16 "lgamma16" $ convFloat . lgammaf . convFloat, f32 "lgamma32" lgammaf, f64 "lgamma64" lgamma, -- i8 "clz8" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i16 "clz16" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i32 "clz32" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i64 "clz64" $ IntValue . Int32Value . fromIntegral . countLeadingZeros, i8 "ctz8" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i16 "ctz16" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i32 "ctz32" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i64 "ctz64" $ IntValue . Int32Value . fromIntegral . countTrailingZeros, i8 "popc8" $ IntValue . Int32Value . fromIntegral . popCount, i16 "popc16" $ IntValue . Int32Value . fromIntegral . popCount, i32 "popc32" $ IntValue . Int32Value . fromIntegral . popCount, i64 "popc64" $ IntValue . Int32Value . fromIntegral . popCount, ( "mad_hi8", ( [IntType Int8, IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b), IntValue (Int8Value c)] -> Just $ IntValue . Int8Value $ mad_hi8 (Int8Value a) (Int8Value b) c _ -> Nothing ) ), ( "mad_hi16", ( [IntType Int16, IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b), IntValue (Int16Value c)] -> Just $ IntValue . Int16Value $ mad_hi16 (Int16Value a) (Int16Value b) c _ -> Nothing ) ), ( "mad_hi32", ( [IntType Int32, IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b), IntValue (Int32Value c)] -> Just $ IntValue . Int32Value $ mad_hi32 (Int32Value a) (Int32Value b) c _ -> Nothing ) ), ( "mad_hi64", ( [IntType Int64, IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b), IntValue (Int64Value c)] -> Just $ IntValue . Int64Value $ mad_hi64 (Int64Value a) (Int64Value b) c _ -> Nothing ) ), ( "mul_hi8", ( [IntType Int8, IntType Int8], IntType Int8, \case [IntValue (Int8Value a), IntValue (Int8Value b)] -> Just $ IntValue . Int8Value $ mul_hi8 (Int8Value a) (Int8Value b) _ -> Nothing ) ), ( "mul_hi16", ( [IntType Int16, IntType Int16], IntType Int16, \case [IntValue (Int16Value a), IntValue (Int16Value b)] -> Just $ IntValue . Int16Value $ mul_hi16 (Int16Value a) (Int16Value b) _ -> Nothing ) ), ( "mul_hi32", ( [IntType Int32, IntType Int32], IntType Int32, \case [IntValue (Int32Value a), IntValue (Int32Value b)] -> Just $ IntValue . Int32Value $ mul_hi32 (Int32Value a) (Int32Value b) _ -> Nothing ) ), ( "mul_hi64", ( [IntType Int64, IntType Int64], IntType Int64, \case [IntValue (Int64Value a), IntValue (Int64Value b)] -> Just $ IntValue . Int64Value $ mul_hi64 (Int64Value a) (Int64Value b) _ -> Nothing ) ), -- ( "atan2_16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ atan2 x y _ -> Nothing ) ), ( "atan2_32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ atan2 x y _ -> Nothing ) ), ( "atan2_64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ atan2 x y _ -> Nothing ) ), -- ( "hypot16", ( [FloatType Float16, FloatType Float16], FloatType Float16, \case [FloatValue (Float16Value x), FloatValue (Float16Value y)] -> Just $ FloatValue $ Float16Value $ convFloat $ hypotf (convFloat x) (convFloat y) _ -> Nothing ) ), ( "hypot32", ( [FloatType Float32, FloatType Float32], FloatType Float32, \case [FloatValue (Float32Value x), FloatValue (Float32Value y)] -> Just $ FloatValue $ Float32Value $ hypotf x y _ -> Nothing ) ), ( "hypot64", ( [FloatType Float64, FloatType Float64], FloatType Float64, \case [FloatValue (Float64Value x), FloatValue (Float64Value y)] -> Just $ FloatValue $ Float64Value $ hypot x y _ -> Nothing ) ), ( "isinf16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isinf64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isInfinite x _ -> Nothing ) ), ( "isnan16", ( [FloatType Float16], Bool, \case [FloatValue (Float16Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan32", ( [FloatType Float32], Bool, \case [FloatValue (Float32Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "isnan64", ( [FloatType Float64], Bool, \case [FloatValue (Float64Value x)] -> Just $ BoolValue $ isNaN x _ -> Nothing ) ), ( "to_bits16", ( [FloatType Float16], IntType Int16, \case [FloatValue (Float16Value x)] -> Just $ IntValue $ Int16Value $ fromIntegral $ halfToWord x _ -> Nothing ) ), ( "to_bits32", ( [FloatType Float32], IntType Int32, \case [FloatValue (Float32Value x)] -> Just $ IntValue $ Int32Value $ fromIntegral $ floatToWord x _ -> Nothing ) ), ( "to_bits64", ( [FloatType Float64], IntType Int64, \case [FloatValue (Float64Value x)] -> Just $ IntValue $ Int64Value $ fromIntegral $ doubleToWord x _ -> Nothing ) ), ( "from_bits16", ( [IntType Int16], FloatType Float16, \case [IntValue (Int16Value x)] -> Just $ FloatValue $ Float16Value $ wordToHalf $ fromIntegral x _ -> Nothing ) ), ( "from_bits32", ( [IntType Int32], FloatType Float32, \case [IntValue (Int32Value x)] -> Just $ FloatValue $ Float32Value $ wordToFloat $ fromIntegral x _ -> Nothing ) ), ( "from_bits64", ( [IntType Int64], FloatType Float64, \case [IntValue (Int64Value x)] -> Just $ FloatValue $ Float64Value $ wordToDouble $ fromIntegral x _ -> Nothing ) ), f16_3 "lerp16" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f32_3 "lerp32" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f64_3 "lerp64" (\v0 v1 t -> v0 + (v1 - v0) * max 0 (min 1 t)), f16_3 "mad16" (\a b c -> a * b + c), f32_3 "mad32" (\a b c -> a * b + c), f64_3 "mad64" (\a b c -> a * b + c), f16_3 "fma16" (\a b c -> a * b + c), f32_3 "fma32" (\a b c -> a * b + c), f64_3 "fma64" (\a b c -> a * b + c) ] where i8 s f = (s, ([IntType Int8], IntType Int32, i8PrimFun f)) i16 s f = (s, ([IntType Int16], IntType Int32, i16PrimFun f)) i32 s f = (s, ([IntType Int32], IntType Int32, i32PrimFun f)) i64 s f = (s, ([IntType Int64], IntType Int32, i64PrimFun f)) f16 s f = (s, ([FloatType Float16], FloatType Float16, f16PrimFun f)) f32 s f = (s, ([FloatType Float32], FloatType Float32, f32PrimFun f)) f64 s f = (s, ([FloatType Float64], FloatType Float64, f64PrimFun f)) f16_3 s f = ( s, ( [FloatType Float16, FloatType Float16, FloatType Float16], FloatType Float16, f16PrimFun3 f ) ) f32_3 s f = ( s, ( [FloatType Float32, FloatType Float32, FloatType Float32], FloatType Float32, f32PrimFun3 f ) ) f64_3 s f = ( s, ( [FloatType Float64, FloatType Float64, FloatType Float64], FloatType Float64, f64PrimFun3 f ) ) i8PrimFun f [IntValue (Int8Value x)] = Just $ f x i8PrimFun _ _ = Nothing i16PrimFun f [IntValue (Int16Value x)] = Just $ f x i16PrimFun _ _ = Nothing i32PrimFun f [IntValue (Int32Value x)] = Just $ f x i32PrimFun _ _ = Nothing i64PrimFun f [IntValue (Int64Value x)] = Just $ f x i64PrimFun _ _ = Nothing f16PrimFun f [FloatValue (Float16Value x)] = Just $ FloatValue $ Float16Value $ f x f16PrimFun _ _ = Nothing f32PrimFun f [FloatValue (Float32Value x)] = Just $ FloatValue $ Float32Value $ f x f32PrimFun _ _ = Nothing f64PrimFun f [FloatValue (Float64Value x)] = Just $ FloatValue $ Float64Value $ f x f64PrimFun _ _ = Nothing f16PrimFun3 f [ FloatValue (Float16Value a), FloatValue (Float16Value b), FloatValue (Float16Value c) ] = Just $ FloatValue $ Float16Value $ f a b c f16PrimFun3 _ _ = Nothing f32PrimFun3 f [ FloatValue (Float32Value a), FloatValue (Float32Value b), FloatValue (Float32Value c) ] = Just $ FloatValue $ Float32Value $ f a b c f32PrimFun3 _ _ = Nothing f64PrimFun3 f [ FloatValue (Float64Value a), FloatValue (Float64Value b), FloatValue (Float64Value c) ] = Just $ FloatValue $ Float64Value $ f a b c f64PrimFun3 _ _ = Nothing -- | Is the given value kind of zero?
13,024
true
true
54
14
4,948
4,495
2,296
2,199
null
null
ahmadsalim/p3-tool
p3-tool/TVL/Pretty.hs
gpl-3.0
prettyPresence PNone = empty
28
prettyPresence PNone = empty
28
prettyPresence PNone = empty
28
false
false
0
5
3
9
4
5
null
null
jaapweel/piffle
src/IrPiffle.hs
gpl-2.0
tExp env (ForIn p i@(Ident _) a c b) = do thisPosition p a <- tExp env a (n,t) <- array (ty a) (g, env) <- gensym i "count" (Atomic U32) env (h, env) <- gensym i "range" (ty a) env c <- tExp (insertVar i t env) c b <- tExp (insertVar i t env) b return (I.ForIn p Void (n, t, g, h) i a c b) {- The loop counter in a for...from...to loop is deemed to be of type u32, and does not need to be declared. XXXIs this a good idea? What about 64-bit machines?XXX Note also that the loop counter is defined within the condition clause. -}
593
tExp env (ForIn p i@(Ident _) a c b) = do thisPosition p a <- tExp env a (n,t) <- array (ty a) (g, env) <- gensym i "count" (Atomic U32) env (h, env) <- gensym i "range" (ty a) env c <- tExp (insertVar i t env) c b <- tExp (insertVar i t env) b return (I.ForIn p Void (n, t, g, h) i a c b) {- The loop counter in a for...from...to loop is deemed to be of type u32, and does not need to be declared. XXXIs this a good idea? What about 64-bit machines?XXX Note also that the loop counter is defined within the condition clause. -}
593
tExp env (ForIn p i@(Ident _) a c b) = do thisPosition p a <- tExp env a (n,t) <- array (ty a) (g, env) <- gensym i "count" (Atomic U32) env (h, env) <- gensym i "range" (ty a) env c <- tExp (insertVar i t env) c b <- tExp (insertVar i t env) b return (I.ForIn p Void (n, t, g, h) i a c b) {- The loop counter in a for...from...to loop is deemed to be of type u32, and does not need to be declared. XXXIs this a good idea? What about 64-bit machines?XXX Note also that the loop counter is defined within the condition clause. -}
593
false
false
0
10
177
215
104
111
null
null
CindyLinz/Haskell.js
trans/src/Desugar/Tuple.hs
mit
deTupleDeclHead (DHApp l declHead tyVarBind) = DHApp (id l) (deTupleDeclHead declHead) (deTupleTyVarBind tyVarBind)
115
deTupleDeclHead (DHApp l declHead tyVarBind) = DHApp (id l) (deTupleDeclHead declHead) (deTupleTyVarBind tyVarBind)
115
deTupleDeclHead (DHApp l declHead tyVarBind) = DHApp (id l) (deTupleDeclHead declHead) (deTupleTyVarBind tyVarBind)
115
false
false
0
7
12
45
21
24
null
null
diku-dk/futhark
src/Futhark/Test.hs
isc
getValuesBS _ _ (ScriptValues e) = fail $ "Cannot get values from FutharkScript expression: " <> prettyOneLine e
114
getValuesBS _ _ (ScriptValues e) = fail $ "Cannot get values from FutharkScript expression: " <> prettyOneLine e
114
getValuesBS _ _ (ScriptValues e) = fail $ "Cannot get values from FutharkScript expression: " <> prettyOneLine e
114
false
false
0
7
19
30
14
16
null
null
iansullivan88/stock-ticker
Main.hs
mit
main :: IO () main = do chan <- newChan forkIO (notifyClients chan) runServer "127.0.0.1" 3000 $ \pc -> do conn <- acceptRequest pc c <- dupChan chan handleConnection conn c
191
main :: IO () main = do chan <- newChan forkIO (notifyClients chan) runServer "127.0.0.1" 3000 $ \pc -> do conn <- acceptRequest pc c <- dupChan chan handleConnection conn c
191
main = do chan <- newChan forkIO (notifyClients chan) runServer "127.0.0.1" 3000 $ \pc -> do conn <- acceptRequest pc c <- dupChan chan handleConnection conn c
177
false
true
1
13
48
84
35
49
null
null
gibiansky/nvim-hs
library/Neovim/API/Parser.hs
apache-2.0
extractCustomTypes :: Object -> Either String [(String, Int64)] extractCustomTypes objAPI = extractTypeNameAndID =<< oLookup (ObjectBinary "types") objAPI
158
extractCustomTypes :: Object -> Either String [(String, Int64)] extractCustomTypes objAPI = extractTypeNameAndID =<< oLookup (ObjectBinary "types") objAPI
158
extractCustomTypes objAPI = extractTypeNameAndID =<< oLookup (ObjectBinary "types") objAPI
94
false
true
0
8
20
47
24
23
null
null
wangwangwar/cis194
src/ch3/Ch3.hs
bsd-3-clause
keepOnlyEven (Cons x xs) | even x = Cons x (keepOnlyEven xs) | otherwise = keepOnlyEven xs
94
keepOnlyEven (Cons x xs) | even x = Cons x (keepOnlyEven xs) | otherwise = keepOnlyEven xs
94
keepOnlyEven (Cons x xs) | even x = Cons x (keepOnlyEven xs) | otherwise = keepOnlyEven xs
94
false
false
1
8
20
47
21
26
null
null
mightybyte/reflex-dom-stubs
GenCode.hs
bsd-3-clause
cpp :: FilePath -> IO String cpp file = do let ins = [file] opts = defaultCpphsOptions { defines = [ -- ("WEBKIT_CHECK_VERSION(2,2,2)", "1") ("ghcjs_HOST_OS", "1") , ("USE_JAVASCRIPTFFI", "1") -- , ("USE_WEBKIT", "1") ] -- , infiles = ins -- , includes = [] } contents <- readFile file runCpphs opts "blah" $ stripCHS contents
534
cpp :: FilePath -> IO String cpp file = do let ins = [file] opts = defaultCpphsOptions { defines = [ -- ("WEBKIT_CHECK_VERSION(2,2,2)", "1") ("ghcjs_HOST_OS", "1") , ("USE_JAVASCRIPTFFI", "1") -- , ("USE_WEBKIT", "1") ] -- , infiles = ins -- , includes = [] } contents <- readFile file runCpphs opts "blah" $ stripCHS contents
534
cpp file = do let ins = [file] opts = defaultCpphsOptions { defines = [ -- ("WEBKIT_CHECK_VERSION(2,2,2)", "1") ("ghcjs_HOST_OS", "1") , ("USE_JAVASCRIPTFFI", "1") -- , ("USE_WEBKIT", "1") ] -- , infiles = ins -- , includes = [] } contents <- readFile file runCpphs opts "blah" $ stripCHS contents
505
false
true
0
14
262
97
51
46
null
null
GaloisInc/halvm-ghc
compiler/basicTypes/RdrName.hs
bsd-3-clause
pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc pprGlobalRdrEnv locals_only env = vcat [ text "GlobalRdrEnv" <+> ppWhen locals_only (ptext (sLit "(locals only)")) <+> lbrace , nest 2 (vcat [ pp (remove_locals gre_list) | gre_list <- occEnvElts env ] <+> rbrace) ] where remove_locals gres | locals_only = filter isLocalGRE gres | otherwise = gres pp [] = empty pp gres = hang (ppr occ <+> parens (text "unique" <+> ppr (getUnique occ)) <> colon) 2 (vcat (map ppr gres)) where occ = nameOccName (gre_name (head gres))
667
pprGlobalRdrEnv :: Bool -> GlobalRdrEnv -> SDoc pprGlobalRdrEnv locals_only env = vcat [ text "GlobalRdrEnv" <+> ppWhen locals_only (ptext (sLit "(locals only)")) <+> lbrace , nest 2 (vcat [ pp (remove_locals gre_list) | gre_list <- occEnvElts env ] <+> rbrace) ] where remove_locals gres | locals_only = filter isLocalGRE gres | otherwise = gres pp [] = empty pp gres = hang (ppr occ <+> parens (text "unique" <+> ppr (getUnique occ)) <> colon) 2 (vcat (map ppr gres)) where occ = nameOccName (gre_name (head gres))
667
pprGlobalRdrEnv locals_only env = vcat [ text "GlobalRdrEnv" <+> ppWhen locals_only (ptext (sLit "(locals only)")) <+> lbrace , nest 2 (vcat [ pp (remove_locals gre_list) | gre_list <- occEnvElts env ] <+> rbrace) ] where remove_locals gres | locals_only = filter isLocalGRE gres | otherwise = gres pp [] = empty pp gres = hang (ppr occ <+> parens (text "unique" <+> ppr (getUnique occ)) <> colon) 2 (vcat (map ppr gres)) where occ = nameOccName (gre_name (head gres))
619
false
true
0
14
236
227
108
119
null
null
suhailshergill/liboleg
Control/CCCxe.hs
bsd-3-clause
-- | Create the initial bubble takeSubCont :: Monad m => Prompt p m w -> CCT p m x w -> CC p m x takeSubCont p@(inj,_) body = CC $ \ki kd -> kd id (inj body)
172
takeSubCont :: Monad m => Prompt p m w -> CCT p m x w -> CC p m x takeSubCont p@(inj,_) body = CC $ \ki kd -> kd id (inj body)
141
takeSubCont p@(inj,_) body = CC $ \ki kd -> kd id (inj body)
60
true
true
0
9
53
86
43
43
null
null
hectorhon/autotrace2
app/Blc/Views.hs
bsd-3-clause
blcLabelsPage :: [Entity BlcLabel] -> Html blcLabelsPage blcLabels = layout "View controller labels" $ do h1 "Controller labels" ul $ forM_ blcLabels (\ (Entity lid blcLabel) -> li $ a ! href (viewBlcLabelLink lid) $ toHtml (blcLabelName blcLabel))
256
blcLabelsPage :: [Entity BlcLabel] -> Html blcLabelsPage blcLabels = layout "View controller labels" $ do h1 "Controller labels" ul $ forM_ blcLabels (\ (Entity lid blcLabel) -> li $ a ! href (viewBlcLabelLink lid) $ toHtml (blcLabelName blcLabel))
256
blcLabelsPage blcLabels = layout "View controller labels" $ do h1 "Controller labels" ul $ forM_ blcLabels (\ (Entity lid blcLabel) -> li $ a ! href (viewBlcLabelLink lid) $ toHtml (blcLabelName blcLabel))
213
false
true
0
16
45
95
45
50
null
null
olsner/ghc
compiler/basicTypes/Module.hs
bsd-3-clause
-- Note [UnitId to InstalledUnitId improvement] -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- Just because a UnitId is definite (has no holes) doesn't -- mean it's necessarily a InstalledUnitId; it could just be -- that over the course of renaming UnitIds on the fly -- while typechecking an indefinite library, we -- ended up with a fully instantiated unit id with no hash, -- since we haven't built it yet. This is fine. -- -- However, if there is a hashed unit id for this instantiation -- in the package database, we *better use it*, because -- that hashed unit id may be lurking in another interface, -- and chaos will ensue if we attempt to compare the two -- (the unitIdFS for a UnitId never corresponds to a Cabal-provided -- hash of a compiled instantiated library). -- -- There is one last niggle: improvement based on the package database means -- that we might end up developing on a package that is not transitively -- depended upon by the packages the user specified directly via command line -- flags. This could lead to strange and difficult to understand bugs if those -- instantiations are out of date. The solution is to only improve a -- unit id if the new unit id is part of the 'preloadClosure'; i.e., the -- closure of all the packages which were explicitly specified. -- | Retrieve the set of free holes of a 'UnitId'. unitIdFreeHoles :: UnitId -> UniqDSet ModuleName unitIdFreeHoles (IndefiniteUnitId x) = indefUnitIdFreeHoles x
1,459
unitIdFreeHoles :: UnitId -> UniqDSet ModuleName unitIdFreeHoles (IndefiniteUnitId x) = indefUnitIdFreeHoles x
110
unitIdFreeHoles (IndefiniteUnitId x) = indefUnitIdFreeHoles x
61
true
true
0
7
252
54
38
16
null
null
simonmichael/hledger
hledger-lib/Hledger/Read/CsvReader.hs
gpl-3.0
parseCassava :: Char -> FilePath -> Text -> Either String CSV parseCassava separator path content = either (Left . errorBundlePretty) (Right . parseResultToCsv) <$> CassavaMP.decodeWith (decodeOptions separator) Cassava.NoHeader path $ BL.fromStrict $ T.encodeUtf8 content
278
parseCassava :: Char -> FilePath -> Text -> Either String CSV parseCassava separator path content = either (Left . errorBundlePretty) (Right . parseResultToCsv) <$> CassavaMP.decodeWith (decodeOptions separator) Cassava.NoHeader path $ BL.fromStrict $ T.encodeUtf8 content
278
parseCassava separator path content = either (Left . errorBundlePretty) (Right . parseResultToCsv) <$> CassavaMP.decodeWith (decodeOptions separator) Cassava.NoHeader path $ BL.fromStrict $ T.encodeUtf8 content
216
false
true
0
10
39
90
44
46
null
null
siddhanathan/ghc
libraries/base/Data/List/NonEmpty.hs
bsd-3-clause
-- | 'uncons' produces the first element of the stream, and a stream of the -- remaining elements, if any. uncons :: NonEmpty a -> (a, Maybe (NonEmpty a)) uncons ~(a :| as) = (a, nonEmpty as)
191
uncons :: NonEmpty a -> (a, Maybe (NonEmpty a)) uncons ~(a :| as) = (a, nonEmpty as)
84
uncons ~(a :| as) = (a, nonEmpty as)
36
true
true
0
9
36
55
29
26
null
null