code stringlengths 2 1.05M | repo_name stringlengths 5 101 | path stringlengths 4 991 | language stringclasses 3
values | license stringclasses 5
values | size int64 2 1.05M |
|---|---|---|---|---|---|
module Options.Nested.Types where
import Options.Nested.Types.Parser
import Control.Applicative
import Data.Maybe (isJust)
import Data.Monoid
import Data.Tree
-- | A command tree is a rose tree of the command label and it's optional flag
-- parser.
type CommandTree ... | athanclark/optparse-nested | src/Options/Nested/Types.hs | Haskell | bsd-3-clause | 804 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Lambdasim.Time where
import Data.Time hiding (utc)
import Data.Ratio ((%))
import Control.Monad (liftM)
import Control.Parallel.Strategies
import Prelude ()
import Lambdasim.Prelude
addTime :: Time -> UTCTime -> UTCTime
addTime x = addUTCTime (toNominalDiffTime x)
toNo... | jystic/lambdasim | src/Lambdasim/Time.hs | Haskell | bsd-3-clause | 911 |
module Ling.Rename where
import qualified Data.Map as Map
import Data.Map (Map)
import Data.Maybe (fromMaybe)
import Control.Applicative
import Control.Lens
import Ling.Abs (Name)
import Ling.Utils
import Ling.Norm
-- import Ling.Print.Instances ()
type Ren = Map Name Name
type E a = a -> a
class Rename a where
... | jyp/ling | Ling/Rename.hs | Haskell | bsd-3-clause | 2,485 |
import Control.Monad.ST (runST)
import Criterion.Main
import Data.Complex
import Statistics.Sample
import Statistics.Transform
import Statistics.Correlation.Pearson
import System.Random.MWC
import qualified Data.Vector.Unboxed as U
-- Test sample
sample :: U.Vector Double
sample = runST $ flip uniformVector 10000 =<<... | bos/statistics | benchmark/bench.hs | Haskell | bsd-2-clause | 2,701 |
{-# LANGUAGE OverloadedStrings #-}
module Distribution.Nixpkgs.Haskell.FromCabal.Name ( toNixName, libNixName, buildToolNixName ) where
import Data.String
import Distribution.Package
import Language.Nix
-- | Map Cabal names to Nix attribute names.
toNixName :: PackageName -> Identifier
toNixName (PackageName "") = e... | psibi/cabal2nix | src/Distribution/Nixpkgs/Haskell/FromCabal/Name.hs | Haskell | bsd-3-clause | 10,974 |
{-# LANGUAGE ForeignFunctionInterface, EmptyDataDecls, LambdaCase, TupleSections, GeneralizedNewtypeDeriving #-}
module Sound.Pd.Internal where
import Foreign.C
import Foreign.Ptr
import Foreign.StablePtr
import Control.Concurrent
import Control.Monad
import Sound.Pd.OpenAL
data FileOpaque
type File = Ptr FileOpaque
... | lukexi/pd-hs | src/Sound/Pd/Internal.hs | Haskell | bsd-3-clause | 5,558 |
import Data.List
isPossible :: [String] -> String -> (Int, Int) -> (Int, Int) -> Bool
isPossible _ [] _ _ = True
isPossible grid (w:ws) (x, y) (dx, dy)
| x < 10 && y < 10 && (grid !! x !! y == w || grid !! x !! y == '-') = isPossible grid ws (x + dx, y + dy) (dx, dy)
| otherwise = False
putWords :: [String] -... | EdisonAlgorithms/HackerRank | practice/fp/recursion/crosswords-101/crosswords-101.hs | Haskell | mit | 1,691 |
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
--
-- Code generator utilities; mostly monadic
--
-- (c) The University of Glasgow 2004-2006
--
-----------------------------------------------------------------------------
module StgCmmUtils (
cgLit, mkSimpleL... | oldmanmike/ghc | compiler/codeGen/StgCmmUtils.hs | Haskell | bsd-3-clause | 23,049 |
module C where
-- Test file
baz = 13
| RefactoringTools/HaRe | test/testdata/C.hs | Haskell | bsd-3-clause | 39 |
module Meas () where
import Language.Haskell.Liquid.Prelude
mylen :: [a] -> Int
mylen [] = 0
mylen (_:xs) = 1 + mylen xs
mymap f [] = []
mymap f (x:xs) = (f x) : (mymap f xs)
zs :: [Int]
zs = [1..100]
prop2 = liquidAssertB (n1 == n2)
where n1 = mylen zs
n2 = mylen $ mymap (+ 1) zs
| mightymoose/liquidhaskell | tests/pos/meas3.hs | Haskell | bsd-3-clause | 320 |
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, UnboxedTuples, RankNTypes #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.ST
-- Copyright : (c) The University of Glasgow, 1992-2002
-- License : see libr... | tolysz/prepare-ghcjs | spec-lts8/base/GHC/ST.hs | Haskell | bsd-3-clause | 3,357 |
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Generate HPC (Haskell Program Coverage) reports
module Stack.Build.Coverage
( generateHpcReport
, generateHpcMar... | akhileshs/stack | src/Stack/Build/Coverage.hs | Haskell | bsd-3-clause | 6,914 |
{-# LANGUAGE CPP, RecordWildCards #-}
-----------------------------------------------------------------------------
--
-- Stg to C-- code generation:
--
-- The types LambdaFormInfo
-- ClosureInfo
--
-- Nothing monadic in here!
--
---------------------------------------------------------------------------... | green-haskell/ghc | compiler/codeGen/StgCmmClosure.hs | Haskell | bsd-3-clause | 37,881 |
module Kinding where
import qualified Data.Set as Set
import qualified Data.Map as Map
import Core
type KindSubst = Map.Map LowerName Kind
class Kinded | robertkleffner/gruit | src/Kinding.hs | Haskell | mit | 158 |
module Display (showColumns) where
import Data.List(intercalate)
showColumns :: Int -> Int -> ([String], [String]) -> String
showColumns wrapOne wrapTwo (as', bs') = intercalate "\n" $ map joinRow $ zip (map (pad wrapOne) colOneRows) (map (pad wrapTwo) colTwoRows)
where as = map (rmLineBreaks . rmLeadingWhit... | MichaelBaker/zgy-cli | src/Display.hs | Haskell | mit | 1,215 |
module SFML.SFResource
where
class SFResource a where
-- | Destroy the given SFML resource.
destroy :: a -> IO ()
| SFML-haskell/SFML | src/SFML/SFResource.hs | Haskell | mit | 130 |
module Y2016.M11.D08.Exercise where
import Data.Aeson
{--
So, last week we looked at a graph of twitter-users. NOICE! If you look at the
source code that generated the graph, it's a python script that makes a
request to the twitter API to get a list of the followers of the graphed
account.
Well. I happen to have a ... | geophf/1HaskellADay | exercises/HAD/Y2016/M11/D08/Exercise.hs | Haskell | mit | 1,902 |
{-# LANGUAGE OverloadedStrings #-}
module Lib (
withAuth
)
where
import Snap.Snaplet
import Snap.Core
import qualified Data.ByteString.Base64 as D
import qualified Data.ByteString.Char8 as B
import Control.Monad.Trans (liftIO)
import Data.Maybe
import Database.MongoDB (MongoContext(..), Database, connect, hos... | cackharot/heub | src/Lib.hs | Haskell | mit | 2,410 |
module Main where
import Lang.Cmn.Dict
main :: IO ()
main = do
dictEntries <- loadDict
let wdToEntry = dictToWdDict dictEntries
print $ length dictEntries
| dancor/melang | src/Main/optimize-wubi.hs | Haskell | mit | 169 |
-----------------------------------------------------------------------------
-- |
-- Module : Arguments
-- License : MIT (see the LICENSE file)
-- Maintainer : Felix Klein (klein@react.uni-saarland.de)
--
-- Argument parser.
--
-----------------------------------------------------------------------------
... | reactive-systems/syfco | src/syfco/Arguments.hs | Haskell | mit | 12,225 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
module BT.Polling where
import BT.ZMQ
import BT.Types
import Data.Pool (Pool)
import qualified System.ZMQ3 as ZMQ
import Data.IORef (IORef, writeIORef)
import Network.Bitcoin (BTC)
import Data.ByteString as B
import Data.ByteString.Char8 as BC
im... | c00w/BitToll | haskell/BT/Polling.hs | Haskell | mit | 1,097 |
{-|
Module: Y2015.Util
Description: Shared functions for Advent of Code Solutions.
License: MIT
Maintainer: @tylerjl
Shared functions that support solutions to problems for the
<adventofcode.com> challenges.
-}
module Y2015.Util
( (<&&>)
, regularParse
, intParser
) where
import Cont... | tylerjl/adventofcode | src/Y2015/Util.hs | Haskell | mit | 942 |
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE... | mgsloan/ghcjs-typescript | examples/highcharts/Raw.hs | Haskell | mit | 68,354 |
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.XMLHttpRequestUpload
(abort, error, load, loadEnd, loadStart, progress,
XMLHttpRequestUpload, castToXMLHttpRequestUpload,
gTypeXMLHttpRequestUpload)
where
import Prelude ((.), (==), (... | manyoo/ghcjs-dom | ghcjs-dom-jsffi/src/GHCJS/DOM/JSFFI/Generated/XMLHttpRequestUpload.hs | Haskell | mit | 2,568 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeOperators #-}
module Api (app) where
import Control.Monad.Except (ExceptT)
import Control.Monad.Reader (ReaderT, runReaderT)
-- import Control.Monad.Reader.... | tdox/aircraft-service | src/Api.hs | Haskell | mit | 2,746 |
{-# LANGUAGE ScopedTypeVariables #-}
--------------------------------------------------
--------------------------------------------------
{-| Define (non-deriveable) 'Ix' instances
via a (deriveable) 'Enumerate' instance.
== Usage
@
data A = ...
instance 'Bounded' A where
minBound = 'minBound_Enumerable' array_... | sboosali/enumerate | enumerate/sources/Enumerate/Ix.hs | Haskell | mit | 7,847 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafregional-webacl-action.html
module Stratosphere.ResourceProperties.WAFRegionalWebACLAction where
import S... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/WAFRegionalWebACLAction.hs | Haskell | mit | 1,379 |
--file ch6/TypeClass.hs
module TypeClass
where
class BasicEq a where
isEqual :: a -> a -> Bool
isEqual x y = not (isNotEqual x y)
isNotEqual :: a -> a -> Bool
isNotEqual x y = not (isEqual x y)
data Color = Red | Blue | Green
deriving (Show, Read, Eq, Ord)
instance BasicEq Color where
isEqu... | Numberartificial/workflow | haskell-first-principles/src/RW/CH6/TypeClass.hs | Haskell | mit | 610 |
module HepMC.Barcoded where
import Control.Lens
import Data.IntMap (IntMap)
import qualified Data.IntMap as IM
type BC = Int
class Barcoded b where
bc :: Lens' b BC
instance (Barcoded a, Barcoded b) => Barcoded (Either a b) where
bc = choosing bc bc
liftBC :: Barcoded a => (BC -> b) -> ... | cspollard/HHepMC | src/HepMC/Barcoded.hs | Haskell | apache-2.0 | 780 |
{-# LANGUAGE ExistentialQuantification #-}
-----------------------------------------------------------------------------
-- Copyright 2019, Ideas project team. This file is distributed under the
-- terms of the Apache License 2.0. For more information, see the files
-- "LICENSE.txt" and "NOTICE.txt", which are incl... | ideas-edu/ideas | src/Ideas/Common/Environment.hs | Haskell | apache-2.0 | 6,216 |
sm y = y + 1
biggestInt,smallestInt :: Int
biggestInt = maxBound
smallestInt = minBound
reallyBig::Integer
reallyBig = 2^(2^(2^(2^2)))
numDigits :: Int
numDigits = length(show reallyBig)
ex11 = True && False
ex12 = not(False || True)
ex13 = ('a' == 'a')
ex14 = (16 /= 3)
ex15 = (5>3) && ('p' <= 'q')
ex16 = "Ha... | hungaikev/learning-haskell | cis194/week1/intro.hs | Haskell | apache-2.0 | 1,695 |
module HSRT.Test where
import HSRT
import HSRT.Types
import Test.QuickCheck
---------------------------------------------------
-- QuickCheck testing
---------------------------------------------------
-- Generate random Rays
instance Arbitrary Ray where
arbitrary = do
p1 <- vectorOf 3 (arbitrary::Gen D... | brailsmt/hsrt | src/hsrt/test.hs | Haskell | apache-2.0 | 1,279 |
module Geometry where
import System.Random
import qualified Data.Map.Strict as M
data Point = Point { pointX :: Int, pointY :: Int }
deriving (Eq, Ord)
type Angle = Float
instance Show Point where
show point = "(" ++ (show $ pointX point) ++ "," ++ (show $ pointY point) ++ ")"
randomPoint width hei... | ftomassetti/hplatetectonics | src/Geometry.hs | Haskell | apache-2.0 | 2,293 |
{-# LANGUAGE PackageImports, TypeFamilies, DataKinds, PolyKinds #-}
module Propellor.Info (
osDebian,
osBuntish,
osArchLinux,
osFreeBSD,
setInfoProperty,
addInfoProperty,
pureInfoProperty,
pureInfoProperty',
askInfo,
getOS,
ipv4,
ipv6,
alias,
addDNS,
hostMap,
aliasMap,
findHost,
findHostNoAlias,
get... | ArchiveTeam/glowing-computing-machine | src/Propellor/Info.hs | Haskell | bsd-2-clause | 6,537 |
module Handler.AdminBlog
( getAdminBlogR
, getAdminBlogNewR
, postAdminBlogNewR
, getAdminBlogPostR
, postAdminBlogPostR
, postAdminBlogDeleteR
)
where
import Import
import Yesod.Auth
import Data.Time
import System.Locale (defaultTimeLocale)
-- The view showing the list of articles
ge... | BeerAndProgramming/BeerAndProgrammingSite | Handler/AdminBlog.hs | Haskell | bsd-2-clause | 2,678 |
--
-- Copyright 2014, General Dynamics C4 Systems
--
-- This software may be distributed and modified according to the terms of
-- the GNU General Public License version 2. Note that NO WARRANTY is provided.
-- See "LICENSE_GPLv2.txt" for details.
--
-- @TAG(GD_GPL)
--
{-# LANGUAGE EmptyDataDecls, ForeignFunctionInter... | NICTA/seL4 | haskell/src/SEL4/Machine/Hardware/ARM/Lyrebird.hs | Haskell | bsd-2-clause | 3,656 |
module Main (main) where
import Test.DocTest (doctest)
main :: IO ()
main = doctest ["-isrc","src/Hangman.hs"]
| stackbuilders/hangman-off | tests/DocTests.hs | Haskell | bsd-3-clause | 113 |
import Test.Tasty
import qualified Admin
import qualified Check
main :: IO ()
main = defaultMain $ testGroup "ghc-server"
[ Admin.tests
, Check.tests
]
| bennofs/ghc-server | tests/Main.hs | Haskell | bsd-3-clause | 159 |
{-# LANGUAGE MultiParamTypeClasses #-}
module Test.Framework.Providers.Program(
Checker
, testProgramRuns
, testProgramOutput
)
where
import Data.Typeable
import System.Directory
import System.Exit
import System.IO hiding (stdout, stderr)
import System.Process hiding (runProcess)
import... | acw/test-framework-program | Test/Framework/Providers/Program.hs | Haskell | bsd-3-clause | 3,747 |
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
------------------... | rfranek/duckling | Duckling/Ranking/Classifiers/PL.hs | Haskell | bsd-3-clause | 144,652 |
module TestUtil where
import Test.Hspec
import Util
spec :: Spec
spec =
it "size2humanSize" $
size2humanSize . fst <$> sizeHumanSizes
`shouldBe` snd <$> sizeHumanSizes
where
sizeHumanSizes =
[ ( 0, "0B")
, ( ... | oshyshko/adventofcode | test/TestUtil.hs | Haskell | bsd-3-clause | 1,165 |
{-# LANGUAGE OverloadedStrings #-}
module IptAdmin.EditPolicyForm.Render where
import Data.Monoid
import Data.String
import Iptables.Types
import Text.Blaze
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
editPolicyForm :: (String, String) -> Policy -> Markup
editPolicyForm (... | etarasov/iptadmin | src/IptAdmin/EditPolicyForm/Render.hs | Haskell | bsd-3-clause | 1,476 |
{- OPTIONS_GHC -fplugin Brisk.Plugin #-}
{- OPTIONS_GHC -fplugin-opt Brisk.Plugin:main #-}
{-# LANGUAGE TemplateHaskell #-}
module SpawnSym (main) where
import Control.Monad (forM, foldM)
import Control.Distributed.Process
import Control.Distributed.BriskStatic
import Control.Distributed.Process.Closure
import Control... | abakst/brisk-prelude | examples/SpawnSym.hs | Haskell | bsd-3-clause | 902 |
{-# LANGUAGE OverloadedStrings #-}
import Network.NetSpec
import Network.NetSpec.Text
main :: IO ()
main = runSpec ServerSpec
{ _ports = [PortNumber 5001]
, _begin = (! "I'll echo anything you say.")
, _loop = \[h] () -> receive h >>= \line -> case line of
"bye" -> stop_
_ -> h ! line >> conti... | DanBurton/netspec | examples/Echo.hs | Haskell | bsd-3-clause | 368 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
module Sky.Parsing.Invertible3.PartialType
( PartialType
, PartialType'
, basicType
, fullAlgebraicType
, partialAlgebraicType
... | xicesky/sky-haskell-playground | src/Sky/Parsing/Invertible3/PartialType.hs | Haskell | bsd-3-clause | 2,503 |
{-# language CPP #-}
-- No documentation found for Chapter "PipelineShaderStageCreateFlagBits"
module Vulkan.Core10.Enums.PipelineShaderStageCreateFlagBits ( PipelineShaderStageCreateFlags
, PipelineShaderStageCreateFlagBits( PIPELINE_SHADER_STAGE_CREATE_RE... | expipiplus1/vulkan | src/Vulkan/Core10/Enums/PipelineShaderStageCreateFlagBits.hs | Haskell | bsd-3-clause | 4,741 |
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, TypeSynonymInstances #-}
-- | Complex Type: @extensionsType@ <http://www.topografix.com/GPX/1/1/#type_extensionsType>
module Data.Geo.GPX.Type.Extensions(
Extensions
, extensions
, runExtensions
) where
import Text.XML.HXT.Arrow.Pickle
import Text.XML.HXT.DOM.T... | tonymorris/geo-gpx | src/Data/Geo/GPX/Type/Extensions.hs | Haskell | bsd-3-clause | 770 |
{-# LANGUAGE OverloadedStrings #-}
module Skywalker.RestServer (RestAPI, restOr, buildRest) where
import Data.Text hiding (tail)
import Data.ByteString.Lazy hiding (tail)
import Network.Wai
import Network.HTTP.Types.Status
safeHead [] = Nothing
safeHead (a:_) = Just a
restOr :: Text -> Application -> Application... | manyoo/skywalker | src/Skywalker/RestServer.hs | Haskell | bsd-3-clause | 897 |
import Control.Applicative
import Control.Monad.Reader
import Control.Monad.State
import Data.List
import Data.Map (Map)
import qualified Data.Map as M
import System.Directory
import System.FilePath
import System.Environment
import System.Exit
import System.IO
import AST
import CppLexer (lexCpp)
import CodeGen
impor... | olsner/m3 | Main.hs | Haskell | bsd-3-clause | 3,898 |
module Cipher where
import Data.Char
import Data.List
letterIndex :: Char -> Int
letterIndex = (+ (-(ord 'a'))) . ord . toLower
offsettedChar :: Int -> Char -> Char
offsettedChar offset c =
toOriginalCharCase . chr . (+ firstLetterOrd) . (`mod` numLetters) . (+ offset) . (+ (-firstLetterOrd)) . ord . toLower $... | abhean/phffp-examples | src/Cipher.hs | Haskell | bsd-3-clause | 1,795 |
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
import Control.Concurrent (ThreadId, forkIO, myThreadId)
import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar, readMVar)
import qualified Control.Exception as E
import qualified Data.ByteString as S
import qualified Data.ByteString.Char8 as C
import Ne... | jspahrsummers/network | tests/Simple.hs | Haskell | bsd-3-clause | 8,034 |
module Zero.Bitfinex.Internal
(
Ticker(..)
, defaultTicker
) where
import GHC.Generics (Generic)
import Data.Aeson
import Data.Text (Text)
------------------------------------------------------------------------------
--
--------------------------------------------------------... | et4te/zero | src-shared/Zero/Bitfinex/Internal.hs | Haskell | bsd-3-clause | 1,140 |
module Opticover.Geometry.Calc.Box where
import Control.Lens
import Data.AEq
import Opticover.Geometry.Types
import Opticover.Ple
pointInBox :: Box -> Point -> Bool
pointInBox (Box pair) p =
let (p1, p2) = unPair pair
in p1 <= p && p <= p2
-- Hoping derived Ord instance do what we expect here
segmentBorderBox ... | s9gf4ult/opticover | src/Opticover/Geometry/Calc/Box.hs | Haskell | bsd-3-clause | 381 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.PackageDescription.Parse
-- Copyright : Isaac Jones 2003-2005
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell.org
-- Portability :... | DavidAlphaFox/ghc | libraries/Cabal/Cabal/Distribution/PackageDescription/Parse.hs | Haskell | bsd-3-clause | 54,747 |
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKi... | dreixel/instant-generics | src/Generics/Instant/Base.hs | Haskell | bsd-3-clause | 3,468 |
{-# LANGUAGE LambdaCase #-}
import Control.Arrow
import Control.Lens
import Data.Char
import Data.List.Split
import qualified Data.Map as M
data ColorDef = ColorDef { colorName :: String, colorValue :: String }
main = interact process
where
process = generateDefs ... | diagrams/diagrams-contrib | src/Diagrams/Color/ProcessXKCDColors.hs | Haskell | bsd-3-clause | 1,426 |
module Deprecated.DiGraph.SampleData where
import PolyGraph.Common
import qualified Instances.SimpleGraph as SG
import qualified SampleInstances.FirstLastWord as FL
import qualified Data.HashSet as HS
-- simple test data (list of pars that will serve as edges)
testEdges = map(OPair) [
("a0", "a01"),
(... | rpeszek/GraphPlay | play/Play/DiGraph/SampleData.hs | Haskell | bsd-3-clause | 1,095 |
{-# LANGUAGE LambdaCase, PatternGuards, ViewPatterns #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
module Idris.Elab.Term where
import Idris.AbsSyntax
import Idris.AbsSyntaxTree
import Idris.DSL
import Idris.Delaborate
import Idris.Error
import Idris.ProofSearch
import Idris.Output (pshow)
import Idris.Core.Case... | adnelson/Idris-dev | src/Idris/Elab/Term.hs | Haskell | bsd-3-clause | 119,645 |
-- (c) The University of Glasgow, 1997-2006
{-# LANGUAGE BangPatterns, CPP, DeriveDataTypeable, MagicHash, UnboxedTuples #-}
{-# OPTIONS_GHC -O -funbox-strict-fields #-}
-- We always optimise this, otherwise performance of a non-optimised
-- compiler is severely affected
-- |
-- There are two principal string types u... | tjakway/ghcjvm | compiler/utils/FastString.hs | Haskell | bsd-3-clause | 20,477 |
module Foo where
{-@ LIQUID "--no-termination" @-}
{-@ LIQUID "--native" @-}
{-@ foo :: {v:a | false} @-}
foo = foo
nat :: Int
{-@ nat :: Nat @-}
nat = 42
| ssaavedra/liquidhaskell | tests/todo/false.hs | Haskell | bsd-3-clause | 160 |
{-# LANGUAGE
MagicHash,
FlexibleInstances,
MultiParamTypeClasses,
TypeFamilies,
PolyKinds,
DataKinds,
FunctionalDependencies,
TypeFamilyDependencies #-}
module T17541 where
import GHC.Prim
import GHC.Exts
type fam... | sdiehl/ghc | testsuite/tests/dependent/should_fail/T17541.hs | Haskell | bsd-3-clause | 450 |
module E4 where
--Any type/data constructor name declared in this module can be renamed.
--Any type variable can be renamed.
--Rename type Constructor 'BTree' to 'MyBTree'
data BTree a = Empty | T a (BTree a) (BTree a)
deriving Show
buildtree :: (Monad m, Ord a) => [a] -> m (BTree a)
buildtree [] = ... | SAdams601/HaRe | old/testing/asPatterns/E4.hs | Haskell | bsd-3-clause | 1,008 |
{-# LANGUAGE TypeInType, GADTs #-}
module T11811 where
import Data.Kind
data Test (a :: x) (b :: x) :: x -> *
where K :: Test Int Bool Double
| olsner/ghc | testsuite/tests/typecheck/should_compile/T11811.hs | Haskell | bsd-3-clause | 147 |
-- Test for Trac #2188
module TH_scope where
f g = [d| f :: Int
f = g
g :: Int
g = 4 |]
| forked-upstream-packages-for-ghcjs/ghc | testsuite/tests/th/TH_scope.hs | Haskell | bsd-3-clause | 120 |
-- read.hs
-- read a file
import System.IO
main = do
withFile "song.txt" ReadMode (\handle -> do
contents <- hGetContents handle
putStr contents)
| doylew/practice | haskell/file.hs | Haskell | mit | 158 |
-- |
-- Module : HGE2D.Time
-- Copyright : (c) 2016 Martin Buck
-- License : see LICENSE
--
-- Containing functions to get the current time or transform times
module HGE2D.Time where
import HGE2D.Types
import Data.Time.Clock
-----------------------------------------------------------------------------... | I3ck/HGE2D | src/HGE2D/Time.hs | Haskell | mit | 671 |
-- Algorithms/Strings/Game of Thrones - I
module HackerRank.Algorithms.GameOfThrones1 where
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as M
data Answer = YES | NO deriving (Show)
mkAnswer :: Bool -> Answer
mkAnswer True = YES
mkAnswer False = NO
freqMap :: (Hashable a, Ord a) => [a] -> M... | 4e6/sandbox | haskell/HackerRank/Algorithms/GameOfThrones1.hs | Haskell | mit | 791 |
{-# LANGUAGE RankNTypes #-}
-- | @SkipList@s are comprised of a list and an index on top of it
-- which makes deep indexing into the list more efficient (O(log n)).
-- They achieve this by essentially memoizing the @tail@ function to
-- create a balanced tree.
--
-- NOTE: @SkipList@s are /amortized/ efficient, see the ... | gmalecha/skip-list | src/Data/SkipList.hs | Haskell | mit | 2,746 |
-- A permutation is an ordered arrangement of objects. For example,
-- 3124 is one possible permutation of the digits 1, 2, 3 and 4. If
-- all of the permutations are listed numerically or alphabetically,
-- we call it lexicographic order. The lexicographic permutations of
-- 0, 1 and 2 are:
-- 012 021 102 120 ... | whittle/euler | src/Euler/Problem024.hs | Haskell | mit | 1,462 |
module Data.Streaming.Process.Internal
( StreamingProcessHandle (..)
, InputSource (..)
, OutputSink (..)
) where
import Control.Concurrent.STM (TMVar)
import System.Exit (ExitCode)
import System.IO (Handle)
import System.Process (... | fpco/streaming-commons | Data/Streaming/Process/Internal.hs | Haskell | mit | 1,213 |
module PrintProof where
import Data.IORef
import Control.Monad (liftM)
import NarrowingSearch
import Syntax
prMeta :: MMetavar a -> (a -> IO String) -> IO String
prMeta m prv = do
b <- readIORef $ mbind m
case b of
Nothing -> return $ "?" ++ show (mid m)
Just v -> prv v
prProof :: Int -> MetaProof -> IO Stri... | frelindb/agsyHOL | PrintProof.hs | Haskell | mit | 10,596 |
{-# LANGUAGE DeriveDataTypeable #-}
module Development.Duplo.Types.Builder where
import Control.Exception (Exception)
import Data.Typeable (Typeable)
data BuilderException = MissingGithubUserException
| MissingGithubRepoException
| MalformedManifest... | pixbi/duplo | src/Development/Duplo/Types/Builder.hs | Haskell | mit | 1,003 |
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
module Shifts.Types
(
Eng(..)
, Shift(..)
) where
import Control.Monad (liftM)
import Data.Aeson
import Data.Text
import Data.Time
import GHC.Generics
instance Ord Shift where
(Shift s1 _ _) `compare`... | tippenein/shifts | src/Shifts/Types.hs | Haskell | mit | 824 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import CoinApi
import qualified CoinApi.Monadic as M
import Data.Time
import Control.Monad.State (liftIO)
key = "73034021-0EBC-493D-8A00-E0F138111F41"
asset_id_base = "BTC"
asset_id_quote = "USD"
symbol_id = "BITSTAMP_SPOT_BTC_USD"
period_id = "1HRS"
time_start = ... | coinapi/coinapi-sdk | data-api/haskell-rest/Main.hs | Haskell | mit | 11,093 |
{-# LANGUAGE CPP #-}
module Compat where
import Control.Concurrent (mkWeakThreadId, myThreadId)
import Control.Exception (AsyncException (UserInterrupt), throwTo)
import System.Mem.Weak (deRefWeak)
#if defined(mingw32_HOST_OS)
import qualified GHC.ConsoleHandler as WinSig
#else
import qualified System.Posix.Signals a... | unisonweb/platform | parser-typechecker/unison/Compat.hs | Haskell | mit | 987 |
module Main where
import Haste
main = withElem "root" $ \root -> do
img <- newElem "img"
setAttr img "src" "cat.jpg"
setAttr img "id" "cat"
addChild img root
onEvent img OnMouseOver $ \_ ->
setClass img "foo" True
onEvent img OnMouseOut
$ setClass img "foo" False
| laser/haste-experiment | demos/event-handling/event-handling.hs | Haskell | mit | 289 |
import qualified Data.List
import Kd2nTree
p1 :: Point3d
p1 = list2Point [3.0,-1.0,2.1]
p2 :: Point3d
p2 = list2Point [3.5,2.8,3.1]
p3 :: Point3d
p3 = list2Point [3.5,0.0,2.1]
p4 :: Point3d
p4 = list2Point [3.0,-1.7,3.1]
p5 :: Point3d
p5 = list2Point [3.0,5.1,0.0]
p6 :: Point3d
p6 = list2Point [1.5,8.0,1.5]
p7 :: Poin... | albertsgrc/practica-lp-kd2ntrees | Main.hs | Haskell | mit | 6,316 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, InstanceSigs #-}
{--# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, MultiParamTypeClasses
, FlexibleInstances, FunctionalDependencies #-}
module TemplatesUtility (templatesSettings) where
import Control.Applic... | Prinhotels/goog-closure | src/TemplatesUtility.hs | Haskell | mit | 3,681 |
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE helpset PUBLIC "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version 2.0//EN" "http://java.sun.com/products/javahelp/helpset_2_0.dtd">
<helpset version="2.0" xml:lang="ms-MY">
<title>TLS Debug | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapref lo... | secdec/zap-extensions | addOns/tlsdebug/src/main/javahelp/org/zaproxy/zap/extension/tlsdebug/resources/help_ms_MY/helpset_ms_MY.hs | Haskell | apache-2.0 | 970 |
{-
Copyright 2018 The CodeWorld Authors. 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 applicab... | tgdavies/codeworld | codeworld-prediction/src/Data/MultiMap.hs | Haskell | apache-2.0 | 2,493 |
import Data.List
import Data.Char
main = do line' <- fmap reverse getLine
putStrLn $ "You said " ++ line' ++ " backwords!"
-- fmap reverse will give "Just halb" from "Just Blah"
-- getLine gives IO String and mapping it to reverse IO gnirtS kind of :)-
main1 = do line' <- fmap (++ "!") getLine
... | dongarerahul/lyah | chapter11-functorApplicativeMonad/IOFunctor.hs | Haskell | apache-2.0 | 607 |
module Finance.Hqfl.Instrument.Cap
(
Cap
)where
data Cap
| cokleisli/hqfl | src/Finance/Hqfl/Instrument/Cap.hs | Haskell | apache-2.0 | 66 |
{-# LANGUAGE RankNTypes, FlexibleContexts, ScopedTypeVariables #-}
{- fixing resolution. This is a large beast of a module. Sorry.
updated for version 2.0.3 to match protoc's namespace resolution better
updated for version 2.0.4 to differentiate Entity and E'Entity, this makes eName a total selector
updated af... | edahlgren/protocol-buffers | hprotoc/Text/ProtocolBuffers/ProtoCompile/Resolve.hs | Haskell | apache-2.0 | 78,001 |
{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, FlexibleInstances,
UndecidableInstances, RebindableSyntax, DataKinds,
TypeOperators, PolyKinds, FlexibleContexts, ConstraintKinds,
IncoherentInstances, GADTs
#-}
module Control.Effect.State (Set(..), get, put, State(... | dorchard/effect-monad | src/Control/Effect/State.hs | Haskell | bsd-2-clause | 8,221 |
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.
{-# LANGUAGE OverloadedStrings #-}
module Duckling.PhoneNumber.AR.Corpus
( corpus
, negativeCorpus
) where... | facebookincubator/duckling | Duckling/PhoneNumber/AR/Corpus.hs | Haskell | bsd-3-clause | 2,919 |
{-# OPTIONS -fglasgow-exts #-}
module GisServer.Data.Common ( LexicalLevel, lexLevel
, fieldTermChar, fieldTerm
, recordTermChar, recordTerm
, getStringN, getStringEncoded, getStringTill
, getInt, getInt... | alios/gisserver | GisServer/Data/Common.hs | Haskell | bsd-3-clause | 2,485 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
-- | Github API: http://developer.github.com/v3/oauth/
module Main where
import Control.Monad (mzero)
import Data.Aeson
import qualified Data.ByteString as BS
import Data... | reactormonk/hoauth2 | example/Github/test.hs | Haskell | bsd-3-clause | 1,761 |
{-# OPTIONS -fno-implicit-prelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.HashTable
-- Copyright : (c) The University of Glasgow 2003
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : libraries@haskell.org
-- ... | OS2World/DEV-UTIL-HUGS | libraries/Data/HashTable.hs | Haskell | bsd-3-clause | 12,055 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE LambdaCase #-}
module Zodiac.Cli.TSRP.Env(
tsrpParamsFromEnv
) where
import Control.Monad.IO.Class (liftIO)
import Data.ByteString (ByteString)
import qualified Data.Text as T
import qualified Data.Text.Encod... | ambiata/zodiac | zodiac-cli/src/Zodiac/Cli/TSRP/Env.hs | Haskell | bsd-3-clause | 1,276 |
{-# LANGUAGE OverloadedStrings #-}
module Data.Conduit.Succinct.JsonSpec (spec) where
import Control.Monad.Trans.Resource (MonadThrow)
import Data.ByteString
import Data.Conduit
import Data.Conduit.Succinct.Json
import Data.Int
import Data.Succinct
import... | haskell-works/conduit-succinct-json | test/Data/Conduit/Succinct/JsonSpec.hs | Haskell | bsd-3-clause | 5,764 |
{-# LANGUAGE PatternSynonyms #-}
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.GL.ARB.CullDistance
-- Copyright : (c) Sven Panne 2019
-- License : BSD3
--
-- Maintainer : Sven Panne <svenpanne@gmail.com>
-- Stability : stable
-- Portability... | haskell-opengl/OpenGLRaw | src/Graphics/GL/ARB/CullDistance.hs | Haskell | bsd-3-clause | 699 |
{-# OPTIONS -XDeriveDataTypeable #-}
-- this program imput numbers and calculate their factorials. The workflow control a record all the inputs and outputs
-- so that when the program restart, all the previous results are shown.
-- if the program abort by a runtime error or a power failure, the program will still work... | agocorona/Workflow | Demos/fact.hs | Haskell | bsd-3-clause | 1,741 |
module FillingJars
( getlines,
startjars
) where
getlines :: Int -> IO Integer
getlines m
| m <= 0 = do return 0
| otherwise = do
x_temp <- getLine
let x_t = words x_temp
let a = read $ x_t!!0 :: Integer
let b = read $ x_t!!1 :: Integer
let k = read $... | zuoqin/hackerrank | src/FillingJars.hs | Haskell | bsd-3-clause | 741 |
module Module3.Task17 where
-- system code
coins :: (Ord a, Num a) => [a]
coins = [2, 3, 7]
-- solution code
change :: (Ord a, Num a) => a -> [[a]]
change 0 = [[]]
change s = [coin:ch | coin <- coins, coin <= s, ch <- (change $ s - coin)]
| dstarcev/stepic-haskell | src/Module3/Task17.hs | Haskell | bsd-3-clause | 241 |
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module CommandLine (readOptions) where
import Control.Applicative ((<$>), (<*>))
import Control.Arrow (first)
import Control.Monad (unless)
import Data.Maybe (fromMaybe)
import System.Console.GetOpt (getOpt, ArgOrder(..), OptDescr(..), ArgDescr(... | YoshikuniJujo/forest | subprojects/tls-analysis/server/CommandLine.hs | Haskell | bsd-3-clause | 5,968 |
{-# LANGUAGE CPP #-}
-- | HPACK(<https://tools.ietf.org/html/rfc7541>) encoding and decoding a header list.
module Network.HPACK (
-- * Encoding and decoding
encodeHeader
, decodeHeader
-- * Encoding and decoding with token
, encodeTokenHeader
, decodeTokenHeader
-- * DynamicTable
, DynamicTable
, ... | kazu-yamamoto/http2 | Network/HPACK.hs | Haskell | bsd-3-clause | 1,358 |
module Main (main) where
import qualified Data.ByteString as B
--import Language.C
import Language.CIL
import System.Environment
--import Compile
--import Verify
version = "0.2.0"
main :: IO ()
main = do
args <- getArgs
case args of
[] -> help
(a:_) | elem a ["help", "-h", "--help", "-help"] -> help
... | tomahawkins/afv | src/AFV.hs | Haskell | bsd-3-clause | 3,244 |
{-# LANGUAGE CPP #-}
module Feldspar.IO.Frontend
( module Feldspar.IO.Frontend
, ExternalCompilerOpts (..)
, defaultExtCompilerOpts
) where
#if __GLASGOW_HASKELL__ < 710
import Control.Applicative
#endif
import Data.Ix
import Data.Monoid
import Data.Proxy
import Text.Printf (PrintfArg)
import qualified Con... | emilaxelsson/feldspar-io | src/Feldspar/IO/Frontend.hs | Haskell | bsd-3-clause | 14,031 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE NoImplicitPrelude #-}
-- |
-- Module: $HEADER$
-- Description: Data type that represents name of a SCM (Source Code
-- Management) tool.
-- Copyright: (c) 2016 Peter Trško
-- License: BSD3
--
-- Maintainer: peter.trsko@gmail.com
-- Stability: ... | trskop/yx | src/YX/Type/DbConnection.hs | Haskell | bsd-3-clause | 1,177 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
module VarEnv (
-- * Var, Id and TyVar environments (maps)
VarEnv, IdEnv, TyVarEnv, CoVarEnv, TyCoVarEnv,
-- ** Manipulating these environments
emptyVarEnv, unitVarEnv, mkVarEnv, mkVarEnv... | sdiehl/ghc | compiler/basicTypes/VarEnv.hs | Haskell | bsd-3-clause | 23,220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.