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
MadSciGuys/trebuchet
src/Treb/Routes/DataBlockGet.hs
mit
dataBlockGetH :: TrebServer DataBlockGetH dataBlockGetH = undefined
67
dataBlockGetH :: TrebServer DataBlockGetH dataBlockGetH = undefined
67
dataBlockGetH = undefined
25
false
true
1
5
6
18
7
11
null
null
CristhianMotoche/scion
lib/Scion/Types/Notes.hs
bsd-3-clause
ghcErrMsgToNote :: DynFlags -> FilePath -> GHC.ErrMsg -> Note ghcErrMsgToNote dflags = ghcMsgToNote dflags ErrorNote
116
ghcErrMsgToNote :: DynFlags -> FilePath -> GHC.ErrMsg -> Note ghcErrMsgToNote dflags = ghcMsgToNote dflags ErrorNote
116
ghcErrMsgToNote dflags = ghcMsgToNote dflags ErrorNote
54
false
true
0
9
14
38
17
21
null
null
iblumenfeld/cryptol
src/Cryptol/Parser/NoPat.hs
bsd-3-clause
toPragma (DPragma xs s) = [ (thing x,[Located (srcRange x) s]) | x <- xs ]
76
toPragma (DPragma xs s) = [ (thing x,[Located (srcRange x) s]) | x <- xs ]
76
toPragma (DPragma xs s) = [ (thing x,[Located (srcRange x) s]) | x <- xs ]
76
false
false
0
10
17
52
26
26
null
null
mightymoose/liquidhaskell
benchmarks/esop2013-submission/Array.hs
bsd-3-clause
{-@ data Vec a <dom :: Int -> Prop, rng :: Int -> a -> Prop> = V {a :: i:Int<dom> -> a <rng i>} @-} {-@ empty :: forall <p :: Int -> a -> Prop>. Vec <{\v -> 0=1}, p> a @-} empty :: Vec a empty = V $ \_ -> (error "Empty array!")
245
empty :: Vec a empty = V $ \_ -> (error "Empty array!")
64
empty = V $ \_ -> (error "Empty array!")
44
true
true
0
8
74
31
17
14
null
null
rueshyna/gogol
gogol-youtube/gen/Network/Google/Resource/YouTube/Videos/GetRating.hs
mpl-2.0
-- | Creates a value of 'VideosGetRating' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'vgrOnBehalfOfContentOwner' -- -- * 'vgrId' videosGetRating :: Text -- ^ 'vgrId' -> VideosGetRating videosGetRating pVgrId_ = VideosGetRating' { _vgrOnBehalfOfContentOwner = Nothing , _vgrId = pVgrId_ }
401
videosGetRating :: Text -- ^ 'vgrId' -> VideosGetRating videosGetRating pVgrId_ = VideosGetRating' { _vgrOnBehalfOfContentOwner = Nothing , _vgrId = pVgrId_ }
182
videosGetRating pVgrId_ = VideosGetRating' { _vgrOnBehalfOfContentOwner = Nothing , _vgrId = pVgrId_ }
118
true
true
0
7
82
49
28
21
null
null
batterseapower/haskell-kata
0CFA.hs
bsd-3-clause
runUniqM :: UniqM a -> a runUniqM = fst . flip State.runState 0
63
runUniqM :: UniqM a -> a runUniqM = fst . flip State.runState 0
63
runUniqM = fst . flip State.runState 0
38
false
true
0
7
12
29
14
15
null
null
joranvar/GoogleCodeJam
Y2014/R1C/B.hs
gpl-3.0
parse [] = []
13
parse [] = []
13
parse [] = []
13
false
false
0
5
3
14
6
8
null
null
kazu-yamamoto/iproute
Data/IP/RouteTable/Internal.hs
bsd-3-clause
foldt :: (IPRTable k a -> b -> b) -> b -> IPRTable k a -> b foldt _ v Nil = v
77
foldt :: (IPRTable k a -> b -> b) -> b -> IPRTable k a -> b foldt _ v Nil = v
77
foldt _ v Nil = v
17
false
true
0
9
22
57
26
31
null
null
PiotrJustyna/roller
Roller/Types.hs
gpl-2.0
constructDieTerm :: NumberOfDice -> NumberOfFacesOfEachDie -> DiceExpression constructDieTerm x y | validateDieTermParameters x y = DieTerm x y | otherwise = error $ dieTermLimitsErrorMessage x y
199
constructDieTerm :: NumberOfDice -> NumberOfFacesOfEachDie -> DiceExpression constructDieTerm x y | validateDieTermParameters x y = DieTerm x y | otherwise = error $ dieTermLimitsErrorMessage x y
199
constructDieTerm x y | validateDieTermParameters x y = DieTerm x y | otherwise = error $ dieTermLimitsErrorMessage x y
122
false
true
2
8
29
66
28
38
null
null
mkovacs/ipoly
Exp.hs
gpl-3.0
rec :: Char -> Int prec c = case c of '+' -> 1 '-' -> 1 '*' -> 2 '~' -> 3 '^' -> 4
93
prec :: Char -> Int prec c = case c of '+' -> 1 '-' -> 1 '*' -> 2 '~' -> 3 '^' -> 4
93
prec c = case c of '+' -> 1 '-' -> 1 '*' -> 2 '~' -> 3 '^' -> 4
73
false
true
0
7
36
57
27
30
null
null
brendanhay/gogol
gogol-gmail/gen/Network/Google/Gmail/Types/Product.hs
mpl-2.0
-- | The language to display Gmail in, formatted as an RFC 3066 Language Tag -- (for example \`en-GB\`, \`fr\` or \`ja\` for British English, French, or -- Japanese respectively). The set of languages supported by Gmail evolves -- over time, so please refer to the \"Language\" dropdown in the Gmail -- settings for all available options, as described in the language -- settings help article. A table of sample values is also provided in the -- Managing Language Settings guide Not all Gmail clients can display the -- same set of languages. In the case that a user\'s display language is -- not available for use on a particular client, said client automatically -- chooses to display in the closest supported variant (or a reasonable -- default). lsDisplayLanguage :: Lens' LanguageSettings (Maybe Text) lsDisplayLanguage = lens _lsDisplayLanguage (\ s a -> s{_lsDisplayLanguage = a})
895
lsDisplayLanguage :: Lens' LanguageSettings (Maybe Text) lsDisplayLanguage = lens _lsDisplayLanguage (\ s a -> s{_lsDisplayLanguage = a})
145
lsDisplayLanguage = lens _lsDisplayLanguage (\ s a -> s{_lsDisplayLanguage = a})
88
true
true
2
9
152
65
35
30
null
null
schnommus/monadline
Main.hs
mit
main = displayAll
17
main = displayAll
17
main = displayAll
17
false
false
0
4
2
6
3
3
null
null
ghcjs/ghcjs
src/Compiler/JMacro/Base.hs
mit
jsUnsat_ :: JMacro a => [Ident] -> a -> IdentSupply a jsUnsat_ xs e = IS $ do (idents,is') <- splitAt (length xs) <$> get put is' return $ jsReplace_ (zip xs idents) e -- | Apply a transformation to a fully saturated syntax tree, -- taking care to return any free variables back to their free state -- following the transformation. As the transformation preserves -- free variables, it is hygienic.
405
jsUnsat_ :: JMacro a => [Ident] -> a -> IdentSupply a jsUnsat_ xs e = IS $ do (idents,is') <- splitAt (length xs) <$> get put is' return $ jsReplace_ (zip xs idents) e -- | Apply a transformation to a fully saturated syntax tree, -- taking care to return any free variables back to their free state -- following the transformation. As the transformation preserves -- free variables, it is hygienic.
405
jsUnsat_ xs e = IS $ do (idents,is') <- splitAt (length xs) <$> get put is' return $ jsReplace_ (zip xs idents) e -- | Apply a transformation to a fully saturated syntax tree, -- taking care to return any free variables back to their free state -- following the transformation. As the transformation preserves -- free variables, it is hygienic.
351
false
true
0
12
78
97
48
49
null
null
aslpavel/geekbar
lib/GeekBar/Css.hs
bsd-3-clause
-- | Conpose with immedieate left sibling selector = "selector + selector" adjacentSiblingS :: Selector -> Selector adjacentSiblingS s = Selector ((s ^. select =<<) . zleft) (s ^. repr ++ " + ")
224
adjacentSiblingS :: Selector -> Selector adjacentSiblingS s = Selector ((s ^. select =<<) . zleft) (s ^. repr ++ " + ")
149
adjacentSiblingS s = Selector ((s ^. select =<<) . zleft) (s ^. repr ++ " + ")
108
true
true
0
9
63
55
28
27
null
null
diminishedprime/.org
talks/haskell_typeclasses/02.hs
mit
getDOBSafe _ = Nothing
22
getDOBSafe _ = Nothing
22
getDOBSafe _ = Nothing
22
false
false
0
5
3
9
4
5
null
null
ghorn/ois-input-manager
src/Key.hs
bsd-3-clause
decodeKey 32 = KC_D
19
decodeKey 32 = KC_D
19
decodeKey 32 = KC_D
19
false
false
1
5
3
13
4
9
null
null
stevely/hspirv
src/SpirV/Builder.hs
bsd-3-clause
-- Id 1: Result type, must be a scalar integer -- Id 2: Sampler, must have dim of 1D, 2D, 3D, or cube textureQueryLevels :: TypeId -> Id -> Builder Id textureQueryLevels (TypeId i) = R.textureQueryLevels i
205
textureQueryLevels :: TypeId -> Id -> Builder Id textureQueryLevels (TypeId i) = R.textureQueryLevels i
103
textureQueryLevels (TypeId i) = R.textureQueryLevels i
54
true
true
0
10
36
42
20
22
null
null
kindl/Hypatia
src/Compiler.hs
mit
toJavaScriptE (Arr es) = brackets (commas (fmap toJavaScriptE es))
66
toJavaScriptE (Arr es) = brackets (commas (fmap toJavaScriptE es))
66
toJavaScriptE (Arr es) = brackets (commas (fmap toJavaScriptE es))
66
false
false
0
9
8
33
15
18
null
null
kylcarte/threepenny-extras
src/Foundation/Sections.hs
bsd-3-clause
mkSectionType :: SectionType -> (String,String) mkSectionType Auto = ("auto" , "" )
111
mkSectionType :: SectionType -> (String,String) mkSectionType Auto = ("auto" , "" )
111
mkSectionType Auto = ("auto" , "" )
63
false
true
0
6
39
30
17
13
null
null
input-output-hk/rscoin-haskell
src/RSCoin/User/Wallet.hs
gpl-3.0
getDependentAddresses :: Address -> ExceptQuery [Address] getDependentAddresses addr = checkInitR $ do allAddrs <- L.views ownedAddresses M.keys mappedAddrs <- mapM (\a -> (a,) . fst <$> findUserAddress a) allAddrs return [a | (a,b) <- mappedAddrs, b == addr && a /= addr] -- | Get all available user addresses that have private keys
346
getDependentAddresses :: Address -> ExceptQuery [Address] getDependentAddresses addr = checkInitR $ do allAddrs <- L.views ownedAddresses M.keys mappedAddrs <- mapM (\a -> (a,) . fst <$> findUserAddress a) allAddrs return [a | (a,b) <- mappedAddrs, b == addr && a /= addr] -- | Get all available user addresses that have private keys
346
getDependentAddresses addr = checkInitR $ do allAddrs <- L.views ownedAddresses M.keys mappedAddrs <- mapM (\a -> (a,) . fst <$> findUserAddress a) allAddrs return [a | (a,b) <- mappedAddrs, b == addr && a /= addr] -- | Get all available user addresses that have private keys
288
false
true
0
14
65
119
60
59
null
null
GRACeFUL-project/haskelzinc
src/Interfaces/MZPrinter.hs
bsd-3-clause
printGenerator :: Generator -> Doc printGenerator (es, r) = hsep (punctuate (text ", ") (map printIdent es)) <+> text "in" <+> printExpr r
189
printGenerator :: Generator -> Doc printGenerator (es, r) = hsep (punctuate (text ", ") (map printIdent es)) <+> text "in" <+> printExpr r
189
printGenerator (es, r) = hsep (punctuate (text ", ") (map printIdent es)) <+> text "in" <+> printExpr r
154
false
true
0
11
73
63
31
32
null
null
iteloo/tsuru-sample
iteratee-0.8.9.6/Examples/Wave.hs
bsd-3-clause
convFunc :: AudioFormat -> Iteratee [Word8] IO [Double] convFunc (AudioFormat _nc _sr 8) = fmap ((:[]) . normalize 8 . (fromIntegral :: Word8 -> Int8)) Iter.head
167
convFunc :: AudioFormat -> Iteratee [Word8] IO [Double] convFunc (AudioFormat _nc _sr 8) = fmap ((:[]) . normalize 8 . (fromIntegral :: Word8 -> Int8)) Iter.head
167
convFunc (AudioFormat _nc _sr 8) = fmap ((:[]) . normalize 8 . (fromIntegral :: Word8 -> Int8)) Iter.head
111
false
true
0
9
31
79
41
38
null
null
abooij/haskell-wayland
tests/listglobals.hs
mit
main = do connect <- displayConnect let display = case connect of Just x -> x Nothing -> error "couldn't connect to a wayland server." fd <- displayGetFd display putStrLn $ "Using file descriptor " ++ show fd putStrLn $ "Display at " ++ show display registry <- displayGetRegistry display putStrLn $ "Registry at "++ show registry let listener = RegistryListener { registryGlobal = \reg name ifacename version -> putStrLn $ "Received global " ++ show name ++ " (" ++ ifacename ++ ") version " ++ show version, registryGlobalRemove = \ _ _ -> return () } errorCode <- registrySetListener registry listener putStrLn $ "Setting registry listener... " ++ show errorCode res <- displayPrepareRead display putStrLn $ "Preparing read... " ++ show res flushed <- displayFlush display putStrLn $ "Flushed " ++ show flushed putStrLn "polling" threadWaitRead fd putStrLn $ "Ready to read." events <- displayReadEvents display putStrLn $ "Read display events: " ++ show events dispatched <- displayDispatchPending display putStrLn $ "Dispatched events: " ++ show dispatched displayDisconnect display
1,180
main = do connect <- displayConnect let display = case connect of Just x -> x Nothing -> error "couldn't connect to a wayland server." fd <- displayGetFd display putStrLn $ "Using file descriptor " ++ show fd putStrLn $ "Display at " ++ show display registry <- displayGetRegistry display putStrLn $ "Registry at "++ show registry let listener = RegistryListener { registryGlobal = \reg name ifacename version -> putStrLn $ "Received global " ++ show name ++ " (" ++ ifacename ++ ") version " ++ show version, registryGlobalRemove = \ _ _ -> return () } errorCode <- registrySetListener registry listener putStrLn $ "Setting registry listener... " ++ show errorCode res <- displayPrepareRead display putStrLn $ "Preparing read... " ++ show res flushed <- displayFlush display putStrLn $ "Flushed " ++ show flushed putStrLn "polling" threadWaitRead fd putStrLn $ "Ready to read." events <- displayReadEvents display putStrLn $ "Read display events: " ++ show events dispatched <- displayDispatchPending display putStrLn $ "Dispatched events: " ++ show dispatched displayDisconnect display
1,180
main = do connect <- displayConnect let display = case connect of Just x -> x Nothing -> error "couldn't connect to a wayland server." fd <- displayGetFd display putStrLn $ "Using file descriptor " ++ show fd putStrLn $ "Display at " ++ show display registry <- displayGetRegistry display putStrLn $ "Registry at "++ show registry let listener = RegistryListener { registryGlobal = \reg name ifacename version -> putStrLn $ "Received global " ++ show name ++ " (" ++ ifacename ++ ") version " ++ show version, registryGlobalRemove = \ _ _ -> return () } errorCode <- registrySetListener registry listener putStrLn $ "Setting registry listener... " ++ show errorCode res <- displayPrepareRead display putStrLn $ "Preparing read... " ++ show res flushed <- displayFlush display putStrLn $ "Flushed " ++ show flushed putStrLn "polling" threadWaitRead fd putStrLn $ "Ready to read." events <- displayReadEvents display putStrLn $ "Read display events: " ++ show events dispatched <- displayDispatchPending display putStrLn $ "Dispatched events: " ++ show dispatched displayDisconnect display
1,180
false
false
0
18
263
329
145
184
null
null
mattvperry/AI-2048-hs
src/AI.hs
mit
getProb :: GameTree -> Prob getProb (PlayNode p _) = p
54
getProb :: GameTree -> Prob getProb (PlayNode p _) = p
54
getProb (PlayNode p _) = p
26
false
true
0
9
10
32
14
18
null
null
jgm/pandoc-citeproc
src/Text/CSL/Eval/Output.hs
bsd-3-clause
oStr' s f = [OStr s f]
23
oStr' s f = [OStr s f]
23
oStr' s f = [OStr s f]
23
false
false
1
6
7
23
9
14
null
null
marcelosousa/poet
src/Domain/Interval/Type.hs
gpl-2.0
absIVal MinusInf = PlusInf
26
absIVal MinusInf = PlusInf
26
absIVal MinusInf = PlusInf
26
false
false
0
5
3
9
4
5
null
null
eigengrau/hlint
data/Default.hs
bsd-3-clause
error = findIndex (== a) ==> elemIndex a
40
error = findIndex (== a) ==> elemIndex a
40
error = findIndex (== a) ==> elemIndex a
40
false
false
1
7
7
23
10
13
null
null
GaloisInc/HaNS
src/Hans/Socket/Udp.hs
bsd-3-clause
newUdpSocket :: (HasNetworkStack ns, Network addr) => ns -> SocketConfig -> Maybe Device -> addr -> Maybe SockPort -> IO (UdpSocket addr) newUdpSocket ns SocketConfig { .. } mbDev src mbSrcPort = do let udpNS = view networkStack ns srcPort <- case mbSrcPort of Nothing -> do mb <- nextUdpPort udpNS (toAddr src) case mb of Just port -> return port Nothing -> throwIO NoPortAvailable Just p -> return p udpSockState <- newIORef (KnownSource mbDev src srcPort) udpBuffer <- DGram.newBuffer scRecvBufferSize -- XXX: Need some SocketError exceptions: this only happens if there's -- already something listening mbClose <- registerRecv udpNS (toAddr src) srcPort udpBuffer udpClose <- case mbClose of Just unreg -> return unreg Nothing -> throwIO AlreadyListening return $! UdpSocket { .. }
1,088
newUdpSocket :: (HasNetworkStack ns, Network addr) => ns -> SocketConfig -> Maybe Device -> addr -> Maybe SockPort -> IO (UdpSocket addr) newUdpSocket ns SocketConfig { .. } mbDev src mbSrcPort = do let udpNS = view networkStack ns srcPort <- case mbSrcPort of Nothing -> do mb <- nextUdpPort udpNS (toAddr src) case mb of Just port -> return port Nothing -> throwIO NoPortAvailable Just p -> return p udpSockState <- newIORef (KnownSource mbDev src srcPort) udpBuffer <- DGram.newBuffer scRecvBufferSize -- XXX: Need some SocketError exceptions: this only happens if there's -- already something listening mbClose <- registerRecv udpNS (toAddr src) srcPort udpBuffer udpClose <- case mbClose of Just unreg -> return unreg Nothing -> throwIO AlreadyListening return $! UdpSocket { .. }
1,087
newUdpSocket ns SocketConfig { .. } mbDev src mbSrcPort = do let udpNS = view networkStack ns srcPort <- case mbSrcPort of Nothing -> do mb <- nextUdpPort udpNS (toAddr src) case mb of Just port -> return port Nothing -> throwIO NoPortAvailable Just p -> return p udpSockState <- newIORef (KnownSource mbDev src srcPort) udpBuffer <- DGram.newBuffer scRecvBufferSize -- XXX: Need some SocketError exceptions: this only happens if there's -- already something listening mbClose <- registerRecv udpNS (toAddr src) srcPort udpBuffer udpClose <- case mbClose of Just unreg -> return unreg Nothing -> throwIO AlreadyListening return $! UdpSocket { .. }
871
false
true
0
16
426
267
123
144
null
null
MoixaEnergy/blaze-react
src/Blaze/React/Examples/TabbedApps.hs
mit
pathToRoute :: Prism' T.Text TabbedRoute pathToRoute = prism' fromRoute toRoute where fromRoute :: TabbedRoute -> T.Text fromRoute (TabbedRoute appIdx innerPath) = T.concat [ T.pack $ show appIdx , if T.null innerPath then "" else "-" <> innerPath ] toRoute :: T.Text -> Maybe TabbedRoute toRoute path = case T.decimal path of Left _ -> Nothing Right (appIdx, leftover) -> Just $ TabbedRoute { _trAppIdx = appIdx , _trInnerPath = T.drop 1 leftover } -- Rendering -------------
626
pathToRoute :: Prism' T.Text TabbedRoute pathToRoute = prism' fromRoute toRoute where fromRoute :: TabbedRoute -> T.Text fromRoute (TabbedRoute appIdx innerPath) = T.concat [ T.pack $ show appIdx , if T.null innerPath then "" else "-" <> innerPath ] toRoute :: T.Text -> Maybe TabbedRoute toRoute path = case T.decimal path of Left _ -> Nothing Right (appIdx, leftover) -> Just $ TabbedRoute { _trAppIdx = appIdx , _trInnerPath = T.drop 1 leftover } -- Rendering -------------
626
pathToRoute = prism' fromRoute toRoute where fromRoute :: TabbedRoute -> T.Text fromRoute (TabbedRoute appIdx innerPath) = T.concat [ T.pack $ show appIdx , if T.null innerPath then "" else "-" <> innerPath ] toRoute :: T.Text -> Maybe TabbedRoute toRoute path = case T.decimal path of Left _ -> Nothing Right (appIdx, leftover) -> Just $ TabbedRoute { _trAppIdx = appIdx , _trInnerPath = T.drop 1 leftover } -- Rendering -------------
585
false
true
0
12
225
172
88
84
null
null
mgsloan/zeroth
src/Language/Haskell/TH/ZeroTH/Comments.hs
bsd-3-clause
mixComments [] i = map snd i
28
mixComments [] i = map snd i
28
mixComments [] i = map snd i
28
false
false
0
6
6
18
8
10
null
null
cartazio/omega
src/Auxillary.hs
bsd-3-clause
next bad (x:xs) = if notIn bad x then (x,xs) else next bad xs where notIn [] x = True notIn (y:ys) x = if (root x)==(root y) then False else notIn ys x root (c:cs) | not(isAlpha c) = root cs root cs = cs {- SOME TESTS to turn into Unit Tests d0 = newDI [(1::Int,"b"),(2,"c")] ans = displays d1 [Ds "A",Df f 1, Df f 0, Df f 2, Df f 3, Df f 4,Df f 1,Ds "Z",Df f 3] f:: DispInfo Int -> Int -> (DispInfo Int,String) f = useDisplay (\ x -> x) d1 :: DispInfo Int d1 = newDI [] (d2,_) = tryDisplay 0 "a" 1 id d1 (d3,_) = tryDisplay 0 "b" 2 id d2 (d4,_) = tryDisplay 0 "a" 3 id d3 (d5,_) = tryDisplay 0 "x" 4 id d4 d6 = displays d5 [Ds "[",Df f 1,Df f 2,Df f 3, Df f 4,Df f 5,Ds "]"] -} -- Here we suggest a name "x" for a variable "uniq", if "uniq" isn't -- already mapped to some other name. If it is still not mapped we -- use "x" if it is still available, "x1", or "x2", or "x3" etc if -- "x" is already in use.
938
next bad (x:xs) = if notIn bad x then (x,xs) else next bad xs where notIn [] x = True notIn (y:ys) x = if (root x)==(root y) then False else notIn ys x root (c:cs) | not(isAlpha c) = root cs root cs = cs {- SOME TESTS to turn into Unit Tests d0 = newDI [(1::Int,"b"),(2,"c")] ans = displays d1 [Ds "A",Df f 1, Df f 0, Df f 2, Df f 3, Df f 4,Df f 1,Ds "Z",Df f 3] f:: DispInfo Int -> Int -> (DispInfo Int,String) f = useDisplay (\ x -> x) d1 :: DispInfo Int d1 = newDI [] (d2,_) = tryDisplay 0 "a" 1 id d1 (d3,_) = tryDisplay 0 "b" 2 id d2 (d4,_) = tryDisplay 0 "a" 3 id d3 (d5,_) = tryDisplay 0 "x" 4 id d4 d6 = displays d5 [Ds "[",Df f 1,Df f 2,Df f 3, Df f 4,Df f 5,Ds "]"] -} -- Here we suggest a name "x" for a variable "uniq", if "uniq" isn't -- already mapped to some other name. If it is still not mapped we -- use "x" if it is still available, "x1", or "x2", or "x3" etc if -- "x" is already in use.
938
next bad (x:xs) = if notIn bad x then (x,xs) else next bad xs where notIn [] x = True notIn (y:ys) x = if (root x)==(root y) then False else notIn ys x root (c:cs) | not(isAlpha c) = root cs root cs = cs {- SOME TESTS to turn into Unit Tests d0 = newDI [(1::Int,"b"),(2,"c")] ans = displays d1 [Ds "A",Df f 1, Df f 0, Df f 2, Df f 3, Df f 4,Df f 1,Ds "Z",Df f 3] f:: DispInfo Int -> Int -> (DispInfo Int,String) f = useDisplay (\ x -> x) d1 :: DispInfo Int d1 = newDI [] (d2,_) = tryDisplay 0 "a" 1 id d1 (d3,_) = tryDisplay 0 "b" 2 id d2 (d4,_) = tryDisplay 0 "a" 3 id d3 (d5,_) = tryDisplay 0 "x" 4 id d4 d6 = displays d5 [Ds "[",Df f 1,Df f 2,Df f 3, Df f 4,Df f 5,Ds "]"] -} -- Here we suggest a name "x" for a variable "uniq", if "uniq" isn't -- already mapped to some other name. If it is still not mapped we -- use "x" if it is still available, "x1", or "x2", or "x3" etc if -- "x" is already in use.
938
false
false
4
9
236
145
77
68
null
null
DanielSchuessler/th-expand-syns
Language/Haskell/TH/ExpandSyns.hs
bsd-3-clause
substInType :: (Name,Type) -> Type -> Type substInType vt = applySubstitution (Map.fromList [vt])
97
substInType :: (Name,Type) -> Type -> Type substInType vt = applySubstitution (Map.fromList [vt])
97
substInType vt = applySubstitution (Map.fromList [vt])
54
false
true
0
8
12
47
23
24
null
null
glguy/th-abstraction
test/Harness.hs
isc
check :: (Show b, Eq b) => String -> (a -> b) -> a -> a -> Either String () check lbl f x y | f x == f y = Right () | otherwise = Left (lbl ++ ":\n\n" ++ show (f x) ++ "\n\n" ++ show (f y))
194
check :: (Show b, Eq b) => String -> (a -> b) -> a -> a -> Either String () check lbl f x y | f x == f y = Right () | otherwise = Left (lbl ++ ":\n\n" ++ show (f x) ++ "\n\n" ++ show (f y))
194
check lbl f x y | f x == f y = Right () | otherwise = Left (lbl ++ ":\n\n" ++ show (f x) ++ "\n\n" ++ show (f y))
118
false
true
1
12
55
133
64
69
null
null
bacchanalia/KitchenSink
KitchenSink/Qualified.hs
gpl-3.0
-- |'IntSet.fold' is_fold = IntSet.fold
39
is_fold = IntSet.fold
21
is_fold = IntSet.fold
21
true
false
0
5
4
9
5
4
null
null
madebyjeffrey/socrsite
Handler/Document.hs
bsd-2-clause
errorPage :: forall (backend :: (* -> *) -> * -> *). DocumentGeneric backend errorPage = Document "Document not found" "" "No document by that name was found" "" ""
164
errorPage :: forall (backend :: (* -> *) -> * -> *). DocumentGeneric backend errorPage = Document "Document not found" "" "No document by that name was found" "" ""
164
errorPage = Document "Document not found" "" "No document by that name was found" "" ""
87
false
true
0
10
29
51
27
24
null
null
angler-lang/angler-lang
src/Language/Angler/SrcLoc.hs
bsd-3-clause
srcSpanSpan :: SrcSpan -> SrcSpan -> SrcSpan srcSpanSpan s e = case (s,e) of (SrcSpanNoInfo, _ ) -> e (_ , SrcSpanNoInfo) -> s _ -> srcLocSpan startLoc endLoc where startLoc :: SrcLoc startLoc = minimum (fmap srcSpanSLoc both) endLoc :: SrcLoc endLoc = maximum (fmap srcSpanELoc both) both :: [SrcSpan] both = [s,e]
442
srcSpanSpan :: SrcSpan -> SrcSpan -> SrcSpan srcSpanSpan s e = case (s,e) of (SrcSpanNoInfo, _ ) -> e (_ , SrcSpanNoInfo) -> s _ -> srcLocSpan startLoc endLoc where startLoc :: SrcLoc startLoc = minimum (fmap srcSpanSLoc both) endLoc :: SrcLoc endLoc = maximum (fmap srcSpanELoc both) both :: [SrcSpan] both = [s,e]
442
srcSpanSpan s e = case (s,e) of (SrcSpanNoInfo, _ ) -> e (_ , SrcSpanNoInfo) -> s _ -> srcLocSpan startLoc endLoc where startLoc :: SrcLoc startLoc = minimum (fmap srcSpanSLoc both) endLoc :: SrcLoc endLoc = maximum (fmap srcSpanELoc both) both :: [SrcSpan] both = [s,e]
397
false
true
0
9
180
132
72
60
null
null
frontrowed/stratosphere
library-gen/Stratosphere/Resources/CognitoIdentityPool.hs
mit
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cognito-identitypool.html#cfn-cognito-identitypool-pushsync cipPushSync :: Lens' CognitoIdentityPool (Maybe CognitoIdentityPoolPushSync) cipPushSync = lens _cognitoIdentityPoolPushSync (\s a -> s { _cognitoIdentityPoolPushSync = a })
313
cipPushSync :: Lens' CognitoIdentityPool (Maybe CognitoIdentityPoolPushSync) cipPushSync = lens _cognitoIdentityPoolPushSync (\s a -> s { _cognitoIdentityPoolPushSync = a })
173
cipPushSync = lens _cognitoIdentityPoolPushSync (\s a -> s { _cognitoIdentityPoolPushSync = a })
96
true
true
0
9
21
46
25
21
null
null
urbit/urbit
pkg/hs/urbit-noun/lib/Urbit/Noun/Time.hs
mit
addGap :: Wen -> Gap -> Wen addGap (Wen x) y = Wen (x+y)
56
addGap :: Wen -> Gap -> Wen addGap (Wen x) y = Wen (x+y)
56
addGap (Wen x) y = Wen (x+y)
28
false
true
0
7
13
40
20
20
null
null
nyirog/cis194
lec06.hs
unlicense
adjacentCoord U (C x y) = C x (y+1)
38
adjacentCoord U (C x y) = C x (y+1)
38
adjacentCoord U (C x y) = C x (y+1)
38
false
false
0
7
11
33
15
18
null
null
whittle/linkedin-api
Data/API/LinkedIn/Profile.hs
mit
parseShareVisibility :: MonadThrow m => Sink Event m (Maybe ShareVisibility) parseShareVisibility = tagNoAttr "visibility" $ ShareVisibility <$> (force "visibility must contain a code" $ tagNoAttr "code" content)
235
parseShareVisibility :: MonadThrow m => Sink Event m (Maybe ShareVisibility) parseShareVisibility = tagNoAttr "visibility" $ ShareVisibility <$> (force "visibility must contain a code" $ tagNoAttr "code" content)
235
parseShareVisibility = tagNoAttr "visibility" $ ShareVisibility <$> (force "visibility must contain a code" $ tagNoAttr "code" content)
158
false
true
2
9
49
64
28
36
null
null
JackTheEngineer/Drone
scripts/fileMirrorXMC4700.hs
gpl-3.0
(<<>>) path source dest = dest </> dropPreDir source path
57
(<<>>) path source dest = dest </> dropPreDir source path
57
(<<>>) path source dest = dest </> dropPreDir source path
57
false
false
0
6
9
24
12
12
null
null
pparkkin/eta
compiler/ETA/Parser/Ctype.hs
bsd-3-clause
is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit, is_alphanum :: Char -> Bool is_ident = is_ctype cIdent
128
is_ident, is_symbol, is_any, is_space, is_lower, is_upper, is_digit, is_alphanum :: Char -> Bool is_ident = is_ctype cIdent
128
is_ident = is_ctype cIdent
27
false
true
2
5
20
36
23
13
null
null
olorin/amazonka
amazonka-iam/gen/Network/AWS/IAM/RemoveRoleFromInstanceProfile.hs
mpl-2.0
-- | The name of the instance profile to update. rrfipInstanceProfileName :: Lens' RemoveRoleFromInstanceProfile Text rrfipInstanceProfileName = lens _rrfipInstanceProfileName (\ s a -> s{_rrfipInstanceProfileName = a})
219
rrfipInstanceProfileName :: Lens' RemoveRoleFromInstanceProfile Text rrfipInstanceProfileName = lens _rrfipInstanceProfileName (\ s a -> s{_rrfipInstanceProfileName = a})
170
rrfipInstanceProfileName = lens _rrfipInstanceProfileName (\ s a -> s{_rrfipInstanceProfileName = a})
101
true
true
0
9
25
40
22
18
null
null
athanclark/Idris-dev
src/Idris/AbsSyntaxTree.hs
bsd-3-clause
eqOpts = []
11
eqOpts = []
11
eqOpts = []
11
false
false
1
6
2
12
4
8
null
null
spechub/Hets
Proofs/HideTheoremShift.hs
gpl-2.0
prettyPrintPath :: DGraph -> [LEdge DGLinkLab] -> String prettyPrintPath _ [] = "<empty path>"
94
prettyPrintPath :: DGraph -> [LEdge DGLinkLab] -> String prettyPrintPath _ [] = "<empty path>"
94
prettyPrintPath _ [] = "<empty path>"
37
false
true
0
8
13
32
16
16
null
null
mikebenfield/ftensor
test/Tests/Math/Ftensor/SizedList.hs
isc
case_foldr_1 = foldr (-) 0 ((1::Int):-2:-3:-N) @?= 2
56
case_foldr_1 = foldr (-) 0 ((1::Int):-2:-3:-N) @?= 2
56
case_foldr_1 = foldr (-) 0 ((1::Int):-2:-3:-N) @?= 2
56
false
false
0
11
11
40
22
18
null
null
yesodweb/persistent
persistent/test/Database/Persist/TH/EmbedSpec.hs
mit
spec :: Spec spec = describe "EmbedSpec" $ do describe "ModelWithList" $ do let edef = entityDef $ Proxy @ModelWithList [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` FTList (FTTypeCon Nothing "Text") it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "MapIdValue" $ do let edef = entityDef $ Proxy @MapIdValue [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` (FTTypeCon Nothing "Key" `FTApp` FTTypeCon Nothing "Thing" ) ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "HasMap" $ do let edef = entityDef $ Proxy @HasMap [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` FTTypeCon (Just "T") "Text" ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "SomeThing" $ do let edef = entityDef $ Proxy @Thing describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "should have the same field count as Haskell fields" $ do length (embeddedFields embedDef) `shouldBe` length (getEntityFields edef) describe "EmbedThing" $ do it "generates the right constructor" $ do let embedThing :: EmbedThing embedThing = EmbedThing (Thing "asdf") pass describe "SelfEmbed" $ do let edef = entityDef $ Proxy @SelfEmbed describe "fieldReference" $ do let [nameField, selfField] = getEntityFields edef it "has self reference" $ do fieldReference selfField `shouldBe` NoReference describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "has the same field count as regular def" $ do length (getEntityFields edef) `shouldBe` length (embeddedFields embedDef)
3,186
spec :: Spec spec = describe "EmbedSpec" $ do describe "ModelWithList" $ do let edef = entityDef $ Proxy @ModelWithList [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` FTList (FTTypeCon Nothing "Text") it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "MapIdValue" $ do let edef = entityDef $ Proxy @MapIdValue [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` (FTTypeCon Nothing "Key" `FTApp` FTTypeCon Nothing "Thing" ) ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "HasMap" $ do let edef = entityDef $ Proxy @HasMap [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` FTTypeCon (Just "T") "Text" ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "SomeThing" $ do let edef = entityDef $ Proxy @Thing describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "should have the same field count as Haskell fields" $ do length (embeddedFields embedDef) `shouldBe` length (getEntityFields edef) describe "EmbedThing" $ do it "generates the right constructor" $ do let embedThing :: EmbedThing embedThing = EmbedThing (Thing "asdf") pass describe "SelfEmbed" $ do let edef = entityDef $ Proxy @SelfEmbed describe "fieldReference" $ do let [nameField, selfField] = getEntityFields edef it "has self reference" $ do fieldReference selfField `shouldBe` NoReference describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "has the same field count as regular def" $ do length (getEntityFields edef) `shouldBe` length (embeddedFields embedDef)
3,186
spec = describe "EmbedSpec" $ do describe "ModelWithList" $ do let edef = entityDef $ Proxy @ModelWithList [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` FTList (FTTypeCon Nothing "Text") it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "MapIdValue" $ do let edef = entityDef $ Proxy @MapIdValue [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` (FTTypeCon Nothing "Key" `FTApp` FTTypeCon Nothing "Thing" ) ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "HasMap" $ do let edef = entityDef $ Proxy @HasMap [fieldDef] = getEntityFields edef it "has the right type" $ do fieldType fieldDef `shouldBe` ( FTTypeCon (Just "M") "Map" `FTApp` FTTypeCon (Just "T") "Text" `FTApp` FTTypeCon (Just "T") "Text" ) it "has the right sqltype" $ do fieldSqlType fieldDef `shouldBe` SqlString describe "SomeThing" $ do let edef = entityDef $ Proxy @Thing describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "should have the same field count as Haskell fields" $ do length (embeddedFields embedDef) `shouldBe` length (getEntityFields edef) describe "EmbedThing" $ do it "generates the right constructor" $ do let embedThing :: EmbedThing embedThing = EmbedThing (Thing "asdf") pass describe "SelfEmbed" $ do let edef = entityDef $ Proxy @SelfEmbed describe "fieldReference" $ do let [nameField, selfField] = getEntityFields edef it "has self reference" $ do fieldReference selfField `shouldBe` NoReference describe "toEmbedEntityDef" $ do let embedDef = toEmbedEntityDef edef it "has the same field count as regular def" $ do length (getEntityFields edef) `shouldBe` length (embeddedFields embedDef)
3,173
false
true
2
20
1,609
664
303
361
null
null
snoyberg/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
gHC_NUM = mkBaseModule (fsLit "GHC.Num")
48
gHC_NUM = mkBaseModule (fsLit "GHC.Num")
48
gHC_NUM = mkBaseModule (fsLit "GHC.Num")
48
false
false
0
7
12
15
7
8
null
null
osa1/Idris-dev
src/IRTS/Lang.hs
bsd-3-clause
lift env (LApp tc f args) = do f' <- lift env f fn <- getNextName addFn fn (LFun [Inline] fn env f') args' <- mapM (lift env) args return (LApp tc (LV (Glob fn)) (map (LV . Glob) env ++ args'))
317
lift env (LApp tc f args) = do f' <- lift env f fn <- getNextName addFn fn (LFun [Inline] fn env f') args' <- mapM (lift env) args return (LApp tc (LV (Glob fn)) (map (LV . Glob) env ++ args'))
317
lift env (LApp tc f args) = do f' <- lift env f fn <- getNextName addFn fn (LFun [Inline] fn env f') args' <- mapM (lift env) args return (LApp tc (LV (Glob fn)) (map (LV . Glob) env ++ args'))
317
false
false
0
14
165
130
60
70
null
null
rueshyna/gogol
gogol-books/gen/Network/Google/Books/Types/Product.hs
mpl-2.0
-- | Volume subtitle. (In LITE projection.) vviSubtitle :: Lens' VolumeVolumeInfo (Maybe Text) vviSubtitle = lens _vviSubtitle (\ s a -> s{_vviSubtitle = a})
159
vviSubtitle :: Lens' VolumeVolumeInfo (Maybe Text) vviSubtitle = lens _vviSubtitle (\ s a -> s{_vviSubtitle = a})
115
vviSubtitle = lens _vviSubtitle (\ s a -> s{_vviSubtitle = a})
64
true
true
1
9
25
50
25
25
null
null
Teaspot-Studio/Urho3D-Haskell
src/Graphics/Urho3D/UI/Internal/Menu.hs
mit
menuCntx :: C.Context menuCntx = mempty { C.ctxTypesTable = Map.fromList [ (C.TypeName "Menu", [t| Menu |]) ] }
128
menuCntx :: C.Context menuCntx = mempty { C.ctxTypesTable = Map.fromList [ (C.TypeName "Menu", [t| Menu |]) ] }
127
menuCntx = mempty { C.ctxTypesTable = Map.fromList [ (C.TypeName "Menu", [t| Menu |]) ] }
105
false
true
0
12
34
56
29
27
null
null
sdynerow/SemiringsLibrary
Examples/WidestPath.hs
apache-2.0
wpExamples 3 = M (toArray 5 [ zero, zero, zero, zero, zero , WP 3, zero, zero, zero, zero , zero, WP 5, zero, zero, zero , zero, WP 4, zero, zero, zero , zero, zero, WP 6, WP 8, zero])
316
wpExamples 3 = M (toArray 5 [ zero, zero, zero, zero, zero , WP 3, zero, zero, zero, zero , zero, WP 5, zero, zero, zero , zero, WP 4, zero, zero, zero , zero, zero, WP 6, WP 8, zero])
316
wpExamples 3 = M (toArray 5 [ zero, zero, zero, zero, zero , WP 3, zero, zero, zero, zero , zero, WP 5, zero, zero, zero , zero, WP 4, zero, zero, zero , zero, zero, WP 6, WP 8, zero])
316
false
false
1
9
172
114
64
50
null
null
mr/gazelle
src/Network/Gazelle/Routes/Torrent.hs
mit
torrentGroupRoute :: TorrentGroupID -> Route torrentGroupRoute (TorrentGroupID t) = Route { urlPieces = [], urlParams = [ "action" =. ("torrentgroup" :: Text) , "id" =. t ], httpMethod = renderStdMethod GET }
240
torrentGroupRoute :: TorrentGroupID -> Route torrentGroupRoute (TorrentGroupID t) = Route { urlPieces = [], urlParams = [ "action" =. ("torrentgroup" :: Text) , "id" =. t ], httpMethod = renderStdMethod GET }
240
torrentGroupRoute (TorrentGroupID t) = Route { urlPieces = [], urlParams = [ "action" =. ("torrentgroup" :: Text) , "id" =. t ], httpMethod = renderStdMethod GET }
195
false
true
0
9
63
69
39
30
null
null
byorgey/Idris-dev
src/IRTS/CodegenJavaScript.hs
bsd-3-clause
translateExpression (SForeign _ _ fun args) | "[]=" `isSuffixOf` fun , (obj:idx:val:[]) <- args = concat [object obj, index idx, assign val] | "[]" `isSuffixOf` fun , (obj:idx:[]) <- args = object obj ++ index idx | "[" `isPrefixOf` fun && "]=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, '[' : name ++ "]", assign val] | "[" `isPrefixOf` fun && "]" `isSuffixOf` fun , (obj:[]) <- args = object obj ++ '[' : name ++ "]" | "." `isPrefixOf` fun, "=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, field, assign val] | "." `isPrefixOf` fun , (obj:[]) <- args = object obj ++ field | "." `isPrefixOf` fun , (obj:[(FUnit, _)]) <- args = concat [object obj, method, "()"] | "." `isPrefixOf` fun , (obj:as) <- args = concat [object obj, method, arguments as] | "[]=" `isSuffixOf` fun , (idx:val:[]) <- args = concat [array, index idx, assign val] | "[]" `isSuffixOf` fun , (idx:[]) <- args = array ++ index idx | otherwise = fun ++ arguments args where name = filter (`notElem` "[]=") fun method = name field = name array = name object o = translateVariableName (snd o) index i = "[" ++ translateVariableName (snd i) ++ "]" assign v = '=' : generateWrapper v arguments as = '(' : intercalate "," (map generateWrapper as) ++ ")" generateWrapper (ffunc, name) | FFunction <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" | FFunctionIO <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" generateWrapper (_, name) = translateVariableName name
1,709
translateExpression (SForeign _ _ fun args) | "[]=" `isSuffixOf` fun , (obj:idx:val:[]) <- args = concat [object obj, index idx, assign val] | "[]" `isSuffixOf` fun , (obj:idx:[]) <- args = object obj ++ index idx | "[" `isPrefixOf` fun && "]=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, '[' : name ++ "]", assign val] | "[" `isPrefixOf` fun && "]" `isSuffixOf` fun , (obj:[]) <- args = object obj ++ '[' : name ++ "]" | "." `isPrefixOf` fun, "=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, field, assign val] | "." `isPrefixOf` fun , (obj:[]) <- args = object obj ++ field | "." `isPrefixOf` fun , (obj:[(FUnit, _)]) <- args = concat [object obj, method, "()"] | "." `isPrefixOf` fun , (obj:as) <- args = concat [object obj, method, arguments as] | "[]=" `isSuffixOf` fun , (idx:val:[]) <- args = concat [array, index idx, assign val] | "[]" `isSuffixOf` fun , (idx:[]) <- args = array ++ index idx | otherwise = fun ++ arguments args where name = filter (`notElem` "[]=") fun method = name field = name array = name object o = translateVariableName (snd o) index i = "[" ++ translateVariableName (snd i) ++ "]" assign v = '=' : generateWrapper v arguments as = '(' : intercalate "," (map generateWrapper as) ++ ")" generateWrapper (ffunc, name) | FFunction <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" | FFunctionIO <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" generateWrapper (_, name) = translateVariableName name
1,709
translateExpression (SForeign _ _ fun args) | "[]=" `isSuffixOf` fun , (obj:idx:val:[]) <- args = concat [object obj, index idx, assign val] | "[]" `isSuffixOf` fun , (obj:idx:[]) <- args = object obj ++ index idx | "[" `isPrefixOf` fun && "]=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, '[' : name ++ "]", assign val] | "[" `isPrefixOf` fun && "]" `isSuffixOf` fun , (obj:[]) <- args = object obj ++ '[' : name ++ "]" | "." `isPrefixOf` fun, "=" `isSuffixOf` fun , (obj:val:[]) <- args = concat [object obj, field, assign val] | "." `isPrefixOf` fun , (obj:[]) <- args = object obj ++ field | "." `isPrefixOf` fun , (obj:[(FUnit, _)]) <- args = concat [object obj, method, "()"] | "." `isPrefixOf` fun , (obj:as) <- args = concat [object obj, method, arguments as] | "[]=" `isSuffixOf` fun , (idx:val:[]) <- args = concat [array, index idx, assign val] | "[]" `isSuffixOf` fun , (idx:[]) <- args = array ++ index idx | otherwise = fun ++ arguments args where name = filter (`notElem` "[]=") fun method = name field = name array = name object o = translateVariableName (snd o) index i = "[" ++ translateVariableName (snd i) ++ "]" assign v = '=' : generateWrapper v arguments as = '(' : intercalate "," (map generateWrapper as) ++ ")" generateWrapper (ffunc, name) | FFunction <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" | FFunctionIO <- ffunc = "__IDRRT__.ffiWrap(" ++ translateVariableName name ++ ")" generateWrapper (_, name) = translateVariableName name
1,709
false
false
15
16
464
782
401
381
null
null
bgw/hs-rpal
src/Parser/Ast.hs
gpl-3.0
showName (AstAmp _ _) = "&"
27
showName (AstAmp _ _) = "&"
27
showName (AstAmp _ _) = "&"
27
false
false
0
7
5
17
8
9
null
null
fmapfmapfmap/amazonka
amazonka-cloudsearch-domains/gen/Network/AWS/CloudSearchDomains/Search.hs
mpl-2.0
-- | Specifies the offset of the first search hit you want to return. Note -- that the result set is zero-based; the first result is at index 0. You -- can specify either the 'start' or 'cursor' parameter in a request, they -- are mutually exclusive. -- -- For more information, see -- <http://docs.aws.amazon.com/cloudsearch/latest/developerguide/paginating-results.html Paginating Results> -- in the /Amazon CloudSearch Developer Guide/. seaStart :: Lens' Search (Maybe Integer) seaStart = lens _seaStart (\ s a -> s{_seaStart = a})
534
seaStart :: Lens' Search (Maybe Integer) seaStart = lens _seaStart (\ s a -> s{_seaStart = a})
94
seaStart = lens _seaStart (\ s a -> s{_seaStart = a})
53
true
true
0
9
80
53
32
21
null
null
JacquesCarette/literate-scientific-software
People/Dan/Presentations/CommitteeMeeting4/BodyOld.hs
bsd-2-clause
s5_1_table = Table [S "Use Case NO.", S "Use Case Name", S "Actor", S "Input and Output"] (mkTable [(\x -> (x!!0)),(\x -> (x!!1)), (\x -> (x!!2)), (\x -> (x!!3))] [[S "1", S "Inputs", S "User", S "Characteristics of the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "and of the" +:+. (sMap (map toLower) (blast ^. term)) +:+ S "Details in" +:+ (makeRef s5_2)], [S "2", S "Output", (gLassBR ^. defn), S "Whether or not the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "is safe for the calculated" +:+ (sMap (map toLower) (load ^. term)) +:+ S "and supporting" +:+ S "calculated values"]]) (S "Table 1: Use Case Table") True
655
s5_1_table = Table [S "Use Case NO.", S "Use Case Name", S "Actor", S "Input and Output"] (mkTable [(\x -> (x!!0)),(\x -> (x!!1)), (\x -> (x!!2)), (\x -> (x!!3))] [[S "1", S "Inputs", S "User", S "Characteristics of the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "and of the" +:+. (sMap (map toLower) (blast ^. term)) +:+ S "Details in" +:+ (makeRef s5_2)], [S "2", S "Output", (gLassBR ^. defn), S "Whether or not the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "is safe for the calculated" +:+ (sMap (map toLower) (load ^. term)) +:+ S "and supporting" +:+ S "calculated values"]]) (S "Table 1: Use Case Table") True
655
s5_1_table = Table [S "Use Case NO.", S "Use Case Name", S "Actor", S "Input and Output"] (mkTable [(\x -> (x!!0)),(\x -> (x!!1)), (\x -> (x!!2)), (\x -> (x!!3))] [[S "1", S "Inputs", S "User", S "Characteristics of the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "and of the" +:+. (sMap (map toLower) (blast ^. term)) +:+ S "Details in" +:+ (makeRef s5_2)], [S "2", S "Output", (gLassBR ^. defn), S "Whether or not the" +:+ (sMap (map toLower) (glaSlab ^. term)) +:+ S "is safe for the calculated" +:+ (sMap (map toLower) (load ^. term)) +:+ S "and supporting" +:+ S "calculated values"]]) (S "Table 1: Use Case Table") True
655
false
false
0
18
136
330
173
157
null
null
hnfmr/beginning_haskell
chapter6/src/Chapter6/KMeans.hs
mit
kMeans' :: (Vector v, Vectorizable e v) => [v] -> [e] -> Int -> Double -> ([v], Int) kMeans' centroids points steps threshold = let assignments = clusterAssignmentPhase centroids points oldNewCentroids = newCentroidPhase assignments newCentroids = map snd oldNewCentroids in if shouldStop oldNewCentroids threshold then (newCentroids, steps) else kMeans' newCentroids points (steps+1) threshold
427
kMeans' :: (Vector v, Vectorizable e v) => [v] -> [e] -> Int -> Double -> ([v], Int) kMeans' centroids points steps threshold = let assignments = clusterAssignmentPhase centroids points oldNewCentroids = newCentroidPhase assignments newCentroids = map snd oldNewCentroids in if shouldStop oldNewCentroids threshold then (newCentroids, steps) else kMeans' newCentroids points (steps+1) threshold
427
kMeans' centroids points steps threshold = let assignments = clusterAssignmentPhase centroids points oldNewCentroids = newCentroidPhase assignments newCentroids = map snd oldNewCentroids in if shouldStop oldNewCentroids threshold then (newCentroids, steps) else kMeans' newCentroids points (steps+1) threshold
342
false
true
0
11
85
145
73
72
null
null
denibertovic/haskell
kubernetes/lib/Kubernetes/OpenAPI/ModelLens.hs
bsd-3-clause
-- | 'v1VolumePortworxVolume' Lens v1VolumePortworxVolumeL :: Lens_' V1Volume (Maybe V1PortworxVolumeSource) v1VolumePortworxVolumeL f V1Volume{..} = (\v1VolumePortworxVolume -> V1Volume { v1VolumePortworxVolume, ..} ) <$> f v1VolumePortworxVolume
247
v1VolumePortworxVolumeL :: Lens_' V1Volume (Maybe V1PortworxVolumeSource) v1VolumePortworxVolumeL f V1Volume{..} = (\v1VolumePortworxVolume -> V1Volume { v1VolumePortworxVolume, ..} ) <$> f v1VolumePortworxVolume
212
v1VolumePortworxVolumeL f V1Volume{..} = (\v1VolumePortworxVolume -> V1Volume { v1VolumePortworxVolume, ..} ) <$> f v1VolumePortworxVolume
138
true
true
1
8
23
61
30
31
null
null
mboes/vCard
Text/VCard/Query.hs
lgpl-3.0
-- | Analog to |Data.List.lookup|. In general an attribute may map to a number -- of values. vCards should maintain the invariant that @forall attr, lookup -- attr vcard /= Just []@. lookup :: I.ByteString -> VCard -> Maybe [VCardValue] lookup typ vcard = fmap (Prelude.map D.prop_value) $ Map.lookup typ (vcard_properties vcard)
333
lookup :: I.ByteString -> VCard -> Maybe [VCardValue] lookup typ vcard = fmap (Prelude.map D.prop_value) $ Map.lookup typ (vcard_properties vcard)
150
lookup typ vcard = fmap (Prelude.map D.prop_value) $ Map.lookup typ (vcard_properties vcard)
96
true
true
0
9
55
65
33
32
null
null
ml9951/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
96
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
96
quotRemIntegerName = varQual gHC_INTEGER_TYPE (fsLit "quotRemInteger") quotRemIntegerIdKey
96
false
false
0
7
12
19
9
10
null
null
crogers1/manager
xenmgr/XenMgr/Config.hs
gpl-2.0
-- Is autostart function active (by default it is) appAutoStart :: Rpc Bool appAutoStart = do dbMaybeRead "/xenmgr/autostart" >>= f where f Nothing = return True f (Just v) = return v
236
appAutoStart :: Rpc Bool appAutoStart = do dbMaybeRead "/xenmgr/autostart" >>= f where f Nothing = return True f (Just v) = return v
185
appAutoStart = do dbMaybeRead "/xenmgr/autostart" >>= f where f Nothing = return True f (Just v) = return v
160
true
true
0
9
84
55
26
29
null
null
tittoassini/flat
test/Spec.hs
bsd-3-clause
-- take n $ cycle ['a'..'z'] csb = map (fromIntegral . ord) . cs
65
csb = map (fromIntegral . ord) . cs
35
csb = map (fromIntegral . ord) . cs
35
true
false
1
7
14
25
11
14
null
null
stephenpascoe/mongo-sql
src/Transfuser/Mongo/Encoder.hs
bsd-3-clause
-- TODO : merge fields -- TODO : gather fields with same name to make $all claues {- aesonify (OpALL field array) = mkOp "$all" field (Array array) -} -- | Convert a BSON value into an Aeson value -- TODO : This function is not total. Deprecated, just use until we move to JSON parser aesonifyValue :: DocValue -> A.Value aesonifyValue (B.Float f) = toJSON f
360
aesonifyValue :: DocValue -> A.Value aesonifyValue (B.Float f) = toJSON f
73
aesonifyValue (B.Float f) = toJSON f
36
true
true
0
7
68
40
21
19
null
null
mrd/camfort
src/Camfort/Specification/Stencils/InferenceFrontend.hs
apache-2.0
isArraySubscript _ = Nothing
28
isArraySubscript _ = Nothing
28
isArraySubscript _ = Nothing
28
false
false
0
5
3
9
4
5
null
null
CharlesRandles/cryptoChallenge
decryptxor.hs
gpl-3.0
candidates :: Int -> [Key] candidates n = map fromText [replicate n c | c <- ['a'..'z']++['A'..'Z']++['0'..'9']]
112
candidates :: Int -> [Key] candidates n = map fromText [replicate n c | c <- ['a'..'z']++['A'..'Z']++['0'..'9']]
112
candidates n = map fromText [replicate n c | c <- ['a'..'z']++['A'..'Z']++['0'..'9']]
85
false
true
0
11
16
70
35
35
null
null
nushio3/ghc
compiler/prelude/PrelNames.hs
bsd-3-clause
-- Base strings Strings unpackCStringName, unpackCStringFoldrName, unpackCStringUtf8Name, eqStringName :: Name unpackCStringName = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
204
unpackCStringName, unpackCStringFoldrName, unpackCStringUtf8Name, eqStringName :: Name unpackCStringName = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
180
unpackCStringName = varQual gHC_CSTRING (fsLit "unpackCString#") unpackCStringIdKey
89
true
true
0
7
26
31
19
12
null
null
forked-upstream-packages-for-ghcjs/ghc
compiler/codeGen/StgCmmPrim.hs
bsd-3-clause
translateOp dflags Double2IntOp = Just (MO_FS_Conv W64 (wordWidth dflags))
76
translateOp dflags Double2IntOp = Just (MO_FS_Conv W64 (wordWidth dflags))
76
translateOp dflags Double2IntOp = Just (MO_FS_Conv W64 (wordWidth dflags))
76
false
false
0
9
10
28
13
15
null
null
splondike/depcache
src/Program.hs
gpl-3.0
printSummary logger results = logger Info summary where summary = concat [ "Processed " ++ (show totalResults) ++ " files, ", (show successCount) ++ " " ++ (wereWas successCount) ++ " successful and ", (show failureCount) ++ " " ++ (wereWas failureCount) ++ " not." ] totalResults = length results failureCount = length $ filter isFailureResult results successCount = totalResults - failureCount isFailureResult R.Ok = False isFailureResult _ = True wereWas count = if count == 1 then "was" else "were"
617
printSummary logger results = logger Info summary where summary = concat [ "Processed " ++ (show totalResults) ++ " files, ", (show successCount) ++ " " ++ (wereWas successCount) ++ " successful and ", (show failureCount) ++ " " ++ (wereWas failureCount) ++ " not." ] totalResults = length results failureCount = length $ filter isFailureResult results successCount = totalResults - failureCount isFailureResult R.Ok = False isFailureResult _ = True wereWas count = if count == 1 then "was" else "were"
617
printSummary logger results = logger Info summary where summary = concat [ "Processed " ++ (show totalResults) ++ " files, ", (show successCount) ++ " " ++ (wereWas successCount) ++ " successful and ", (show failureCount) ++ " " ++ (wereWas failureCount) ++ " not." ] totalResults = length results failureCount = length $ filter isFailureResult results successCount = totalResults - failureCount isFailureResult R.Ok = False isFailureResult _ = True wereWas count = if count == 1 then "was" else "were"
617
false
false
6
13
195
170
85
85
null
null
alexander-at-github/eta
compiler/ETA/DeSugar/DsForeign.hs
bsd-3-clause
getPrimTyOf :: Type -> UnaryType getPrimTyOf ty | UnaryRep repTy <- repType ty = if isBoolTy repTy then jboolPrimTy else case splitDataProductType_maybe repTy of Just (_, _, _, [primTy]) -> primTy _ -> pprPanic "DsForeign.getPrimTyOf" $ ppr ty
279
getPrimTyOf :: Type -> UnaryType getPrimTyOf ty | UnaryRep repTy <- repType ty = if isBoolTy repTy then jboolPrimTy else case splitDataProductType_maybe repTy of Just (_, _, _, [primTy]) -> primTy _ -> pprPanic "DsForeign.getPrimTyOf" $ ppr ty
279
getPrimTyOf ty | UnaryRep repTy <- repType ty = if isBoolTy repTy then jboolPrimTy else case splitDataProductType_maybe repTy of Just (_, _, _, [primTy]) -> primTy _ -> pprPanic "DsForeign.getPrimTyOf" $ ppr ty
246
false
true
0
12
73
92
45
47
null
null
shlevy/ghc
compiler/types/TyCoRep.hs
bsd-3-clause
tidyTypes :: TidyEnv -> [Type] -> [Type] tidyTypes env tys = map (tidyType env) tys
83
tidyTypes :: TidyEnv -> [Type] -> [Type] tidyTypes env tys = map (tidyType env) tys
83
tidyTypes env tys = map (tidyType env) tys
42
false
true
0
9
14
47
22
25
null
null
chip2n/tin172-project
haskell/src/Shrdlite/AmbiguityResolver.hs
gpl-3.0
showObjectHelper sEq cEq ((Object size color form):rest) = "the " ++ sString ++ cString ++ show form ++ " or " ++ showObjectHelper sEq cEq rest where sString = if sEq then "" else show size ++ " " cString = if cEq then "" else show color ++ " "
329
showObjectHelper sEq cEq ((Object size color form):rest) = "the " ++ sString ++ cString ++ show form ++ " or " ++ showObjectHelper sEq cEq rest where sString = if sEq then "" else show size ++ " " cString = if cEq then "" else show color ++ " "
329
showObjectHelper sEq cEq ((Object size color form):rest) = "the " ++ sString ++ cString ++ show form ++ " or " ++ showObjectHelper sEq cEq rest where sString = if sEq then "" else show size ++ " " cString = if cEq then "" else show color ++ " "
329
false
false
0
9
135
102
52
50
null
null
mgsloan/slogger
TypedData.hs
bsd-3-clause
unStripTypeRep :: TypeRep -> Ty.TypeRep unStripTypeRep (TypeRep tyCon args) = Ty.mkTyConApp (unStripTyCon tyCon) (map unStripTypeRep args)
190
unStripTypeRep :: TypeRep -> Ty.TypeRep unStripTypeRep (TypeRep tyCon args) = Ty.mkTyConApp (unStripTyCon tyCon) (map unStripTypeRep args)
190
unStripTypeRep (TypeRep tyCon args) = Ty.mkTyConApp (unStripTyCon tyCon) (map unStripTypeRep args)
150
false
true
0
7
67
49
24
25
null
null
dan-t/Gamgine
Gamgine/Utils.hs
bsd-3-clause
word :: Word8 -> Word8 -> Word8 -> Word8 -> Word32 word a b c d = (fromIntegral a `shiftL` 24) .|. (fromIntegral b `shiftL` 16) .|. (fromIntegral c `shiftL` 8) .|. (fromIntegral d )
242
word :: Word8 -> Word8 -> Word8 -> Word8 -> Word32 word a b c d = (fromIntegral a `shiftL` 24) .|. (fromIntegral b `shiftL` 16) .|. (fromIntegral c `shiftL` 8) .|. (fromIntegral d )
242
word a b c d = (fromIntegral a `shiftL` 24) .|. (fromIntegral b `shiftL` 16) .|. (fromIntegral c `shiftL` 8) .|. (fromIntegral d )
191
false
true
3
10
95
102
52
50
null
null
ejlilley/AbstractMusic
Music.hs
gpl-3.0
foldPhrase1 _ _ = error "Exhausted patterns in foldPhrase1"
59
foldPhrase1 _ _ = error "Exhausted patterns in foldPhrase1"
59
foldPhrase1 _ _ = error "Exhausted patterns in foldPhrase1"
59
false
false
1
5
8
15
6
9
null
null
pegurnee/2015-01-341
projects/project4_mini_haskell/haskell_mini_project.hs
mit
-- 2 -- sum' :: (Num a) => [a] -> a sum' [] = 0
47
sum' :: (Num a) => [a] -> a sum' [] = 0
39
sum' [] = 0
11
true
true
0
7
14
33
18
15
null
null
nevrenato/HetsAlloy
CASL/CCC/FreeTypes.hs
gpl-2.0
recoverSortsAndConstructors :: [Named (FORMULA f)] -> [Named (FORMULA f)] -> (Set.Set SORT, [OP_SYMB]) recoverSortsAndConstructors osens fsn = let (srts, cons, _) = unzip3 . map recover_Sort_gen_ax . constraintOfAxiom . getFs $ osens ++ fsn in (Set.unions $ map Set.fromList srts, nubOrd $ concat cons)
312
recoverSortsAndConstructors :: [Named (FORMULA f)] -> [Named (FORMULA f)] -> (Set.Set SORT, [OP_SYMB]) recoverSortsAndConstructors osens fsn = let (srts, cons, _) = unzip3 . map recover_Sort_gen_ax . constraintOfAxiom . getFs $ osens ++ fsn in (Set.unions $ map Set.fromList srts, nubOrd $ concat cons)
312
recoverSortsAndConstructors osens fsn = let (srts, cons, _) = unzip3 . map recover_Sort_gen_ax . constraintOfAxiom . getFs $ osens ++ fsn in (Set.unions $ map Set.fromList srts, nubOrd $ concat cons)
207
false
true
0
14
53
134
67
67
null
null
steve-chavez/postgrest
test/Feature/NonexistentSchemaSpec.hs
mit
spec :: SpecWith ((), Application) spec = describe "Non existent api schema" $ do it "succeeds when requesting root path" $ get "/" `shouldRespondWith` 200 it "gives 404 when requesting a nonexistent table in this nonexistent schema" $ get "/nonexistent_table" `shouldRespondWith` 404
307
spec :: SpecWith ((), Application) spec = describe "Non existent api schema" $ do it "succeeds when requesting root path" $ get "/" `shouldRespondWith` 200 it "gives 404 when requesting a nonexistent table in this nonexistent schema" $ get "/nonexistent_table" `shouldRespondWith` 404
307
spec = describe "Non existent api schema" $ do it "succeeds when requesting root path" $ get "/" `shouldRespondWith` 200 it "gives 404 when requesting a nonexistent table in this nonexistent schema" $ get "/nonexistent_table" `shouldRespondWith` 404
272
false
true
0
10
64
73
34
39
null
null
JamesSullivan1/Mpp
src/MppCodeGen.hs
mit
gen_exprs (e:es) = gen_expr e ++ gen_exprs es
54
gen_exprs (e:es) = gen_expr e ++ gen_exprs es
54
gen_exprs (e:es) = gen_expr e ++ gen_exprs es
54
false
false
2
7
16
27
12
15
null
null
susisu/Dolce
src/VM.hs
mit
runOperation NullOperation _ = finish
41
runOperation NullOperation _ = finish
41
runOperation NullOperation _ = finish
41
false
false
0
5
8
13
5
8
null
null
mettekou/ghc
compiler/coreSyn/CoreSyn.hs
bsd-3-clause
-- | 'bindersOf' applied to a list of binding groups bindersOfBinds :: [Bind b] -> [b] bindersOfBinds binds = foldr ((++) . bindersOf) [] binds
143
bindersOfBinds :: [Bind b] -> [b] bindersOfBinds binds = foldr ((++) . bindersOf) [] binds
90
bindersOfBinds binds = foldr ((++) . bindersOf) [] binds
56
true
true
0
8
24
52
26
26
null
null
goshakkk/hadis
src/Hadis/Commands/Strings.hs
mit
append :: Key -> String -> CommandReply append k v = strState k $ alterStr (++v) (ReplyInt . length) k
102
append :: Key -> String -> CommandReply append k v = strState k $ alterStr (++v) (ReplyInt . length) k
102
append k v = strState k $ alterStr (++v) (ReplyInt . length) k
62
false
true
0
8
19
54
26
28
null
null
chrisnc/tangaroa
src/Network/Tangaroa/Timer.hs
bsd-3-clause
resetElectionTimer :: Raft nt et rt mt () resetElectionTimer = do timeout <- getNewElectionTimeout setTimedEvent (ElectionTimeout $ show (timeout `div` 1000) ++ "ms") timeout
178
resetElectionTimer :: Raft nt et rt mt () resetElectionTimer = do timeout <- getNewElectionTimeout setTimedEvent (ElectionTimeout $ show (timeout `div` 1000) ++ "ms") timeout
178
resetElectionTimer = do timeout <- getNewElectionTimeout setTimedEvent (ElectionTimeout $ show (timeout `div` 1000) ++ "ms") timeout
136
false
true
1
14
27
69
31
38
null
null
ghcjs/ghcjs
src/Gen2/Prim.hs
mit
-- Parallelism genPrim _ _ ParOp [r] [_a] = PrimInline $ r |= 0
64
genPrim _ _ ParOp [r] [_a] = PrimInline $ r |= 0
48
genPrim _ _ ParOp [r] [_a] = PrimInline $ r |= 0
48
true
false
0
6
14
32
17
15
null
null
oldmanmike/ghc
compiler/deSugar/DsBinds.hs
bsd-3-clause
dsEvTerm (EvCast tm co) = do { tm' <- dsEvTerm tm ; return $ mkCastDs tm' co }
87
dsEvTerm (EvCast tm co) = do { tm' <- dsEvTerm tm ; return $ mkCastDs tm' co }
87
dsEvTerm (EvCast tm co) = do { tm' <- dsEvTerm tm ; return $ mkCastDs tm' co }
87
false
false
0
8
26
43
20
23
null
null
rednum/hmlk
Hmlk/DataSet.hs
bsd-3-clause
dumpData' DataSet {_rows = r, _names' = n} = unlines $ header:(replicate (length header) '-'):datas where paddingSize = 16 --fixme padding x = (replicate (paddingSize - length x + 1) ' ') ++ x ++ " |" header = unwords . map padding $ n datas = [unwords . map (padding . showAttribute) $ x | (_, x) <- toList r] showAttribute (Numeric n) = show n showAttribute (Nominal n) = n showAttribute (Boolean n) = show n showAttribute Missing = "?"
510
dumpData' DataSet {_rows = r, _names' = n} = unlines $ header:(replicate (length header) '-'):datas where paddingSize = 16 --fixme padding x = (replicate (paddingSize - length x + 1) ' ') ++ x ++ " |" header = unwords . map padding $ n datas = [unwords . map (padding . showAttribute) $ x | (_, x) <- toList r] showAttribute (Numeric n) = show n showAttribute (Nominal n) = n showAttribute (Boolean n) = show n showAttribute Missing = "?"
510
dumpData' DataSet {_rows = r, _names' = n} = unlines $ header:(replicate (length header) '-'):datas where paddingSize = 16 --fixme padding x = (replicate (paddingSize - length x + 1) ' ') ++ x ++ " |" header = unwords . map padding $ n datas = [unwords . map (padding . showAttribute) $ x | (_, x) <- toList r] showAttribute (Numeric n) = show n showAttribute (Nominal n) = n showAttribute (Boolean n) = show n showAttribute Missing = "?"
510
false
false
5
12
153
234
109
125
null
null
HJvT/hdirect
src/Parser.hs
bsd-3-clause
action_469 (114#) = happyGoto action_194
40
action_469 (114#) = happyGoto action_194
40
action_469 (114#) = happyGoto action_194
40
false
false
0
6
4
15
7
8
null
null
sapek/pandoc
src/Text/Pandoc/Writers/Textile.hs
gpl-2.0
blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) = return $ "<pre" ++ classes' ++ ">\n" ++ escapeStringForXML str ++ "\n</pre>\n" where classes' = if null classes then "" else " class=\"" ++ unwords classes ++ "\""
310
blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) = return $ "<pre" ++ classes' ++ ">\n" ++ escapeStringForXML str ++ "\n</pre>\n" where classes' = if null classes then "" else " class=\"" ++ unwords classes ++ "\""
310
blockToTextile _ (CodeBlock (_,classes,_) str) | any (all isSpace) (lines str) = return $ "<pre" ++ classes' ++ ">\n" ++ escapeStringForXML str ++ "\n</pre>\n" where classes' = if null classes then "" else " class=\"" ++ unwords classes ++ "\""
310
false
false
0
10
105
103
51
52
null
null
ssaavedra/liquidhaskell
benchmarks/hmatrix-0.15.0.1/lib/Numeric/LinearAlgebra/LAPACK.hs
bsd-3-clause
-- | Matrix product based on BLAS's /sgemm/. multiplyF :: Matrix Float -> Matrix Float -> Matrix Float multiplyF a b = multiplyAux sgemmc "sgemmc" a b
150
multiplyF :: Matrix Float -> Matrix Float -> Matrix Float multiplyF a b = multiplyAux sgemmc "sgemmc" a b
105
multiplyF a b = multiplyAux sgemmc "sgemmc" a b
47
true
true
0
8
26
47
21
26
null
null
ThorntheLetter/wavestimation
haskell/Wavestimation.hs
mit
-- compsToWave :: Result -> [Wave] -> Wave -- compsToWave ms cs = -- do -- let compsList = zipWith multComp ms cs -- addComps (replicate (length compsList) 0) compsList -- multComp :: Double -> Wave -> Wave -- multComp k w = map ((*) k) w -- addComps :: Wave -> [Wave] -> Wave -- addComps base [] = base -- addComps base (w:ws) = addComps (zipWith (+) base w) ws compsToWave :: Result -> Matrix R -> Wave compsToWave weights components = components #> weights
474
compsToWave :: Result -> Matrix R -> Wave compsToWave weights components = components #> weights
96
compsToWave weights components = components #> weights
54
true
true
0
8
101
47
26
21
null
null
li-zhirui/JSAnalyzer
JSParser.hs
mit
pBreakStatement :: Parser JSStatement pBreakStatement = positionStatement pBreakStatementContent
97
pBreakStatement :: Parser JSStatement pBreakStatement = positionStatement pBreakStatementContent
97
pBreakStatement = positionStatement pBreakStatementContent
59
false
true
1
5
8
20
8
12
null
null
mettekou/ghc
compiler/prelude/TysWiredIn.hs
bsd-3-clause
cTupleDataConNames :: [Name] cTupleDataConNames = map cTupleDataConName (0 : [2..mAX_CTUPLE_SIZE])
98
cTupleDataConNames :: [Name] cTupleDataConNames = map cTupleDataConName (0 : [2..mAX_CTUPLE_SIZE])
98
cTupleDataConNames = map cTupleDataConName (0 : [2..mAX_CTUPLE_SIZE])
69
false
true
0
8
9
31
17
14
null
null
tibbe/ghc
libraries/base/Data/Data.hs
bsd-3-clause
ratioConstr :: Constr ratioConstr = mkConstr ratioDataType ":%" [] Infix
72
ratioConstr :: Constr ratioConstr = mkConstr ratioDataType ":%" [] Infix
72
ratioConstr = mkConstr ratioDataType ":%" [] Infix
50
false
true
0
6
9
29
12
17
null
null
grscheller/scheller-linux-archive
grok/Haskell/pythag-triples/drivers/pythagTriples.hs
bsd-3-clause
triplesOrdered2 :: Int -> [Triple] triplesOrdered2 num = take num pythagTriplesOrdered2
87
triplesOrdered2 :: Int -> [Triple] triplesOrdered2 num = take num pythagTriplesOrdered2
87
triplesOrdered2 num = take num pythagTriplesOrdered2
52
false
true
0
6
10
26
13
13
null
null
randen/cabal
Cabal/Distribution/InstalledPackageInfo.hs
bsd-3-clause
deprecatedFieldDescrs :: [FieldDescr InstalledPackageInfo] deprecatedFieldDescrs = [ listField "hugs-options" showToken parseTokenQ (const []) (const id) ]
194
deprecatedFieldDescrs :: [FieldDescr InstalledPackageInfo] deprecatedFieldDescrs = [ listField "hugs-options" showToken parseTokenQ (const []) (const id) ]
194
deprecatedFieldDescrs = [ listField "hugs-options" showToken parseTokenQ (const []) (const id) ]
135
false
true
0
10
54
52
24
28
null
null
AlexeyRaga/eta
compiler/ETA/Prelude/PrimOp.hs
bsd-3-clause
tagOf_PrimOp ReadJBooleanArrayOp = _ILIT(1117)
46
tagOf_PrimOp ReadJBooleanArrayOp = _ILIT(1117)
46
tagOf_PrimOp ReadJBooleanArrayOp = _ILIT(1117)
46
false
false
0
6
3
16
7
9
null
null
sgillespie/ghc
compiler/types/CoAxiom.hs
bsd-3-clause
toUnbranched :: Branches br -> Branches Unbranched toUnbranched (MkBranches arr) = ASSERT( bounds arr == (0,0) ) MkBranches arr
159
toUnbranched :: Branches br -> Branches Unbranched toUnbranched (MkBranches arr) = ASSERT( bounds arr == (0,0) ) MkBranches arr
159
toUnbranched (MkBranches arr) = ASSERT( bounds arr == (0,0) ) MkBranches arr
108
false
true
0
8
50
53
26
27
null
null
mlitchard/lambdaweb.com-content
blog/getposts.hs
bsd-2-clause
grab m (daytime, href, titleBS) = runResourceT $ do let title = decodeUtf8 titleBS let slug = snd $ T.breakOnEnd "/" $ decodeUtf8 href let mutc = parseTime defaultTimeLocale "%B %e, %Y %l:%M %P" $ S8.unpack daytime utc <- case mutc of Nothing -> error $ "Invalid timestamp: " ++ show daytime Just utc -> return utc let (year, month, _) = toGregorian $ utctDay utc let fp = F.decodeString (show year) F.</> F.decodeString (show month) F.</> F.fromText slug F.<.> "html" liftIO $ F.createTree $ F.directory fp req <- parseUrl $ S8.unpack href Response _ _ body <- http req m x <- body $$ tokenStream =$ dropWhile' (not . isAvatar) =$ takeWhile' (not . isDisqus) =$ CL.consume author <- case x of TagOpen "img" as _:_ -> case lookup "src" as of Just src -> case src of "http://www.gravatar.com/avatar/bad65d3d7319025d73e065d7a29ee22a?s=100&amp;d=identicon" -> return "greg" "http://www.gravatar.com/avatar/71596bb1ca3ba3aa4400c3f407baec9f?s=100&amp;d=identicon" -> return "michael" _ -> error $ "Unknown author: " ++ show src Nothing -> error "Unknown author" _ -> error "Unknown author" let content = encode $ drop 1 $ dropWhile (not . isScriptClose) x liftIO $ S8.writeFile (F.encodeString fp) content return $ Post utc author (replace title) fp where isAvatar (TagOpen "img" as _) = lookup "alt" as == Just "Avatar" isAvatar _ = False isScriptClose (TagClose "script") = True isScriptClose _ = False isArticleClose (TagClose "article") = True isArticleClose _ = False isDisqus (TagOpen "div" [("id", "disqus")] _) = True isDisqus _ = False replace = T.replace "&#39;" "'" . T.replace "&quot;" "\"" . T.replace "&amp;" "&" . T.replace "&lt;" "<" . T.replace "&gt;" ">"
2,101
grab m (daytime, href, titleBS) = runResourceT $ do let title = decodeUtf8 titleBS let slug = snd $ T.breakOnEnd "/" $ decodeUtf8 href let mutc = parseTime defaultTimeLocale "%B %e, %Y %l:%M %P" $ S8.unpack daytime utc <- case mutc of Nothing -> error $ "Invalid timestamp: " ++ show daytime Just utc -> return utc let (year, month, _) = toGregorian $ utctDay utc let fp = F.decodeString (show year) F.</> F.decodeString (show month) F.</> F.fromText slug F.<.> "html" liftIO $ F.createTree $ F.directory fp req <- parseUrl $ S8.unpack href Response _ _ body <- http req m x <- body $$ tokenStream =$ dropWhile' (not . isAvatar) =$ takeWhile' (not . isDisqus) =$ CL.consume author <- case x of TagOpen "img" as _:_ -> case lookup "src" as of Just src -> case src of "http://www.gravatar.com/avatar/bad65d3d7319025d73e065d7a29ee22a?s=100&amp;d=identicon" -> return "greg" "http://www.gravatar.com/avatar/71596bb1ca3ba3aa4400c3f407baec9f?s=100&amp;d=identicon" -> return "michael" _ -> error $ "Unknown author: " ++ show src Nothing -> error "Unknown author" _ -> error "Unknown author" let content = encode $ drop 1 $ dropWhile (not . isScriptClose) x liftIO $ S8.writeFile (F.encodeString fp) content return $ Post utc author (replace title) fp where isAvatar (TagOpen "img" as _) = lookup "alt" as == Just "Avatar" isAvatar _ = False isScriptClose (TagClose "script") = True isScriptClose _ = False isArticleClose (TagClose "article") = True isArticleClose _ = False isDisqus (TagOpen "div" [("id", "disqus")] _) = True isDisqus _ = False replace = T.replace "&#39;" "'" . T.replace "&quot;" "\"" . T.replace "&amp;" "&" . T.replace "&lt;" "<" . T.replace "&gt;" ">"
2,101
grab m (daytime, href, titleBS) = runResourceT $ do let title = decodeUtf8 titleBS let slug = snd $ T.breakOnEnd "/" $ decodeUtf8 href let mutc = parseTime defaultTimeLocale "%B %e, %Y %l:%M %P" $ S8.unpack daytime utc <- case mutc of Nothing -> error $ "Invalid timestamp: " ++ show daytime Just utc -> return utc let (year, month, _) = toGregorian $ utctDay utc let fp = F.decodeString (show year) F.</> F.decodeString (show month) F.</> F.fromText slug F.<.> "html" liftIO $ F.createTree $ F.directory fp req <- parseUrl $ S8.unpack href Response _ _ body <- http req m x <- body $$ tokenStream =$ dropWhile' (not . isAvatar) =$ takeWhile' (not . isDisqus) =$ CL.consume author <- case x of TagOpen "img" as _:_ -> case lookup "src" as of Just src -> case src of "http://www.gravatar.com/avatar/bad65d3d7319025d73e065d7a29ee22a?s=100&amp;d=identicon" -> return "greg" "http://www.gravatar.com/avatar/71596bb1ca3ba3aa4400c3f407baec9f?s=100&amp;d=identicon" -> return "michael" _ -> error $ "Unknown author: " ++ show src Nothing -> error "Unknown author" _ -> error "Unknown author" let content = encode $ drop 1 $ dropWhile (not . isScriptClose) x liftIO $ S8.writeFile (F.encodeString fp) content return $ Post utc author (replace title) fp where isAvatar (TagOpen "img" as _) = lookup "alt" as == Just "Avatar" isAvatar _ = False isScriptClose (TagClose "script") = True isScriptClose _ = False isArticleClose (TagClose "article") = True isArticleClose _ = False isDisqus (TagOpen "div" [("id", "disqus")] _) = True isDisqus _ = False replace = T.replace "&#39;" "'" . T.replace "&quot;" "\"" . T.replace "&amp;" "&" . T.replace "&lt;" "<" . T.replace "&gt;" ">"
2,101
false
false
43
14
695
609
304
305
null
null
mzini/TcT
source/Tct/Encoding/Polynomial.hs
gpl-3.0
simpPower ((Pow _ n):xs) | n == 0 = simpPower xs
51
simpPower ((Pow _ n):xs) | n == 0 = simpPower xs
51
simpPower ((Pow _ n):xs) | n == 0 = simpPower xs
51
false
false
0
9
13
37
17
20
null
null
sopvop/cabal
Cabal/Distribution/Simple/Utils.hs
bsd-3-clause
-- | Writes a file atomically. -- -- The file is either written successfully or an IO exception is raised and -- the original file is left unchanged. -- -- On windows it is not possible to delete a file that is open by a process. -- This case will give an IO exception but the atomic property is not affected. -- writeFileAtomic :: FilePath -> BS.ByteString -> NoCallStackIO () writeFileAtomic targetPath content = do let (targetDir, targetFile) = splitFileName targetPath Exception.bracketOnError (openBinaryTempFileWithDefaultPermissions targetDir $ targetFile <.> "tmp") (\(tmpPath, handle) -> hClose handle >> removeFile tmpPath) (\(tmpPath, handle) -> do BS.hPut handle content hClose handle renameFile tmpPath targetPath) -- | Write a file but only if it would have new content. If we would be writing -- the same as the existing content then leave the file as is so that we do not -- update the file's modification time. -- -- NB: the file is assumed to be ASCII-encoded.
1,019
writeFileAtomic :: FilePath -> BS.ByteString -> NoCallStackIO () writeFileAtomic targetPath content = do let (targetDir, targetFile) = splitFileName targetPath Exception.bracketOnError (openBinaryTempFileWithDefaultPermissions targetDir $ targetFile <.> "tmp") (\(tmpPath, handle) -> hClose handle >> removeFile tmpPath) (\(tmpPath, handle) -> do BS.hPut handle content hClose handle renameFile tmpPath targetPath) -- | Write a file but only if it would have new content. If we would be writing -- the same as the existing content then leave the file as is so that we do not -- update the file's modification time. -- -- NB: the file is assumed to be ASCII-encoded.
706
writeFileAtomic targetPath content = do let (targetDir, targetFile) = splitFileName targetPath Exception.bracketOnError (openBinaryTempFileWithDefaultPermissions targetDir $ targetFile <.> "tmp") (\(tmpPath, handle) -> hClose handle >> removeFile tmpPath) (\(tmpPath, handle) -> do BS.hPut handle content hClose handle renameFile tmpPath targetPath) -- | Write a file but only if it would have new content. If we would be writing -- the same as the existing content then leave the file as is so that we do not -- update the file's modification time. -- -- NB: the file is assumed to be ASCII-encoded.
641
true
true
0
13
200
151
80
71
null
null