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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tdietert/nanocoin | src/Nanocoin/Network/P2P.hs | apache-2.0 | onPeerQuery :: ProcessId -> Node.NodeProcessM ()
onPeerQuery pid = do
say "Received peer query..."
peers <- Node.getPeers
let peer = Peer $ processNodeId pid
unless (peer `Set.member` peers) $ do
Node.addPeer peer
void $ monitor pid
Node.nsendPeer' peer PeerDiscovery peers | 291 | onPeerQuery :: ProcessId -> Node.NodeProcessM ()
onPeerQuery pid = do
say "Received peer query..."
peers <- Node.getPeers
let peer = Peer $ processNodeId pid
unless (peer `Set.member` peers) $ do
Node.addPeer peer
void $ monitor pid
Node.nsendPeer' peer PeerDiscovery peers | 291 | onPeerQuery pid = do
say "Received peer query..."
peers <- Node.getPeers
let peer = Peer $ processNodeId pid
unless (peer `Set.member` peers) $ do
Node.addPeer peer
void $ monitor pid
Node.nsendPeer' peer PeerDiscovery peers | 242 | false | true | 0 | 11 | 57 | 107 | 48 | 59 | null | null |
astro/haskell-torrent | src/Data/ByteString/Parser.hs | bsd-2-clause | getByteString :: Int -> Parser B.ByteString
getByteString n = readN n id | 72 | getByteString :: Int -> Parser B.ByteString
getByteString n = readN n id | 72 | getByteString n = readN n id | 28 | false | true | 0 | 7 | 11 | 28 | 13 | 15 | null | null |
ashnikel/haskellbook | ch06/ch06.14_ex.hs | mit | sigmund :: Int -> Int
sigmund x = myX | 37 | sigmund :: Int -> Int
sigmund x = myX | 37 | sigmund x = myX | 15 | false | true | 0 | 7 | 8 | 24 | 10 | 14 | null | null |
edsko/cabal | Cabal/src/Distribution/Simple/Setup.hs | bsd-3-clause | hscolourCommand :: CommandUI HscolourFlags
hscolourCommand = CommandUI
{ commandName = "hscolour"
, commandSynopsis =
"Generate HsColour colourised code, in HTML format."
, commandDescription = Just (\_ -> "Requires the hscolour program.\n")
, commandNotes = Nothing
, commandUsage = \pname ->
"Usage: " ++ pname ++ " hscolour [FLAGS]\n"
, commandDefaultFlags = defaultHscolourFlags
, commandOptions = \showOrParseArgs ->
[optionVerbosity hscolourVerbosity
(\v flags -> flags { hscolourVerbosity = v })
,optionDistPref
hscolourDistPref (\d flags -> flags { hscolourDistPref = d })
showOrParseArgs
,option "" ["executables"]
"Run hscolour for Executables targets"
hscolourExecutables (\v flags -> flags { hscolourExecutables = v })
trueArg
,option "" ["tests"]
"Run hscolour for Test Suite targets"
hscolourTestSuites (\v flags -> flags { hscolourTestSuites = v })
trueArg
,option "" ["benchmarks"]
"Run hscolour for Benchmark targets"
hscolourBenchmarks (\v flags -> flags { hscolourBenchmarks = v })
trueArg
,option "" ["all"]
"Run hscolour for all targets"
(\f -> allFlags [ hscolourExecutables f
, hscolourTestSuites f
, hscolourBenchmarks f])
(\v flags -> flags { hscolourExecutables = v
, hscolourTestSuites = v
, hscolourBenchmarks = v })
trueArg
,option "" ["css"]
"Use a cascading style sheet"
hscolourCSS (\v flags -> flags { hscolourCSS = v })
(reqArgFlag "PATH")
]
} | 1,769 | hscolourCommand :: CommandUI HscolourFlags
hscolourCommand = CommandUI
{ commandName = "hscolour"
, commandSynopsis =
"Generate HsColour colourised code, in HTML format."
, commandDescription = Just (\_ -> "Requires the hscolour program.\n")
, commandNotes = Nothing
, commandUsage = \pname ->
"Usage: " ++ pname ++ " hscolour [FLAGS]\n"
, commandDefaultFlags = defaultHscolourFlags
, commandOptions = \showOrParseArgs ->
[optionVerbosity hscolourVerbosity
(\v flags -> flags { hscolourVerbosity = v })
,optionDistPref
hscolourDistPref (\d flags -> flags { hscolourDistPref = d })
showOrParseArgs
,option "" ["executables"]
"Run hscolour for Executables targets"
hscolourExecutables (\v flags -> flags { hscolourExecutables = v })
trueArg
,option "" ["tests"]
"Run hscolour for Test Suite targets"
hscolourTestSuites (\v flags -> flags { hscolourTestSuites = v })
trueArg
,option "" ["benchmarks"]
"Run hscolour for Benchmark targets"
hscolourBenchmarks (\v flags -> flags { hscolourBenchmarks = v })
trueArg
,option "" ["all"]
"Run hscolour for all targets"
(\f -> allFlags [ hscolourExecutables f
, hscolourTestSuites f
, hscolourBenchmarks f])
(\v flags -> flags { hscolourExecutables = v
, hscolourTestSuites = v
, hscolourBenchmarks = v })
trueArg
,option "" ["css"]
"Use a cascading style sheet"
hscolourCSS (\v flags -> flags { hscolourCSS = v })
(reqArgFlag "PATH")
]
} | 1,769 | hscolourCommand = CommandUI
{ commandName = "hscolour"
, commandSynopsis =
"Generate HsColour colourised code, in HTML format."
, commandDescription = Just (\_ -> "Requires the hscolour program.\n")
, commandNotes = Nothing
, commandUsage = \pname ->
"Usage: " ++ pname ++ " hscolour [FLAGS]\n"
, commandDefaultFlags = defaultHscolourFlags
, commandOptions = \showOrParseArgs ->
[optionVerbosity hscolourVerbosity
(\v flags -> flags { hscolourVerbosity = v })
,optionDistPref
hscolourDistPref (\d flags -> flags { hscolourDistPref = d })
showOrParseArgs
,option "" ["executables"]
"Run hscolour for Executables targets"
hscolourExecutables (\v flags -> flags { hscolourExecutables = v })
trueArg
,option "" ["tests"]
"Run hscolour for Test Suite targets"
hscolourTestSuites (\v flags -> flags { hscolourTestSuites = v })
trueArg
,option "" ["benchmarks"]
"Run hscolour for Benchmark targets"
hscolourBenchmarks (\v flags -> flags { hscolourBenchmarks = v })
trueArg
,option "" ["all"]
"Run hscolour for all targets"
(\f -> allFlags [ hscolourExecutables f
, hscolourTestSuites f
, hscolourBenchmarks f])
(\v flags -> flags { hscolourExecutables = v
, hscolourTestSuites = v
, hscolourBenchmarks = v })
trueArg
,option "" ["css"]
"Use a cascading style sheet"
hscolourCSS (\v flags -> flags { hscolourCSS = v })
(reqArgFlag "PATH")
]
} | 1,726 | false | true | 0 | 15 | 589 | 377 | 215 | 162 | null | null |
arzig/hednist | test/ParserSpec.hs | bsd-3-clause | checkCharRecognized :: Char -> Bool
checkCharRecognized char = parse character "" ("\\" ++ [char]) == Right (EDNChar char) | 123 | checkCharRecognized :: Char -> Bool
checkCharRecognized char = parse character "" ("\\" ++ [char]) == Right (EDNChar char) | 123 | checkCharRecognized char = parse character "" ("\\" ++ [char]) == Right (EDNChar char) | 87 | false | true | 0 | 9 | 18 | 48 | 24 | 24 | null | null |
ChadMcKinney/Haskollider | src/Haskollider/Node.hs | gpl-2.0 | -- |Internal function for converting a ControlList to a list of Osc Datum
controlToDatum :: ControlList -> [Datum]
controlToDatum cl = (foldr (\(arg, val) acc -> string arg : float val : acc) [] cl) | 198 | controlToDatum :: ControlList -> [Datum]
controlToDatum cl = (foldr (\(arg, val) acc -> string arg : float val : acc) [] cl) | 124 | controlToDatum cl = (foldr (\(arg, val) acc -> string arg : float val : acc) [] cl) | 83 | true | true | 0 | 11 | 34 | 64 | 34 | 30 | null | null |
Spheniscida/cHaTTP | persistence-pg/Chattp/PersistencePg/Config.hs | mit | makeBrokerSockAddr :: IO SockAddr
makeBrokerSockAddr = do
raw_fam <- getEnv "CHATTP_PERSISTENCE_LAYER_FAMILY"
raw_addr <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_ADDR"
case raw_fam of
"UNIX" -> return $ SockAddrUnix raw_addr
"INET" -> do
raw_port <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_PORT"
(ai:_) <- getAddrInfo (Just $ defaultHints { addrFamily = AF_UNSPEC }) (Just raw_addr) (Just raw_port)
return (addrAddress ai)
[] -> ioError $ userError "No address family has been provided"
_ -> ioError $ userError "An invalid address family has been provided" | 642 | makeBrokerSockAddr :: IO SockAddr
makeBrokerSockAddr = do
raw_fam <- getEnv "CHATTP_PERSISTENCE_LAYER_FAMILY"
raw_addr <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_ADDR"
case raw_fam of
"UNIX" -> return $ SockAddrUnix raw_addr
"INET" -> do
raw_port <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_PORT"
(ai:_) <- getAddrInfo (Just $ defaultHints { addrFamily = AF_UNSPEC }) (Just raw_addr) (Just raw_port)
return (addrAddress ai)
[] -> ioError $ userError "No address family has been provided"
_ -> ioError $ userError "An invalid address family has been provided" | 642 | makeBrokerSockAddr = do
raw_fam <- getEnv "CHATTP_PERSISTENCE_LAYER_FAMILY"
raw_addr <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_ADDR"
case raw_fam of
"UNIX" -> return $ SockAddrUnix raw_addr
"INET" -> do
raw_port <- getEnv "CHATTP_MSGBROKER_PERSISTENCE_BIND_PORT"
(ai:_) <- getAddrInfo (Just $ defaultHints { addrFamily = AF_UNSPEC }) (Just raw_addr) (Just raw_port)
return (addrAddress ai)
[] -> ioError $ userError "No address family has been provided"
_ -> ioError $ userError "An invalid address family has been provided" | 608 | false | true | 0 | 17 | 152 | 158 | 74 | 84 | null | null |
ciderpunx/57-exercises-for-programmers | test/P29InputSpec.hs | gpl-3.0 | spec :: Spec
spec = do
describe "expectedReturnOn" $ do
it "calculates the book example correctly" $ do
expectedReturnOn 4 `shouldBe` 18 | 148 | spec :: Spec
spec = do
describe "expectedReturnOn" $ do
it "calculates the book example correctly" $ do
expectedReturnOn 4 `shouldBe` 18 | 148 | spec = do
describe "expectedReturnOn" $ do
it "calculates the book example correctly" $ do
expectedReturnOn 4 `shouldBe` 18 | 135 | false | true | 0 | 14 | 33 | 50 | 21 | 29 | null | null |
ony/hledger | hledger-ui/Hledger/UI/UIState.hs | gpl-3.0 | -- | Toggle between showing only unmarked items or all items.
toggleUnmarked :: UIState -> UIState
toggleUnmarked ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatusSomehow Unmarked copts ropts}}} | 287 | toggleUnmarked :: UIState -> UIState
toggleUnmarked ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatusSomehow Unmarked copts ropts}}} | 225 | toggleUnmarked ui@UIState{aopts=uopts@UIOpts{cliopts_=copts@CliOpts{reportopts_=ropts}}} =
ui{aopts=uopts{cliopts_=copts{reportopts_=reportOptsToggleStatusSomehow Unmarked copts ropts}}} | 188 | true | true | 0 | 17 | 24 | 86 | 49 | 37 | null | null |
lfairy/robot | Test/Robot/Internal.hs | apache-2.0 | switch :: Bool -> Switch -> Robot ()
switch press (Key key) = mkRobot $ \(c, keymap) -> do
case M.lookup key keymap of
Nothing -> error $ "keysym " ++ show key
++ " does not exist on keyboard layout"
Just keycode -> X.keyboard c press keycode | 290 | switch :: Bool -> Switch -> Robot ()
switch press (Key key) = mkRobot $ \(c, keymap) -> do
case M.lookup key keymap of
Nothing -> error $ "keysym " ++ show key
++ " does not exist on keyboard layout"
Just keycode -> X.keyboard c press keycode | 290 | switch press (Key key) = mkRobot $ \(c, keymap) -> do
case M.lookup key keymap of
Nothing -> error $ "keysym " ++ show key
++ " does not exist on keyboard layout"
Just keycode -> X.keyboard c press keycode | 253 | false | true | 0 | 14 | 95 | 103 | 50 | 53 | null | null |
AndrewWUw/cs9181 | Data/Array/Accelerate/C/Acc.hs | bsd-3-clause | adaptFun (Lam f) = Lam $ adaptFun f | 37 | adaptFun (Lam f) = Lam $ adaptFun f | 37 | adaptFun (Lam f) = Lam $ adaptFun f | 37 | false | false | 0 | 6 | 9 | 23 | 10 | 13 | null | null |
alexander-at-github/eta | compiler/ETA/Rename/RnBinds.hs | bsd-3-clause | unusedPatBindWarn :: HsBind Name -> SDoc
unusedPatBindWarn bind
= hang (ptext (sLit "This pattern-binding binds no variables:"))
2 (ppr bind) | 150 | unusedPatBindWarn :: HsBind Name -> SDoc
unusedPatBindWarn bind
= hang (ptext (sLit "This pattern-binding binds no variables:"))
2 (ppr bind) | 150 | unusedPatBindWarn bind
= hang (ptext (sLit "This pattern-binding binds no variables:"))
2 (ppr bind) | 109 | false | true | 0 | 9 | 28 | 46 | 22 | 24 | null | null |
eigengrau/haskell-sg | Data/SG/Vector.hs | bsd-3-clause | averageUnitVec vs = unitVector $ sum vs | 39 | averageUnitVec vs = unitVector $ sum vs | 39 | averageUnitVec vs = unitVector $ sum vs | 39 | false | false | 0 | 6 | 6 | 16 | 7 | 9 | null | null |
hxw/conlecterm | src/SessionParser.hs | bsd-2-clause | fromOrientation :: Data.String.IsString a => Orientation -> a
fromOrientation TopTabs = "top" | 93 | fromOrientation :: Data.String.IsString a => Orientation -> a
fromOrientation TopTabs = "top" | 93 | fromOrientation TopTabs = "top" | 31 | false | true | 0 | 7 | 11 | 28 | 14 | 14 | null | null |
Javran/xmonad-javran | src/XMonad/Javran/Config.hs | mit | myEwmhDesktopsEventHook :: Event -> X All
myEwmhDesktopsEventHook e@ClientMessageEvent{..} = do
a_aw <- getAtom "_NET_ACTIVE_WINDOW"
curTime <- liftIO getCurrentTime
StartupTime starupTime <- XS.get
-- prevernt ewmh for the first 5 sec window after startup.
if ev_message_type == a_aw && curTime `diffUTCTime` starupTime <= 5.0
then pure (All True)
else ewmhDesktopsEventHook e | 409 | myEwmhDesktopsEventHook :: Event -> X All
myEwmhDesktopsEventHook e@ClientMessageEvent{..} = do
a_aw <- getAtom "_NET_ACTIVE_WINDOW"
curTime <- liftIO getCurrentTime
StartupTime starupTime <- XS.get
-- prevernt ewmh for the first 5 sec window after startup.
if ev_message_type == a_aw && curTime `diffUTCTime` starupTime <= 5.0
then pure (All True)
else ewmhDesktopsEventHook e | 409 | myEwmhDesktopsEventHook e@ClientMessageEvent{..} = do
a_aw <- getAtom "_NET_ACTIVE_WINDOW"
curTime <- liftIO getCurrentTime
StartupTime starupTime <- XS.get
-- prevernt ewmh for the first 5 sec window after startup.
if ev_message_type == a_aw && curTime `diffUTCTime` starupTime <= 5.0
then pure (All True)
else ewmhDesktopsEventHook e | 367 | false | true | 1 | 12 | 81 | 111 | 51 | 60 | null | null |
ezyang/ghc | libraries/template-haskell/Language/Haskell/TH/Ppr.hs | bsd-3-clause | nestDepth :: Int
nestDepth = 4 | 30 | nestDepth :: Int
nestDepth = 4 | 30 | nestDepth = 4 | 13 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
Purview/purview | src/Graphics/Forensics/Utilities.hs | gpl-3.0 | r2c1d :: (Storable e) => Array F DIM1 e -> CArray Int e
r2c1d array = unsafePerformIO $ do
let x = Repa.size $ extent array
ptr = Repa.toForeignPtr array
CArray.unsafeForeignPtrToCArray ptr (0, x - 1)
| 212 | r2c1d :: (Storable e) => Array F DIM1 e -> CArray Int e
r2c1d array = unsafePerformIO $ do
let x = Repa.size $ extent array
ptr = Repa.toForeignPtr array
CArray.unsafeForeignPtrToCArray ptr (0, x - 1)
| 212 | r2c1d array = unsafePerformIO $ do
let x = Repa.size $ extent array
ptr = Repa.toForeignPtr array
CArray.unsafeForeignPtrToCArray ptr (0, x - 1)
| 156 | false | true | 0 | 12 | 47 | 91 | 44 | 47 | null | null |
formrre/yi | yi-core/src/Yi/Buffer/HighLevel.hs | gpl-2.0 | lastNonSpaceB :: BufferM ()
lastNonSpaceB = do
moveToEol
untilB_ ((||) <$> atSol <*> ((not . isSpace) <$> readB)) leftB
-- | Go to the first non space character in the line;
-- if already there, then go to the beginning of the line. | 237 | lastNonSpaceB :: BufferM ()
lastNonSpaceB = do
moveToEol
untilB_ ((||) <$> atSol <*> ((not . isSpace) <$> readB)) leftB
-- | Go to the first non space character in the line;
-- if already there, then go to the beginning of the line. | 237 | lastNonSpaceB = do
moveToEol
untilB_ ((||) <$> atSol <*> ((not . isSpace) <$> readB)) leftB
-- | Go to the first non space character in the line;
-- if already there, then go to the beginning of the line. | 209 | false | true | 0 | 13 | 47 | 56 | 30 | 26 | null | null |
Courseography/courseography | app/Css/Constants.hs | gpl-3.0 | -- |Defines the color of a soft lime green.
hciDark :: T.Text
hciDark = "#91F27A" | 81 | hciDark :: T.Text
hciDark = "#91F27A" | 37 | hciDark = "#91F27A" | 19 | true | true | 0 | 7 | 14 | 21 | 9 | 12 | null | null |
kaizhang/SciFlow | SciFlow-app/src/Control/Workflow/Main/Command/View.hs | mit | mkEdges :: G.Gr NodeLabel () -> Value
mkEdges gr = toJSON $ flip map (G.edges gr) $ \(fr, to) ->
let fr' = _label $ fromJust $ G.lab gr fr
to' = _label $ fromJust $ G.lab gr to
in M.fromList [ ("source" :: T.Text, fr'), ("target" :: T.Text, to') ] | 264 | mkEdges :: G.Gr NodeLabel () -> Value
mkEdges gr = toJSON $ flip map (G.edges gr) $ \(fr, to) ->
let fr' = _label $ fromJust $ G.lab gr fr
to' = _label $ fromJust $ G.lab gr to
in M.fromList [ ("source" :: T.Text, fr'), ("target" :: T.Text, to') ] | 264 | mkEdges gr = toJSON $ flip map (G.edges gr) $ \(fr, to) ->
let fr' = _label $ fromJust $ G.lab gr fr
to' = _label $ fromJust $ G.lab gr to
in M.fromList [ ("source" :: T.Text, fr'), ("target" :: T.Text, to') ] | 226 | false | true | 0 | 13 | 67 | 143 | 73 | 70 | null | null |
brendanhay/gogol | gogol-qpxexpress/gen/Network/Google/QPXExpress/Types/Product.hs | mpl-2.0 | -- | The flight number.
fiNumber :: Lens' FlightInfo (Maybe Text)
fiNumber = lens _fiNumber (\ s a -> s{_fiNumber = a}) | 119 | fiNumber :: Lens' FlightInfo (Maybe Text)
fiNumber = lens _fiNumber (\ s a -> s{_fiNumber = a}) | 95 | fiNumber = lens _fiNumber (\ s a -> s{_fiNumber = a}) | 53 | true | true | 0 | 9 | 21 | 46 | 25 | 21 | null | null |
vkomenda/CoALP | lib/CoALP/UI/Parser.hs | lgpl-3.0 | term :: TermParser Term1
term = try app <|> con <|> var | 55 | term :: TermParser Term1
term = try app <|> con <|> var | 55 | term = try app <|> con <|> var | 30 | false | true | 6 | 6 | 11 | 37 | 17 | 20 | null | null |
IreneKnapp/direct-opengl | Graphics/Rendering/OpenGL/GL/Capability.hs | bsd-3-clause | isIndexedEnabled :: GLuint -> IndexedEnableCap -> IO Capability
isIndexedEnabled i =
maybe (do recordInvalidEnum; return Disabled)
(\cap -> fmap unmarshalCapability $ glIsEnabledi cap i) .
marshalIndexedEnableCap | 227 | isIndexedEnabled :: GLuint -> IndexedEnableCap -> IO Capability
isIndexedEnabled i =
maybe (do recordInvalidEnum; return Disabled)
(\cap -> fmap unmarshalCapability $ glIsEnabledi cap i) .
marshalIndexedEnableCap | 227 | isIndexedEnabled i =
maybe (do recordInvalidEnum; return Disabled)
(\cap -> fmap unmarshalCapability $ glIsEnabledi cap i) .
marshalIndexedEnableCap | 163 | false | true | 0 | 10 | 40 | 67 | 32 | 35 | null | null |
jean-edouard/manager | xenmgr/XenMgr/Expose/VmObject.hs | gpl-2.0 | _delete_v4v_firewall_rule :: Uuid -> String -> Rpc ()
_delete_v4v_firewall_rule uuid rule_str =
case Firewall.parseRule rule_str of
Nothing -> failRuleParseError
Just r -> deleteVmFirewallRule uuid r | 216 | _delete_v4v_firewall_rule :: Uuid -> String -> Rpc ()
_delete_v4v_firewall_rule uuid rule_str =
case Firewall.parseRule rule_str of
Nothing -> failRuleParseError
Just r -> deleteVmFirewallRule uuid r | 216 | _delete_v4v_firewall_rule uuid rule_str =
case Firewall.parseRule rule_str of
Nothing -> failRuleParseError
Just r -> deleteVmFirewallRule uuid r | 162 | false | true | 0 | 8 | 41 | 58 | 27 | 31 | null | null |
dimara/ganeti | src/Ganeti/Constants.hs | bsd-2-clause | -- * Drbd
drbdHmacAlg :: String
drbdHmacAlg = "md5" | 52 | drbdHmacAlg :: String
drbdHmacAlg = "md5" | 41 | drbdHmacAlg = "md5" | 19 | true | true | 0 | 6 | 9 | 19 | 8 | 11 | null | null |
ku-fpg/kansas-amber | legacy/Rewrite/LCD.hs | bsd-3-clause | -- | Turn the display on
lcdDisplayOn :: LCD -> Arduino ()
lcdDisplayOn lcd = updateDisplayControl True (maskBit LCD_DISPLAYON) lcd | 131 | lcdDisplayOn :: LCD -> Arduino ()
lcdDisplayOn lcd = updateDisplayControl True (maskBit LCD_DISPLAYON) lcd | 106 | lcdDisplayOn lcd = updateDisplayControl True (maskBit LCD_DISPLAYON) lcd | 72 | true | true | 0 | 8 | 19 | 41 | 19 | 22 | null | null |
ExNexu/Idris-dev | src/Idris/ParseData.hs | bsd-3-clause | constructor :: SyntaxInfo -> IdrisParser (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name])
constructor syn
= do (doc, argDocs) <- option noDocs docComment
(cn_in, nfc) <- fnName; fc <- getFC
let cn = expandNS syn cn_in
lchar ':'
fs <- option [] (do lchar '%'; reserved "erase"
sepBy1 (fst <$> name) (lchar ','))
ty <- typeExpr (allowImp syn)
ist <- get
let doc' = annotCode (tryFullExpr syn ist) doc
argDocs' = [ (n, annotCode (tryFullExpr syn ist) d)
| (n, d) <- argDocs ]
return (doc', argDocs', cn, nfc, ty, fc, fs)
<?> "constructor" | 734 | constructor :: SyntaxInfo -> IdrisParser (Docstring (Either Err PTerm), [(Name, Docstring (Either Err PTerm))], Name, FC, PTerm, FC, [Name])
constructor syn
= do (doc, argDocs) <- option noDocs docComment
(cn_in, nfc) <- fnName; fc <- getFC
let cn = expandNS syn cn_in
lchar ':'
fs <- option [] (do lchar '%'; reserved "erase"
sepBy1 (fst <$> name) (lchar ','))
ty <- typeExpr (allowImp syn)
ist <- get
let doc' = annotCode (tryFullExpr syn ist) doc
argDocs' = [ (n, annotCode (tryFullExpr syn ist) d)
| (n, d) <- argDocs ]
return (doc', argDocs', cn, nfc, ty, fc, fs)
<?> "constructor" | 734 | constructor syn
= do (doc, argDocs) <- option noDocs docComment
(cn_in, nfc) <- fnName; fc <- getFC
let cn = expandNS syn cn_in
lchar ':'
fs <- option [] (do lchar '%'; reserved "erase"
sepBy1 (fst <$> name) (lchar ','))
ty <- typeExpr (allowImp syn)
ist <- get
let doc' = annotCode (tryFullExpr syn ist) doc
argDocs' = [ (n, annotCode (tryFullExpr syn ist) d)
| (n, d) <- argDocs ]
return (doc', argDocs', cn, nfc, ty, fc, fs)
<?> "constructor" | 593 | false | true | 0 | 15 | 247 | 303 | 154 | 149 | null | null |
ibukanov/ahome | dev/bna/old/Symbols_Term.hs | unlicense | sterm2 :: NumCoef -> Symbol -> Symbol -> Symbols_Term
sterm 0 list = ST 0 [] | 77 | sterm2 :: NumCoef -> Symbol -> Symbol -> Symbols_Term
sterm 0 list = ST 0 [] | 76 | sterm 0 list = ST 0 [] | 22 | false | true | 0 | 7 | 16 | 35 | 17 | 18 | null | null |
christiaanb/ghc | compiler/simplCore/CoreMonad.hs | bsd-3-clause | read :: (CoreReader -> a) -> CoreM a
read f = CoreM (\s -> getEnv >>= (\r -> nop s (f r))) | 90 | read :: (CoreReader -> a) -> CoreM a
read f = CoreM (\s -> getEnv >>= (\r -> nop s (f r))) | 90 | read f = CoreM (\s -> getEnv >>= (\r -> nop s (f r))) | 53 | false | true | 0 | 13 | 21 | 67 | 33 | 34 | null | null |
brendanhay/gogol | gogol-slides/gen/Network/Google/Slides/Types/Product.hs | mpl-2.0 | -- | The object ID of the master that this slide is based on. This property
-- is read-only.
spMasterObjectId :: Lens' SlideProperties (Maybe Text)
spMasterObjectId
= lens _spMasterObjectId
(\ s a -> s{_spMasterObjectId = a}) | 233 | spMasterObjectId :: Lens' SlideProperties (Maybe Text)
spMasterObjectId
= lens _spMasterObjectId
(\ s a -> s{_spMasterObjectId = a}) | 140 | spMasterObjectId
= lens _spMasterObjectId
(\ s a -> s{_spMasterObjectId = a}) | 85 | true | true | 0 | 9 | 43 | 49 | 26 | 23 | null | null |
tonyday567/pipes-extended | src/Pipes/Extended.hs | mit | until' :: (Monad m, Eq a) => a -> Pipe a a m ()
until' stop = do
a <- await
yield a
when (a /= stop) (until' stop)
-- | Getter stuff | 139 | until' :: (Monad m, Eq a) => a -> Pipe a a m ()
until' stop = do
a <- await
yield a
when (a /= stop) (until' stop)
-- | Getter stuff | 139 | until' stop = do
a <- await
yield a
when (a /= stop) (until' stop)
-- | Getter stuff | 91 | false | true | 0 | 9 | 39 | 79 | 38 | 41 | null | null |
akegalj/snowdrift | View/User.hs | agpl-3.0 | previewUserForm :: User -> Form UserUpdate
previewUserForm User{..} = renderBootstrap3 BootstrapBasicForm $
UserUpdate
<$> aopt hiddenField "" (Just userName)
<*> aopt hiddenField "" (Just userAvatar)
<*> aopt hiddenField "" (Just userEmail)
<*> aopt hiddenField "" (Just userIrcNick)
<*> hiddenMarkdown userBlurb
<*> hiddenMarkdown userStatement | 398 | previewUserForm :: User -> Form UserUpdate
previewUserForm User{..} = renderBootstrap3 BootstrapBasicForm $
UserUpdate
<$> aopt hiddenField "" (Just userName)
<*> aopt hiddenField "" (Just userAvatar)
<*> aopt hiddenField "" (Just userEmail)
<*> aopt hiddenField "" (Just userIrcNick)
<*> hiddenMarkdown userBlurb
<*> hiddenMarkdown userStatement | 398 | previewUserForm User{..} = renderBootstrap3 BootstrapBasicForm $
UserUpdate
<$> aopt hiddenField "" (Just userName)
<*> aopt hiddenField "" (Just userAvatar)
<*> aopt hiddenField "" (Just userEmail)
<*> aopt hiddenField "" (Just userIrcNick)
<*> hiddenMarkdown userBlurb
<*> hiddenMarkdown userStatement | 355 | false | true | 0 | 13 | 94 | 116 | 54 | 62 | null | null |
Changaco/haskell-plugins | src/System/Plugins/Utils.hs | lgpl-2.1 | -- Variables
encode_ch 'z' = "zz" | 34 | encode_ch 'z' = "zz" | 21 | encode_ch 'z' = "zz" | 21 | true | false | 0 | 5 | 6 | 10 | 5 | 5 | null | null |
dmbarbour/awelon | hsrc_util/ABCGraph.hs | bsd-3-clause | boolAnd a (Stat True) = return a | 32 | boolAnd a (Stat True) = return a | 32 | boolAnd a (Stat True) = return a | 32 | false | false | 0 | 6 | 6 | 22 | 9 | 13 | null | null |
sdiehl/ghc | testsuite/tests/perf/should_run/T14955a.hs | bsd-3-clause | dors pd (o:os) = dor pd o (dors pd os) | 38 | dors pd (o:os) = dor pd o (dors pd os) | 38 | dors pd (o:os) = dor pd o (dors pd os) | 38 | false | false | 0 | 7 | 9 | 33 | 16 | 17 | null | null |
bravit/Idris-dev | src/Idris/Core/Unify.hs | bsd-3-clause | recoverable _ t@(App _ _ _)
| (P _ (UN l) _, _) <- unApply t, l == txt "Delayed" = False | 92 | recoverable _ t@(App _ _ _)
| (P _ (UN l) _, _) <- unApply t, l == txt "Delayed" = False | 92 | recoverable _ t@(App _ _ _)
| (P _ (UN l) _, _) <- unApply t, l == txt "Delayed" = False | 92 | false | false | 0 | 12 | 25 | 71 | 33 | 38 | null | null |
plumlife/cabal | cabal-install/Distribution/Client/Setup.hs | bsd-3-clause | benchmarkCommand :: CommandUI (BenchmarkFlags, BuildFlags, BuildExFlags)
benchmarkCommand = parent {
commandDefaultFlags = (commandDefaultFlags parent,
Cabal.defaultBuildFlags, mempty),
commandOptions =
\showOrParseArgs -> liftOptions get1 set1
(commandOptions parent showOrParseArgs)
++
liftOptions get2 set2
(Cabal.buildOptions progConf showOrParseArgs)
++
liftOptions get3 set3 (buildExOptions showOrParseArgs)
}
where
get1 (a,_,_) = a; set1 a (_,b,c) = (a,b,c)
get2 (_,b,_) = b; set2 b (a,_,c) = (a,b,c)
get3 (_,_,c) = c; set3 c (a,b,_) = (a,b,c)
parent = Cabal.benchmarkCommand
progConf = defaultProgramConfiguration
-- ------------------------------------------------------------
-- * Fetch command
-- ------------------------------------------------------------ | 978 | benchmarkCommand :: CommandUI (BenchmarkFlags, BuildFlags, BuildExFlags)
benchmarkCommand = parent {
commandDefaultFlags = (commandDefaultFlags parent,
Cabal.defaultBuildFlags, mempty),
commandOptions =
\showOrParseArgs -> liftOptions get1 set1
(commandOptions parent showOrParseArgs)
++
liftOptions get2 set2
(Cabal.buildOptions progConf showOrParseArgs)
++
liftOptions get3 set3 (buildExOptions showOrParseArgs)
}
where
get1 (a,_,_) = a; set1 a (_,b,c) = (a,b,c)
get2 (_,b,_) = b; set2 b (a,_,c) = (a,b,c)
get3 (_,_,c) = c; set3 c (a,b,_) = (a,b,c)
parent = Cabal.benchmarkCommand
progConf = defaultProgramConfiguration
-- ------------------------------------------------------------
-- * Fetch command
-- ------------------------------------------------------------ | 978 | benchmarkCommand = parent {
commandDefaultFlags = (commandDefaultFlags parent,
Cabal.defaultBuildFlags, mempty),
commandOptions =
\showOrParseArgs -> liftOptions get1 set1
(commandOptions parent showOrParseArgs)
++
liftOptions get2 set2
(Cabal.buildOptions progConf showOrParseArgs)
++
liftOptions get3 set3 (buildExOptions showOrParseArgs)
}
where
get1 (a,_,_) = a; set1 a (_,b,c) = (a,b,c)
get2 (_,b,_) = b; set2 b (a,_,c) = (a,b,c)
get3 (_,_,c) = c; set3 c (a,b,_) = (a,b,c)
parent = Cabal.benchmarkCommand
progConf = defaultProgramConfiguration
-- ------------------------------------------------------------
-- * Fetch command
-- ------------------------------------------------------------ | 905 | false | true | 6 | 13 | 291 | 290 | 154 | 136 | null | null |
vincenthz/hs-foundation | foundation/Foundation/Random/ChaChaDRG.hs | bsd-3-clause | generateF64 :: State -> (Double, State)
generateF64 (State key) = runST $ unsafePrimFromIO $
Foreign.Marshal.Alloc.alloca $ \dst -> do
newKey <- A.newPinned keySize
A.withMutablePtr newKey $ \newKeyP ->
A.withPtr key $ \keyP ->
c_rngv1_generate_f64 newKeyP dst keyP *> return ()
(,) <$> peek dst <*> (State <$> A.unsafeFreeze newKey)
-- return 0 on success, !0 for failure | 434 | generateF64 :: State -> (Double, State)
generateF64 (State key) = runST $ unsafePrimFromIO $
Foreign.Marshal.Alloc.alloca $ \dst -> do
newKey <- A.newPinned keySize
A.withMutablePtr newKey $ \newKeyP ->
A.withPtr key $ \keyP ->
c_rngv1_generate_f64 newKeyP dst keyP *> return ()
(,) <$> peek dst <*> (State <$> A.unsafeFreeze newKey)
-- return 0 on success, !0 for failure | 434 | generateF64 (State key) = runST $ unsafePrimFromIO $
Foreign.Marshal.Alloc.alloca $ \dst -> do
newKey <- A.newPinned keySize
A.withMutablePtr newKey $ \newKeyP ->
A.withPtr key $ \keyP ->
c_rngv1_generate_f64 newKeyP dst keyP *> return ()
(,) <$> peek dst <*> (State <$> A.unsafeFreeze newKey)
-- return 0 on success, !0 for failure | 394 | false | true | 4 | 14 | 118 | 148 | 71 | 77 | null | null |
tjakway/ghcjvm | compiler/cmm/CLabel.hs | bsd-3-clause | toEntryLbl (IdLabel n c _) = IdLabel n c Entry | 60 | toEntryLbl (IdLabel n c _) = IdLabel n c Entry | 60 | toEntryLbl (IdLabel n c _) = IdLabel n c Entry | 60 | false | false | 0 | 7 | 23 | 26 | 12 | 14 | null | null |
danstiner/cryptopals | set1/app/Main.hs | mit | main :: IO ()
main = return () | 30 | main :: IO ()
main = return () | 30 | main = return () | 16 | false | true | 0 | 7 | 7 | 27 | 11 | 16 | null | null |
Jon0/status | src/Device.hs | gpl-3.0 | --find device by name
findPartitionName :: [Partition] -> String -> Maybe Partition
findPartitionName [] _ = Nothing | 116 | findPartitionName :: [Partition] -> String -> Maybe Partition
findPartitionName [] _ = Nothing | 94 | findPartitionName [] _ = Nothing | 32 | true | true | 0 | 7 | 16 | 33 | 17 | 16 | null | null |
DavidAlphaFox/ghc | utils/haddock/haddock-api/src/Haddock/GhcUtils.hs | bsd-3-clause | isDocD :: HsDecl a -> Bool
isDocD (DocD _) = True | 49 | isDocD :: HsDecl a -> Bool
isDocD (DocD _) = True | 49 | isDocD (DocD _) = True | 22 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
rasendubi/hsreadability | src/Network/Readability/Parser.hs | mit | parseStatus "VALIDATED_BY_USERS" = Just ValidatedByUsers | 56 | parseStatus "VALIDATED_BY_USERS" = Just ValidatedByUsers | 56 | parseStatus "VALIDATED_BY_USERS" = Just ValidatedByUsers | 56 | false | false | 0 | 5 | 4 | 12 | 5 | 7 | null | null |
jdubrule/bond | compiler/src/Language/Bond/Codegen/TypeMapping.hs | mit | csInterfaceType (BT_Vector element) = "IList<" <>> elementTypeName element <<> ">" | 82 | csInterfaceType (BT_Vector element) = "IList<" <>> elementTypeName element <<> ">" | 82 | csInterfaceType (BT_Vector element) = "IList<" <>> elementTypeName element <<> ">" | 82 | false | false | 0 | 7 | 9 | 26 | 12 | 14 | null | null |
massysett/penny | penny/lib/Penny/Decimal.hs | bsd-3-clause | poleDecNonZero :: Lens.Lens' DecNonZero Pole
poleDecNonZero = coefficient . NonZero.pole | 88 | poleDecNonZero :: Lens.Lens' DecNonZero Pole
poleDecNonZero = coefficient . NonZero.pole | 88 | poleDecNonZero = coefficient . NonZero.pole | 43 | false | true | 0 | 6 | 9 | 24 | 12 | 12 | null | null |
ra1u/HaskellPitaya | src/System/RedPitaya/Fpga.hs | lgpl-3.0 | - | starting writing address ch x - CH x AXI lower address
setAxiUpperAddress :: (FpgaSetGet a) => Channel -> Registry -> a ()
setAxiUpperAddress = setAxiGeneric' 0x54
| 169 | setAxiUpperAddress :: (FpgaSetGet a) => Channel -> Registry -> a ()
setAxiUpperAddress = setAxiGeneric' 0x54 | 109 | setAxiUpperAddress = setAxiGeneric' 0x54 | 40 | true | true | 5 | 9 | 29 | 72 | 33 | 39 | null | null |
MostAwesomeDude/gemstone | Gemstone/Timers.hs | mit | makeTimers :: Timers
makeTimers = Timers 0 0 0 | 46 | makeTimers :: Timers
makeTimers = Timers 0 0 0 | 46 | makeTimers = Timers 0 0 0 | 25 | false | true | 0 | 5 | 8 | 18 | 9 | 9 | null | null |
sol/pandoc | src/Text/Pandoc/Shared.hs | gpl-2.0 | -- | Generate a unique identifier from a list of inlines.
-- Second argument is a list of already used identifiers.
uniqueIdent :: [Inline] -> [String] -> String
uniqueIdent title' usedIdents =
let baseIdent = case inlineListToIdentifier title' of
"" -> "section"
x -> x
numIdent n = baseIdent ++ "-" ++ show n
in if baseIdent `elem` usedIdents
then case find (\x -> numIdent x `notElem` usedIdents) ([1..60000] :: [Int]) of
Just x -> numIdent x
Nothing -> baseIdent -- if we have more than 60,000, allow repeats
else baseIdent | 646 | uniqueIdent :: [Inline] -> [String] -> String
uniqueIdent title' usedIdents =
let baseIdent = case inlineListToIdentifier title' of
"" -> "section"
x -> x
numIdent n = baseIdent ++ "-" ++ show n
in if baseIdent `elem` usedIdents
then case find (\x -> numIdent x `notElem` usedIdents) ([1..60000] :: [Int]) of
Just x -> numIdent x
Nothing -> baseIdent -- if we have more than 60,000, allow repeats
else baseIdent | 530 | uniqueIdent title' usedIdents =
let baseIdent = case inlineListToIdentifier title' of
"" -> "section"
x -> x
numIdent n = baseIdent ++ "-" ++ show n
in if baseIdent `elem` usedIdents
then case find (\x -> numIdent x `notElem` usedIdents) ([1..60000] :: [Int]) of
Just x -> numIdent x
Nothing -> baseIdent -- if we have more than 60,000, allow repeats
else baseIdent | 484 | true | true | 0 | 13 | 209 | 154 | 82 | 72 | null | null |
TomMD/cryptol | sbv/Data/SBV/SMT/SMT.hs | bsd-3-clause | mergeSExpr (x:xs)
| d == 0 = x : mergeSExpr xs
| True = let (f, r) = grab d xs in unwords (x:f) : mergeSExpr r
where d = parenDiff x
parenDiff :: String -> Int
parenDiff = go 0
where go i "" = i
go i ('(':cs) = let i'= i+1 in i' `seq` go i' cs
go i (')':cs) = let i'= i-1 in i' `seq` go i' cs
go i (_ :cs) = go i cs
grab i ls
| i <= 0 = ([], ls)
grab _ [] = ([], [])
grab i (l:ls) = let (a, b) = grab (i+parenDiff l) ls in (l:a, b) | 548 | mergeSExpr (x:xs)
| d == 0 = x : mergeSExpr xs
| True = let (f, r) = grab d xs in unwords (x:f) : mergeSExpr r
where d = parenDiff x
parenDiff :: String -> Int
parenDiff = go 0
where go i "" = i
go i ('(':cs) = let i'= i+1 in i' `seq` go i' cs
go i (')':cs) = let i'= i-1 in i' `seq` go i' cs
go i (_ :cs) = go i cs
grab i ls
| i <= 0 = ([], ls)
grab _ [] = ([], [])
grab i (l:ls) = let (a, b) = grab (i+parenDiff l) ls in (l:a, b) | 548 | mergeSExpr (x:xs)
| d == 0 = x : mergeSExpr xs
| True = let (f, r) = grab d xs in unwords (x:f) : mergeSExpr r
where d = parenDiff x
parenDiff :: String -> Int
parenDiff = go 0
where go i "" = i
go i ('(':cs) = let i'= i+1 in i' `seq` go i' cs
go i (')':cs) = let i'= i-1 in i' `seq` go i' cs
go i (_ :cs) = go i cs
grab i ls
| i <= 0 = ([], ls)
grab _ [] = ([], [])
grab i (l:ls) = let (a, b) = grab (i+parenDiff l) ls in (l:a, b) | 548 | false | false | 23 | 10 | 228 | 330 | 171 | 159 | null | null |
dmjio/async | Control/Concurrent/Async.hs | bsd-3-clause | -- | Like 'waitAny', but also cancels the other asynchronous
-- operations as soon as one has completed.
--
waitAnyCancel :: [Async a] -> IO (Async a, a)
waitAnyCancel asyncs =
waitAny asyncs `finally` mapM_ cancel asyncs | 223 | waitAnyCancel :: [Async a] -> IO (Async a, a)
waitAnyCancel asyncs =
waitAny asyncs `finally` mapM_ cancel asyncs | 115 | waitAnyCancel asyncs =
waitAny asyncs `finally` mapM_ cancel asyncs | 69 | true | true | 0 | 8 | 38 | 53 | 28 | 25 | null | null |
Rathcke/uni | ap/advanced programming/assignment0/Curves.hs | gpl-3.0 | pointY :: Point -> Double
pointY (Point (_, y)) = y | 51 | pointY :: Point -> Double
pointY (Point (_, y)) = y | 51 | pointY (Point (_, y)) = y | 25 | false | true | 0 | 10 | 10 | 36 | 17 | 19 | null | null |
meiersi/bytestring | Data/ByteString.hs | bsd-3-clause | illegalBufferSize :: Handle -> String -> Int -> IO a
illegalBufferSize handle fn sz =
ioError (mkIOError illegalOperationErrorType msg (Just handle) Nothing)
--TODO: System.IO uses InvalidArgument here, but it's not exported :-(
where
msg = fn ++ ": illegal ByteString size " ++ showsPrec 9 sz []
-- | Read entire handle contents strictly into a 'ByteString'.
--
-- This function reads chunks at a time, doubling the chunksize on each
-- read. The final buffer is then realloced to the appropriate size. For
-- files > half of available memory, this may lead to memory exhaustion.
-- Consider using 'readFile' in this case.
--
-- As with 'hGet', the string representation in the file is assumed to
-- be ISO-8859-1.
--
-- The Handle is closed once the contents have been read,
-- or if an exception is thrown.
-- | 832 | illegalBufferSize :: Handle -> String -> Int -> IO a
illegalBufferSize handle fn sz =
ioError (mkIOError illegalOperationErrorType msg (Just handle) Nothing)
--TODO: System.IO uses InvalidArgument here, but it's not exported :-(
where
msg = fn ++ ": illegal ByteString size " ++ showsPrec 9 sz []
-- | Read entire handle contents strictly into a 'ByteString'.
--
-- This function reads chunks at a time, doubling the chunksize on each
-- read. The final buffer is then realloced to the appropriate size. For
-- files > half of available memory, this may lead to memory exhaustion.
-- Consider using 'readFile' in this case.
--
-- As with 'hGet', the string representation in the file is assumed to
-- be ISO-8859-1.
--
-- The Handle is closed once the contents have been read,
-- or if an exception is thrown.
-- | 832 | illegalBufferSize handle fn sz =
ioError (mkIOError illegalOperationErrorType msg (Just handle) Nothing)
--TODO: System.IO uses InvalidArgument here, but it's not exported :-(
where
msg = fn ++ ": illegal ByteString size " ++ showsPrec 9 sz []
-- | Read entire handle contents strictly into a 'ByteString'.
--
-- This function reads chunks at a time, doubling the chunksize on each
-- read. The final buffer is then realloced to the appropriate size. For
-- files > half of available memory, this may lead to memory exhaustion.
-- Consider using 'readFile' in this case.
--
-- As with 'hGet', the string representation in the file is assumed to
-- be ISO-8859-1.
--
-- The Handle is closed once the contents have been read,
-- or if an exception is thrown.
-- | 779 | false | true | 3 | 8 | 160 | 97 | 52 | 45 | null | null |
snoyberg/ghc | compiler/basicTypes/Name.hs | bsd-3-clause | cmpName :: Name -> Name -> Ordering
cmpName n1 n2 = n_uniq n1 `compare` n_uniq n2 | 81 | cmpName :: Name -> Name -> Ordering
cmpName n1 n2 = n_uniq n1 `compare` n_uniq n2 | 81 | cmpName n1 n2 = n_uniq n1 `compare` n_uniq n2 | 45 | false | true | 0 | 6 | 15 | 36 | 18 | 18 | null | null |
mfilmer/kpModel | newton.hs | gpl-3.0 | guess :: (Double -> Double) -> (Double, Double) -> Double
guess func (start, stop) = xValues !! (fromJust $ elemIndex (minimum funcVals) funcVals)
where
step = (stop - start) / 101
xValues = [start, start + step .. stop]
funcVals = map (abs.func) xValues | 268 | guess :: (Double -> Double) -> (Double, Double) -> Double
guess func (start, stop) = xValues !! (fromJust $ elemIndex (minimum funcVals) funcVals)
where
step = (stop - start) / 101
xValues = [start, start + step .. stop]
funcVals = map (abs.func) xValues | 268 | guess func (start, stop) = xValues !! (fromJust $ elemIndex (minimum funcVals) funcVals)
where
step = (stop - start) / 101
xValues = [start, start + step .. stop]
funcVals = map (abs.func) xValues | 210 | false | true | 0 | 10 | 57 | 117 | 64 | 53 | null | null |
dysinger/amazonka | amazonka-cognito-identity/gen/Network/AWS/CognitoIdentity/DeleteIdentityPool.hs | mpl-2.0 | -- | 'DeleteIdentityPoolResponse' constructor.
deleteIdentityPoolResponse :: DeleteIdentityPoolResponse
deleteIdentityPoolResponse = DeleteIdentityPoolResponse | 159 | deleteIdentityPoolResponse :: DeleteIdentityPoolResponse
deleteIdentityPoolResponse = DeleteIdentityPoolResponse | 112 | deleteIdentityPoolResponse = DeleteIdentityPoolResponse | 55 | true | true | 0 | 4 | 9 | 12 | 7 | 5 | null | null |
RaphaelJ/getwebb.org | Handler/Upload/Archive.hs | gpl-3.0 | treeToHtml :: (Hmac -> Text) -> ArchiveTree -> Html
treeToHtml rdrUrl ~(NodeDirectory tree) = [shamlet|
<ul .last>
^{go $ sortFiles tree}
|]
where
go [] = mempty
go ((name, item):is) = -- Last item of a level
let nodeClass = if null is then "last" else "" :: Text
name' = wrappedText (T.pack name) 30
in case item of
NodeDirectory files -> [shamlet|
<li class=#{nodeClass}>
<span .directory title=#{name}>#{name'}
<ul>
^{go (sortFiles files)}
|]
NodeFile hmac size ->
let url = rdrUrl hmac
in [shamlet|
<li class=#{nodeClass}>
<a .file href=#{url} download=#{name} title=#{name}>
#{name'}
<span .size>#{PrettyFileSize size}
|]
`mappend` go is
-- Extracts and sorts a single level of mapped files. Directories first.
sortFiles = sortBy cmpNodes . M.toList
cmpNodes (_, NodeDirectory {}) (_, NodeFile {}) = LT
cmpNodes (_, NodeFile {}) (_, NodeDirectory {}) = GT
cmpNodes (name1, _) (name2, _) = name1 `compare` name2 | 1,271 | treeToHtml :: (Hmac -> Text) -> ArchiveTree -> Html
treeToHtml rdrUrl ~(NodeDirectory tree) = [shamlet|
<ul .last>
^{go $ sortFiles tree}
|]
where
go [] = mempty
go ((name, item):is) = -- Last item of a level
let nodeClass = if null is then "last" else "" :: Text
name' = wrappedText (T.pack name) 30
in case item of
NodeDirectory files -> [shamlet|
<li class=#{nodeClass}>
<span .directory title=#{name}>#{name'}
<ul>
^{go (sortFiles files)}
|]
NodeFile hmac size ->
let url = rdrUrl hmac
in [shamlet|
<li class=#{nodeClass}>
<a .file href=#{url} download=#{name} title=#{name}>
#{name'}
<span .size>#{PrettyFileSize size}
|]
`mappend` go is
-- Extracts and sorts a single level of mapped files. Directories first.
sortFiles = sortBy cmpNodes . M.toList
cmpNodes (_, NodeDirectory {}) (_, NodeFile {}) = LT
cmpNodes (_, NodeFile {}) (_, NodeDirectory {}) = GT
cmpNodes (name1, _) (name2, _) = name1 `compare` name2 | 1,271 | treeToHtml rdrUrl ~(NodeDirectory tree) = [shamlet|
<ul .last>
^{go $ sortFiles tree}
|]
where
go [] = mempty
go ((name, item):is) = -- Last item of a level
let nodeClass = if null is then "last" else "" :: Text
name' = wrappedText (T.pack name) 30
in case item of
NodeDirectory files -> [shamlet|
<li class=#{nodeClass}>
<span .directory title=#{name}>#{name'}
<ul>
^{go (sortFiles files)}
|]
NodeFile hmac size ->
let url = rdrUrl hmac
in [shamlet|
<li class=#{nodeClass}>
<a .file href=#{url} download=#{name} title=#{name}>
#{name'}
<span .size>#{PrettyFileSize size}
|]
`mappend` go is
-- Extracts and sorts a single level of mapped files. Directories first.
sortFiles = sortBy cmpNodes . M.toList
cmpNodes (_, NodeDirectory {}) (_, NodeFile {}) = LT
cmpNodes (_, NodeFile {}) (_, NodeDirectory {}) = GT
cmpNodes (name1, _) (name2, _) = name1 `compare` name2 | 1,219 | false | true | 0 | 15 | 499 | 278 | 153 | 125 | null | null |
nkpart/score-writer | src/Score/Types.hs | bsd-3-clause | swapH R = L | 11 | swapH R = L | 11 | swapH R = L | 11 | false | false | 0 | 4 | 3 | 10 | 4 | 6 | null | null |
cnc-patch/disass | src/Language/Assembly/X86/Parse.hs | bsd-3-clause | -- FIXME: register number
parsePOPSeg :: (Stream s m Word8, Monad m) => String -> Word8 -> ParsecT s PState m Instr
parsePOPSeg r _ = return $ Instr POP OP16 [(OpReg r 0)] | 173 | parsePOPSeg :: (Stream s m Word8, Monad m) => String -> Word8 -> ParsecT s PState m Instr
parsePOPSeg r _ = return $ Instr POP OP16 [(OpReg r 0)] | 145 | parsePOPSeg r _ = return $ Instr POP OP16 [(OpReg r 0)] | 55 | true | true | 0 | 9 | 35 | 75 | 38 | 37 | null | null |
uduki/hsQt | Qtc/Gui/QStyleOptionGraphicsItem.hs | bsd-2-clause | qsetExposedRect :: QStyleOptionGraphicsItem a -> ((QRectF t1)) -> IO ()
qsetExposedRect x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QStyleOptionGraphicsItem_setExposedRect cobj_x0 cobj_x1 | 229 | qsetExposedRect :: QStyleOptionGraphicsItem a -> ((QRectF t1)) -> IO ()
qsetExposedRect x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QStyleOptionGraphicsItem_setExposedRect cobj_x0 cobj_x1 | 229 | qsetExposedRect x0 (x1)
= withObjectPtr x0 $ \cobj_x0 ->
withObjectPtr x1 $ \cobj_x1 ->
qtc_QStyleOptionGraphicsItem_setExposedRect cobj_x0 cobj_x1 | 157 | false | true | 0 | 9 | 36 | 73 | 36 | 37 | null | null |
ghc-android/ghc | compiler/typecheck/TcType.hs | bsd-3-clause | isTauTy (TyConApp tc tys) = all isTauTy tys && isTauTyCon tc | 60 | isTauTy (TyConApp tc tys) = all isTauTy tys && isTauTyCon tc | 60 | isTauTy (TyConApp tc tys) = all isTauTy tys && isTauTyCon tc | 60 | false | false | 0 | 7 | 10 | 29 | 13 | 16 | null | null |
mtolly/rhythm | src/Data/Rhythm/Time.hs | gpl-3.0 | -- | Corrects for rounding errors along the way.
toTickTrack :: Resolution -> RTB.T Beats a -> RTB.T Ticks a
toTickTrack (Ticks res) = RTB.discretize . RTB.mapTime f where
f (Beats bts) = bts * NN.fromNumberUnsafe (fromIntegral res)
-- | The smallest resolution needed to represent all times correctly. | 305 | toTickTrack :: Resolution -> RTB.T Beats a -> RTB.T Ticks a
toTickTrack (Ticks res) = RTB.discretize . RTB.mapTime f where
f (Beats bts) = bts * NN.fromNumberUnsafe (fromIntegral res)
-- | The smallest resolution needed to represent all times correctly. | 256 | toTickTrack (Ticks res) = RTB.discretize . RTB.mapTime f where
f (Beats bts) = bts * NN.fromNumberUnsafe (fromIntegral res)
-- | The smallest resolution needed to represent all times correctly. | 196 | true | true | 0 | 10 | 51 | 86 | 42 | 44 | null | null |
Tehnix/HsCMS | Handler/API/Disqus.hs | bsd-2-clause | {-|
'submitPostRequest' sends the POST request to the url parameter, and return the response as a 'L.ByteString' wrapped in 'MonadIO' or 'MonadBaseControl IO' monad.
-}
submitPostRequest :: (MonadIO m, MonadBaseControl IO m) => String -> m L.ByteString
submitPostRequest urlString =
case parseUrl urlString of
Nothing -> return "URL Syntax Error"
Just initReq -> withManager $ \manager -> do
let req = initReq { secure = True
, requestHeaders = [("User-Agent", "HsCMS")]
, checkStatus = \_ _ _ -> Nothing
}
res <- httpLbs req manager
return $ responseBody res
{-|
Sends a POST request to https://disqus.com/api/3.0/applications/listUsage.json with the the secret API key and access token as GET parameters, and returns a list of the popular articles.
-} | 904 | submitPostRequest :: (MonadIO m, MonadBaseControl IO m) => String -> m L.ByteString
submitPostRequest urlString =
case parseUrl urlString of
Nothing -> return "URL Syntax Error"
Just initReq -> withManager $ \manager -> do
let req = initReq { secure = True
, requestHeaders = [("User-Agent", "HsCMS")]
, checkStatus = \_ _ _ -> Nothing
}
res <- httpLbs req manager
return $ responseBody res
{-|
Sends a POST request to https://disqus.com/api/3.0/applications/listUsage.json with the the secret API key and access token as GET parameters, and returns a list of the popular articles.
-} | 733 | submitPostRequest urlString =
case parseUrl urlString of
Nothing -> return "URL Syntax Error"
Just initReq -> withManager $ \manager -> do
let req = initReq { secure = True
, requestHeaders = [("User-Agent", "HsCMS")]
, checkStatus = \_ _ _ -> Nothing
}
res <- httpLbs req manager
return $ responseBody res
{-|
Sends a POST request to https://disqus.com/api/3.0/applications/listUsage.json with the the secret API key and access token as GET parameters, and returns a list of the popular articles.
-} | 649 | true | true | 0 | 18 | 267 | 145 | 75 | 70 | null | null |
glutamate/probably-base | Math/Probably/Sampler.hs | bsd-3-clause | bernoulli :: Double -> Prob Bool
bernoulli p = (<p) `fmap` unitSample | 69 | bernoulli :: Double -> Prob Bool
bernoulli p = (<p) `fmap` unitSample | 69 | bernoulli p = (<p) `fmap` unitSample | 36 | false | true | 0 | 7 | 11 | 38 | 19 | 19 | null | null |
karamellpelle/grid | source/Game/Grid/Helpers/Path.hs | gpl-3.0 | gridModifyPathM :: GridWorld -> (Path -> MEnv' Path) -> MEnv' GridWorld
gridModifyPathM grid f = do
path' <- f $ gridPath grid
return grid { gridPath = path' } | 167 | gridModifyPathM :: GridWorld -> (Path -> MEnv' Path) -> MEnv' GridWorld
gridModifyPathM grid f = do
path' <- f $ gridPath grid
return grid { gridPath = path' } | 167 | gridModifyPathM grid f = do
path' <- f $ gridPath grid
return grid { gridPath = path' } | 95 | false | true | 0 | 10 | 36 | 70 | 32 | 38 | null | null |
fmapfmapfmap/amazonka | amazonka-kms/gen/Network/AWS/KMS/CreateGrant.hs | mpl-2.0 | -- | List of operations permitted by the grant. This can be any combination
-- of one or more of the following values:
--
-- 1. Decrypt
-- 2. Encrypt
-- 3. GenerateDataKey
-- 4. GenerateDataKeyWithoutPlaintext
-- 5. ReEncryptFrom
-- 6. ReEncryptTo
-- 7. CreateGrant
-- 8. RetireGrant
cgOperations :: Lens' CreateGrant [GrantOperation]
cgOperations = lens _cgOperations (\ s a -> s{_cgOperations = a}) . _Default . _Coerce | 429 | cgOperations :: Lens' CreateGrant [GrantOperation]
cgOperations = lens _cgOperations (\ s a -> s{_cgOperations = a}) . _Default . _Coerce | 137 | cgOperations = lens _cgOperations (\ s a -> s{_cgOperations = a}) . _Default . _Coerce | 86 | true | true | 0 | 11 | 75 | 61 | 38 | 23 | null | null |
Feeniks/wreq | Network/Wreq/Internal.hs | bsd-3-clause | setRedirects :: Options -> Request -> Request
setRedirects opts req
| redirects opts == HTTP.redirectCount req = req
| otherwise = req { HTTP.redirectCount = redirects opts } | 178 | setRedirects :: Options -> Request -> Request
setRedirects opts req
| redirects opts == HTTP.redirectCount req = req
| otherwise = req { HTTP.redirectCount = redirects opts } | 178 | setRedirects opts req
| redirects opts == HTTP.redirectCount req = req
| otherwise = req { HTTP.redirectCount = redirects opts } | 132 | false | true | 1 | 10 | 31 | 63 | 30 | 33 | null | null |
mfpi/OpenGLRaw | src/Graphics/Rendering/OpenGL/Raw/ARB/UniformBufferObject.hs | bsd-3-clause | gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH :: GLenum
gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35 | 98 | gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH :: GLenum
gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35 | 98 | gl_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35 | 48 | false | true | 0 | 4 | 5 | 11 | 6 | 5 | null | null |
rethab/combinatorrent | src/Supervisor.hs | bsd-2-clause | handleIAmDying :: ThreadId -> Process CF ST ()
handleIAmDying tid = do
p <- asks restartPolicy
case p of
AllForOne -> do
gets childInfo >>= mapM_ finChild
stopP
OneForOne ->
pruneChild tid | 248 | handleIAmDying :: ThreadId -> Process CF ST ()
handleIAmDying tid = do
p <- asks restartPolicy
case p of
AllForOne -> do
gets childInfo >>= mapM_ finChild
stopP
OneForOne ->
pruneChild tid | 248 | handleIAmDying tid = do
p <- asks restartPolicy
case p of
AllForOne -> do
gets childInfo >>= mapM_ finChild
stopP
OneForOne ->
pruneChild tid | 201 | false | true | 0 | 13 | 91 | 75 | 33 | 42 | null | null |
ndmitchell/nsis | src/Development/NSIS.hs | bsd-3-clause | -- | Create the contents of an NSIS script from an installer specification.
--
-- Beware, 'unsafeInject' and 'unsafeInjectGlobal' may break 'nsis'. The
-- optimizer relies on invariants that may not hold when arbitrary lines are
-- injected. Consider using 'nsisNoOptimise' if problems arise.
nsis :: Action a -> String
nsis = unlines . showNSIS . optimise . runAction . void | 375 | nsis :: Action a -> String
nsis = unlines . showNSIS . optimise . runAction . void | 82 | nsis = unlines . showNSIS . optimise . runAction . void | 55 | true | true | 0 | 8 | 60 | 39 | 22 | 17 | null | null |
jdnavarro/graphql-haskell | Data/GraphQL/Execute.hs | bsd-3-clause | document :: Alternative f => Schema f -> AST.Core.Document -> f Aeson.Value
document schema (op :| []) = operation schema op | 124 | document :: Alternative f => Schema f -> AST.Core.Document -> f Aeson.Value
document schema (op :| []) = operation schema op | 124 | document schema (op :| []) = operation schema op | 48 | false | true | 0 | 9 | 20 | 56 | 27 | 29 | null | null |
GaloisInc/saw-script | saw-core/src/Verifier/SAW/Name.hs | bsd-3-clause | toAbsoluteName (ImportedName uri _) = render uri | 48 | toAbsoluteName (ImportedName uri _) = render uri | 48 | toAbsoluteName (ImportedName uri _) = render uri | 48 | false | false | 0 | 7 | 6 | 20 | 9 | 11 | null | null |
haskell-opengl/OpenGLRaw | src/Graphics/GL/Functions/F16.hs | bsd-3-clause | -- glMap2f ---------------------------------------------------------------------
-- | Manual page for <https://www.opengl.org/sdk/docs/man2/xhtml/glMap2.xml OpenGL 2.x>.
glMap2f
:: MonadIO m
=> GLenum -- ^ @target@ of type [MapTarget](Graphics-GL-Groups.html#MapTarget).
-> GLfloat -- ^ @u1@ of type @CoordF@.
-> GLfloat -- ^ @u2@ of type @CoordF@.
-> GLint -- ^ @ustride@.
-> GLint -- ^ @uorder@ of type @CheckedInt32@.
-> GLfloat -- ^ @v1@ of type @CoordF@.
-> GLfloat -- ^ @v2@ of type @CoordF@.
-> GLint -- ^ @vstride@.
-> GLint -- ^ @vorder@ of type @CheckedInt32@.
-> Ptr GLfloat -- ^ @points@ pointing to @COMPSIZE(target,ustride,uorder,vstride,vorder)@ elements of type @CoordF@.
-> m ()
glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 = liftIO $ dyn523 ptr_glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 | 820 | glMap2f
:: MonadIO m
=> GLenum -- ^ @target@ of type [MapTarget](Graphics-GL-Groups.html#MapTarget).
-> GLfloat -- ^ @u1@ of type @CoordF@.
-> GLfloat -- ^ @u2@ of type @CoordF@.
-> GLint -- ^ @ustride@.
-> GLint -- ^ @uorder@ of type @CheckedInt32@.
-> GLfloat -- ^ @v1@ of type @CoordF@.
-> GLfloat -- ^ @v2@ of type @CoordF@.
-> GLint -- ^ @vstride@.
-> GLint -- ^ @vorder@ of type @CheckedInt32@.
-> Ptr GLfloat -- ^ @points@ pointing to @COMPSIZE(target,ustride,uorder,vstride,vorder)@ elements of type @CoordF@.
-> m ()
glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 = liftIO $ dyn523 ptr_glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 | 649 | glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 = liftIO $ dyn523 ptr_glMap2f v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 | 99 | true | true | 0 | 18 | 147 | 130 | 68 | 62 | null | null |
c-brenn/kronos | src/Interpreter.hs | bsd-3-clause | undoInstruction (GoTo offset) = do
return (-offset) | 53 | undoInstruction (GoTo offset) = do
return (-offset) | 53 | undoInstruction (GoTo offset) = do
return (-offset) | 53 | false | false | 0 | 9 | 8 | 26 | 12 | 14 | null | null |
katydid/nwe | src/NWA.hs | bsd-3-clause | isTrans symbol current input (Return (s', s) c _) = s' == symbol && s == current && c == input | 94 | isTrans symbol current input (Return (s', s) c _) = s' == symbol && s == current && c == input | 94 | isTrans symbol current input (Return (s', s) c _) = s' == symbol && s == current && c == input | 94 | false | false | 0 | 9 | 20 | 51 | 26 | 25 | null | null |
nevrenato/HetsAlloy | CSL/TreePO.hs | gpl-2.0 | {- | We combine the comparison outcome of the individual parameters with
the following (symmetrical => commutative) table:
> \ | > < = O D
> -------------
> > | > O > O D
> < | < < O D
> = | = O D
> O | O D
> D | D
>
> , where
>
> > | < | = | O | D
> ---------------------------------------------
> RightOf | LeftOf | Equal | Overlap | Disjoint
The purpose of this table is to use it for cartesian products as follows
Let
A', A'' \subset A
B', B'' \subset B
In order to get the comparison result for A' x B' and A'' x B'' we compare
A' and A'' as well as B' and B'' and combine the results with the above table.
Note that for empty sets the comparable results <,>,= are preferred over the
disjoint result.
-}
combineCmp :: SetOrdering -> SetOrdering -> SetOrdering
combineCmp x y
| x == y = x -- idempotence
| otherwise =
case (x, y) of
(_, Incomparable Disjoint) -> Incomparable Disjoint
(Incomparable Overlap, _) -> Incomparable Overlap
(Comparable EQ, _) -> y -- neutral element
(Comparable GT, Comparable LT) -> Incomparable Overlap
_ -> combineCmp y x -- commutative (should capture all cases) | 1,264 | combineCmp :: SetOrdering -> SetOrdering -> SetOrdering
combineCmp x y
| x == y = x -- idempotence
| otherwise =
case (x, y) of
(_, Incomparable Disjoint) -> Incomparable Disjoint
(Incomparable Overlap, _) -> Incomparable Overlap
(Comparable EQ, _) -> y -- neutral element
(Comparable GT, Comparable LT) -> Incomparable Overlap
_ -> combineCmp y x -- commutative (should capture all cases) | 455 | combineCmp x y
| x == y = x -- idempotence
| otherwise =
case (x, y) of
(_, Incomparable Disjoint) -> Incomparable Disjoint
(Incomparable Overlap, _) -> Incomparable Overlap
(Comparable EQ, _) -> y -- neutral element
(Comparable GT, Comparable LT) -> Incomparable Overlap
_ -> combineCmp y x -- commutative (should capture all cases) | 399 | true | true | 0 | 10 | 386 | 140 | 71 | 69 | null | null |
kosmoskatten/ghost-lang | ghost-node/test/GhostLang/FlowTests.hs | mit | -- | Test some stuff about the initial state.
initStateTest :: Assertion
initStateTest = do
state <- initState
-- Http configuration shall be equal to what's given by the empty
-- network configuration.
initConfig <- getHttpConfig state
emptyService @=? initConfig
-- There shall be no programs in the initial state.
initPrograms <- listPrograms state
[] @=? initPrograms
-- If trying to list the patterns for a non existing program there
-- shall be Nothing as reply.
patterns <- listPatternsFromProgram state "foo"
Nothing @=? patterns
-- There shall be no in flight patterns in the initial state.
initPatterns <- listPatterns state
[] @=? initPatterns
-- | Test that the setting of a new http
-- configuration is working as intended. | 771 | initStateTest :: Assertion
initStateTest = do
state <- initState
-- Http configuration shall be equal to what's given by the empty
-- network configuration.
initConfig <- getHttpConfig state
emptyService @=? initConfig
-- There shall be no programs in the initial state.
initPrograms <- listPrograms state
[] @=? initPrograms
-- If trying to list the patterns for a non existing program there
-- shall be Nothing as reply.
patterns <- listPatternsFromProgram state "foo"
Nothing @=? patterns
-- There shall be no in flight patterns in the initial state.
initPatterns <- listPatterns state
[] @=? initPatterns
-- | Test that the setting of a new http
-- configuration is working as intended. | 725 | initStateTest = do
state <- initState
-- Http configuration shall be equal to what's given by the empty
-- network configuration.
initConfig <- getHttpConfig state
emptyService @=? initConfig
-- There shall be no programs in the initial state.
initPrograms <- listPrograms state
[] @=? initPrograms
-- If trying to list the patterns for a non existing program there
-- shall be Nothing as reply.
patterns <- listPatternsFromProgram state "foo"
Nothing @=? patterns
-- There shall be no in flight patterns in the initial state.
initPatterns <- listPatterns state
[] @=? initPatterns
-- | Test that the setting of a new http
-- configuration is working as intended. | 698 | true | true | 0 | 8 | 153 | 101 | 49 | 52 | null | null |
geophf/1HaskellADay | exercises/HAD/Y2020/M07/D16/Solution.hs | mit | dataset :: FilePath -> IO KnowledgeBase
dataset file = readFile file >>=
return . Map.fromList . map (toRow . csv) . tail . lines | 132 | dataset :: FilePath -> IO KnowledgeBase
dataset file = readFile file >>=
return . Map.fromList . map (toRow . csv) . tail . lines | 132 | dataset file = readFile file >>=
return . Map.fromList . map (toRow . csv) . tail . lines | 92 | false | true | 1 | 10 | 26 | 62 | 28 | 34 | null | null |
gianlucagiorgolo/glue-cgi-tp | CgiTP.hs | mit | nubByShortest :: Eq a => (a -> Int) ->
(a -> a -> Bool) ->
[a] ->
[a]
nubByShortest len eq l = aux l [] where
aux [] acc = acc
aux (a : as) acc =
case find (\x -> eq a x) acc of
Nothing -> aux as (a : acc)
Just a' -> case len a < len a' of
False -> aux as acc
True -> aux as (a : delete a' acc) | 429 | nubByShortest :: Eq a => (a -> Int) ->
(a -> a -> Bool) ->
[a] ->
[a]
nubByShortest len eq l = aux l [] where
aux [] acc = acc
aux (a : as) acc =
case find (\x -> eq a x) acc of
Nothing -> aux as (a : acc)
Just a' -> case len a < len a' of
False -> aux as acc
True -> aux as (a : delete a' acc) | 429 | nubByShortest len eq l = aux l [] where
aux [] acc = acc
aux (a : as) acc =
case find (\x -> eq a x) acc of
Nothing -> aux as (a : acc)
Just a' -> case len a < len a' of
False -> aux as acc
True -> aux as (a : delete a' acc) | 306 | false | true | 0 | 14 | 212 | 195 | 97 | 98 | null | null |
shingoOKAWA/hsarg-haskell | src/DSL/Abstract/Api.hs | bsd-3-clause | -- * "Uncertains"
-- | The function "uncertains" of arguments with respect to the context,
-- given a context, give back the arguments labelled 'Uncertain'.
uncertains :: Context arg -> [arg]
uncertains cxt =
[x | (x, Uncertain) <- cxt] | 242 | uncertains :: Context arg -> [arg]
uncertains cxt =
[x | (x, Uncertain) <- cxt] | 83 | uncertains cxt =
[x | (x, Uncertain) <- cxt] | 48 | true | true | 0 | 8 | 45 | 44 | 25 | 19 | null | null |
ezyang/ghc | compiler/nativeGen/PPC/Instr.hs | bsd-3-clause | -- -----------------------------------------------------------------------------
-- Making far branches
-- Conditional branches on PowerPC are limited to +-32KB; if our Procs get too
-- big, we have to work around this limitation.
makeFarBranches
:: LabelMap CmmStatics
-> [NatBasicBlock Instr]
-> [NatBasicBlock Instr]
makeFarBranches info_env blocks
| last blockAddresses < nearLimit = blocks
| otherwise = zipWith handleBlock blockAddresses blocks
where
blockAddresses = scanl (+) 0 $ map blockLen blocks
blockLen (BasicBlock _ instrs) = length instrs
handleBlock addr (BasicBlock id instrs)
= BasicBlock id (zipWith makeFar [addr..] instrs)
makeFar _ (BCC ALWAYS tgt _) = BCC ALWAYS tgt Nothing
makeFar addr (BCC cond tgt p)
| abs (addr - targetAddr) >= nearLimit
= BCCFAR cond tgt p
| otherwise
= BCC cond tgt p
where Just targetAddr = lookupUFM blockAddressMap tgt
makeFar _ other = other
-- 8192 instructions are allowed; let's keep some distance, as
-- we have a few pseudo-insns that are pretty-printed as
-- multiple instructions, and it's just not worth the effort
-- to calculate things exactly
nearLimit = 7000 - mapSize info_env * maxRetInfoTableSizeW
blockAddressMap = listToUFM $ zip (map blockId blocks) blockAddresses | 1,460 | makeFarBranches
:: LabelMap CmmStatics
-> [NatBasicBlock Instr]
-> [NatBasicBlock Instr]
makeFarBranches info_env blocks
| last blockAddresses < nearLimit = blocks
| otherwise = zipWith handleBlock blockAddresses blocks
where
blockAddresses = scanl (+) 0 $ map blockLen blocks
blockLen (BasicBlock _ instrs) = length instrs
handleBlock addr (BasicBlock id instrs)
= BasicBlock id (zipWith makeFar [addr..] instrs)
makeFar _ (BCC ALWAYS tgt _) = BCC ALWAYS tgt Nothing
makeFar addr (BCC cond tgt p)
| abs (addr - targetAddr) >= nearLimit
= BCCFAR cond tgt p
| otherwise
= BCC cond tgt p
where Just targetAddr = lookupUFM blockAddressMap tgt
makeFar _ other = other
-- 8192 instructions are allowed; let's keep some distance, as
-- we have a few pseudo-insns that are pretty-printed as
-- multiple instructions, and it's just not worth the effort
-- to calculate things exactly
nearLimit = 7000 - mapSize info_env * maxRetInfoTableSizeW
blockAddressMap = listToUFM $ zip (map blockId blocks) blockAddresses | 1,227 | makeFarBranches info_env blocks
| last blockAddresses < nearLimit = blocks
| otherwise = zipWith handleBlock blockAddresses blocks
where
blockAddresses = scanl (+) 0 $ map blockLen blocks
blockLen (BasicBlock _ instrs) = length instrs
handleBlock addr (BasicBlock id instrs)
= BasicBlock id (zipWith makeFar [addr..] instrs)
makeFar _ (BCC ALWAYS tgt _) = BCC ALWAYS tgt Nothing
makeFar addr (BCC cond tgt p)
| abs (addr - targetAddr) >= nearLimit
= BCCFAR cond tgt p
| otherwise
= BCC cond tgt p
where Just targetAddr = lookupUFM blockAddressMap tgt
makeFar _ other = other
-- 8192 instructions are allowed; let's keep some distance, as
-- we have a few pseudo-insns that are pretty-printed as
-- multiple instructions, and it's just not worth the effort
-- to calculate things exactly
nearLimit = 7000 - mapSize info_env * maxRetInfoTableSizeW
blockAddressMap = listToUFM $ zip (map blockId blocks) blockAddresses | 1,114 | true | true | 1 | 11 | 409 | 312 | 152 | 160 | null | null |
drets/scheme-haskell-48h | src/Scheme/Eval.hs | bsd-3-clause | ccase env bad = throwError $ Default $ "case eval error: " ++ show bad | 70 | ccase env bad = throwError $ Default $ "case eval error: " ++ show bad | 70 | ccase env bad = throwError $ Default $ "case eval error: " ++ show bad | 70 | false | false | 0 | 7 | 14 | 26 | 12 | 14 | null | null |
danoctavian/tcp-proxy | src/Network/TCP/Proxy/Socks5.hs | mit | {-
TODO: implement
main RFC
https://www.ietf.org/rfc/rfc1928.txt
GSS API authentication
https://tools.ietf.org/html/rfc1961
UserName/Password auth
https://tools.ietf.org/html/rfc1929
-}
protocol = undefined | 229 | protocol = undefined | 20 | protocol = undefined | 20 | true | false | 1 | 5 | 39 | 11 | 4 | 7 | null | null |
mbernat/aoc16-haskell | src/Day4.hs | bsd-3-clause | load :: String -> [Room]
load = map parse . lines | 49 | load :: String -> [Room]
load = map parse . lines | 49 | load = map parse . lines | 24 | false | true | 0 | 6 | 10 | 25 | 13 | 12 | null | null |
uduki/hsQt | Qtc/Enums/Gui/QStyleOptionMenuItem.hs | bsd-2-clause | ieCheckType :: Int -> CheckType
ieCheckType x = QEnum (CCheckType x) | 68 | ieCheckType :: Int -> CheckType
ieCheckType x = QEnum (CCheckType x) | 68 | ieCheckType x = QEnum (CCheckType x) | 36 | false | true | 0 | 7 | 10 | 27 | 13 | 14 | null | null |
antarestrader/sapphire | Text/Parsec/Pos.hs | gpl-3.0 | -- | Increments the line number of a source position.
incSourceLine :: SourcePos -> Line -> SourcePos
incSourceLine (SourcePos name line column) n = SourcePos name (line+n) column | 181 | incSourceLine :: SourcePos -> Line -> SourcePos
incSourceLine (SourcePos name line column) n = SourcePos name (line+n) column | 125 | incSourceLine (SourcePos name line column) n = SourcePos name (line+n) column | 77 | true | true | 0 | 7 | 29 | 49 | 25 | 24 | null | null |
iqsf/HFitUI | src/WebUI/Scripts/JavaScript/HJSMath.hs | bsd-3-clause | mathLog10 x = HL $ "Math.log10()" ++ (buildHSL_L hbConf x) ++ ")" | 67 | mathLog10 x = HL $ "Math.log10()" ++ (buildHSL_L hbConf x) ++ ")" | 67 | mathLog10 x = HL $ "Math.log10()" ++ (buildHSL_L hbConf x) ++ ")" | 67 | false | false | 0 | 8 | 13 | 29 | 14 | 15 | null | null |
christian-marie/pill-bug | Shipper/Inputs/ZMQ4.hs | mit | startZMQ4Input :: TBQueue Types.ChannelPayload-> Types.Input -> Int -> IO ()
startZMQ4Input ch Types.ZMQ4Input{..} wait_time = forever $ do
runZMQ $ do
s <- socket Rep
setCurveServer True s
setCurveSecretKey TextFormat ziPrivateKey s
bind s ziBind
forever $ do
payload <- receive s
liftIO $ emit $ (decode . decompress) payload
send s [] B.empty
`catch` \e -> do
putStrLn $ "ZMQ input server died: " ++ show (e :: SomeException)
threadDelay wait_time
where
emit = atomically . writeTBQueue ch . Types.Multiple
decode bs = map Types.PackedEvent $ MP.unpack bs
decompress bs = fromMaybe (error "LZ4.decompress failed") $
LZ4.decompress bs | 794 | startZMQ4Input :: TBQueue Types.ChannelPayload-> Types.Input -> Int -> IO ()
startZMQ4Input ch Types.ZMQ4Input{..} wait_time = forever $ do
runZMQ $ do
s <- socket Rep
setCurveServer True s
setCurveSecretKey TextFormat ziPrivateKey s
bind s ziBind
forever $ do
payload <- receive s
liftIO $ emit $ (decode . decompress) payload
send s [] B.empty
`catch` \e -> do
putStrLn $ "ZMQ input server died: " ++ show (e :: SomeException)
threadDelay wait_time
where
emit = atomically . writeTBQueue ch . Types.Multiple
decode bs = map Types.PackedEvent $ MP.unpack bs
decompress bs = fromMaybe (error "LZ4.decompress failed") $
LZ4.decompress bs | 794 | startZMQ4Input ch Types.ZMQ4Input{..} wait_time = forever $ do
runZMQ $ do
s <- socket Rep
setCurveServer True s
setCurveSecretKey TextFormat ziPrivateKey s
bind s ziBind
forever $ do
payload <- receive s
liftIO $ emit $ (decode . decompress) payload
send s [] B.empty
`catch` \e -> do
putStrLn $ "ZMQ input server died: " ++ show (e :: SomeException)
threadDelay wait_time
where
emit = atomically . writeTBQueue ch . Types.Multiple
decode bs = map Types.PackedEvent $ MP.unpack bs
decompress bs = fromMaybe (error "LZ4.decompress failed") $
LZ4.decompress bs | 717 | false | true | 2 | 18 | 256 | 254 | 117 | 137 | null | null |
gcampax/ghc | compiler/types/TyCon.hs | bsd-3-clause | isOpenFamilyTyCon _ = False | 73 | isOpenFamilyTyCon _ = False | 73 | isOpenFamilyTyCon _ = False | 73 | false | false | 0 | 5 | 49 | 9 | 4 | 5 | null | null |
chadbrewbaker/combinat | Math/Combinat/LatticePaths.hs | bsd-3-clause | thEndpoint :: LatticePath -> (Int,Int)
pathEndpoint = go 0 0 where
go !x !y [] = (x,y)
go !x !y (t:ts) = case t of
UpStep -> go (x+1) (y+1) ts
DownStep -> go (x+1) (y-1) ts
-- | Returns the coordinates of the path (excluding the starting point @(0,0)@, but including
-- the endpoint)
| 337 | pathEndpoint :: LatticePath -> (Int,Int)
pathEndpoint = go 0 0 where
go !x !y [] = (x,y)
go !x !y (t:ts) = case t of
UpStep -> go (x+1) (y+1) ts
DownStep -> go (x+1) (y-1) ts
-- | Returns the coordinates of the path (excluding the starting point @(0,0)@, but including
-- the endpoint) | 336 | pathEndpoint = go 0 0 where
go !x !y [] = (x,y)
go !x !y (t:ts) = case t of
UpStep -> go (x+1) (y+1) ts
DownStep -> go (x+1) (y-1) ts
-- | Returns the coordinates of the path (excluding the starting point @(0,0)@, but including
-- the endpoint) | 295 | false | true | 0 | 12 | 108 | 131 | 68 | 63 | null | null |
fmapfmapfmap/amazonka | gen/src/Gen/AST/Data/Syntax.hs | mpl-2.0 | lensD :: Field -> Decl
lensD f = sfun noLoc (ident l) [] (UnGuardedRhs rhs) noBinds
where
l = fieldLens f
a = fieldAccessor f
rhs = mapping (typeOf f) $
app (app (var "lens") (var a))
(paren (lamE noLoc [pvar "s", pvar "a"]
(RecUpdate (var "s") [FieldUpdate (unqual a) (var "a")]))) | 336 | lensD :: Field -> Decl
lensD f = sfun noLoc (ident l) [] (UnGuardedRhs rhs) noBinds
where
l = fieldLens f
a = fieldAccessor f
rhs = mapping (typeOf f) $
app (app (var "lens") (var a))
(paren (lamE noLoc [pvar "s", pvar "a"]
(RecUpdate (var "s") [FieldUpdate (unqual a) (var "a")]))) | 336 | lensD f = sfun noLoc (ident l) [] (UnGuardedRhs rhs) noBinds
where
l = fieldLens f
a = fieldAccessor f
rhs = mapping (typeOf f) $
app (app (var "lens") (var a))
(paren (lamE noLoc [pvar "s", pvar "a"]
(RecUpdate (var "s") [FieldUpdate (unqual a) (var "a")]))) | 313 | false | true | 2 | 16 | 105 | 167 | 82 | 85 | null | null |
jamshidh/ethereum-vm | src/Blockchain/Data/Wire.hs | bsd-3-clause | wireMessage2Obj (Peers peers) = (0x5, RLPArray $ (rlpEncode <$> peers)) | 71 | wireMessage2Obj (Peers peers) = (0x5, RLPArray $ (rlpEncode <$> peers)) | 71 | wireMessage2Obj (Peers peers) = (0x5, RLPArray $ (rlpEncode <$> peers)) | 71 | false | false | 0 | 8 | 9 | 32 | 17 | 15 | null | null |
rpeszek/GraphPlay | play/Deprecated/DiGraph/PolyRebuild.hs | bsd-3-clause | diamond0123Simple :: SG.SimpleListDiGraph Int
diamond0123Simple = SG.SimpleGraph (map (OPair) edgeList) [] | 106 | diamond0123Simple :: SG.SimpleListDiGraph Int
diamond0123Simple = SG.SimpleGraph (map (OPair) edgeList) [] | 106 | diamond0123Simple = SG.SimpleGraph (map (OPair) edgeList) [] | 60 | false | true | 0 | 8 | 10 | 36 | 18 | 18 | null | null |
Bodigrim/arithmoi | Math/NumberTheory/Primes/Sieve/Eratosthenes.hs | mit | primeListInternal :: Num a => PrimeSieve -> [a]
primeListInternal (PS v0 bs)
= map ((+ fromInteger v0) . toPrim)
$ filter (unsafeAt bs) [lo..hi]
where
(lo, hi) = bounds bs
-- | Returns true if integer is beyond representation range of type a. | 253 | primeListInternal :: Num a => PrimeSieve -> [a]
primeListInternal (PS v0 bs)
= map ((+ fromInteger v0) . toPrim)
$ filter (unsafeAt bs) [lo..hi]
where
(lo, hi) = bounds bs
-- | Returns true if integer is beyond representation range of type a. | 253 | primeListInternal (PS v0 bs)
= map ((+ fromInteger v0) . toPrim)
$ filter (unsafeAt bs) [lo..hi]
where
(lo, hi) = bounds bs
-- | Returns true if integer is beyond representation range of type a. | 205 | false | true | 2 | 10 | 53 | 100 | 48 | 52 | null | null |
psibi/yesod | yesod-core/test/YesodCoreTest/Links.hs | mit | case_linkToHome :: IO ()
case_linkToHome = runner $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title></head><body><a href=\"/\"></a>\n</body></html>" res | 201 | case_linkToHome :: IO ()
case_linkToHome = runner $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title></head><body><a href=\"/\"></a>\n</body></html>" res | 201 | case_linkToHome = runner $ do
res <- request defaultRequest
assertBody "<!DOCTYPE html>\n<html><head><title></title></head><body><a href=\"/\"></a>\n</body></html>" res | 176 | false | true | 0 | 9 | 25 | 38 | 17 | 21 | null | null |
matthewbauer/eu4-parser | Map.hs | gpl-3.0 | -- |semicolon separated values
ssvOptions :: Data.Csv.DecodeOptions
ssvOptions = Data.Csv.defaultDecodeOptions {
Data.Csv.decDelimiter = fromIntegral $ ord ';'
} | 163 | ssvOptions :: Data.Csv.DecodeOptions
ssvOptions = Data.Csv.defaultDecodeOptions {
Data.Csv.decDelimiter = fromIntegral $ ord ';'
} | 132 | ssvOptions = Data.Csv.defaultDecodeOptions {
Data.Csv.decDelimiter = fromIntegral $ ord ';'
} | 95 | true | true | 0 | 9 | 19 | 43 | 22 | 21 | null | null |
mrkkrp/stack | src/Stack/Types/TemplateName.hs | bsd-3-clause | mkTemplateName :: String -> Q Exp
mkTemplateName s =
case parseTemplateNameFromString s of
Left{} -> errorString ("Invalid template name: " ++ show s)
Right (TemplateName (T.unpack -> prefix) p) ->
[|TemplateName (T.pack prefix) $(pn)|]
where pn =
case p of
AbsPath (Path fp) -> [|AbsPath (Path fp)|]
RelPath (Path fp) -> [|RelPath (Path fp)|]
UrlPath fp -> [|UrlPath fp|]
-- | Get a text representation of the template name. | 570 | mkTemplateName :: String -> Q Exp
mkTemplateName s =
case parseTemplateNameFromString s of
Left{} -> errorString ("Invalid template name: " ++ show s)
Right (TemplateName (T.unpack -> prefix) p) ->
[|TemplateName (T.pack prefix) $(pn)|]
where pn =
case p of
AbsPath (Path fp) -> [|AbsPath (Path fp)|]
RelPath (Path fp) -> [|RelPath (Path fp)|]
UrlPath fp -> [|UrlPath fp|]
-- | Get a text representation of the template name. | 570 | mkTemplateName s =
case parseTemplateNameFromString s of
Left{} -> errorString ("Invalid template name: " ++ show s)
Right (TemplateName (T.unpack -> prefix) p) ->
[|TemplateName (T.pack prefix) $(pn)|]
where pn =
case p of
AbsPath (Path fp) -> [|AbsPath (Path fp)|]
RelPath (Path fp) -> [|RelPath (Path fp)|]
UrlPath fp -> [|UrlPath fp|]
-- | Get a text representation of the template name. | 536 | false | true | 0 | 15 | 213 | 140 | 74 | 66 | null | null |
NicolasDP/hit | Data/Git/Storage.hs | bsd-3-clause | -- | execute a function on the current repository.
--
-- check findRepo to see how the git repository is found.
withCurrentRepo :: (Git -> IO a) -> IO a
withCurrentRepo f = findRepo >>= \path -> withRepo path f | 210 | withCurrentRepo :: (Git -> IO a) -> IO a
withCurrentRepo f = findRepo >>= \path -> withRepo path f | 98 | withCurrentRepo f = findRepo >>= \path -> withRepo path f | 57 | true | true | 0 | 8 | 39 | 48 | 25 | 23 | null | null |
siddhanathan/ghc | testsuite/tests/rename/should_compile/timing001.hs | bsd-3-clause | a358 = a359 | 11 | a358 = a359 | 11 | a358 = a359 | 11 | false | false | 1 | 5 | 2 | 10 | 3 | 7 | null | null |
brodyberg/Notes | ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/Reverse.hs | mit | rvrs :: String -> String
rvrs curry = third ++ " " ++ second ++ " " ++ first
where
first = take 5 curry
second = take 2 $ drop 6 curry
third = drop 9 curry | 170 | rvrs :: String -> String
rvrs curry = third ++ " " ++ second ++ " " ++ first
where
first = take 5 curry
second = take 2 $ drop 6 curry
third = drop 9 curry | 170 | rvrs curry = third ++ " " ++ second ++ " " ++ first
where
first = take 5 curry
second = take 2 $ drop 6 curry
third = drop 9 curry | 145 | false | true | 6 | 7 | 52 | 89 | 37 | 52 | null | null |
alvare/discogs2pg | src/Discogs/Label.hs | bsd-3-clause | parseLabel _ = error "Couldn't find 'label' tag." | 49 | parseLabel _ = error "Couldn't find 'label' tag." | 49 | parseLabel _ = error "Couldn't find 'label' tag." | 49 | false | false | 0 | 4 | 7 | 13 | 5 | 8 | null | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.