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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
quyse/flaw | flaw-al/Flaw/Audio/OpenAL.hs | mit | alCheckError1 = alCheckError | 28 | alCheckError1 = alCheckError | 28 | alCheckError1 = alCheckError | 28 | false | false | 0 | 4 | 2 | 6 | 3 | 3 | null | null |
rahulmutt/ghcvm | compiler/Eta/Prelude/PrimOp.hs | bsd-3-clause | primOpInfo FloatSinhOp = mkMonadic (fsLit "sinhFloat#") floatPrimTy | 67 | primOpInfo FloatSinhOp = mkMonadic (fsLit "sinhFloat#") floatPrimTy | 67 | primOpInfo FloatSinhOp = mkMonadic (fsLit "sinhFloat#") floatPrimTy | 67 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
gcampax/ghc | compiler/hsSyn/HsTypes.hs | bsd-3-clause | -- We are not printing kind applications. If we wanted to do so, we should do
-- something like this:
{-
= go ctxt_prec kis ty
where
go ctxt_prec [] ty = ppr_mono_ty ctxt_prec ty
go ctxt_prec (ki:kis) ty
= maybeParen ctxt_prec TyConPrec $
hsep [ go FunPrec kis ty
, ptext (sLit "@") <> pprParendKind ki ]
-}
ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2)
= maybeParen ctxt_prec TyOpPrec $
ppr_mono_lty TyOpPrec ty1 <+> char '~' <+> ppr_mono_lty TyOpPrec ty2 | 495 | ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2)
= maybeParen ctxt_prec TyOpPrec $
ppr_mono_lty TyOpPrec ty1 <+> char '~' <+> ppr_mono_lty TyOpPrec ty2 | 147 | ppr_mono_ty ctxt_prec (HsEqTy ty1 ty2)
= maybeParen ctxt_prec TyOpPrec $
ppr_mono_lty TyOpPrec ty1 <+> char '~' <+> ppr_mono_lty TyOpPrec ty2 | 147 | true | false | 0 | 7 | 124 | 55 | 25 | 30 | null | null |
RefactoringTools/HaRe | test/testdata/AddOneParameter/A2.expected.hs | bsd-3-clause | sumSq xs = sum (map (sq sq_f) xs) + sumSquares xs + sumSquares1 xs | 66 | sumSq xs = sum (map (sq sq_f) xs) + sumSquares xs + sumSquares1 xs | 66 | sumSq xs = sum (map (sq sq_f) xs) + sumSquares xs + sumSquares1 xs | 66 | false | false | 0 | 11 | 13 | 40 | 18 | 22 | null | null |
mgiles/fit | src/Fit/Messages.hs | bsd-3-clause | toMessage (FF.DataM _ gmt fields) = Just $ Message gmt (foldr go Map.empty fields)
where go f@(FF.SingletonField num _) fieldMap = Map.insert num (toField f) fieldMap
go f@(FF.ArrayField num _) fieldMap = Map.insert num (toField f) fieldMap | 250 | toMessage (FF.DataM _ gmt fields) = Just $ Message gmt (foldr go Map.empty fields)
where go f@(FF.SingletonField num _) fieldMap = Map.insert num (toField f) fieldMap
go f@(FF.ArrayField num _) fieldMap = Map.insert num (toField f) fieldMap | 250 | toMessage (FF.DataM _ gmt fields) = Just $ Message gmt (foldr go Map.empty fields)
where go f@(FF.SingletonField num _) fieldMap = Map.insert num (toField f) fieldMap
go f@(FF.ArrayField num _) fieldMap = Map.insert num (toField f) fieldMap | 250 | false | false | 2 | 9 | 46 | 130 | 59 | 71 | null | null |
jaiyalas/creepy-waffle | src/CreepyWaffle/EventHandle.hs | mit | perform :: (String -> IO ()) -> SDL.Keycode -> IO ()
perform sW SDL.KeycodeUp = sW "Up" | 92 | perform :: (String -> IO ()) -> SDL.Keycode -> IO ()
perform sW SDL.KeycodeUp = sW "Up" | 92 | perform sW SDL.KeycodeUp = sW "Up" | 39 | false | true | 0 | 9 | 21 | 48 | 23 | 25 | null | null |
raichoo/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | bi = fileFC "builtin" | 21 | bi = fileFC "builtin" | 21 | bi = fileFC "builtin" | 21 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Ericson2314/clash-prelude | src/CLaSH/Signal/Delayed.hs | bsd-2-clause | dfromList :: [a] -> DSignal 0 a
dfromList = coerce . fromList | 61 | dfromList :: [a] -> DSignal 0 a
dfromList = coerce . fromList | 61 | dfromList = coerce . fromList | 29 | false | true | 0 | 6 | 11 | 27 | 14 | 13 | null | null |
GaloisInc/halvm-ghc | compiler/nativeGen/PPC/Ppr.hs | bsd-3-clause | pprImm (LO (ImmInteger i)) = pprImm (ImmInteger (toInteger lo16))
where
lo16 = fromInteger (i .&. 0xffff) :: Int16 | 120 | pprImm (LO (ImmInteger i)) = pprImm (ImmInteger (toInteger lo16))
where
lo16 = fromInteger (i .&. 0xffff) :: Int16 | 120 | pprImm (LO (ImmInteger i)) = pprImm (ImmInteger (toInteger lo16))
where
lo16 = fromInteger (i .&. 0xffff) :: Int16 | 120 | false | false | 0 | 9 | 23 | 61 | 29 | 32 | null | null |
headprogrammingczar/cabal | Cabal/Distribution/Simple/Setup.hs | bsd-3-clause | testCommand :: CommandUI TestFlags
testCommand = CommandUI
{ commandName = "test"
, commandSynopsis =
"Run all/specific tests in the test suite."
, commandDescription = Just $ \pname -> wrapText $
"If necessary (re)configures with `--enable-tests` flag and builds"
++ " the test suite.\n"
++ "\n"
++ "Remember that the tests' dependencies must be installed if there"
++ " are additional ones; e.g. with `" ++ pname
++ " install --only-dependencies --enable-tests`.\n"
++ "\n"
++ "By defining UserHooks in a custom Setup.hs, the package can"
++ " define actions to be executed before and after running tests.\n"
, commandNotes = Nothing
, commandUsage = usageAlternatives "test"
[ "[FLAGS]"
, "TESTCOMPONENTS [FLAGS]"
]
, commandDefaultFlags = defaultTestFlags
, commandOptions = \showOrParseArgs ->
[ optionVerbosity testVerbosity (\v flags -> flags { testVerbosity = v })
, optionDistPref
testDistPref (\d flags -> flags { testDistPref = d })
showOrParseArgs
, option [] ["log"]
("Log all test suite results to file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $test-suite, $result)")
testHumanLog (\v flags -> flags { testHumanLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["machine-log"]
("Produce a machine-readable log file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $result)")
testMachineLog (\v flags -> flags { testMachineLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["show-details"]
("'always': always show results of individual test cases. "
++ "'never': never show results of individual test cases. "
++ "'failures': show results of failing test cases. "
++ "'streaming': show results of test cases in real time."
++ "'direct': send results of test cases in real time; no log file.")
testShowDetails (\v flags -> flags { testShowDetails = v })
(reqArg "FILTER"
(readP_to_E (\_ -> "--show-details flag expects one of "
++ intercalate ", "
(map display knownTestShowDetails))
(fmap toFlag parse))
(flagToList . fmap display))
, option [] ["keep-tix-files"]
"keep .tix files for HPC between test runs"
testKeepTix (\v flags -> flags { testKeepTix = v})
trueArg
, option [] ["test-options"]
("give extra options to test executables "
++ "(name templates can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATES" (map toPathTemplate . splitArgs)
(const []))
, option [] ["test-option"]
("give extra option to test executables "
++ "(no need to quote options containing spaces, "
++ "name template can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATE" (\x -> [toPathTemplate x])
(map fromPathTemplate))
]
} | 3,599 | testCommand :: CommandUI TestFlags
testCommand = CommandUI
{ commandName = "test"
, commandSynopsis =
"Run all/specific tests in the test suite."
, commandDescription = Just $ \pname -> wrapText $
"If necessary (re)configures with `--enable-tests` flag and builds"
++ " the test suite.\n"
++ "\n"
++ "Remember that the tests' dependencies must be installed if there"
++ " are additional ones; e.g. with `" ++ pname
++ " install --only-dependencies --enable-tests`.\n"
++ "\n"
++ "By defining UserHooks in a custom Setup.hs, the package can"
++ " define actions to be executed before and after running tests.\n"
, commandNotes = Nothing
, commandUsage = usageAlternatives "test"
[ "[FLAGS]"
, "TESTCOMPONENTS [FLAGS]"
]
, commandDefaultFlags = defaultTestFlags
, commandOptions = \showOrParseArgs ->
[ optionVerbosity testVerbosity (\v flags -> flags { testVerbosity = v })
, optionDistPref
testDistPref (\d flags -> flags { testDistPref = d })
showOrParseArgs
, option [] ["log"]
("Log all test suite results to file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $test-suite, $result)")
testHumanLog (\v flags -> flags { testHumanLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["machine-log"]
("Produce a machine-readable log file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $result)")
testMachineLog (\v flags -> flags { testMachineLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["show-details"]
("'always': always show results of individual test cases. "
++ "'never': never show results of individual test cases. "
++ "'failures': show results of failing test cases. "
++ "'streaming': show results of test cases in real time."
++ "'direct': send results of test cases in real time; no log file.")
testShowDetails (\v flags -> flags { testShowDetails = v })
(reqArg "FILTER"
(readP_to_E (\_ -> "--show-details flag expects one of "
++ intercalate ", "
(map display knownTestShowDetails))
(fmap toFlag parse))
(flagToList . fmap display))
, option [] ["keep-tix-files"]
"keep .tix files for HPC between test runs"
testKeepTix (\v flags -> flags { testKeepTix = v})
trueArg
, option [] ["test-options"]
("give extra options to test executables "
++ "(name templates can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATES" (map toPathTemplate . splitArgs)
(const []))
, option [] ["test-option"]
("give extra option to test executables "
++ "(no need to quote options containing spaces, "
++ "name template can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATE" (\x -> [toPathTemplate x])
(map fromPathTemplate))
]
} | 3,599 | testCommand = CommandUI
{ commandName = "test"
, commandSynopsis =
"Run all/specific tests in the test suite."
, commandDescription = Just $ \pname -> wrapText $
"If necessary (re)configures with `--enable-tests` flag and builds"
++ " the test suite.\n"
++ "\n"
++ "Remember that the tests' dependencies must be installed if there"
++ " are additional ones; e.g. with `" ++ pname
++ " install --only-dependencies --enable-tests`.\n"
++ "\n"
++ "By defining UserHooks in a custom Setup.hs, the package can"
++ " define actions to be executed before and after running tests.\n"
, commandNotes = Nothing
, commandUsage = usageAlternatives "test"
[ "[FLAGS]"
, "TESTCOMPONENTS [FLAGS]"
]
, commandDefaultFlags = defaultTestFlags
, commandOptions = \showOrParseArgs ->
[ optionVerbosity testVerbosity (\v flags -> flags { testVerbosity = v })
, optionDistPref
testDistPref (\d flags -> flags { testDistPref = d })
showOrParseArgs
, option [] ["log"]
("Log all test suite results to file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $test-suite, $result)")
testHumanLog (\v flags -> flags { testHumanLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["machine-log"]
("Produce a machine-readable log file (name template can use "
++ "$pkgid, $compiler, $os, $arch, $result)")
testMachineLog (\v flags -> flags { testMachineLog = v })
(reqArg' "TEMPLATE"
(toFlag . toPathTemplate)
(flagToList . fmap fromPathTemplate))
, option [] ["show-details"]
("'always': always show results of individual test cases. "
++ "'never': never show results of individual test cases. "
++ "'failures': show results of failing test cases. "
++ "'streaming': show results of test cases in real time."
++ "'direct': send results of test cases in real time; no log file.")
testShowDetails (\v flags -> flags { testShowDetails = v })
(reqArg "FILTER"
(readP_to_E (\_ -> "--show-details flag expects one of "
++ intercalate ", "
(map display knownTestShowDetails))
(fmap toFlag parse))
(flagToList . fmap display))
, option [] ["keep-tix-files"]
"keep .tix files for HPC between test runs"
testKeepTix (\v flags -> flags { testKeepTix = v})
trueArg
, option [] ["test-options"]
("give extra options to test executables "
++ "(name templates can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATES" (map toPathTemplate . splitArgs)
(const []))
, option [] ["test-option"]
("give extra option to test executables "
++ "(no need to quote options containing spaces, "
++ "name template can use $pkgid, $compiler, "
++ "$os, $arch, $test-suite)")
testOptions (\v flags -> flags { testOptions = v })
(reqArg' "TEMPLATE" (\x -> [toPathTemplate x])
(map fromPathTemplate))
]
} | 3,564 | false | true | 0 | 20 | 1,210 | 647 | 355 | 292 | null | null |
spinda/liquidhaskell | src/Language/Haskell/Liquid/Spec/Resolve.hs | bsd-3-clause | withFixScope :: [Symbol] -> ResolveM a -> ResolveM a
withFixScope scope act = do
scope' <- gets rs_fixScope
modify $ \rs -> rs { rs_fixScope = foldr S.insert scope' scope }
res <- act
modify $ \rs -> rs { rs_fixScope = scope' }
return res | 248 | withFixScope :: [Symbol] -> ResolveM a -> ResolveM a
withFixScope scope act = do
scope' <- gets rs_fixScope
modify $ \rs -> rs { rs_fixScope = foldr S.insert scope' scope }
res <- act
modify $ \rs -> rs { rs_fixScope = scope' }
return res | 248 | withFixScope scope act = do
scope' <- gets rs_fixScope
modify $ \rs -> rs { rs_fixScope = foldr S.insert scope' scope }
res <- act
modify $ \rs -> rs { rs_fixScope = scope' }
return res | 195 | false | true | 0 | 13 | 55 | 110 | 52 | 58 | null | null |
rvion/lamdu | Lamdu/Data/Ops.hs | gpl-3.0 | addListItem ::
MonadA m =>
ExprIRef.ValIProperty m ->
T m (ExprIRef.ValI m, ExprIRef.ValI m)
addListItem exprP =
do
newItemI <- newHole
newListI <-
ExprIRef.writeValTree $
v $ V.BToNom $ V.Nom Builtins.listTid $
v $ V.BInject $ V.Inject Builtins.consTag $
recEx Builtins.headTag (ValTreeLeaf newItemI) $
recEx Builtins.tailTag (ValTreeLeaf (Property.value exprP))
recEmpty
Property.set exprP newListI
return (newListI, newItemI)
where
v = ValTreeNode
recEx tag val rest = v $ V.BRecExtend $ V.RecExtend tag val rest
recEmpty = v $ V.BLeaf V.LRecEmpty | 708 | addListItem ::
MonadA m =>
ExprIRef.ValIProperty m ->
T m (ExprIRef.ValI m, ExprIRef.ValI m)
addListItem exprP =
do
newItemI <- newHole
newListI <-
ExprIRef.writeValTree $
v $ V.BToNom $ V.Nom Builtins.listTid $
v $ V.BInject $ V.Inject Builtins.consTag $
recEx Builtins.headTag (ValTreeLeaf newItemI) $
recEx Builtins.tailTag (ValTreeLeaf (Property.value exprP))
recEmpty
Property.set exprP newListI
return (newListI, newItemI)
where
v = ValTreeNode
recEx tag val rest = v $ V.BRecExtend $ V.RecExtend tag val rest
recEmpty = v $ V.BLeaf V.LRecEmpty | 708 | addListItem exprP =
do
newItemI <- newHole
newListI <-
ExprIRef.writeValTree $
v $ V.BToNom $ V.Nom Builtins.listTid $
v $ V.BInject $ V.Inject Builtins.consTag $
recEx Builtins.headTag (ValTreeLeaf newItemI) $
recEx Builtins.tailTag (ValTreeLeaf (Property.value exprP))
recEmpty
Property.set exprP newListI
return (newListI, newItemI)
where
v = ValTreeNode
recEx tag val rest = v $ V.BRecExtend $ V.RecExtend tag val rest
recEmpty = v $ V.BLeaf V.LRecEmpty | 603 | false | true | 1 | 16 | 236 | 237 | 110 | 127 | null | null |
Concomitant/LambdaHack | Game/LambdaHack/Client/Key.hs | bsd-3-clause | -- | Show a key with a modifier, if any.
showKM :: KM -> Text
showKM KM{modifier=Shift, key} = "SHIFT-" <> showKey key | 118 | showKM :: KM -> Text
showKM KM{modifier=Shift, key} = "SHIFT-" <> showKey key | 77 | showKM KM{modifier=Shift, key} = "SHIFT-" <> showKey key | 56 | true | true | 0 | 8 | 22 | 38 | 20 | 18 | null | null |
DavidAlphaFox/CacheDNS | src/CacheDNS/Cache/LRU/Atomic.hs | bsd-3-clause | -- | Build a new LRU from the optional maximum size and list of
-- contents. See 'LRU.fromList' for the semantics.
fromList :: Ord key => Maybe Integer -- ^ the optional maximum size
-> [(key, val)] -> IO (AtomicLRU key val)
fromList s l = fmap C . MV.newMVar $ LRU.fromList s l | 290 | fromList :: Ord key => Maybe Integer -- ^ the optional maximum size
-> [(key, val)] -> IO (AtomicLRU key val)
fromList s l = fmap C . MV.newMVar $ LRU.fromList s l | 175 | fromList s l = fmap C . MV.newMVar $ LRU.fromList s l | 53 | true | true | 3 | 11 | 65 | 85 | 40 | 45 | null | null |
hjwylde/qux-haskell | src/Language/Qux/Llvm/Generator.hs | bsd-3-clause | boolType :: Type
boolType = i1 | 30 | boolType :: Type
boolType = i1 | 30 | boolType = i1 | 13 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
synsem/texhs | src/Text/TeX/Lexer/TokenParser/Core.hs | gpl-3.0 | -- | See 'P.optionMaybe' from "Text.Parsec".
optionMaybe :: Monad m => LexerT m a -> LexerT m (Maybe a)
optionMaybe = liftP P.optionMaybe | 137 | optionMaybe :: Monad m => LexerT m a -> LexerT m (Maybe a)
optionMaybe = liftP P.optionMaybe | 92 | optionMaybe = liftP P.optionMaybe | 33 | true | true | 0 | 9 | 22 | 44 | 21 | 23 | null | null |
pgj/bead | src/Bead/Persistence/NoSQLDirFile.hs | bsd-3-clause | testScriptDir = "test-script" | 29 | testScriptDir = "test-script" | 29 | testScriptDir = "test-script" | 29 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
dmcclean/ais | src/Network/AIS.hs | bsd-3-clause | getRemainingSixBitText :: BitGet Text
getRemainingSixBitText = do
bits <- remaining
getSixBitText $ bits `div` 6 | 166 | getRemainingSixBitText :: BitGet Text
getRemainingSixBitText = do
bits <- remaining
getSixBitText $ bits `div` 6 | 166 | getRemainingSixBitText = do
bits <- remaining
getSixBitText $ bits `div` 6 | 128 | false | true | 0 | 8 | 68 | 40 | 18 | 22 | null | null |
mcschroeder/ghc | compiler/hsSyn/HsUtils.hs | bsd-3-clause | lhsBindsImplicits :: LHsBindsLR Name idR -> NameSet
lhsBindsImplicits = foldBag unionNameSet (lhs_bind . unLoc) emptyNameSet
where
lhs_bind (PatBind { pat_lhs = lpat }) = lPatImplicits lpat
lhs_bind _ = emptyNameSet | 225 | lhsBindsImplicits :: LHsBindsLR Name idR -> NameSet
lhsBindsImplicits = foldBag unionNameSet (lhs_bind . unLoc) emptyNameSet
where
lhs_bind (PatBind { pat_lhs = lpat }) = lPatImplicits lpat
lhs_bind _ = emptyNameSet | 225 | lhsBindsImplicits = foldBag unionNameSet (lhs_bind . unLoc) emptyNameSet
where
lhs_bind (PatBind { pat_lhs = lpat }) = lPatImplicits lpat
lhs_bind _ = emptyNameSet | 173 | false | true | 0 | 9 | 39 | 68 | 34 | 34 | null | null |
maruks/haskell-book | src/Chapter12_maybe.hs | gpl-3.0 | listToMaybe _ = Nothing | 23 | listToMaybe _ = Nothing | 23 | listToMaybe _ = Nothing | 23 | false | false | 0 | 5 | 3 | 9 | 4 | 5 | null | null |
Wollw/TicTacToe-HS | src/Main.hs | isc | putGameStateF :: (F.Foldable t, MonadState FreeGameState m) => Bool -> t GameState -> m ()
putGameStateF mouse = F.mapM_ (\gs -> put $ FreeGameState gs mouse) | 158 | putGameStateF :: (F.Foldable t, MonadState FreeGameState m) => Bool -> t GameState -> m ()
putGameStateF mouse = F.mapM_ (\gs -> put $ FreeGameState gs mouse) | 158 | putGameStateF mouse = F.mapM_ (\gs -> put $ FreeGameState gs mouse) | 67 | false | true | 0 | 9 | 25 | 71 | 35 | 36 | null | null |
zaxtax/hakaru | haskell/Examples/Slam.hs | bsd-3-clause | laserReadings :: FilePath -> IO [Laser]
laserReadings inpath = do
let input = inpath </> "input_laser.csv"
doesFileExist input >>= flip unless (noFileBye input)
decodeFileStream input | 213 | laserReadings :: FilePath -> IO [Laser]
laserReadings inpath = do
let input = inpath </> "input_laser.csv"
doesFileExist input >>= flip unless (noFileBye input)
decodeFileStream input | 213 | laserReadings inpath = do
let input = inpath </> "input_laser.csv"
doesFileExist input >>= flip unless (noFileBye input)
decodeFileStream input | 173 | false | true | 0 | 10 | 54 | 64 | 29 | 35 | null | null |
mcschroeder/ghc | compiler/basicTypes/Id.hs | bsd-3-clause | setOneShotLambda :: Id -> Id
setOneShotLambda id = modifyIdInfo (`setOneShotInfo` OneShotLam) id | 96 | setOneShotLambda :: Id -> Id
setOneShotLambda id = modifyIdInfo (`setOneShotInfo` OneShotLam) id | 96 | setOneShotLambda id = modifyIdInfo (`setOneShotInfo` OneShotLam) id | 67 | false | true | 0 | 7 | 11 | 34 | 17 | 17 | null | null |
eklavya/Idris-dev | src/Idris/Core/ProofState.hs | bsd-3-clause | dropSwaps (p@(x, P _ y _) : xs) | solvedIn y x xs = dropSwaps xs
where solvedIn _ _ [] = False
solvedIn y x ((y', P _ x' _) : xs) | y == y' && x == x' = True
solvedIn y x (_ : xs) = solvedIn y x xs | 215 | dropSwaps (p@(x, P _ y _) : xs) | solvedIn y x xs = dropSwaps xs
where solvedIn _ _ [] = False
solvedIn y x ((y', P _ x' _) : xs) | y == y' && x == x' = True
solvedIn y x (_ : xs) = solvedIn y x xs | 215 | dropSwaps (p@(x, P _ y _) : xs) | solvedIn y x xs = dropSwaps xs
where solvedIn _ _ [] = False
solvedIn y x ((y', P _ x' _) : xs) | y == y' && x == x' = True
solvedIn y x (_ : xs) = solvedIn y x xs | 215 | false | false | 1 | 10 | 71 | 144 | 68 | 76 | null | null |
rcook/pansite | spec/PansiteSpec/Config/UtilSpec.hs | mit | genRoutePath :: Gen String
genRoutePath = intercalate "/" <$> listOf (listOf $ elements ['a'..'z']) | 99 | genRoutePath :: Gen String
genRoutePath = intercalate "/" <$> listOf (listOf $ elements ['a'..'z']) | 99 | genRoutePath = intercalate "/" <$> listOf (listOf $ elements ['a'..'z']) | 72 | false | true | 0 | 10 | 13 | 39 | 19 | 20 | null | null |
rueshyna/gogol | gogol-logging/gen/Network/Google/Resource/Logging/Projects/Metrics/List.hs | mpl-2.0 | -- | JSONP
pmlCallback :: Lens' ProjectsMetricsList (Maybe Text)
pmlCallback
= lens _pmlCallback (\ s a -> s{_pmlCallback = a}) | 129 | pmlCallback :: Lens' ProjectsMetricsList (Maybe Text)
pmlCallback
= lens _pmlCallback (\ s a -> s{_pmlCallback = a}) | 118 | pmlCallback
= lens _pmlCallback (\ s a -> s{_pmlCallback = a}) | 64 | true | true | 0 | 9 | 21 | 48 | 25 | 23 | null | null |
alephcloud/bayhac2014 | contrib/Setup.hs | mit | extraSources :: LocalBuildInfo -> [FilePath]
extraSources = extraSrcFiles . localPkgDescr | 89 | extraSources :: LocalBuildInfo -> [FilePath]
extraSources = extraSrcFiles . localPkgDescr | 89 | extraSources = extraSrcFiles . localPkgDescr | 44 | false | true | 0 | 6 | 9 | 22 | 12 | 10 | null | null |
ublubu/shapes | shapes-math/src/Shapes/Linear/Template.hs | mit | simpleClause :: [PatQ] -> ExpQ -> ClauseQ
simpleClause ps e = clause ps (normalB e) [] | 86 | simpleClause :: [PatQ] -> ExpQ -> ClauseQ
simpleClause ps e = clause ps (normalB e) [] | 86 | simpleClause ps e = clause ps (normalB e) [] | 44 | false | true | 0 | 7 | 15 | 42 | 21 | 21 | null | null |
eigengrau/haskell-unicode-symbols | src/Prelude/Unicode/SR.hs | gpl-3.0 | -- Fancy fractions.
(⁄) ∷ Fractional α ⇒ α → α → α
(⁄) = (/) | 60 | (⁄) ∷ Fractional α ⇒ α → α → α
(⁄) = (/) | 40 | (⁄) = (/) | 9 | true | true | 0 | 9 | 15 | 40 | 21 | 19 | null | null |
brendanhay/gogol | gogol-genomics/gen/Network/Google/Genomics/Types/Product.hs | mpl-2.0 | -- | An Empty object.
oResponse :: Lens' Operation (Maybe OperationResponse)
oResponse
= lens _oResponse (\ s a -> s{_oResponse = a}) | 135 | oResponse :: Lens' Operation (Maybe OperationResponse)
oResponse
= lens _oResponse (\ s a -> s{_oResponse = a}) | 113 | oResponse
= lens _oResponse (\ s a -> s{_oResponse = a}) | 58 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
cchalmers/geometry | src/Geometry/Transform.hs | bsd-3-clause | listRep :: Foldable v => v n -> [n]
listRep = F.toList | 54 | listRep :: Foldable v => v n -> [n]
listRep = F.toList | 54 | listRep = F.toList | 18 | false | true | 0 | 9 | 11 | 37 | 16 | 21 | null | null |
peter-fogg/pardoc | tests/Tests/Readers/LaTeX.hs | gpl-2.0 | latex :: String -> Pandoc
latex = readLaTeX def | 47 | latex :: String -> Pandoc
latex = readLaTeX def | 47 | latex = readLaTeX def | 21 | false | true | 0 | 7 | 8 | 25 | 10 | 15 | null | null |
icyfork/shellcheck | ShellCheck/Analytics.hs | gpl-3.0 | prop_checkReturn1 = verifyNot checkReturn "return" | 50 | prop_checkReturn1 = verifyNot checkReturn "return" | 50 | prop_checkReturn1 = verifyNot checkReturn "return" | 50 | false | false | 1 | 5 | 4 | 15 | 5 | 10 | null | null |
schell/varying | src/Control/Varying/Core.hs | mit | accumulate :: Monad m => (c -> b -> c) -> c -> VarT m b c
accumulate f b = VarT $ \a -> do
let b' = f b a
return (b', accumulate f b')
-- | Delays the given var by one sample using the argument as the first
-- sample.
--
-- >>> testVarOver (delay 0 id) [1,2,3]
-- 0
-- 1
-- 2
--
-- This enables the programmer to create vars that depend on
-- themselves for values. For example:
--
-- >>> let v = delay 0 v + 1 in testVarOver v [1,1,1]
-- 1
-- 2
-- 3 | 459 | accumulate :: Monad m => (c -> b -> c) -> c -> VarT m b c
accumulate f b = VarT $ \a -> do
let b' = f b a
return (b', accumulate f b')
-- | Delays the given var by one sample using the argument as the first
-- sample.
--
-- >>> testVarOver (delay 0 id) [1,2,3]
-- 0
-- 1
-- 2
--
-- This enables the programmer to create vars that depend on
-- themselves for values. For example:
--
-- >>> let v = delay 0 v + 1 in testVarOver v [1,1,1]
-- 1
-- 2
-- 3 | 459 | accumulate f b = VarT $ \a -> do
let b' = f b a
return (b', accumulate f b')
-- | Delays the given var by one sample using the argument as the first
-- sample.
--
-- >>> testVarOver (delay 0 id) [1,2,3]
-- 0
-- 1
-- 2
--
-- This enables the programmer to create vars that depend on
-- themselves for values. For example:
--
-- >>> let v = delay 0 v + 1 in testVarOver v [1,1,1]
-- 1
-- 2
-- 3 | 401 | false | true | 0 | 12 | 115 | 104 | 58 | 46 | null | null |
glguy/advent2015 | Day21.hs | isc | chooseUpTo n (x:xs) = map (x:) (chooseUpTo (n-1) xs) ++ chooseUpTo n xs | 71 | chooseUpTo n (x:xs) = map (x:) (chooseUpTo (n-1) xs) ++ chooseUpTo n xs | 71 | chooseUpTo n (x:xs) = map (x:) (chooseUpTo (n-1) xs) ++ chooseUpTo n xs | 71 | false | false | 0 | 10 | 12 | 51 | 26 | 25 | null | null |
romanb/amazonka | amazonka-swf/gen/Network/AWS/SWF/Types.hs | mpl-2.0 | -- | Required. The unique Id of the timer.
--
-- The specified string must not start or end with whitespace. It must not
-- contain a ':' (colon), '/' (slash), '|' (vertical bar), or any control characters
-- (\u0000-\u001f | \u007f - \u009f). Also, it must not contain the literal
-- string quotarnquot.
stdaTimerId :: Lens' StartTimerDecisionAttributes Text
stdaTimerId = lens _stdaTimerId (\s a -> s { _stdaTimerId = a }) | 424 | stdaTimerId :: Lens' StartTimerDecisionAttributes Text
stdaTimerId = lens _stdaTimerId (\s a -> s { _stdaTimerId = a }) | 119 | stdaTimerId = lens _stdaTimerId (\s a -> s { _stdaTimerId = a }) | 64 | true | true | 0 | 9 | 71 | 45 | 27 | 18 | null | null |
gspindles/rftg-cards | src/Game/RftG/Cards/Base.hs | mit | earthsLostColony :: Card
earthsLostColony = Card
(World $ Production NoveltyGoods)
"EARTH'S LOST COLONY"
(Cost 2)
(VP 1)
Nothing
[]
[Consume, Produce] | 164 | earthsLostColony :: Card
earthsLostColony = Card
(World $ Production NoveltyGoods)
"EARTH'S LOST COLONY"
(Cost 2)
(VP 1)
Nothing
[]
[Consume, Produce] | 164 | earthsLostColony = Card
(World $ Production NoveltyGoods)
"EARTH'S LOST COLONY"
(Cost 2)
(VP 1)
Nothing
[]
[Consume, Produce] | 139 | false | true | 0 | 7 | 34 | 62 | 29 | 33 | null | null |
snoyberg/hackage-server | Distribution/Server/Pages/Package.hs | bsd-3-clause | --cabalLogoURL :: URL
--cabalLogoURL = "/built-with-cabal.png"
-- global URLs
cabalHomeURL :: URL
cabalHomeURL = "http://haskell.org/cabal/" | 141 | cabalHomeURL :: URL
cabalHomeURL = "http://haskell.org/cabal/" | 62 | cabalHomeURL = "http://haskell.org/cabal/" | 42 | true | true | 0 | 4 | 15 | 14 | 9 | 5 | null | null |
ezyang/ghc | testsuite/tests/simplCore/should_compile/spec001.hs | bsd-3-clause | filter :: (Char -> Bool) -> PackedString -> PackedString {-or String?-}
filter pred ps = pack $ Prelude.filter pred $ unpack ps | 127 | filter :: (Char -> Bool) -> PackedString -> PackedString
filter pred ps = pack $ Prelude.filter pred $ unpack ps | 112 | filter pred ps = pack $ Prelude.filter pred $ unpack ps | 55 | true | true | 0 | 8 | 21 | 53 | 25 | 28 | null | null |
jonathan-laurent/copilot-kind | src/Copilot/Kind/Cnub/PrettyPrint.hs | bsd-3-clause | ppSpec :: Spec -> Doc
ppSpec
( Spec
{ specStreams
, specProperties
, specObservers }) =
text "STREAMS" $$ emptyLine
$$ ppMap ppStream specStreams
$$ text "PROPERTIES"
$$ ppMap ppProperty specProperties
$$ text "OBSERVERS"
$$ ppMap ppObserver specObservers
where
ppMap f m =
indent (foldr (($$) . f) empty (Map.toList m)) | 360 | ppSpec :: Spec -> Doc
ppSpec
( Spec
{ specStreams
, specProperties
, specObservers }) =
text "STREAMS" $$ emptyLine
$$ ppMap ppStream specStreams
$$ text "PROPERTIES"
$$ ppMap ppProperty specProperties
$$ text "OBSERVERS"
$$ ppMap ppObserver specObservers
where
ppMap f m =
indent (foldr (($$) . f) empty (Map.toList m)) | 360 | ppSpec
( Spec
{ specStreams
, specProperties
, specObservers }) =
text "STREAMS" $$ emptyLine
$$ ppMap ppStream specStreams
$$ text "PROPERTIES"
$$ ppMap ppProperty specProperties
$$ text "OBSERVERS"
$$ ppMap ppObserver specObservers
where
ppMap f m =
indent (foldr (($$) . f) empty (Map.toList m)) | 338 | false | true | 10 | 10 | 90 | 130 | 61 | 69 | null | null |
brendanhay/gogol | gogol-dlp/gen/Network/Google/Resource/DLP/Organizations/Locations/JobTriggers/Patch.hs | mpl-2.0 | -- | V1 error format.
oljtpXgafv :: Lens' OrganizationsLocationsJobTriggersPatch (Maybe Xgafv)
oljtpXgafv
= lens _oljtpXgafv (\ s a -> s{_oljtpXgafv = a}) | 156 | oljtpXgafv :: Lens' OrganizationsLocationsJobTriggersPatch (Maybe Xgafv)
oljtpXgafv
= lens _oljtpXgafv (\ s a -> s{_oljtpXgafv = a}) | 134 | oljtpXgafv
= lens _oljtpXgafv (\ s a -> s{_oljtpXgafv = a}) | 61 | true | true | 0 | 9 | 23 | 48 | 25 | 23 | null | null |
holzensp/ghc | compiler/cmm/CLabel.hs | bsd-3-clause | addLabelSize label _
= label | 32 | addLabelSize label _
= label | 32 | addLabelSize label _
= label | 32 | false | false | 0 | 5 | 8 | 12 | 5 | 7 | null | null |
axhav/AFPLAB3 | executable/Preview.hs | bsd-3-clause | -- | This is the example
main :: IO ()
main = do
let hight = 500
let width = 500
-- make a sphere possition and make 2
-- others from rotated versions of the first
let spherePos1' = R.fromListUnboxed (R.ix2 1 3) [10.0,0.0,0.0]
spherePos2' <- R.mmultP spherePos1' (rotMatY (0-pi/4))
spherePos3' <- R.mmultP spherePos1' (rotMatY (pi/4))
--- take the vector part of the matrix
let spherePos1 = R.computeUnboxedS $
R.slice (R.transpose spherePos1') (R.Any R.:. (0::Int))
let spherePos2 = R.computeUnboxedS $
R.slice (R.transpose spherePos2') (R.Any R.:. (0::Int))
let spherePos3 = R.computeUnboxedS $
R.slice (R.transpose spherePos3') (R.Any R.:. (0::Int))
-- generate the objects fro the repa arrays (vectors)
let obj = ([EntO (createPlane vDown vUp (0.0,150.0,0.0) 1 0),
EntO (v2Sphere spherePos1 (t2c Blue) 2.0 0 16),
EntO (v2Sphere spherePos2 (t2c White) 2.0 0 16),
EntO (v2Sphere spherePos3 (t2c Red) 2.0 0 16),
EntL (createLight (6.0,0.0,0.0) (t2c White))])
putStrLn ("Starting trace on a " ++ show width ++ "x"
++ show hight ++ " ...")
t0 <- getCurrentTime
-- trace the image to an array
let image = trace2Array obj dummyCam (width ,hight) 2 --"test.bmp"
-- flipp the image 180
let imageFinal = R.computeUnboxedS $ rot180 image
--prin the image and it's 180 rotated counterpart
writeImageToBMP ("./revers.bmp") imageFinal
writeImageToBMP ("./normal.bmp") image
t1 <- getCurrentTime
putStrLn ("Trace is done (in "++ show (diffUTCTime t1 t0) ++
") creating image named " ++ "normal.bmp and revers.bmp")
-- | shamlessly stolen from the repa Tutorial to show that
-- you can postprosess our traced images
-- https://wiki.haskell.org/Numeric_Haskell:_A_Repa_Tutorial | 1,994 | main :: IO ()
main = do
let hight = 500
let width = 500
-- make a sphere possition and make 2
-- others from rotated versions of the first
let spherePos1' = R.fromListUnboxed (R.ix2 1 3) [10.0,0.0,0.0]
spherePos2' <- R.mmultP spherePos1' (rotMatY (0-pi/4))
spherePos3' <- R.mmultP spherePos1' (rotMatY (pi/4))
--- take the vector part of the matrix
let spherePos1 = R.computeUnboxedS $
R.slice (R.transpose spherePos1') (R.Any R.:. (0::Int))
let spherePos2 = R.computeUnboxedS $
R.slice (R.transpose spherePos2') (R.Any R.:. (0::Int))
let spherePos3 = R.computeUnboxedS $
R.slice (R.transpose spherePos3') (R.Any R.:. (0::Int))
-- generate the objects fro the repa arrays (vectors)
let obj = ([EntO (createPlane vDown vUp (0.0,150.0,0.0) 1 0),
EntO (v2Sphere spherePos1 (t2c Blue) 2.0 0 16),
EntO (v2Sphere spherePos2 (t2c White) 2.0 0 16),
EntO (v2Sphere spherePos3 (t2c Red) 2.0 0 16),
EntL (createLight (6.0,0.0,0.0) (t2c White))])
putStrLn ("Starting trace on a " ++ show width ++ "x"
++ show hight ++ " ...")
t0 <- getCurrentTime
-- trace the image to an array
let image = trace2Array obj dummyCam (width ,hight) 2 --"test.bmp"
-- flipp the image 180
let imageFinal = R.computeUnboxedS $ rot180 image
--prin the image and it's 180 rotated counterpart
writeImageToBMP ("./revers.bmp") imageFinal
writeImageToBMP ("./normal.bmp") image
t1 <- getCurrentTime
putStrLn ("Trace is done (in "++ show (diffUTCTime t1 t0) ++
") creating image named " ++ "normal.bmp and revers.bmp")
-- | shamlessly stolen from the repa Tutorial to show that
-- you can postprosess our traced images
-- https://wiki.haskell.org/Numeric_Haskell:_A_Repa_Tutorial | 1,968 | main = do
let hight = 500
let width = 500
-- make a sphere possition and make 2
-- others from rotated versions of the first
let spherePos1' = R.fromListUnboxed (R.ix2 1 3) [10.0,0.0,0.0]
spherePos2' <- R.mmultP spherePos1' (rotMatY (0-pi/4))
spherePos3' <- R.mmultP spherePos1' (rotMatY (pi/4))
--- take the vector part of the matrix
let spherePos1 = R.computeUnboxedS $
R.slice (R.transpose spherePos1') (R.Any R.:. (0::Int))
let spherePos2 = R.computeUnboxedS $
R.slice (R.transpose spherePos2') (R.Any R.:. (0::Int))
let spherePos3 = R.computeUnboxedS $
R.slice (R.transpose spherePos3') (R.Any R.:. (0::Int))
-- generate the objects fro the repa arrays (vectors)
let obj = ([EntO (createPlane vDown vUp (0.0,150.0,0.0) 1 0),
EntO (v2Sphere spherePos1 (t2c Blue) 2.0 0 16),
EntO (v2Sphere spherePos2 (t2c White) 2.0 0 16),
EntO (v2Sphere spherePos3 (t2c Red) 2.0 0 16),
EntL (createLight (6.0,0.0,0.0) (t2c White))])
putStrLn ("Starting trace on a " ++ show width ++ "x"
++ show hight ++ " ...")
t0 <- getCurrentTime
-- trace the image to an array
let image = trace2Array obj dummyCam (width ,hight) 2 --"test.bmp"
-- flipp the image 180
let imageFinal = R.computeUnboxedS $ rot180 image
--prin the image and it's 180 rotated counterpart
writeImageToBMP ("./revers.bmp") imageFinal
writeImageToBMP ("./normal.bmp") image
t1 <- getCurrentTime
putStrLn ("Trace is done (in "++ show (diffUTCTime t1 t0) ++
") creating image named " ++ "normal.bmp and revers.bmp")
-- | shamlessly stolen from the repa Tutorial to show that
-- you can postprosess our traced images
-- https://wiki.haskell.org/Numeric_Haskell:_A_Repa_Tutorial | 1,954 | true | true | 0 | 17 | 581 | 575 | 289 | 286 | null | null |
gafiatulin/codewars | src/2 kyu/OddsAndEvens.hs | mit | -- | Proves odd * even = even
oddTimesEven :: Odd n -> Even m -> Even (Mult n m)
oddTimesEven OneOdd m = m | 106 | oddTimesEven :: Odd n -> Even m -> Even (Mult n m)
oddTimesEven OneOdd m = m | 76 | oddTimesEven OneOdd m = m | 25 | true | true | 0 | 9 | 24 | 42 | 20 | 22 | null | null |
bjornbm/astro | src/Astro/Orbit/Conversion.hs | bsd-3-clause | -- | Convert state vector into Classical Orbital Elements. The
-- algorithm employed provides sound results for orbits with
-- inclination and/or eccentricity of zero.
-- i = 0 -> RAAN = one of [-pi,-0,0,pi]
-- i = pi -> RAAN = pi
-- e = 0 -> AoP = 0
sv2coe :: RealFloat a => GravitationalParameter a -> SV a -> COE True a
sv2coe mu pv = COE
{ mu = mu
, slr = p
, ecc = norm e'
, inc = inc
, aop = aop
, raan = raan
, anomaly = Anom trueAnomaly
}
where
r = pos pv
v = vel pv
-- Angular momentum
h' = r `crossProduct` v -- Angular momentum vector.
h = norm h'
(h_x, h_y, h_z) = toTuple h'
-- Semi-latus rectum
p = h ^ pos2 / mu
-- Inclination and ascending node.
inc = acos (h_z / h)
raan = atan2 (h_x) (negate h_y) -- pi for inc == 0.
n' = cos raan <: sin raan <:. (0 *~one) -- Unit vector pointing towards AN.
m' = h' `crossProduct` n' -- Vector 90° ahead of n' (AN) in orbit plane.
-- Eccentricity and perigee.
e' = v `crossProduct` h' >/ mu >-< normalize r -- See e.g. Wikipedia.
aop = atan2 (e' >.< normalize m') (e' >.< n') -- 0 for e' == 0'.
-- Argument of latitude (angle from AN to r).
u = atan2 (r >.< normalize m') (r >.< n')
-- True anomaly.
trueAnomaly = u - aop
-- | Convert a COE into a MEOE. Note that in general the
-- longitude of the result will not be in the range [-pi,pi).
-- This converision is valid for true, eccentric, and mean
-- longitude/anomaly. | 1,514 | sv2coe :: RealFloat a => GravitationalParameter a -> SV a -> COE True a
sv2coe mu pv = COE
{ mu = mu
, slr = p
, ecc = norm e'
, inc = inc
, aop = aop
, raan = raan
, anomaly = Anom trueAnomaly
}
where
r = pos pv
v = vel pv
-- Angular momentum
h' = r `crossProduct` v -- Angular momentum vector.
h = norm h'
(h_x, h_y, h_z) = toTuple h'
-- Semi-latus rectum
p = h ^ pos2 / mu
-- Inclination and ascending node.
inc = acos (h_z / h)
raan = atan2 (h_x) (negate h_y) -- pi for inc == 0.
n' = cos raan <: sin raan <:. (0 *~one) -- Unit vector pointing towards AN.
m' = h' `crossProduct` n' -- Vector 90° ahead of n' (AN) in orbit plane.
-- Eccentricity and perigee.
e' = v `crossProduct` h' >/ mu >-< normalize r -- See e.g. Wikipedia.
aop = atan2 (e' >.< normalize m') (e' >.< n') -- 0 for e' == 0'.
-- Argument of latitude (angle from AN to r).
u = atan2 (r >.< normalize m') (r >.< n')
-- True anomaly.
trueAnomaly = u - aop
-- | Convert a COE into a MEOE. Note that in general the
-- longitude of the result will not be in the range [-pi,pi).
-- This converision is valid for true, eccentric, and mean
-- longitude/anomaly. | 1,248 | sv2coe mu pv = COE
{ mu = mu
, slr = p
, ecc = norm e'
, inc = inc
, aop = aop
, raan = raan
, anomaly = Anom trueAnomaly
}
where
r = pos pv
v = vel pv
-- Angular momentum
h' = r `crossProduct` v -- Angular momentum vector.
h = norm h'
(h_x, h_y, h_z) = toTuple h'
-- Semi-latus rectum
p = h ^ pos2 / mu
-- Inclination and ascending node.
inc = acos (h_z / h)
raan = atan2 (h_x) (negate h_y) -- pi for inc == 0.
n' = cos raan <: sin raan <:. (0 *~one) -- Unit vector pointing towards AN.
m' = h' `crossProduct` n' -- Vector 90° ahead of n' (AN) in orbit plane.
-- Eccentricity and perigee.
e' = v `crossProduct` h' >/ mu >-< normalize r -- See e.g. Wikipedia.
aop = atan2 (e' >.< normalize m') (e' >.< n') -- 0 for e' == 0'.
-- Argument of latitude (angle from AN to r).
u = atan2 (r >.< normalize m') (r >.< n')
-- True anomaly.
trueAnomaly = u - aop
-- | Convert a COE into a MEOE. Note that in general the
-- longitude of the result will not be in the range [-pi,pi).
-- This converision is valid for true, eccentric, and mean
-- longitude/anomaly. | 1,176 | true | true | 8 | 8 | 433 | 370 | 194 | 176 | null | null |
justinethier/husk-scheme | hs-src/Language/Scheme/Core.hs | mit | apply _ func args = do
List [func'] <- recDerefPtrs $ List [func] -- Deref any pointers
List args' <- recDerefPtrs $ List args
throwError $ BadSpecialForm "Unable to evaluate form" $ List (func' : args')
-- |Environment containing the primitive forms that are built into the Scheme
-- language. This function only includes forms that are implemented in Haskell;
-- derived forms implemented in Scheme (such as let, list, etc) are available
-- in the standard library which must be pulled into the environment using /(load)/
--
-- For the purposes of using husk as an extension language, /r5rsEnv/ will
-- probably be more useful. | 643 | apply _ func args = do
List [func'] <- recDerefPtrs $ List [func] -- Deref any pointers
List args' <- recDerefPtrs $ List args
throwError $ BadSpecialForm "Unable to evaluate form" $ List (func' : args')
-- |Environment containing the primitive forms that are built into the Scheme
-- language. This function only includes forms that are implemented in Haskell;
-- derived forms implemented in Scheme (such as let, list, etc) are available
-- in the standard library which must be pulled into the environment using /(load)/
--
-- For the purposes of using husk as an extension language, /r5rsEnv/ will
-- probably be more useful. | 643 | apply _ func args = do
List [func'] <- recDerefPtrs $ List [func] -- Deref any pointers
List args' <- recDerefPtrs $ List args
throwError $ BadSpecialForm "Unable to evaluate form" $ List (func' : args')
-- |Environment containing the primitive forms that are built into the Scheme
-- language. This function only includes forms that are implemented in Haskell;
-- derived forms implemented in Scheme (such as let, list, etc) are available
-- in the standard library which must be pulled into the environment using /(load)/
--
-- For the purposes of using husk as an extension language, /r5rsEnv/ will
-- probably be more useful. | 643 | false | false | 0 | 10 | 119 | 85 | 43 | 42 | null | null |
uuhan/Idris-dev | src/Idris/Reflection.hs | bsd-3-clause | reflectConstant (AType (ATInt (ITFixed IT16))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT16")]]] | 126 | reflectConstant (AType (ATInt (ITFixed IT16))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT16")]]] | 126 | reflectConstant (AType (ATInt (ITFixed IT16))) = reflCall "AType" [reflCall "ATInt" [reflCall "ITFixed" [Var (reflm "IT16")]]] | 126 | false | false | 0 | 13 | 14 | 60 | 29 | 31 | null | null |
YoshikuniJujo/papillon | test/testLeft.hs | bsd-3-clause | sample3 = \l -> l ++ "else" | 27 | sample3 = \l -> l ++ "else" | 27 | sample3 = \l -> l ++ "else" | 27 | false | false | 3 | 5 | 6 | 20 | 8 | 12 | null | null |
stefan-hoeck/labeled-graph | test/GraphTests.hs | bsd-3-clause | prop_fromEdges'_edges ∷ SmallEdges → Bool
prop_fromEdges'_edges (SmallEdges es) = es == edges (fromEdges' es) | 109 | prop_fromEdges'_edges ∷ SmallEdges → Bool
prop_fromEdges'_edges (SmallEdges es) = es == edges (fromEdges' es) | 109 | prop_fromEdges'_edges (SmallEdges es) = es == edges (fromEdges' es) | 67 | false | true | 0 | 8 | 13 | 41 | 19 | 22 | null | null |
Mic92/yammat | Handler/Common.hs | agpl-3.0 | handleGetParam (Just b) eub = do
f <- return $ T.filter C.isAlphaNum b
if T.length f > 0 && b /= ", "
then do
e <- runDB $ getBy $ UniqueBarcode f
if isNothing e
then do
_ <- case eub of
Left uId -> do
-- should usernames containing, among other, spaces cause problems, replace b for f here
runDB $ insert_ $ Barcode b True (Just uId) Nothing
Right bId -> do
-- and here
runDB $ insert_ $ Barcode b False Nothing (Just bId)
setMessageI MsgBarcodeAdded
else
setMessageI MsgBarcodeDuplicate
else
setMessageI MsgProvideBarcode | 679 | handleGetParam (Just b) eub = do
f <- return $ T.filter C.isAlphaNum b
if T.length f > 0 && b /= ", "
then do
e <- runDB $ getBy $ UniqueBarcode f
if isNothing e
then do
_ <- case eub of
Left uId -> do
-- should usernames containing, among other, spaces cause problems, replace b for f here
runDB $ insert_ $ Barcode b True (Just uId) Nothing
Right bId -> do
-- and here
runDB $ insert_ $ Barcode b False Nothing (Just bId)
setMessageI MsgBarcodeAdded
else
setMessageI MsgBarcodeDuplicate
else
setMessageI MsgProvideBarcode | 679 | handleGetParam (Just b) eub = do
f <- return $ T.filter C.isAlphaNum b
if T.length f > 0 && b /= ", "
then do
e <- runDB $ getBy $ UniqueBarcode f
if isNothing e
then do
_ <- case eub of
Left uId -> do
-- should usernames containing, among other, spaces cause problems, replace b for f here
runDB $ insert_ $ Barcode b True (Just uId) Nothing
Right bId -> do
-- and here
runDB $ insert_ $ Barcode b False Nothing (Just bId)
setMessageI MsgBarcodeAdded
else
setMessageI MsgBarcodeDuplicate
else
setMessageI MsgProvideBarcode | 679 | false | false | 0 | 22 | 251 | 192 | 89 | 103 | null | null |
energyflowanalysis/efa-2.1 | src/EFA/Reference/Base.hs | bsd-3-clause | showMissing :: Ref (Map.Map String Data) -> Map.Map String Data -> String
showMissing (Ref rv) v =
"Missing Elemets: \n" ++ (List.intercalate "\n" $ map show $ Map.toList $ Map.difference rv v) | 196 | showMissing :: Ref (Map.Map String Data) -> Map.Map String Data -> String
showMissing (Ref rv) v =
"Missing Elemets: \n" ++ (List.intercalate "\n" $ map show $ Map.toList $ Map.difference rv v) | 196 | showMissing (Ref rv) v =
"Missing Elemets: \n" ++ (List.intercalate "\n" $ map show $ Map.toList $ Map.difference rv v) | 122 | false | true | 0 | 11 | 34 | 86 | 41 | 45 | null | null |
nyaxt/dmix | nkmd/as/Mnemonic.hs | mit | memrtBits MT = (b1 `shiftL` 28) .|. (b1 `shiftL` 1) | 51 | memrtBits MT = (b1 `shiftL` 28) .|. (b1 `shiftL` 1) | 51 | memrtBits MT = (b1 `shiftL` 28) .|. (b1 `shiftL` 1) | 51 | false | false | 2 | 7 | 9 | 37 | 19 | 18 | null | null |
GaloisInc/sk-dev-platform | libs/lviz/LViz.hs | bsd-3-clause | toVNode :: Domain.PortType PortTypeValue -> VNode
toVNode t = VNode {side = sd}
where
pt = PortType t
sd = case positionPortType pt of
Nothing -> case directionPortType pt of
Just InputDirection -> West
Just OutputDirection -> East
_ -> South
Just SubjectPosition -> East
Just ObjectPosition -> West | 415 | toVNode :: Domain.PortType PortTypeValue -> VNode
toVNode t = VNode {side = sd}
where
pt = PortType t
sd = case positionPortType pt of
Nothing -> case directionPortType pt of
Just InputDirection -> West
Just OutputDirection -> East
_ -> South
Just SubjectPosition -> East
Just ObjectPosition -> West | 415 | toVNode t = VNode {side = sd}
where
pt = PortType t
sd = case positionPortType pt of
Nothing -> case directionPortType pt of
Just InputDirection -> West
Just OutputDirection -> East
_ -> South
Just SubjectPosition -> East
Just ObjectPosition -> West | 365 | false | true | 1 | 12 | 164 | 111 | 52 | 59 | null | null |
projectorhq/haskell-liquid | test/Text/Liquid/ParserTests.hs | bsd-3-clause | case_output2 = parseOnly output "{{\'a\' | toUpper|toLower}}" @?=
Right (Output (Filter (QuoteString "a") [FilterCell "toUpper" [], FilterCell "toLower" []])) | 160 | case_output2 = parseOnly output "{{\'a\' | toUpper|toLower}}" @?=
Right (Output (Filter (QuoteString "a") [FilterCell "toUpper" [], FilterCell "toLower" []])) | 160 | case_output2 = parseOnly output "{{\'a\' | toUpper|toLower}}" @?=
Right (Output (Filter (QuoteString "a") [FilterCell "toUpper" [], FilterCell "toLower" []])) | 160 | false | false | 1 | 11 | 20 | 62 | 28 | 34 | null | null |
input-output-hk/pos-haskell-prototype | explorer/src/Pos/Explorer/Socket/Methods.hs | mit | startSession
:: SubscriptionMode m
=> Socket -> m ()
startSession socket = do
let cc = mkClientContext $ ProdSocket socket
id = socketId socket
csClients . at id .= Just cc
logDebug $ sformat ("New session has started (#"%shown%")") id | 263 | startSession
:: SubscriptionMode m
=> Socket -> m ()
startSession socket = do
let cc = mkClientContext $ ProdSocket socket
id = socketId socket
csClients . at id .= Just cc
logDebug $ sformat ("New session has started (#"%shown%")") id | 263 | startSession socket = do
let cc = mkClientContext $ ProdSocket socket
id = socketId socket
csClients . at id .= Just cc
logDebug $ sformat ("New session has started (#"%shown%")") id | 202 | false | true | 0 | 11 | 67 | 94 | 43 | 51 | null | null |
dysinger/amazonka | amazonka-cloudwatch-logs/gen/Network/AWS/CloudWatchLogs/CreateLogGroup.hs | mpl-2.0 | clgLogGroupName :: Lens' CreateLogGroup Text
clgLogGroupName = lens _clgLogGroupName (\s a -> s { _clgLogGroupName = a }) | 121 | clgLogGroupName :: Lens' CreateLogGroup Text
clgLogGroupName = lens _clgLogGroupName (\s a -> s { _clgLogGroupName = a }) | 121 | clgLogGroupName = lens _clgLogGroupName (\s a -> s { _clgLogGroupName = a }) | 76 | false | true | 0 | 9 | 17 | 39 | 21 | 18 | null | null |
Lykos/Sara | src/lib/Sara/Parser/Parser.hs | gpl-3.0 | unaryOperator :: UnaryOperator -> Expr.Operator String () Data.Functor.Identity.Identity ParserExpression
unaryOperator operator = Expr.Prefix (operation (unarySymbol operator) (unaryOperation operator)) | 203 | unaryOperator :: UnaryOperator -> Expr.Operator String () Data.Functor.Identity.Identity ParserExpression
unaryOperator operator = Expr.Prefix (operation (unarySymbol operator) (unaryOperation operator)) | 203 | unaryOperator operator = Expr.Prefix (operation (unarySymbol operator) (unaryOperation operator)) | 97 | false | true | 0 | 9 | 17 | 60 | 30 | 30 | null | null |
danieldietrich/llrbtree | Data/Set/Splay.hs | bsd-3-clause | {-| Singleton set.
-}
singleton :: a -> Splay a
singleton x = Node Leaf x Leaf | 79 | singleton :: a -> Splay a
singleton x = Node Leaf x Leaf | 56 | singleton x = Node Leaf x Leaf | 30 | true | true | 0 | 6 | 17 | 29 | 14 | 15 | null | null |
Ericson2314/clash-prelude | src/CLaSH/Signal/Internal.hs | bsd-2-clause | -- | The above type is a generalisation for:
--
-- @
-- __mux__ :: 'CLaSH.Signal.Signal' 'Bool' -> 'CLaSH.Signal.Signal' a -> 'CLaSH.Signal.Signal' a -> 'CLaSH.Signal.Signal' a
-- @
--
-- A multiplexer. Given "@'mux' b t f@", output @t@ when @b@ is 'True', and @f@
-- when @b@ is 'False'.
mux :: Applicative f => f Bool -> f a -> f a -> f a
mux = liftA3 (\b t f -> if b then t else f) | 384 | mux :: Applicative f => f Bool -> f a -> f a -> f a
mux = liftA3 (\b t f -> if b then t else f) | 95 | mux = liftA3 (\b t f -> if b then t else f) | 43 | true | true | 0 | 10 | 78 | 79 | 41 | 38 | null | null |
ryzhyk/cocoon | cocoon/Syntax.hs | apache-2.0 | disj :: [Expr] -> Expr
disj [] = EBool nopos False | 54 | disj :: [Expr] -> Expr
disj [] = EBool nopos False | 54 | disj [] = EBool nopos False | 31 | false | true | 0 | 6 | 14 | 32 | 15 | 17 | null | null |
unisonweb/platform | parser-typechecker/src/Unison/FileParsers.hs | mit | synthesizeFile'
:: forall v
. Var v
=> [Type v]
-> TL.TypeLookup v Ann
-> UnisonFile v
-> Result (Seq (Note v Ann)) (UF.TypecheckedUnisonFile v Ann)
synthesizeFile' ambient tl uf =
synthesizeFile ambient tl mempty uf $ UF.typecheckingTerm uf | 256 | synthesizeFile'
:: forall v
. Var v
=> [Type v]
-> TL.TypeLookup v Ann
-> UnisonFile v
-> Result (Seq (Note v Ann)) (UF.TypecheckedUnisonFile v Ann)
synthesizeFile' ambient tl uf =
synthesizeFile ambient tl mempty uf $ UF.typecheckingTerm uf | 256 | synthesizeFile' ambient tl uf =
synthesizeFile ambient tl mempty uf $ UF.typecheckingTerm uf | 94 | false | true | 0 | 15 | 53 | 110 | 51 | 59 | null | null |
ryanl/haskell-raytracer | src/Image.hs | gpl-2.0 | join sep (x:xs) = x ++ sep ++ join sep xs | 41 | join sep (x:xs) = x ++ sep ++ join sep xs | 41 | join sep (x:xs) = x ++ sep ++ join sep xs | 41 | false | false | 0 | 7 | 10 | 32 | 15 | 17 | null | null |
fgaray/yesod-table | example/main.hs | mit | main :: IO ()
main = run 3000 =<< toWaiApp App | 46 | main :: IO ()
main = run 3000 =<< toWaiApp App | 46 | main = run 3000 =<< toWaiApp App | 32 | false | true | 1 | 7 | 10 | 32 | 14 | 18 | null | null |
eklavya/Idris-dev | src/Idris/AbsSyntaxTree.hs | bsd-3-clause | declared (PDSL n _) = [n] | 25 | declared (PDSL n _) = [n] | 25 | declared (PDSL n _) = [n] | 25 | false | false | 0 | 7 | 5 | 20 | 10 | 10 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/Compatibility/Tokens.hs | bsd-3-clause | gl_CURRENT_SECONDARY_COLOR :: GLenum
gl_CURRENT_SECONDARY_COLOR = 0x8459 | 72 | gl_CURRENT_SECONDARY_COLOR :: GLenum
gl_CURRENT_SECONDARY_COLOR = 0x8459 | 72 | gl_CURRENT_SECONDARY_COLOR = 0x8459 | 35 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
takano-akio/crunghc | main.hs | cc0-1.0 | -- ^ content
main :: IO ()
main = do
installSignalHandlers
config <- fromRightIO . parseConfig =<< getArgs
plan <- chooseCachePlan config
createDirectoryIfMissing True $ cpCachedir plan
E.bracket
(prepareExecutable config plan)
snd -- cleanup
(runTemp config . fst)
`E.catch` \(KilledBySignal _) -> exitFailure | 335 | main :: IO ()
main = do
installSignalHandlers
config <- fromRightIO . parseConfig =<< getArgs
plan <- chooseCachePlan config
createDirectoryIfMissing True $ cpCachedir plan
E.bracket
(prepareExecutable config plan)
snd -- cleanup
(runTemp config . fst)
`E.catch` \(KilledBySignal _) -> exitFailure | 321 | main = do
installSignalHandlers
config <- fromRightIO . parseConfig =<< getArgs
plan <- chooseCachePlan config
createDirectoryIfMissing True $ cpCachedir plan
E.bracket
(prepareExecutable config plan)
snd -- cleanup
(runTemp config . fst)
`E.catch` \(KilledBySignal _) -> exitFailure | 307 | true | true | 0 | 10 | 67 | 117 | 54 | 63 | null | null |
supki/libstackexchange | src/Network/StackExchange/API.hs | mit | -- $commentsOnQuestions
-- >>> checkLengthM $ askSE (commentsOnQuestions [394601] <> s <> k <> q)
-- True
-- | <https://api.stackexchange.com/docs/comments-on-questions>
commentsOnQuestions ∷ [Int] → Request a "commentsOnQuestions" [SE Comment]
commentsOnQuestions (T.intercalate ";" . map (toLazyText . decimal) → is) =
path ("questions/" <> is <> "/comments") <>
parse (attoparsec items ".questions/{ids}/comments: ") | 424 | commentsOnQuestions ∷ [Int] → Request a "commentsOnQuestions" [SE Comment]
commentsOnQuestions (T.intercalate ";" . map (toLazyText . decimal) → is) =
path ("questions/" <> is <> "/comments") <>
parse (attoparsec items ".questions/{ids}/comments: ") | 253 | commentsOnQuestions (T.intercalate ";" . map (toLazyText . decimal) → is) =
path ("questions/" <> is <> "/comments") <>
parse (attoparsec items ".questions/{ids}/comments: ") | 178 | true | true | 0 | 11 | 56 | 93 | 48 | 45 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/prelude/PrelNames.hs | bsd-3-clause | -- Enum module (Enum, Bounded)
enumClassName, enumFromName, enumFromToName, enumFromThenName,
enumFromThenToName, boundedClassName :: Name
enumClassName = clsQual gHC_ENUM (fsLit "Enum") enumClassKey | 218 | enumClassName, enumFromName, enumFromToName, enumFromThenName,
enumFromThenToName, boundedClassName :: Name
enumClassName = clsQual gHC_ENUM (fsLit "Enum") enumClassKey | 187 | enumClassName = clsQual gHC_ENUM (fsLit "Enum") enumClassKey | 75 | true | true | 5 | 7 | 38 | 46 | 23 | 23 | null | null |
edsko/cabal | cabal-install/Distribution/Client/Sandbox.hs | bsd-3-clause | sandboxInit :: Verbosity -> SandboxFlags -> GlobalFlags -> IO ()
sandboxInit verbosity sandboxFlags globalFlags = do
-- Warn if there's a 'cabal-dev' sandbox.
isCabalDevSandbox <- liftM2 (&&) (doesDirectoryExist "cabal-dev")
(doesFileExist $ "cabal-dev" </> "cabal.config")
when isCabalDevSandbox $
warn verbosity $
"You are apparently using a legacy (cabal-dev) sandbox. "
++ "Legacy sandboxes may interact badly with native Cabal sandboxes. "
++ "You may want to delete the 'cabal-dev' directory to prevent issues."
-- Create the sandbox directory.
let sandboxDir' = fromFlagOrDefault defaultSandboxLocation
(sandboxLocation sandboxFlags)
createDirectoryIfMissingVerbose verbosity True sandboxDir'
sandboxDir <- tryCanonicalizePath sandboxDir'
setFileHidden sandboxDir
-- Determine which compiler to use (using the value from ~/.cabal/config).
userConfig <- loadConfig verbosity (globalConfigFile globalFlags)
(comp, platform, conf) <- configCompilerAuxEx (savedConfigureFlags userConfig)
-- Create the package environment file.
pkgEnvFile <- getSandboxConfigFilePath globalFlags
createPackageEnvironmentFile verbosity sandboxDir pkgEnvFile comp platform
(_sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
let config = pkgEnvSavedConfig pkgEnv
configFlags = savedConfigureFlags config
-- Create the index file if it doesn't exist.
indexFile <- tryGetIndexFilePath config
indexFileExists <- doesFileExist indexFile
if indexFileExists
then notice verbosity $ "Using an existing sandbox located at " ++ sandboxDir
else notice verbosity $ "Creating a new sandbox at " ++ sandboxDir
Index.createEmpty verbosity indexFile
-- Create the package DB for the default compiler.
initPackageDBIfNeeded verbosity configFlags comp conf
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
-- | Entry point for the 'cabal sandbox delete' command. | 2,023 | sandboxInit :: Verbosity -> SandboxFlags -> GlobalFlags -> IO ()
sandboxInit verbosity sandboxFlags globalFlags = do
-- Warn if there's a 'cabal-dev' sandbox.
isCabalDevSandbox <- liftM2 (&&) (doesDirectoryExist "cabal-dev")
(doesFileExist $ "cabal-dev" </> "cabal.config")
when isCabalDevSandbox $
warn verbosity $
"You are apparently using a legacy (cabal-dev) sandbox. "
++ "Legacy sandboxes may interact badly with native Cabal sandboxes. "
++ "You may want to delete the 'cabal-dev' directory to prevent issues."
-- Create the sandbox directory.
let sandboxDir' = fromFlagOrDefault defaultSandboxLocation
(sandboxLocation sandboxFlags)
createDirectoryIfMissingVerbose verbosity True sandboxDir'
sandboxDir <- tryCanonicalizePath sandboxDir'
setFileHidden sandboxDir
-- Determine which compiler to use (using the value from ~/.cabal/config).
userConfig <- loadConfig verbosity (globalConfigFile globalFlags)
(comp, platform, conf) <- configCompilerAuxEx (savedConfigureFlags userConfig)
-- Create the package environment file.
pkgEnvFile <- getSandboxConfigFilePath globalFlags
createPackageEnvironmentFile verbosity sandboxDir pkgEnvFile comp platform
(_sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
let config = pkgEnvSavedConfig pkgEnv
configFlags = savedConfigureFlags config
-- Create the index file if it doesn't exist.
indexFile <- tryGetIndexFilePath config
indexFileExists <- doesFileExist indexFile
if indexFileExists
then notice verbosity $ "Using an existing sandbox located at " ++ sandboxDir
else notice verbosity $ "Creating a new sandbox at " ++ sandboxDir
Index.createEmpty verbosity indexFile
-- Create the package DB for the default compiler.
initPackageDBIfNeeded verbosity configFlags comp conf
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
-- | Entry point for the 'cabal sandbox delete' command. | 2,023 | sandboxInit verbosity sandboxFlags globalFlags = do
-- Warn if there's a 'cabal-dev' sandbox.
isCabalDevSandbox <- liftM2 (&&) (doesDirectoryExist "cabal-dev")
(doesFileExist $ "cabal-dev" </> "cabal.config")
when isCabalDevSandbox $
warn verbosity $
"You are apparently using a legacy (cabal-dev) sandbox. "
++ "Legacy sandboxes may interact badly with native Cabal sandboxes. "
++ "You may want to delete the 'cabal-dev' directory to prevent issues."
-- Create the sandbox directory.
let sandboxDir' = fromFlagOrDefault defaultSandboxLocation
(sandboxLocation sandboxFlags)
createDirectoryIfMissingVerbose verbosity True sandboxDir'
sandboxDir <- tryCanonicalizePath sandboxDir'
setFileHidden sandboxDir
-- Determine which compiler to use (using the value from ~/.cabal/config).
userConfig <- loadConfig verbosity (globalConfigFile globalFlags)
(comp, platform, conf) <- configCompilerAuxEx (savedConfigureFlags userConfig)
-- Create the package environment file.
pkgEnvFile <- getSandboxConfigFilePath globalFlags
createPackageEnvironmentFile verbosity sandboxDir pkgEnvFile comp platform
(_sandboxDir, pkgEnv) <- tryLoadSandboxConfig verbosity globalFlags
let config = pkgEnvSavedConfig pkgEnv
configFlags = savedConfigureFlags config
-- Create the index file if it doesn't exist.
indexFile <- tryGetIndexFilePath config
indexFileExists <- doesFileExist indexFile
if indexFileExists
then notice verbosity $ "Using an existing sandbox located at " ++ sandboxDir
else notice verbosity $ "Creating a new sandbox at " ++ sandboxDir
Index.createEmpty verbosity indexFile
-- Create the package DB for the default compiler.
initPackageDBIfNeeded verbosity configFlags comp conf
maybeAddCompilerTimestampRecord verbosity sandboxDir indexFile
(compilerId comp) platform
-- | Entry point for the 'cabal sandbox delete' command. | 1,957 | false | true | 0 | 12 | 363 | 346 | 162 | 184 | null | null |
ptitfred/slidecoding | src/Slidecoding/Browser.hs | gpl-3.0 | base64 :: String -> String
base64 = filter (not . isSpace) . B64.encode | 71 | base64 :: String -> String
base64 = filter (not . isSpace) . B64.encode | 71 | base64 = filter (not . isSpace) . B64.encode | 44 | false | true | 0 | 8 | 12 | 31 | 16 | 15 | null | null |
dkandalov/katas | haskell/sort/merge-sort/merge-sort.hs | unlicense | mergeSort [x] = [x] | 19 | mergeSort [x] = [x] | 19 | mergeSort [x] = [x] | 19 | false | false | 0 | 6 | 3 | 15 | 8 | 7 | null | null |
alexander-at-github/eta | compiler/ETA/Utils/Pretty.hs | bsd-3-clause | above p@(Beside _ _ _) g q = aboveNest (reduceDoc p) g (_ILIT(0)) (reduceDoc q) | 81 | above p@(Beside _ _ _) g q = aboveNest (reduceDoc p) g (_ILIT(0)) (reduceDoc q) | 81 | above p@(Beside _ _ _) g q = aboveNest (reduceDoc p) g (_ILIT(0)) (reduceDoc q) | 81 | false | false | 1 | 8 | 16 | 63 | 28 | 35 | null | null |
facebook/fbthrift | thrift/compiler/test/fixtures/includes/gen-hs/Module_Types.hs | apache-2.0 | -- | Default values for the 'MyStruct' struct
default_MyStruct :: MyStruct
default_MyStruct = MyStruct{
myStruct_MyIncludedField = Includes_Types.default_Included{Includes_Types.included_MyIntField = 2, Includes_Types.included_MyTransitiveField = Transitive_Types.default_Foo{Transitive_Types.foo_a = 2}},
myStruct_MyOtherIncludedField = Includes_Types.default_Included,
myStruct_MyIncludedInt = 42} | 405 | default_MyStruct :: MyStruct
default_MyStruct = MyStruct{
myStruct_MyIncludedField = Includes_Types.default_Included{Includes_Types.included_MyIntField = 2, Includes_Types.included_MyTransitiveField = Transitive_Types.default_Foo{Transitive_Types.foo_a = 2}},
myStruct_MyOtherIncludedField = Includes_Types.default_Included,
myStruct_MyIncludedInt = 42} | 359 | default_MyStruct = MyStruct{
myStruct_MyIncludedField = Includes_Types.default_Included{Includes_Types.included_MyIntField = 2, Includes_Types.included_MyTransitiveField = Transitive_Types.default_Foo{Transitive_Types.foo_a = 2}},
myStruct_MyOtherIncludedField = Includes_Types.default_Included,
myStruct_MyIncludedInt = 42} | 330 | true | true | 0 | 10 | 35 | 66 | 40 | 26 | null | null |
rcallahan/thermonuc | ThermoNuc/Dat.hs | bsd-3-clause | dgd_sint2 :: Ptr Double
dgd_sint2 = $(embedDoubleArray "dat/sint2.DGD") | 71 | dgd_sint2 :: Ptr Double
dgd_sint2 = $(embedDoubleArray "dat/sint2.DGD") | 71 | dgd_sint2 = $(embedDoubleArray "dat/sint2.DGD") | 47 | false | true | 0 | 8 | 7 | 27 | 11 | 16 | null | null |
alang9/deque | Data/Deque/NonCat/LessTyped.hs | bsd-3-clause | injectB (B1 a) b = B2 a b | 25 | injectB (B1 a) b = B2 a b | 25 | injectB (B1 a) b = B2 a b | 25 | false | false | 1 | 6 | 7 | 28 | 10 | 18 | null | null |
bergmark/hlint | data/Default.hs | bsd-3-clause | error = mapM id ==> sequence | 28 | error = mapM id ==> sequence | 28 | error = mapM id ==> sequence | 28 | false | false | 2 | 5 | 5 | 20 | 7 | 13 | null | null |
cryptica/slapnet | src/Parser/LOLAFormula.hs | gpl-3.0 | lexer :: Token.TokenParser ()
lexer = Token.makeTokenParser languageDef | 71 | lexer :: Token.TokenParser ()
lexer = Token.makeTokenParser languageDef | 71 | lexer = Token.makeTokenParser languageDef | 41 | false | true | 1 | 6 | 7 | 26 | 11 | 15 | null | null |
forked-upstream-packages-for-ghcjs/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | mkMinimalBySCs :: [PredType] -> [PredType]
-- Remove predicates that can be deduced from others by superclasses
mkMinimalBySCs ptys = [ ploc | ploc <- ptys
, ploc `not_in_preds` rec_scs ]
where
rec_scs = concatMap trans_super_classes ptys
not_in_preds p ps = not (any (eqPred p) ps)
trans_super_classes pred -- Superclasses of pred, excluding pred itself
= case classifyPredType pred of
ClassPred cls tys -> transSuperClasses cls tys
TuplePred ts -> concatMap trans_super_classes ts
_ -> [] | 587 | mkMinimalBySCs :: [PredType] -> [PredType]
mkMinimalBySCs ptys = [ ploc | ploc <- ptys
, ploc `not_in_preds` rec_scs ]
where
rec_scs = concatMap trans_super_classes ptys
not_in_preds p ps = not (any (eqPred p) ps)
trans_super_classes pred -- Superclasses of pred, excluding pred itself
= case classifyPredType pred of
ClassPred cls tys -> transSuperClasses cls tys
TuplePred ts -> concatMap trans_super_classes ts
_ -> [] | 518 | mkMinimalBySCs ptys = [ ploc | ploc <- ptys
, ploc `not_in_preds` rec_scs ]
where
rec_scs = concatMap trans_super_classes ptys
not_in_preds p ps = not (any (eqPred p) ps)
trans_super_classes pred -- Superclasses of pred, excluding pred itself
= case classifyPredType pred of
ClassPred cls tys -> transSuperClasses cls tys
TuplePred ts -> concatMap trans_super_classes ts
_ -> [] | 475 | true | true | 2 | 9 | 171 | 151 | 71 | 80 | null | null |
ekmett/ghc | compiler/nativeGen/PPC/CodeGen.hs | bsd-3-clause | etCondCode :: CmmExpr -> NatM CondCode
-- almost the same as everywhere else - but we need to
-- extend small integers to 32 bit first
getCondCode (CmmMachOp mop [x, y])
= case mop of
MO_F_Eq W32 -> condFltCode EQQ x y
MO_F_Ne W32 -> condFltCode NE x y
MO_F_Gt W32 -> condFltCode GTT x y
MO_F_Ge W32 -> condFltCode GE x y
MO_F_Lt W32 -> condFltCode LTT x y
MO_F_Le W32 -> condFltCode LE x y
MO_F_Eq W64 -> condFltCode EQQ x y
MO_F_Ne W64 -> condFltCode NE x y
MO_F_Gt W64 -> condFltCode GTT x y
MO_F_Ge W64 -> condFltCode GE x y
MO_F_Lt W64 -> condFltCode LTT x y
MO_F_Le W64 -> condFltCode LE x y
MO_Eq rep -> condIntCode EQQ (extendUExpr rep x) (extendUExpr rep y)
MO_Ne rep -> condIntCode NE (extendUExpr rep x) (extendUExpr rep y)
MO_S_Gt rep -> condIntCode GTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Ge rep -> condIntCode GE (extendSExpr rep x) (extendSExpr rep y)
MO_S_Lt rep -> condIntCode LTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Le rep -> condIntCode LE (extendSExpr rep x) (extendSExpr rep y)
MO_U_Gt rep -> condIntCode GU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Ge rep -> condIntCode GEU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Lt rep -> condIntCode LU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Le rep -> condIntCode LEU (extendUExpr rep x) (extendUExpr rep y)
_ -> pprPanic "getCondCode(powerpc)" (pprMachOp mop)
| 1,520 | getCondCode :: CmmExpr -> NatM CondCode
getCondCode (CmmMachOp mop [x, y])
= case mop of
MO_F_Eq W32 -> condFltCode EQQ x y
MO_F_Ne W32 -> condFltCode NE x y
MO_F_Gt W32 -> condFltCode GTT x y
MO_F_Ge W32 -> condFltCode GE x y
MO_F_Lt W32 -> condFltCode LTT x y
MO_F_Le W32 -> condFltCode LE x y
MO_F_Eq W64 -> condFltCode EQQ x y
MO_F_Ne W64 -> condFltCode NE x y
MO_F_Gt W64 -> condFltCode GTT x y
MO_F_Ge W64 -> condFltCode GE x y
MO_F_Lt W64 -> condFltCode LTT x y
MO_F_Le W64 -> condFltCode LE x y
MO_Eq rep -> condIntCode EQQ (extendUExpr rep x) (extendUExpr rep y)
MO_Ne rep -> condIntCode NE (extendUExpr rep x) (extendUExpr rep y)
MO_S_Gt rep -> condIntCode GTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Ge rep -> condIntCode GE (extendSExpr rep x) (extendSExpr rep y)
MO_S_Lt rep -> condIntCode LTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Le rep -> condIntCode LE (extendSExpr rep x) (extendSExpr rep y)
MO_U_Gt rep -> condIntCode GU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Ge rep -> condIntCode GEU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Lt rep -> condIntCode LU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Le rep -> condIntCode LEU (extendUExpr rep x) (extendUExpr rep y)
_ -> pprPanic "getCondCode(powerpc)" (pprMachOp mop) | 1,422 | getCondCode (CmmMachOp mop [x, y])
= case mop of
MO_F_Eq W32 -> condFltCode EQQ x y
MO_F_Ne W32 -> condFltCode NE x y
MO_F_Gt W32 -> condFltCode GTT x y
MO_F_Ge W32 -> condFltCode GE x y
MO_F_Lt W32 -> condFltCode LTT x y
MO_F_Le W32 -> condFltCode LE x y
MO_F_Eq W64 -> condFltCode EQQ x y
MO_F_Ne W64 -> condFltCode NE x y
MO_F_Gt W64 -> condFltCode GTT x y
MO_F_Ge W64 -> condFltCode GE x y
MO_F_Lt W64 -> condFltCode LTT x y
MO_F_Le W64 -> condFltCode LE x y
MO_Eq rep -> condIntCode EQQ (extendUExpr rep x) (extendUExpr rep y)
MO_Ne rep -> condIntCode NE (extendUExpr rep x) (extendUExpr rep y)
MO_S_Gt rep -> condIntCode GTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Ge rep -> condIntCode GE (extendSExpr rep x) (extendSExpr rep y)
MO_S_Lt rep -> condIntCode LTT (extendSExpr rep x) (extendSExpr rep y)
MO_S_Le rep -> condIntCode LE (extendSExpr rep x) (extendSExpr rep y)
MO_U_Gt rep -> condIntCode GU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Ge rep -> condIntCode GEU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Lt rep -> condIntCode LU (extendUExpr rep x) (extendUExpr rep y)
MO_U_Le rep -> condIntCode LEU (extendUExpr rep x) (extendUExpr rep y)
_ -> pprPanic "getCondCode(powerpc)" (pprMachOp mop) | 1,382 | true | true | 0 | 10 | 403 | 570 | 264 | 306 | null | null |
tobiasreinhardt/show | CLIArguments/src/Query.hs | apache-2.0 | fetchArgumentsOfOption :: Option -> [MarshalledEntity] -> [String]
fetchArgumentsOfOption _ [] = [] | 99 | fetchArgumentsOfOption :: Option -> [MarshalledEntity] -> [String]
fetchArgumentsOfOption _ [] = [] | 99 | fetchArgumentsOfOption _ [] = [] | 32 | false | true | 0 | 7 | 11 | 34 | 18 | 16 | null | null |
haslab/SecreC | src/Language/SecreC/Monad.hs | gpl-3.0 | appendPromoteOpt :: PromoteOpt -> PromoteOpt -> PromoteOpt
appendPromoteOpt x y | x == y = x | 92 | appendPromoteOpt :: PromoteOpt -> PromoteOpt -> PromoteOpt
appendPromoteOpt x y | x == y = x | 92 | appendPromoteOpt x y | x == y = x | 33 | false | true | 0 | 8 | 15 | 34 | 16 | 18 | null | null |
ezyang/ghc | compiler/coreSyn/CoreStats.hs | bsd-3-clause | tyStats :: Type -> CoreStats
tyStats ty = zeroCS { cs_ty = typeSize ty } | 72 | tyStats :: Type -> CoreStats
tyStats ty = zeroCS { cs_ty = typeSize ty } | 72 | tyStats ty = zeroCS { cs_ty = typeSize ty } | 43 | false | true | 0 | 7 | 14 | 29 | 15 | 14 | null | null |
shlevy/ghc | compiler/nativeGen/RegAlloc/Linear/State.hs | bsd-3-clause | getFreeRegsR :: RegM freeRegs freeRegs
getFreeRegsR = RegM $ \ s@RA_State{ra_freeregs = freeregs} ->
(# s, freeregs #) | 120 | getFreeRegsR :: RegM freeRegs freeRegs
getFreeRegsR = RegM $ \ s@RA_State{ra_freeregs = freeregs} ->
(# s, freeregs #) | 120 | getFreeRegsR = RegM $ \ s@RA_State{ra_freeregs = freeregs} ->
(# s, freeregs #) | 81 | false | true | 1 | 10 | 19 | 46 | 23 | 23 | null | null |
seagate-ssg/options-schema | src/Options/Schema/Builder.hs | bsd-3-clause | -- | Construct a flag for bools.
switch :: Mod Bool -> Schema Bool
switch = flag True False | 91 | switch :: Mod Bool -> Schema Bool
switch = flag True False | 58 | switch = flag True False | 24 | true | true | 0 | 7 | 18 | 34 | 14 | 20 | null | null |
themoritz/cabal | cabal-install/Distribution/Client/ProjectOrchestration.hs | bsd-3-clause | runProjectBuildPhase :: Verbosity
-> ProjectBaseContext
-> ProjectBuildContext
-> IO BuildOutcomes
runProjectBuildPhase _ ProjectBaseContext{buildSettings} _
| buildSettingDryRun buildSettings
= return Map.empty | 278 | runProjectBuildPhase :: Verbosity
-> ProjectBaseContext
-> ProjectBuildContext
-> IO BuildOutcomes
runProjectBuildPhase _ ProjectBaseContext{buildSettings} _
| buildSettingDryRun buildSettings
= return Map.empty | 278 | runProjectBuildPhase _ ProjectBaseContext{buildSettings} _
| buildSettingDryRun buildSettings
= return Map.empty | 116 | false | true | 0 | 8 | 86 | 53 | 24 | 29 | null | null |
urbit/urbit | pkg/hs/urbit-king/lib/Urbit/Vere/Serf.hs | mit | trackProgress
:: HasLogFunc e
=> Word64
-> RIO e (Int -> IO ())
trackProgress = \case
0 -> pure $ const $ pure ()
num -> do
let style = PB.defStyle { PB.stylePostfix = PB.exact }
let refresh = 10
let init = PB.Progress 0 (fromIntegral num) ()
bar <- PB.newProgressBar style refresh init
env <- ask
let incr = PB.incProgress bar
pure (runRIO env . incr)
-- Collect FX ------------------------------------------------------------------ | 475 | trackProgress
:: HasLogFunc e
=> Word64
-> RIO e (Int -> IO ())
trackProgress = \case
0 -> pure $ const $ pure ()
num -> do
let style = PB.defStyle { PB.stylePostfix = PB.exact }
let refresh = 10
let init = PB.Progress 0 (fromIntegral num) ()
bar <- PB.newProgressBar style refresh init
env <- ask
let incr = PB.incProgress bar
pure (runRIO env . incr)
-- Collect FX ------------------------------------------------------------------ | 475 | trackProgress = \case
0 -> pure $ const $ pure ()
num -> do
let style = PB.defStyle { PB.stylePostfix = PB.exact }
let refresh = 10
let init = PB.Progress 0 (fromIntegral num) ()
bar <- PB.newProgressBar style refresh init
env <- ask
let incr = PB.incProgress bar
pure (runRIO env . incr)
-- Collect FX ------------------------------------------------------------------ | 405 | false | true | 5 | 12 | 112 | 172 | 85 | 87 | null | null |
brendanhay/gogol | gen/src/Gen/Syntax.hs | mpl-2.0 | externalType :: TType -> Type ()
externalType = \case
TType r -> tycon r
TMaybe t@TList {} -> externalType t
TMaybe t -> TyApp () (TyCon () "Maybe") (externalType t)
TList t -> TyList () (externalType t)
TLit l -> externalLit l
TMap k v ->
TyApp () (TyApp () (TyCon () "HashMap") (externalType k)) (externalType (require v)) | 411 | externalType :: TType -> Type ()
externalType = \case
TType r -> tycon r
TMaybe t@TList {} -> externalType t
TMaybe t -> TyApp () (TyCon () "Maybe") (externalType t)
TList t -> TyList () (externalType t)
TLit l -> externalLit l
TMap k v ->
TyApp () (TyApp () (TyCon () "HashMap") (externalType k)) (externalType (require v)) | 411 | externalType = \case
TType r -> tycon r
TMaybe t@TList {} -> externalType t
TMaybe t -> TyApp () (TyCon () "Maybe") (externalType t)
TList t -> TyList () (externalType t)
TLit l -> externalLit l
TMap k v ->
TyApp () (TyApp () (TyCon () "HashMap") (externalType k)) (externalType (require v)) | 378 | false | true | 0 | 14 | 144 | 187 | 86 | 101 | null | null |
dalaing/type-systems | src/Ast/Term.hs | bsd-3-clause | tyVarToTmVar :: TyAstVar a -> Identity (TmAstVar a)
tyVarToTmVar (TyAstKiVar x) = fmap TmAstKiVar . pure $ x | 108 | tyVarToTmVar :: TyAstVar a -> Identity (TmAstVar a)
tyVarToTmVar (TyAstKiVar x) = fmap TmAstKiVar . pure $ x | 108 | tyVarToTmVar (TyAstKiVar x) = fmap TmAstKiVar . pure $ x | 56 | false | true | 0 | 9 | 17 | 52 | 23 | 29 | null | null |
ggreif/clash-compiler | examples/MatrixVect.hs | bsd-2-clause | row2 = 4 :> 5 :> 6 :> Nil | 25 | row2 = 4 :> 5 :> 6 :> Nil | 25 | row2 = 4 :> 5 :> 6 :> Nil | 25 | false | false | 1 | 7 | 8 | 21 | 9 | 12 | null | null |
drpowell/Prokka-web | WJR/Jobs.hs | gpl-3.0 | getStemName jobId = jobBasename jobId statusDir "" | 52 | getStemName jobId = jobBasename jobId statusDir "" | 52 | getStemName jobId = jobBasename jobId statusDir "" | 52 | false | false | 0 | 5 | 8 | 16 | 7 | 9 | null | null |
onponomarev/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | hvKvmScsiControllerType :: String
hvKvmScsiControllerType = "scsi_controller_type" | 82 | hvKvmScsiControllerType :: String
hvKvmScsiControllerType = "scsi_controller_type" | 82 | hvKvmScsiControllerType = "scsi_controller_type" | 48 | false | true | 0 | 6 | 5 | 18 | 7 | 11 | null | null |
brendanhay/gogol | gogol-servicemanagement/gen/Network/Google/Resource/ServiceManagement/Services/Rollouts/Create.hs | mpl-2.0 | -- | V1 error format.
srcXgafv :: Lens' ServicesRolloutsCreate (Maybe Xgafv)
srcXgafv = lens _srcXgafv (\ s a -> s{_srcXgafv = a}) | 130 | srcXgafv :: Lens' ServicesRolloutsCreate (Maybe Xgafv)
srcXgafv = lens _srcXgafv (\ s a -> s{_srcXgafv = a}) | 108 | srcXgafv = lens _srcXgafv (\ s a -> s{_srcXgafv = a}) | 53 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
mainland/nikola | src/Data/Vector/CUDA/UnboxedForeign.hs | bsd-3-clause | foldl' = G.foldl' | 17 | foldl' = G.foldl' | 17 | foldl' = G.foldl' | 17 | false | false | 1 | 6 | 2 | 12 | 4 | 8 | null | null |
fmthoma/ghc | compiler/typecheck/TcSplice.hs | bsd-3-clause | -- runQuasiQuoteExpr q = failTH q "quasiquote"
-- runQuasiQuotePat q = failTH q "pattern quasiquote"
-- runQuasiQuoteType q = failTH q "type quasiquote"
-- runQuasiQuoteDecl q = failTH q "declaration quasiquote"
runAnnotation _ q = failTH q "annotation" | 256 | runAnnotation _ q = failTH q "annotation" | 43 | runAnnotation _ q = failTH q "annotation" | 43 | true | false | 1 | 5 | 40 | 20 | 11 | 9 | null | null |
UCSD-PL/RefScript | src/Language/Rsc/Typecheck/Sub.hs | bsd-3-clause | -- Enumeration subtyping
--
subtypeObj l γ _ t1@(TRef (Gen x1 []) _) t2@(TRef (Gen x2 []) _)
| isEnumType (envCHA γ) t1, isEnumType (envCHA γ) t2
= if x1 == x2 then SubOK
else NoSub [errorSubtype l t1 t2] | 224 | subtypeObj l γ _ t1@(TRef (Gen x1 []) _) t2@(TRef (Gen x2 []) _)
| isEnumType (envCHA γ) t1, isEnumType (envCHA γ) t2
= if x1 == x2 then SubOK
else NoSub [errorSubtype l t1 t2] | 196 | subtypeObj l γ _ t1@(TRef (Gen x1 []) _) t2@(TRef (Gen x2 []) _)
| isEnumType (envCHA γ) t1, isEnumType (envCHA γ) t2
= if x1 == x2 then SubOK
else NoSub [errorSubtype l t1 t2] | 196 | true | false | 0 | 11 | 59 | 118 | 59 | 59 | null | null |
fmapfmapfmap/amazonka | amazonka-autoscaling/gen/Network/AWS/AutoScaling/DeletePolicy.hs | mpl-2.0 | -- | Creates a value of 'DeletePolicy' with the minimum fields required to make a request.
--
-- Use one of the following lenses to modify other fields as desired:
--
-- * 'dpAutoScalingGroupName'
--
-- * 'dpPolicyName'
deletePolicy
:: Text -- ^ 'dpPolicyName'
-> DeletePolicy
deletePolicy pPolicyName_ =
DeletePolicy'
{ _dpAutoScalingGroupName = Nothing
, _dpPolicyName = pPolicyName_
} | 411 | deletePolicy
:: Text -- ^ 'dpPolicyName'
-> DeletePolicy
deletePolicy pPolicyName_ =
DeletePolicy'
{ _dpAutoScalingGroupName = Nothing
, _dpPolicyName = pPolicyName_
} | 191 | deletePolicy pPolicyName_ =
DeletePolicy'
{ _dpAutoScalingGroupName = Nothing
, _dpPolicyName = pPolicyName_
} | 126 | true | true | 0 | 6 | 82 | 40 | 26 | 14 | null | null |
maurotrb/processmining | src/ProcessMining/Model/PetriNet.hs | bsd-3-clause | toTransitions EmptyPetriNet = [] | 36 | toTransitions EmptyPetriNet = [] | 36 | toTransitions EmptyPetriNet = [] | 36 | false | false | 0 | 5 | 7 | 12 | 5 | 7 | null | null |
nushio3/Paraiso | attic/npp/NPP.hs | bsd-3-clause | optimize :: Expr -> Expr
optimize expr = let o = optimize in case expr of
Add (Div a b) c -> Madd (o a) (Inv $ o b) (o c)
Add c (Div a b) -> Madd (o a) (Inv $ o b) (o c)
Sub (Div a b) c -> Msub (o a) (Inv $ o b) (o c)
Sub c (Div a b) -> Nmsub (o a) (Inv $ o b) (o c)
Add (Mul a b) c -> Madd (o a) (o b) (o c)
Add c (Mul a b) -> Madd (o a) (o b) (o c)
Sub (Mul a b) c -> Msub (o a) (o b) (o c)
Sub c (Mul a b) -> Nmsub (o a) (o b) (o c)
-- recursive optimization --
t@(Term _) -> t
Add a b -> Add (o a) (o b)
Mul a b -> Mul (o a) (o b)
Sub a b -> Sub (o a) (o b)
Div a b -> Div (o a) (o b)
Inv a -> Inv (o a)
Neg a -> Neg (o a)
Madd a b c -> Madd (o a) (o b) (o c)
Msub a b c -> Msub (o a) (o b) (o c)
Nmadd a b c -> Nmadd (o a) (o b) (o c)
Nmsub a b c -> Nmsub (o a) (o b) (o c) | 911 | optimize :: Expr -> Expr
optimize expr = let o = optimize in case expr of
Add (Div a b) c -> Madd (o a) (Inv $ o b) (o c)
Add c (Div a b) -> Madd (o a) (Inv $ o b) (o c)
Sub (Div a b) c -> Msub (o a) (Inv $ o b) (o c)
Sub c (Div a b) -> Nmsub (o a) (Inv $ o b) (o c)
Add (Mul a b) c -> Madd (o a) (o b) (o c)
Add c (Mul a b) -> Madd (o a) (o b) (o c)
Sub (Mul a b) c -> Msub (o a) (o b) (o c)
Sub c (Mul a b) -> Nmsub (o a) (o b) (o c)
-- recursive optimization --
t@(Term _) -> t
Add a b -> Add (o a) (o b)
Mul a b -> Mul (o a) (o b)
Sub a b -> Sub (o a) (o b)
Div a b -> Div (o a) (o b)
Inv a -> Inv (o a)
Neg a -> Neg (o a)
Madd a b c -> Madd (o a) (o b) (o c)
Msub a b c -> Msub (o a) (o b) (o c)
Nmadd a b c -> Nmadd (o a) (o b) (o c)
Nmsub a b c -> Nmsub (o a) (o b) (o c) | 911 | optimize expr = let o = optimize in case expr of
Add (Div a b) c -> Madd (o a) (Inv $ o b) (o c)
Add c (Div a b) -> Madd (o a) (Inv $ o b) (o c)
Sub (Div a b) c -> Msub (o a) (Inv $ o b) (o c)
Sub c (Div a b) -> Nmsub (o a) (Inv $ o b) (o c)
Add (Mul a b) c -> Madd (o a) (o b) (o c)
Add c (Mul a b) -> Madd (o a) (o b) (o c)
Sub (Mul a b) c -> Msub (o a) (o b) (o c)
Sub c (Mul a b) -> Nmsub (o a) (o b) (o c)
-- recursive optimization --
t@(Term _) -> t
Add a b -> Add (o a) (o b)
Mul a b -> Mul (o a) (o b)
Sub a b -> Sub (o a) (o b)
Div a b -> Div (o a) (o b)
Inv a -> Inv (o a)
Neg a -> Neg (o a)
Madd a b c -> Madd (o a) (o b) (o c)
Msub a b c -> Msub (o a) (o b) (o c)
Nmadd a b c -> Nmadd (o a) (o b) (o c)
Nmsub a b c -> Nmsub (o a) (o b) (o c) | 886 | false | true | 0 | 13 | 364 | 717 | 341 | 376 | null | null |
aostiles/LiveHaskell | src/IHaskell/IPython/Message/Parser.hs | mit | parseHeader :: [ByteString] -- ^ The list of identifiers.
-> ByteString -- ^ The header data.
-> ByteString -- ^ The parent header, or "{}" for Nothing.
-> ByteString -- ^ The metadata, or "{}" for an empty map.
-> MessageHeader -- The resulting message header.
parseHeader idents headerData parentHeader metadata = MessageHeader {
identifiers = idents,
parentHeader = parentResult,
metadata = metadataMap,
messageId = messageUUID,
sessionId = sessionUUID,
username = username,
msgType = messageType
} where
-- Decode the header data and the parent header data into JSON objects.
-- If the parent header data is absent, just have Nothing instead.
Just result = decode $ Lazy.fromStrict headerData :: Maybe Object
parentResult = if parentHeader == "{}"
then Nothing
else Just $ parseHeader idents parentHeader "{}" metadata
-- Get the basic fields from the header.
Success (messageType, username, messageUUID, sessionUUID) = flip parse result $ \obj -> do
messType <- obj .: "msg_type"
username <- obj .: "username"
message <- obj .: "msg_id"
session <- obj .: "session"
return (messType, username, message, session)
-- Get metadata as a simple map.
Just metadataMap = decode $ Lazy.fromStrict metadata :: Maybe (Map Text Text) | 1,433 | parseHeader :: [ByteString] -- ^ The list of identifiers.
-> ByteString -- ^ The header data.
-> ByteString -- ^ The parent header, or "{}" for Nothing.
-> ByteString -- ^ The metadata, or "{}" for an empty map.
-> MessageHeader
parseHeader idents headerData parentHeader metadata = MessageHeader {
identifiers = idents,
parentHeader = parentResult,
metadata = metadataMap,
messageId = messageUUID,
sessionId = sessionUUID,
username = username,
msgType = messageType
} where
-- Decode the header data and the parent header data into JSON objects.
-- If the parent header data is absent, just have Nothing instead.
Just result = decode $ Lazy.fromStrict headerData :: Maybe Object
parentResult = if parentHeader == "{}"
then Nothing
else Just $ parseHeader idents parentHeader "{}" metadata
-- Get the basic fields from the header.
Success (messageType, username, messageUUID, sessionUUID) = flip parse result $ \obj -> do
messType <- obj .: "msg_type"
username <- obj .: "username"
message <- obj .: "msg_id"
session <- obj .: "session"
return (messType, username, message, session)
-- Get metadata as a simple map.
Just metadataMap = decode $ Lazy.fromStrict metadata :: Maybe (Map Text Text) | 1,400 | parseHeader idents headerData parentHeader metadata = MessageHeader {
identifiers = idents,
parentHeader = parentResult,
metadata = metadataMap,
messageId = messageUUID,
sessionId = sessionUUID,
username = username,
msgType = messageType
} where
-- Decode the header data and the parent header data into JSON objects.
-- If the parent header data is absent, just have Nothing instead.
Just result = decode $ Lazy.fromStrict headerData :: Maybe Object
parentResult = if parentHeader == "{}"
then Nothing
else Just $ parseHeader idents parentHeader "{}" metadata
-- Get the basic fields from the header.
Success (messageType, username, messageUUID, sessionUUID) = flip parse result $ \obj -> do
messType <- obj .: "msg_type"
username <- obj .: "username"
message <- obj .: "msg_id"
session <- obj .: "session"
return (messType, username, message, session)
-- Get metadata as a simple map.
Just metadataMap = decode $ Lazy.fromStrict metadata :: Maybe (Map Text Text) | 1,113 | true | true | 25 | 10 | 399 | 269 | 154 | 115 | null | null |
alexvong1995/pandoc | src/Text/Pandoc/Readers/Docx.hs | gpl-2.0 | runElemToInlines (LnBrk) = linebreak | 36 | runElemToInlines (LnBrk) = linebreak | 36 | runElemToInlines (LnBrk) = linebreak | 36 | false | false | 0 | 6 | 3 | 12 | 6 | 6 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.