code
stringlengths
5
1.03M
repo_name
stringlengths
5
90
path
stringlengths
4
158
license
stringclasses
15 values
size
int64
5
1.03M
n_ast_errors
int64
0
53.9k
ast_max_depth
int64
2
4.17k
n_whitespaces
int64
0
365k
n_ast_nodes
int64
3
317k
n_ast_terminals
int64
1
171k
n_ast_nonterminals
int64
1
146k
loc
int64
-1
37.3k
cycloplexity
int64
-1
1.31k
module Main where import Test.HUnit (Assertion, (@=?), runTestTT, Test(..), Counts(..)) import System.Exit (ExitCode(..), exitWith) import qualified Data.RevisionsTest as RevisionsTest main :: IO () main = exitProperly $ runTestTT $ TestList [ TestList RevisionsTest.tests ] exitProperly :: IO Counts -> IO ...
AKST/wikit
socket-server/tests/Main.hs
mit
455
0
12
85
163
91
72
11
2
{-# language GeneralizedNewtypeDeriving #-} {-# language RecursiveDo #-} {-# language FlexibleContexts #-} {-# language TupleSections #-} -- | implementation of reduced ordered binary decision diagrams. module OBDD.Data ( -- * the data type OBDD -- abstract , size -- * for external use , null, satisfiable , number...
jwaldmann/haskell-obdd
src/OBDD/Data.hs
gpl-2.0
8,625
0
21
2,965
2,868
1,491
1,377
237
5
{-# LANGUAGE TemplateHaskell #-} module Language.LCC.AST.Translation where import Control.Lens import Text.Parsec (SourcePos) import Language.LCC.AST.Annotation import Language.LCC.AST.Expr import Language.LCC.AST.Path import Language.LCC.AST.Signature data Translation path ret = Translation { _trSig ...
xcv-/LCC
lib/Language/LCC/AST/Translation.hs
gpl-3.0
1,419
0
10
276
384
209
175
-1
-1
{-# LANGUAGE OverloadedStrings , FlexibleContexts #-} module Session where import Imports import Control.Applicative import Control.Monad.Catch import Control.Monad.Reader import Data.TimeMap as TM import qualified Data.Text.Encoding as T import Data.Aeson as A hiding (json) import qualified Crypto.Saltine....
athanclark/happ-store
src/Session.hs
gpl-3.0
2,419
0
12
616
627
338
289
60
2
module Main where import System.Environment import Control.Exception as EX import Data.Char (toUpper) import Data.List (nub) import qualified Data.Vector as V import Board import Piece import DistanceTables strToLocation :: [String] -> [(Int, Int)] strToLocation [] = [] strToLocation str = do let x = read ( he...
joshuaunderwood7/HaskeLinGeom
Main.hs
gpl-3.0
7,213
0
17
1,806
2,133
1,036
1,097
105
6
module Problem012 (answer) where import Primes (factorize) answer :: Int answer = head $ dropWhile (\x -> dn x <= 500) triangulars -- for a number n = prod(p_i^k_i) where p_i^k_i is its prime factorization -- the number of divisor d(n) is prod(k_i + 1) dn :: Int -> Int dn n = product $ map ((+1) . snd) (aggregate (f...
geekingfrog/project-euler
Problem012.hs
gpl-3.0
693
0
11
154
258
148
110
13
3
module Helpers ( mapList , commitTime ) where import Data.Git (Commit, commitAuthor, personTime) import Data.Git.Types (toUTCTime) import Data.Time.Clock (UTCTime) mapList :: ([a] -> b -> [a]) -> [a] -> [b] -> [a] mapList _ baseList [] = baseList mapList f baseList (c:cs) = mapList f (f baseList c)...
cdepillabout/haskell-git-too-many-cherry-picks
Helpers.hs
gpl-3.0
492
0
9
96
170
96
74
11
1
module File where import CNTypes import CN import Vector writeWaveset :: Show a => Waveset a -> FilePath -> IO () writeWaveset set filename = do let dx = show $ wsetDx set dt = show $ wsetDt set x0 = show $ wsetX0 set ws = show $ map fillVec $ wsetWaves set cb =...
KiNaudiz/bachelor
CN/File.hs
gpl-3.0
923
0
15
303
322
164
158
22
1
reverse' :: String -> String -> String reverse' start end = case start of "" -> end start -> reverse' (tail start) ((head start):end) main :: IO () main = do line <- getLine putStrLn $ reverse' line ""
torchhound/projects
haskell/reverseString.hs
gpl-3.0
240
0
12
77
98
48
50
7
2
-- | -- Module : GameKeeper.API -- Copyright : (c) 2012-2015 Brendan Hay <brendan@soundcloud.com> -- License : This Source Code Form is subject to the terms of -- the Mozilla Public License, v. 2.0. -- A copy of the MPL can be found in the LICENSE file or -- you can ...
brendanhay/gamekeeper
src/GameKeeper/API.hs
mpl-2.0
803
0
4
184
79
61
18
8
0
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# L...
romanb/amazonka
amazonka-ec2/gen/Network/AWS/EC2/DeleteVpcPeeringConnection.hs
mpl-2.0
4,725
0
9
947
488
298
190
61
1
module CombinationSpec where import Test.Hspec import Combinations import Data.List (tails, sort) import Test.QuickCheck -- combinations :: Int -> [a] -> [[a]] -- combinations = undefined (~~) a b = f a `shouldBe` f b where f = sort . fmap sort main :: IO () main = hspec $ do describe "Testing combinations" $ d...
ice1000/OI-codes
codewars/authoring/haskell/CombinationsSpec.hs
agpl-3.0
1,352
0
19
291
848
487
361
29
2
{-# LANGUAGE OverloadedStrings #-} module TestTrie(testTrie) where import Test.Tasty import Test.Tasty.QuickCheck import Test.QuickCheck import Data.FixFile import Data.FixFile.Trie import qualified Data.ByteString.Lazy as BS import Data.Function import Data.List hiding (null) import Data.Maybe import Data.Monoid i...
revnull/fixfile
tests/TestTrie.hs
lgpl-3.0
5,387
0
13
1,149
1,876
992
884
120
4
module Polymorphism where data Identity a = Identity a instance Eq a => Eq (Identity a) where (==) (Identity a1) (Identity a2) = a1 == a2
ocozalp/Haskellbook
chapter6/polymorphism.hs
unlicense
149
0
8
37
63
34
29
5
0
module QR.Beam where import Data.Char import Data.Sequence(Seq) import qualified Data.Sequence as S getMinChange :: String -> String getMinChange xs = let inputs = words xs totalDamage = read (head inputs)::Int program = last inputs shootCount = length $ filter (== 'S') program in if shootC...
lihlcnkr/codejam
src/QR/Beam.hs
apache-2.0
1,077
0
11
283
441
235
206
28
2
module Beowulf.Style.Colors where import Beowulf.Style aliceBlue :: ColorT aliceBlue = Hex 0xF0F8FF antiqueWhite :: ColorT antiqueWhite = Hex 0xFAEBD7 aqua :: ColorT aqua = Hex 0x00FFFF aquamarine :: ColorT aquamarine = Hex 0x7FFFD4 azure :: ColorT azure = Hex 0xF0FFFF beige :: ColorT beige = Hex 0xF5F5DC bisque :: C...
jrahm/Beowulf
Beowulf/Style/Colors.hs
bsd-2-clause
6,332
0
5
992
1,832
988
844
282
1
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ViewPatterns #-} module Tests.Transform ( tests ) where import Data.Bits ((.&.), shiftL) import Data.Complex (Complex((:+))) import Data.Functor ((<$>)) import Statistics.Function (with...
00tau/statistics
tests/Tests/Transform.hs
bsd-2-clause
5,615
0
21
1,497
2,227
1,217
1,010
94
1
{-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeOperators #-} module LiuMS where import Control.Monad import Control.Monad.Reader import Control.Monad.Trans.Except import Control.Monad.IO.Class import System.Directory import Data.ByteStrin...
notcome/liu-ms-adult
src/LiuMS.hs
bsd-3-clause
2,373
0
12
452
623
335
288
62
1
----------------------------------------------------------------------------- -- -- Module : Code.Generating.Utils.Syntax.Exp -- Copyright : (c) 2011 Lars Corbijn -- License : BSD-style (see the file /LICENSE) -- -- Maintainer : -- Stability : -- Portability : -- -- | -- -------------------------------...
Laar/CodeGenerating
src/Code/Generating/Utils/Syntax/Exp.hs
bsd-3-clause
1,715
0
9
307
461
288
173
44
1
module SMACCMPilot.GCS.Gateway.ByteString where import Data.ByteString (ByteString) import qualified Data.ByteString as B import Text.Printf import SMACCMPilot.GCS.Gateway.Monad bytestringPad :: Integer -> ByteString -> GW ByteString bytestringPad l bs = if B....
GaloisInc/smaccmpilot-gcs-gateway
SMACCMPilot/GCS/Gateway/ByteString.hs
bsd-3-clause
1,323
0
14
303
404
208
196
26
2
{-# LANGUAGE OverloadedStrings #-} module HStyle.Block.Tests ( tests ) where import Test.Framework (Test, testGroup) import Test.Framework.Providers.HUnit (testCase) import Test.HUnit (Assertion, (@?=)) import qualified Data.Text as T import HStyle.Block tests :: Test tests = testGroup "HStyle.Block.Tests" ...
mightybyte/hstyle
tests/HStyle/Block/Tests.hs
bsd-3-clause
1,079
0
8
233
214
125
89
26
1
-------------------------------------------------------------------------------- {-# LANGUAGE OverloadedStrings #-} module Main ( main ) where -------------------------------------------------------------------------------- import Control.Concurrent (forkIO) import Control.Monad (fo...
mattjbray/super-bomber-elf-haskell
app/Main.hs
bsd-3-clause
5,885
0
23
1,452
1,768
920
848
159
5
-- | -- Navigable tree structure which allow a program to traverse -- up the tree as well as down. -- copied and modified from HXML (<http://www.flightlab.com/~joe/hxml/>) -- module Yuuko.Data.NavTree ( module Yuuko.Data.NavTree , module Yuuko.Data.Tree.NTree.TypeDefs ) where import Yuuko.Data.Tree.NTree....
nfjinjing/yuuko
src/Yuuko/Data/NavTree.hs
bsd-3-clause
3,027
42
12
668
1,002
530
472
49
1
{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} -- {-# LANGUAGE DataKinds #-} -- {-# LANGUAGE TypeOperators #-} module Ivory.Opts.CFG ( callGraphDot -- ** Generate a dot file of the control flow for a program. ,...
Hodapp87/ivory
ivory-opts/src/Ivory/Opts/CFG.hs
bsd-3-clause
15,612
31
18
4,589
4,028
2,139
1,889
298
14
{- Implements the judgement freshTy given in Chapter 5. Also defines the monad Mfresh in which these judgements can be expressed -} module HOCHC.Fresh(freshVar, freshVarx,freshRel,freshTy,freshEnv, Mfresh, lift, runStateT, runFresh) where import HOCHC.DataTypes import Control.Monad (liftM, ap) import Contro...
penteract/HigherOrderHornRefinement
HOCHC/Fresh.hs
bsd-3-clause
1,553
0
15
336
697
366
331
36
1
-- The Compiler Toolkit: configuration switches -- -- Author : Manuel M. T. Chakravarty -- Created: 3 October 95 -- -- Version $Revision: 1.3 $ from $Date: 1999/09/27 08:44:42 $ -- -- Copyright (c) [1995...1999] Manuel M. T. Chakravarty -- -- This library is free software; you can redistribute it and/or -- modif...
mwotton/ctkl
src/Text/CTK/Config.hs
bsd-3-clause
1,591
0
4
315
77
64
13
7
1
module Protocol.PeerSpec (spec) where import Protocol.Peer -- import Protocol.Types import Test.Hspec import qualified Data.ByteString as B -- import qualified Data.ByteString.Char8 as B8 spec :: Spec spec = do describe "buildBitField" $ do it "should build bitfield" $ do -- 1100 1000 => ...
artems/FlashBit
specs/Protocol/PeerSpec.hs
bsd-3-clause
488
0
15
134
128
73
55
10
1
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-} {-| Binary instances for the core datatypes -} module Idris.Core.Binary where import Control.Applicative ((<*>), (<$>)) import Control.Monad (liftM2) import Control.DeepSeq (($!!)) import Data.Binary import Data.Vector.Binary import qualified Data.Text as T import quali...
athanclark/Idris-dev
src/Idris/Core/Binary.hs
bsd-3-clause
25,274
0
19
15,013
7,377
3,264
4,113
616
0
-------------------------------------------------------------------------------- -- | -- Module : Graphics.Rendering.OpenGL.Raw.ARB.VertexAttribBinding -- Copyright : (c) Sven Panne 2015 -- License : BSD3 -- -- Maintainer : Sven Panne <svenpanne@gmail.com> -- Stability : stable -- Portability : port...
phaazon/OpenGLRaw
src/Graphics/Rendering/OpenGL/Raw/ARB/VertexAttribBinding.hs
bsd-3-clause
1,088
0
4
121
82
62
20
16
0
{-# LANGUAGE ViewPatterns, PatternGuards, TupleSections #-} module Input.Set(setStackage, setPlatform, setGHC) where import Control.Applicative import Data.List.Extra setStackage :: IO [String] setStackage = f . lines <$> readFile "input/stackage.txt" where f (x:xs) | Just x <- stripPrefix "constraints:...
ndmitchell/hogle-dead
src/Input/Set.hs
bsd-3-clause
805
0
13
178
287
150
137
18
2
{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} -------...
cchalmers/dense
src/Data/Dense/TH.hs
bsd-3-clause
21,747
11
23
5,797
5,015
2,677
2,338
340
8
import Data.List (unfoldr, reverse) import Data.Char (chr, ord) decToBin :: Int -> String decToBin x = reverse $ unfoldr helper x where helper 0 = Nothing helper x = Just (chr ((ord '0') + (x `mod` 2)), x `div` 2) palindromic xs = xs == reverse xs main = print $ sum $ [ x | x <- [1 .. 999999], palindromic (s...
foreverbell/project-euler-solutions
src/36.hs
bsd-3-clause
355
0
13
79
182
97
85
8
2
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE BangPatterns #-} module Main (main) where import Client.Connection import Control.Concurrent (forkIO, threadDelay) import Control.Concurrent.MVar (newEmptyMVar, takeMVar, putMVar, MVar) import Control.Concurrent.STM (atomical...
nschoe/hpt
src/Main.hs
bsd-3-clause
12,318
32
28
5,002
2,264
1,183
1,081
201
14
module Ghazan.Speed ( ) where
Cortlandd/ConversionFormulas
src/Ghazan/Speed.hs
bsd-3-clause
35
0
3
10
9
6
3
1
0
{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANG...
kadena-io/pact
src-tool/Pact/Analyze/Eval/Numerical.hs
bsd-3-clause
6,973
0
15
1,769
1,846
916
930
160
6
{-- snippet lend --} lend amount balance = let reserve = 100 newBalance = balance - amount in if balance < reserve then Nothing else Just newBalance {-- /snippet lend --} {-- snippet lend2 --} lend2 amount balance = if...
binesiyu/ifl
examples/ch03/Lending.hs
mit
776
0
9
324
162
84
78
16
2
{-# OPTIONS_GHC -Wno-missing-import-lists #-} -- | Optional parameters for actions. module Strive.Options ( module Strive.Options.Activities , module Strive.Options.Athletes , module Strive.Options.Authentication , module Strive.Options.Clubs , module Strive.Options.Comments , module Strive.Options.Friends...
tfausak/strive
source/library/Strive/Options.hs
mit
776
0
5
88
140
97
43
22
0
{-# LANGUAGE OverloadedStrings #-} module Ketchup.Auth ( basicAuth ) where import qualified Data.ByteString.Char8 as B import qualified Data.ByteString.Base64 as B64 import Ketchup.Httpd import Ketchup.Utils -- |Performs HTTP Basic Auth basicAuth :: [(B.ByteString, B.ByteString)] -- ^...
silverweed/ketchup
Ketchup/Auth.hs
mit
1,333
0
11
471
288
162
126
28
3
module Lamdu.GUI.Expr.InjectEdit ( make, makeNullary ) where import qualified Control.Lens as Lens import GUI.Momentu ((/|/)) import qualified GUI.Momentu as M import qualified GUI.Momentu.EventMap as E import qualified GUI.Momentu.I18N as MomentuTexts import GUI.Momentu.Responsive (Respons...
lamdu/lamdu
src/Lamdu/GUI/Expr/InjectEdit.hs
gpl-3.0
5,025
0
19
1,270
1,427
769
658
-1
-1
{-# LANGUAGE TemplateHaskell #-} {-| This module defines the type constraint closure operation. -} module Language.K3.TypeSystem.Closure ( calculateClosure ) where import Control.Monad import qualified Data.Map as Map import qualified Data.Set as Set import Language.K3.Utils.Pretty import Language.K3.TypeSystem.Da...
DaMSL/K3
src/Language/K3/TypeSystem/Closure.hs
apache-2.0
7,097
0
18
1,399
1,958
988
970
137
7
{- Copyright 2013 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in ...
mzero/plush
src/Plush/Job/StdIO.hs
apache-2.0
3,591
0
10
713
641
337
304
66
1
{-# OPTIONS -fglasgow-exts #-} ----------------------------------------------------------------------------- {-| Program : ashellogl.hs Copyright : (c) David Harley 2010 Project : qtHaskell Version : 1.1.4 Modified : 2010-09-02 17:02:43 Warning : this file is machine generated - do not...
uduki/hsQt
examples/ashellogl.hs
bsd-2-clause
10,811
0
18
2,526
4,096
1,997
2,099
311
3
{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-} -- | -- Module : Statistics.Distribution.FDistribution -- Copyright : (c) 2011 Aleksey Khudyakov -- License : BSD3 -- -- Maintainer : bos@serpentine.com -- Stability : experimental -- Portability : portable -- -- Fisher F distribution module Statistics.Distribu...
fpco/statistics
Statistics/Distribution/FDistribution.hs
bsd-2-clause
3,389
0
17
869
1,193
619
574
80
1
{-# LANGUAGE DeriveDataTypeable #-} module Network.Bluetooth.Exception (BluetoothException(..)) where import Control.Exception import Data.Typeable import Network.Bluetooth.Protocol data BluetoothException = BluetoothPortException BluetoothProtocol BluetoothPort deriving Typeable instance Show BluetoothException w...
bneijt/bluetooth
src/Network/Bluetooth/Exception.hs
bsd-3-clause
654
0
8
90
132
69
63
11
0
{-# LANGUAGE GeneralizedNewtypeDeriving #-} -- | Server and client game state types and operations. module Game.LambdaHack.Client.State ( StateClient(..), defStateClient, defaultHistory , updateTarget, getTarget, updateLeader, sside , PathEtc, TgtMode(..), RunParams(..), LastRecord, EscAI(..) , toggleMarkVision...
Concomitant/LambdaHack
Game/LambdaHack/Client/State.hs
bsd-3-clause
10,273
0
14
2,968
2,247
1,249
998
-1
-1
-- Copyright (c) 2015 Eric McCorkle. All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions -- are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditi...
emc2/saltlang
src/salt/Control/Monad/TypeErrors/Class.hs
bsd-3-clause
3,765
0
12
1,051
274
166
108
23
0
-- Utility functions for dealing with the conversion of Output to Xml module Util.Xml.Output ( outputToXmlString, stringToXmlString, xmlStringToOutput ) where import qualified Util.Xml.OutputDTD as X import qualified Autolib.Output as O import Text.XML.HaXml hiding (o, txt) import Text.XML.HaXml.Pretty im...
Erdwolf/autotool-bonn
server/src/Util/Xml/Output.hs
gpl-2.0
3,955
0
17
1,035
1,456
743
713
95
13
#if __GLASGOW_HASKELL__ >= 701 {-# LANGUAGE Safe #-} #endif -- | Produces XHTML 1.0 Frameset. module Text.XHtml.Frameset ( -- * Data types Html, HtmlAttr, -- * Classes HTML(..), ADDATTRS(..), CHANGEATTRS(..), -- * Primitives and basic combinators (<<), concatHtml, (+++), noHtml, isN...
DavidAlphaFox/ghc
libraries/xhtml/Text/XHtml/Frameset.hs
bsd-3-clause
1,920
0
6
352
280
186
94
30
1
-- | -- Module : $Header$ -- Copyright : (c) 2013-2015 Galois, Inc. -- License : BSD3 -- Maintainer : cryptol@galois.com -- Stability : provisional -- Portability : portable {-# LANGUAGE PatternGuards #-} module Cryptol.TypeCheck ( tcModule , tcExpr , tcDecls , InferInput(..) , InferOutpu...
iblumenfeld/cryptol
src/Cryptol/TypeCheck.hs
bsd-3-clause
3,563
0
21
1,516
889
482
407
80
5
module PackageTests.BuildDeps.InternalLibrary1.Check where import PackageTests.PackageTester import System.FilePath import Test.HUnit suite :: FilePath -> Test suite ghcPath = TestCase $ do let spec = PackageSpec ("PackageTests" </> "BuildDeps" </> "InternalLibrary1") [] result <- cabal_build spec ghcPath ...
jwiegley/ghc-release
libraries/Cabal/cabal/tests/PackageTests/BuildDeps/InternalLibrary1/Check.hs
gpl-3.0
350
0
14
52
89
46
43
9
1
{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilyDependencies #-} {-# LANGUAGE DataKinds, PolyKinds #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} module T14369...
sdiehl/ghc
testsuite/tests/indexed-types/should_fail/T14369.hs
bsd-3-clause
808
1
11
157
247
132
115
-1
-1
-- (c) The University of Glasgow 2012 {-# LANGUAGE CPP, DataKinds, DeriveDataTypeable, GADTs, KindSignatures, ScopedTypeVariables, StandaloneDeriving #-} -- | Module for coercion axioms, used to represent type family instances -- and newtypes module CoAxiom ( BranchFlag, Branched, Unbranched, Bra...
anton-dessiatov/ghc
compiler/types/CoAxiom.hs
bsd-3-clause
20,190
0
14
4,975
3,180
1,720
1,460
223
2
module Abs () where absN :: (Num a, Ord a) => a -> a absN x = if x > 0 then x else (-x) absI :: Int -> Int absI x = if x > 0 then x else (-x) --incI :: Int -> Int --incI = (+) 1 x0 = absN 4 x1 = absI (-5) --x2 = absI (incI 2) -- x3 = absI (-3)
mightymoose/liquidhaskell
tests/pos/Abs.hs
bsd-3-clause
254
0
7
78
115
66
49
7
2
-- -- Derived from a program believed to be originally written by John -- Launchbury, and incorporating the RSA algorithm which is in the -- public domain. -- import System.Environment import Data.List import qualified Data.ByteString.Lazy.Char8 as B import Data.ByteString.Lazy.Char8 (ByteString) import ByteStringComp...
y-kamiya/parallel-concurrent-haskell
src/RsaPipeSample/rsa-pipeline.hs
gpl-2.0
3,403
1
13
684
1,289
676
613
65
2
module Blank where {-@ LIQUID "--no-termination" @-} data Vec a = V (Int -> a) {-@ 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:Int|0=1}, p> a @-} empty = V $ \_...
mightymoose/liquidhaskell
tests/pos/vecloop.hs
bsd-3-clause
1,844
0
12
787
244
131
113
12
2
-- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF licenses this file -- to you under the Apache License, Version 2.0 (the -- "License"); you may n...
guker/fbthrift
thrift/lib/hs/Thrift/Types.hs
apache-2.0
4,679
0
9
1,252
869
488
381
93
0
module Cmm.X86.InstrCore where import Cmm.LabelGenerator import Data.Int import Text.Printf -- | bypassing non exisiting module system of haskell data X86CodeGen = X86CodeGen data SizeDirective = BYTE | WORD | DWORD | QWORD -- 64 bit won't be supported for the time being deriving (Eq, Ord) inst...
cirquit/hjc
src/Cmm/X86/InstrCore.hs
mit
5,446
0
19
1,949
1,829
975
854
182
1
-- Part 1 module Session4.Recursion (test) where import Prelude ((+), (*), Bool(..), Double, IO, Int, return) -- | empty a.k.a. null -- Examples: -- >>> empty [] -- True -- >>> empty [1, 2, 3, 4] -- False empty :: [a] -> Bool empty [] = True empty _ = False -- | map -- Examples: -- >>> map (+100) [] -- [] -- >>> ma...
seahug/pcph-scratch
src/Session4/Recursion.hs
mit
1,346
2
12
392
589
343
246
29
1
module Latte.FrontEnd.Spec (main, spec) where import Test.Hspec import qualified Latte.FrontEnd.MainFunctionPresenceSpec import qualified Latte.FrontEnd.FunctionNameDuplicationSpec import qualified Latte.FrontEnd.TypeCheckSpec import qualified Latte.FrontEnd.VariableDeclaredSpec main :: IO () main = hspec spec spec...
mpsk2/LatteCompiler
testsuite/tests/Latte/FrontEnd/Spec.hs
mit
657
0
8
73
124
72
52
14
1
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE CPP #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE EmptyDataDecls #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE GeneralizedNewtyp...
pseudonom/persistent
persistent/Database/Persist/Sql/Types.hs
mit
4,437
0
12
805
630
413
217
75
0
module Glucose.Codegen.JavaScript (codegen) where import Control.Comonad import Control.Lens import Control.Monad.RWS import Data.Foldable (toList) import Data.Set as Set (Set, fromList, empty, insert, delete, member) import Data.Text (Text, pack, unpack) import Glucose.Identifier import Glucose.IR data JS...
sardonicpresence/glucose
src/Glucose/Codegen/Javascript.hs
mit
2,323
0
14
500
934
466
468
-1
-1
-- (Ready for) Prime Time -- http://www.codewars.com/kata/521ef596c106a935c0000519/ module PrimeTime where prime :: Int -> [Int] prime n = takeWhile (<= n) . sieve $ [2..] where sieve (n:ns) = n : sieve [n' | n' <- ns, n' `mod` n /= 0]
gafiatulin/codewars
src/5 kyu/PrimeTime.hs
mit
242
0
12
48
93
52
41
4
1
import Data.Aeson import Test.Tasty import Test.Tasty.QuickCheck as QC import Pulmurice.Common.Message main :: IO () main = defaultMain qcProps requestMessageProp :: ReqMsg -> Property requestMessageProp msg = Just msg === decode (encode msg) responseMessageProp :: ResMsg -> Property responseMessageProp msg = Just ...
futurice/pulmurice-common
tests/Tests.hs
mit
558
0
8
84
144
75
69
14
1
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-} module GHCJS.DOM.JSFFI.Generated.EventSource (js_newEventSource, newEventSource, js_close, close, pattern CONNECTING, pattern OPEN, pattern CLOSED, js_getUrl, getUrl, js_getWithCredentials, getWithCredentials, js_ge...
plow-technologies/ghcjs-dom
src/GHCJS/DOM/JSFFI/Generated/EventSource.hs
mit
3,934
32
12
554
851
486
365
61
1
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} import qualified Data.ByteString.Lazy as L import Data.ByteString.Builder import Database.Redis import Control.Monad.IO.Class (liftIO) import System.IO import Data.Monoid((<>)) import Data.Foldable import Data.List import qualified Text.ProtocolB...
hnfmr/test-hedis
src/Pub.hs
mit
1,503
0
14
263
419
226
193
38
3
-- Copyright (c) 2016-present, SoundCloud Ltd. -- All rights reserved. -- -- This source code is distributed under the terms of a MIT license, -- found in the LICENSE file. {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE TemplateHaskell #-} module Kubern...
soundcloud/haskell-kubernetes
lib/Kubernetes/Model/V1/GCEPersistentDiskVolumeSource.hs
mit
2,193
0
14
535
324
192
132
39
1
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} module Tests.Sodium.Stream.Common where import Tests.Sodium.Common () import Crypto.Sodium.SecureMem import Crypto.Sodium.Stream.Internal import Data.Bits import qualified Data.ByteString ...
dnaq/crypto-sodium
test/Tests/Sodium/Stream/Common.hs
mit
1,783
0
17
562
487
252
235
43
1
-- | -- Module : Data.Edison.Seq.BankersQueue -- Copyright : Copyright (c) 1998-1999, 2008 Chris Okasaki -- License : MIT; see COPYRIGHT file for terms and conditions -- -- Maintainer : robdockins AT fastmail DOT fm -- Stability : stable -- Portability : GHC, Hugs (MPTC and FD) -- -- T...
robdockins/edison
edison-core/src/Data/Edison/Seq/BankersQueue.hs
mit
15,242
0
15
4,142
6,939
3,653
3,286
326
4
module HJS.Parser.ParserMonad where import Control.Monad.Identity import Control.Monad.Error import Control.Monad.State import HJS.Parser.Lexer data ParseResult a = Ok a | Failed String deriving Show data LexerMode = Normal | InComment | InRegex deriving Show data LexerState = LS { rest::String,lineno...
nbrunt/JSHOP
res/hjs-0.1/src/HJS/Parser/ParserMonad.hs
mit
1,053
3
12
344
374
211
163
27
2
import Data.List import Data.Ord data Graph a = Graph [a] [(a, a)] deriving (Show, Eq) data Adjacency a = Adj [(a, [a])] deriving (Show, Eq) data Friendly a = Edge [(a, a)] deriving (Show, Eq) -- Problem 80 -- Conversions -- graphToAdj, adjToGraph, graphToFri, friToGraph, adjToFri, friToAdj graphToAdj :: Eq a => Gr...
CrazyMerlyn/99problems-haskell
80-89.hs
mit
7,593
0
16
2,688
3,082
1,648
1,434
102
4
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} module Netpoll.Database where import qualified Data.Foldable as Foldable import qualified Data.List as List import qualified Data.Maybe as Maybe import qualified Data.Monoid as Monoid import qualified Data.Word as Word import qualified Database.P...
abayley/netpoll
src/Netpoll/Database.hs
gpl-3.0
16,044
0
35
4,087
3,095
1,677
1,418
248
4
{-# LANGUAGE FlexibleContexts #-} module Language.Objection.Parser.Token ( tokenize, Token(..), ) where import Control.Applicative ((<$>), (*>), (<*)) import Control.Monad.Identity (Identity) import Data.Int import Text.Parsec data Token = TAdd | TChar | TClass |...
jhance/objection
Language/Objection/Parser/Token.hs
gpl-3.0
3,351
0
37
1,467
837
438
399
93
1
{-# LANGUAGE GADTs, Rank2Types, CPP #-} -- Module : FRP.Yampa.Basic -- Copyright : (c) Antony Courtney and Henrik Nilsson, Yale University, 2003 -- License : BSD-style (see the LICENSE file in the distribution) -- -- Maintainer : ivan.perez@keera.co.uk -- Stability : provisional -- Portabili...
keera-studios/pang-a-lambda
Yampa-0.10.4/src/FRP/Yampa/Basic.hs
gpl-3.0
3,519
0
12
806
551
338
213
28
1
module Hamming (distance) where distance :: String -> String -> Maybe Int distance [] [] = Just 0 distance [] _ = Nothing distance _ [] = Nothing distance (x:xs) (y:ys) = if eq then rest else rest >>= return . (+1) where eq = x == y rest = distance xs ys
daewon/til
exercism/haskell/hamming/src/Hamming.hs
mpl-2.0
266
0
7
64
131
70
61
8
2
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators ...
brendanhay/gogol
gogol-dlp/gen/Network/Google/Resource/DLP/Organizations/Locations/StoredInfoTypes/Get.hs
mpl-2.0
5,716
0
15
1,181
703
414
289
109
1
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators ...
brendanhay/gogol
gogol-webmaster-tools/gen/Network/Google/Resource/Webmasters/Sites/Add.hs
mpl-2.0
2,534
0
12
582
303
186
117
46
1
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PackageImports #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeOperators #-} import Control....
fisx/cabal-extras
src/Main.hs
agpl-3.0
6,433
0
18
1,343
1,827
957
870
132
2
ans [a,b] = a + b main = do l <- getLine let i = map read $ words l :: [Integer] o = ans i print o
a143753/AOJ
NTL_2_A.hs
apache-2.0
119
0
11
48
70
34
36
6
1
module Arrays where import Data.Array.IArray type ArrayLength = Int createNewEmptyArray :: ArrayLength -> Array Int a createNewEmptyArray = undefined fromList :: [a] -> Array Int a fromList xs = listArray (0, l - 1) xs where l = length xs buildPair :: (Int, Int) buildPair = let arr = listArray (1,10) (repeat...
songpp/my-haskell-playground
src/Arrays.hs
apache-2.0
417
0
11
109
169
94
75
12
1
module External.A137735 (a137735) where a137735 :: Int -> Integer a137735 n = a137735_list !! n a137735_list :: [Integer] a137735_list = 1 : remaining 1 1 where remaining n maxTerm = nextTerm : remaining (n + 1) (max nextTerm maxTerm) where nextTerm = floor $ toRational n / toRational maxTerm
peterokagey/haskellOEIS
src/External/A137735.hs
apache-2.0
302
0
11
57
111
58
53
7
1
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE RecordWildCards #-} -- | The module provides functionality for manipulating PoliMorf, the -- morphological dictionary for Polish. module Data.PoliMorf ( -- * Types Form , Base , POS , MSD , Tag , Cat , Entr...
kawu/polimorf
src/Data/PoliMorf.hs
bsd-2-clause
2,320
0
13
512
591
342
249
65
3
{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} -- | -- -- Generic OAuth2 plugin for Yesod -- -- * See Yesod.Auth.OAuth2.GitHub for example usage. -- module Yesod.Auth.OAuth2 ( authOAuth2 , authOAuth2Widge...
jasonzoladz/yesod-auth-oauth2
Yesod/Auth/OAuth2.hs
bsd-2-clause
4,800
0
24
1,327
967
512
455
93
5
{-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE Rank2Types #-} ------------------------------------------------------------------------------ -- | Pre-packaged Handlers that deal with form submissions and stand...
23Skidoo/snap
src/Snap/Snaplet/Auth/Handlers.hs
bsd-3-clause
20,449
0
19
5,403
3,650
1,852
1,798
292
4
import Data.Accessor import Graphics.Rendering.Chart.Plot.Image import Graphics.Rendering.Chart import Graphics.Rendering.Chart.Gtk import Data.Array.Repa ((:.)(..)) import qualified Data.Array.Repa as A size = 100 image :: A.Array A.U A.DIM2 (Double,Double,Double) image = A.computeS $ A.fromFunction...
bgamari/chart-image
Test.hs
bsd-3-clause
898
0
12
273
293
164
129
21
1
import System.Hardware.Sump as Sump import I2c import Data.Machine parseLevel '0' = Low parseLevel '1' = High signals = let sda = map parseLevel "1110001110001111" scl = map parseLevel "1111100100111111" in zipWith I2cSignals scl sda main = mapM_ print $ Data.Machine.run $ supply signals (auto decod...
bgamari/sump
TestI2c.hs
bsd-3-clause
323
0
9
65
101
52
49
10
1
{-# LANGUAGE GADTs #-} {-# LANGUAGE PatternGuards #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE ViewPatterns #-} -- | -- Module : Data.Array.Accelerate.Trafo.Algebra -- Copyright : [2012] Manuel M T Chakr...
robeverest/accelerate
Data/Array/Accelerate/Trafo/Algebra.hs
bsd-3-clause
20,751
0
16
5,884
7,578
3,652
3,926
384
54
module Lib.Task2 where import qualified Data.List as List task2 = sum $ filter isEven $ takeWhile (<4000000) fibs where fibs = List.unfoldr (\(a,b) -> Just (a,(b,a+b))) (0,1) isEven x = x `mod` 2 ==0
Austrotaxus/EulerProj
src/Lib/Task2.hs
bsd-3-clause
221
0
13
55
110
64
46
5
1
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE BangPatterns #-} module Y.String ( YiString , Position , Size(..) , fromString, toString , toReverseString , fromLazyText, toLazyText , empty , singleton, null, length , append, concat , reverse , take, drop , takeScreenful...
ethercrow/y
src/Y/String.hs
bsd-3-clause
12,497
0
19
2,927
4,936
2,544
2,392
285
4
{-# LANGUAGE TemplateHaskell #-} module WithArity (main) where import Criterion.Main import Criterion.Types import Data.Monoid import Data.Syntactic hiding (E) import Data.Syntactic.Functional main :: IO () main = defaultMainWith (defaultConfig {csvFile = Just "bench-results/withArity.csv"}) [ bgroup "eval ...
emwap/syntactic
benchmarks/WithArity.hs
bsd-3-clause
4,415
0
18
1,623
2,557
1,241
1,316
-1
-1
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures ...
mstksg/wavelets
src/Numeric/Wavelet/Continuous.hs
bsd-3-clause
8,823
0
24
3,159
3,142
1,672
1,470
-1
-1
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} module VForth.GameTextSpec ( TestableTitle(..) , TestableDescription(..) , unsafeRight , spec ) where import Test.Hspec import Test.QuickCheck.Gen import Test.QuickCheck import Data.Monoid ((<>)) import Data.Text.Arbitrary () import Data.Tex...
budgefeeney/ventureforth
chap6/test/VForth/GameTextSpec.hs
bsd-3-clause
1,846
0
11
358
387
216
171
48
1
{-# LANGUAGE GADTs, NoImplicitPrelude, UnicodeSyntax #-} module Data.Nested.Tree ( -- * Tree type Tree (..) -- * Query , fruit, forest , null, size , lookup, member -- * Construction , empty , singleton , fromFoldable , fromList ...
sheganinans/applicative-nestedmap
src/Data/Nested/Tree.hs
bsd-3-clause
2,283
0
11
914
557
322
235
61
1
{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ImplicitParams #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ConstrainedClassMethods #-} {-# LANGUAGE OverloadedStrings #-} -- We can do b...
sleexyz/haskell-fun
MLModulesWithFunctors2.hs
bsd-3-clause
1,635
0
12
400
592
331
261
49
1
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ViewPatterns #-} module Foreign.HPX.Types where import Bindings.HPX import Control.Applicative (Alternative) import Control.Monad (...
iu-parfunc/haskell-hpx
src/Foreign/HPX/Types.hs
bsd-3-clause
6,488
0
11
2,018
1,741
947
794
208
1
-- | Let's experiment with HUnit some more -- basicaly : <https://wiki.haskell.org/HUnit_1.0_User's_Guide> module TestStuff where import Test.HUnit import Stuff
emaphis/Haskell-Practice
testing-project/test/TestStuff.hs
bsd-3-clause
166
0
4
24
14
10
4
3
0
{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeOperators #-} module Main (main) where import Control.Lens import Halytics.Metric import Halytics.Monitor import Test.Tasty import Test.Tasty.HUnit (testCase, (@=?)) main :: IO () main = defaultMain tests tests :: Test...
nmattia/halytics
test/Test/Spec.hs
bsd-3-clause
1,502
0
10
320
512
298
214
39
1
{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE InstanceSigs #-} {-# LANGUAGE...
et4te/zero
src/Zero/KeyFetchToken/Client.hs
bsd-3-clause
2,139
0
15
601
416
239
177
41
0
{-# LANGUAGE UndecidableInstances, FunctionalDependencies #-} module Feldspar.Multicore.Channel.Frontend where import Control.Monad.Operational.Higher import Control.Monad.Trans import Data.Ix import Data.Proxy import Data.Typeable import Feldspar hiding ((==)) import Feldspar.Data.Storable import Feldspar.Data.Vecto...
kmate/raw-feldspar-mcs
src/Feldspar/Multicore/Channel/Frontend.hs
bsd-3-clause
6,955
0
15
1,768
2,411
1,223
1,188
-1
-1
{-# LANGUAGE Rank2Types #-} {-# LANGUAGE ImpredicativeTypes #-} module Hack.Handler.Hyena (run, runWithConfig, ServerConf(..)) where import qualified Hack as Hack import Hyena.Server import Network.Wai as Wai import Prelude hiding ((.), (^)) import System.IO import Control.Monad import Data.Default import Data.May...
np/hack-handler-hyena
src/Hack/Handler/Hyena.hs
bsd-3-clause
5,627
15
19
1,795
1,464
776
688
132
8
{-# LANGUAGE BangPatterns #-} module LRUCache where import Control.Applicative ((<$>)) import Data.Hashable (Hashable, hash) import qualified Data.HashPSQ as HashPSQ import Data.IORef (IORef, newIORef, atomicModifyIORef') import Data.Int (Int64) i...
Garygunn94/DFS
.stack-work/intero/intero2956XM1.hs
bsd-3-clause
1,997
0
16
666
715
384
331
56
3