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 FireHazard
(grid,
instructions,
lightsLit)
where
import qualified Data.ByteString.Lazy.Char8 as C
import Data.Vector as V (replicate,accum, Vector, foldr, sum)
data Switch = ON | OFF | Toggle deriving (Eq, Show)
type Grid = V.Vector (V.Vector Int)
rv :: V.Vector Int
rv = V.replicate 1000 0
grid :: Grid
g... | cvsekhar/adventofcode | src/FireHazard.hs | Haskell | bsd-3-clause | 1,901 |
{-# LANGUAGE OverloadedStrings #-}
module Text.Authoring.Combinator.Meta where
import Control.Monad.Writer
import Data.Text (Text)
import Text.Authoring.Document
import Text.Authoring.Combinator.Writer
-- | wrap the argument @x@ using curly braces "{x}"
braces :: (MonadWriter t m, HasDocument t) => m () -> m ()
b... | nushio3/authoring | src/Text/Authoring/Combinator/Meta.hs | Haskell | bsd-3-clause | 1,090 |
lend amount balance = let reserve = 100
newBalance = balance - amount
in if balance < reserve
then Nothing
else Just newBalance
lend2 amount balance = if amount < reserve * 0.5
then Just newBalan... | NeonGraal/rwh-stack | ch03/Lending.hs | Haskell | bsd-3-clause | 656 |
-- 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.
module Duckling.Quantity.EN.Tests
( tests
) where
import Data.String
import Prelude
import Test.Tasty
impor... | facebookincubator/duckling | tests/Duckling/Quantity/EN/Tests.hs | Haskell | bsd-3-clause | 557 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module Main where
import Arch
import MainCommon
import Data.String.Conv (toS)
import Data.Aeson (encode)
main :: IO ()
main = do
doc <- getDocumentByArgs
let packageStats = PackagesStats
<$> f "core"
<*> f "extra"
... | chrissound/ArchLinuxPkgStatsScraper | app/Main.hs | Haskell | bsd-3-clause | 628 |
module WeightForWeight where
import Data.Char (digitToInt)
import Data.List (sortBy)
import Data.Ord (comparing)
-- | Sort numbers by the sum of their digits (5 kyu)
-- | Link: https://biturl.io/SortWeight
-- | Refactored solution I came up with after completition of this kata
-- originally I compared the number and... | Eugleo/Code-Wars | src/number-kata/WeightForWeight.hs | Haskell | bsd-3-clause | 646 |
import Graphics.Rendering.Chart.Easy
import Graphics.Rendering.Chart.Backend.Cairo
import Data.Time.LocalTime
import Test.Examples.Prices(prices,mkDate,filterPrices)
prices' :: [(LocalTime,Double,Double)]
prices' = filterPrices prices (mkDate 1 1 2005) (mkDate 31 12 2006)
main = toFile def "example2_big.png" $ do
... | visood/bioalgo | test/Test/Examples/Plots/priceHistory.hs | Haskell | bsd-3-clause | 1,859 |
{-# LANGUAGE RebindableSyntax #-}
-- Copyright : (C) 2009 Corey O'Connor
-- License : BSD-style (see the file LICENSE)
import Bind.Marshal.Prelude
import Bind.Marshal.Verify
import Bind.Marshal.StdLib.Dynamic.ByteString.Lazy.Des
main = run_test $ do
returnM () :: Test ()
| coreyoconnor/bind-marshal | test/verify_stdlib_dynamic_bytestring_lazy_des.hs | Haskell | bsd-3-clause | 288 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeOperators #-}
module Server where
import Control.Mona... | odr/pers | app/Server.hs | Haskell | bsd-3-clause | 2,863 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE RecordWildCards #-}
module IOCP.Worker (
Worker,
new,
enqueue,
-- * Helpers
forkOSUnmasked,
) where
import Control.Concurrent
import Control.Exception (mask_)
import Control.Monad (forever, void)
import Data.IORef
import GHC.IO (un... | joeyadams/haskell-iocp | IOCP/Worker.hs | Haskell | bsd-3-clause | 1,794 |
module Graphomania.Builder.FromVertices
(
) where
-- TODO:
-- - Граф Fold по вершинам.
-- - Вершина. Внешний ID; Тэг (не испльзуется); Fold по рёбрам.
-- - Ребро. ID вершины, на которую оно указывает + Тэг.
-- ID вершины является внутренним идентификатором, но для вершины исходного графа.
-- 1. не использовать зд... | schernichkin/BSPM | graphomania/src/Graphomania/Builder/FromVertices.hs | Haskell | bsd-3-clause | 829 |
-- | Some auxiliary crypto types
module UTxO.Crypto (
-- * Key-pairs
RegularKeyPair(..)
, EncKeyPair(..)
, RedeemKeyPair(..)
, regularKeyPair
, encKeyPair
, encToRegular
-- * Abstract API
, SomeKeyPair(..)
, TxOwnedInput
, ClassifiedInputs(..)
, classifyInputs
-- * Delegation
, Deleg... | input-output-hk/cardano-sl | utxo/src/UTxO/Crypto.hs | Haskell | apache-2.0 | 5,350 |
import Application (appMain)
import Prelude (IO)
main :: IO ()
main = appMain
| sulami/hGM | app/main.hs | Haskell | bsd-3-clause | 103 |
-- (c) The University of Glasgow 2006
--
-- FamInstEnv: Type checked family instance declarations
{-# LANGUAGE CPP, GADTs, ScopedTypeVariables #-}
module FamInstEnv (
FamInst(..), FamFlavor(..), famInstAxiom, famInstTyCon, famInstRHS,
famInstsRepTyCons, famInstRepTyCon_maybe, dataFamInstRepTyCon,
... | oldmanmike/ghc | compiler/types/FamInstEnv.hs | Haskell | bsd-3-clause | 64,841 |
{-# LANGUAGE ExistentialQuantification #-}
-- |This module provides widgets to center other widgets horizontally
-- and vertically. These centering widgets relay focus and key events
-- to their children.
module Graphics.Vty.Widgets.Centering
( HCentered
, VCentered
, hCentered
, vCentered
, center... | KommuSoft/vty-ui | src/Graphics/Vty/Widgets/Centering.hs | Haskell | bsd-3-clause | 4,135 |
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE UnboxedTuples #-}
{-# OPTIONS_HADDOCK hide #-}
-- |
-- Module : Data.Array.Accelerate.Lifetime
-- Copyright : [2015] Robert Clifton-Everest, Manuel M T Chakravarty, Gabriele Keller
-- License : BSD3
--
-- Maintainer : Robert Clifton-... | rrnewton/accelerate | Data/Array/Accelerate/Lifetime.hs | Haskell | bsd-3-clause | 4,837 |
----------------------------------------------------------------------------
-- |
-- Module : Main
-- Copyright : (c) Spencer Janssen 2007
-- License : BSD3-style (see LICENSE)
--
-- Maintainer : sjanssen@cse.unl.edu
-- Stability : unstable
-- Portability : not portable, uses mtl, X11, posix
--
-- x... | atupal/xmonad-mirror | xmonad/Main.hs | Haskell | mit | 3,413 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleContexts #-}
import Control.CP.FD.Example
-- diffList: the differences between successive elements of a list
diffList l = exists $ \d -> do -- request a (collection) variable d
let n = size l -- introduce n as alias for size l
size d @= n-1 ... | neothemachine/monadiccp | examples/AllInterval.hs | Haskell | bsd-3-clause | 1,386 |
{-# LANGUAGE RankNTypes #-}
module Toplevel where
import Data.Char(isAlpha,isDigit)
import Data.List(partition,(\\),nub,find,deleteBy,sort)
import Data.Map(Map,toList)
import System.IO
import Version(version,buildtime)
import Syntax
import ParserDef(getInt,pCommand,parseString,Command(..)
,program,par... | cartazio/omega | src/Toplevel.hs | Haskell | bsd-3-clause | 14,847 |
module Get.Init where
import System.IO (hFlush, stdout)
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Elm.Package.Name as N
import qualified Elm.Package.Version as V
import qualified Elm.Package.Description as D
import qualified Elm.Package.Paths as Path
import qualified Data.ByteString.Lazy as BS
... | laszlopandy/elm-package | src/Get/Init.hs | Haskell | bsd-3-clause | 2,361 |
module ShouldCompile where
(<>) :: (a -> Maybe b) -> (b -> Maybe c) -> (a -> Maybe c)
(m1 <> m2) a1 = case m1 a1 of
Nothing -> Nothing
Just a2 -> m2 a2
| ezyang/ghc | testsuite/tests/parser/should_compile/read026.hs | Haskell | bsd-3-clause | 209 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module TH_RichKinds2 where
import Data.Char
import Data.List
import Language.Haskell.TH
$(return [OpenTypeFamilyD ... | ezyang/ghc | testsuite/tests/th/TH_RichKinds2.hs | Haskell | bsd-3-clause | 1,698 |
{-# LANGUAGE TypeFamilies #-}
module B where
class Entity v where
data Fields v
instance Show (Fields v) where show = undefined
| wxwxwwxxx/ghc | testsuite/tests/driver/T5147/B1.hs | Haskell | bsd-3-clause | 134 |
module ShouldFail where
data Foo = MkFoo Bool
instance Eq Foo where
(MkFoo x) == (MkFoo y) = x == y
instance Eq Foo where
-- forgot to type "Ord" above
(MkFoo x) <= (MkFoo y) = x <= y
| urbanslug/ghc | testsuite/tests/typecheck/should_fail/tcfail056.hs | Haskell | bsd-3-clause | 200 |
{-# LANGUAGE OverloadedStrings #-}
module Store.SQL.Util.Pivots where
{-- Pivot tables ---------------------------------------------------------------
Last week you were able to scan the database, extract rows of name(s), parse
the names, then store them as parsed entities in the database connected to the
source art... | geophf/1HaskellADay | exercises/HAD/Store/SQL/Util/Pivots.hs | Haskell | mit | 3,684 |
{-|
Module : Types
Description : Example of types operations in Haskell
Copyright : (c) Fabrício Olivetti, 2017
License : GPL-3
Maintainer : fabricio.olivetti@gmail.com
A sample of operations with different types.
-}
module Main where
-- |'soma' sums two integer values
soma :: Integer -> Integer -> Integ... | folivetti/BIGDATA | 02 - Básico/Types.hs | Haskell | mit | 685 |
{-# LANGUAGE OverloadedStrings #-}
module Compiler.Types where
import Constants
import Control.Monad (mzero)
import CoreTypes
import Data.Aeson (FromJSON (..), ToJSON (..), Value (..), object,
(.:), (.=))
import Language.Types
impo... | badi/super-user-spark | src/Compiler/Types.hs | Haskell | mit | 1,955 |
-- Traits type class
-- ref: https://wiki.haskell.org/Traits_type_class
-- ref: https://wiki.haskell.org/Reified_type
-- blog: http://augustss.blogspot.nl/2007/04/overloading-haskell-numbers-part-3.html
-- Occasionally you want to associate information with a type, not just a value. An example is the standard Bounded ... | Airtnp/Freshman_Simple_Haskell_Lib | Idioms/Traits-type-class.hs | Haskell | mit | 3,073 |
module Debug.Debug (
DebugShow,
debug_show,
) where
class DebugShow a where
debug_show :: a -> String
| quintenpalmer/fresh | haskell/src/Debug/Debug.hs | Haskell | mit | 115 |
-- Convert string to camel case
-- http://www.codewars.com/kata/517abf86da9663f1d2000003/
module CamelCase where
import Data.Char (toUpper)
import Data.List.Split (split, dropDelims, oneOf)
toCamelCase :: String -> String
toCamelCase str = f . split (dropDelims $ oneOf "-_") $ str
where f [] = []
f [x]... | gafiatulin/codewars | src/5 kyu/CamelCase.hs | Haskell | mit | 422 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ViewPatterns #-}
module Hpack.Render.Hints (
FormattingHints (..)
, sniffFormattingHints
#ifdef TEST
, extractFieldOrder
, extractSectionsFieldOrder
, sanitize
, unindent
, sniffAlignment
, splitField
, sniffIndentation
, sniffCommaStyle
#endif
) where
import Data.Char
imp... | haskell-tinc/hpack | src/Hpack/Render/Hints.hs | Haskell | mit | 3,834 |
{-# LANGUAGE FlexibleContexts #-}
{-
Copyright (C) 2012 Kacper Bak <http://gsd.uwaterloo.ca>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation t... | juodaspaulius/clafer-old-customBNFC | src/Language/Clafer/Intermediate/ResolverInheritance.hs | Haskell | mit | 10,166 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Cilia.Config where
import Prelude
import Data.Maybe(fromMaybe)
import qualified Data.Text as T
import Data.Yaml( FromJSON(..)
, (.:)
, (.:?)
, decodeFileEither)
import qualified Data.Yaml as Y
i... | bbiskup/cilia | src-lib/Cilia/Config.hs | Haskell | mit | 1,446 |
module Y2017.M01.D02.Exercise where
import Data.List
import Data.Set (Set)
{--
Happy New Year, Haskellers.
Dr. Paul Coxon claims 2017 will be less divisive than 2016.
He is correct, but let's prove it.
1. What are the unique divisors of last year and this year?
--}
type Year = Int
uniqueFactors :: Year -> Set In... | geophf/1HaskellADay | exercises/HAD/Y2017/M01/D02/Exercise.hs | Haskell | mit | 1,147 |
{-# LANGUAGE OverloadedStrings #-}
module Utils.Password
( Password (Password)
, PasswordHash
, verifyPassword
, createPasswordHash
, writePasswordHashToFile
, readPasswordHashFromFile
)where
import Data.String (IsString(..))
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf8)
import Data.B... | CarstenKoenig/MyWebSite | src/Utils/Password.hs | Haskell | mit | 1,215 |
-- Smallest multiple
-- Problem 5
-- 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.
-- What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20?
main = do
print (getSmallestN)
getSmallestN =
head [x | x <- [25... | BrunoRB/haskell-problems | euler/euler5.hs | Haskell | mit | 404 |
module GHCJS.DOM.MediaKeyEvent (
) where
| manyoo/ghcjs-dom | ghcjs-dom-webkit/src/GHCJS/DOM/MediaKeyEvent.hs | Haskell | mit | 43 |
module Main where
import Servant.Server
import Network.Wai.Handler.Warp
import Api
--------------------------------------------------------------------------------
main :: IO ()
main = do
run 3000 (serve api server)
| sigrlami/servant-examples | servant-auth-basic/src/Main.hs | Haskell | mit | 222 |
module Parser.Expression where
import Text.Parsec
import Text.Parsec.String
import Text.Parsec.Char
import Types
import Parser.Common
-- CALL --
call :: Parser Call
call = do
pos <- getPosition
name <- identifier
openParen
args <- expr `sepBy` (char ',')
closeParen
return $ Call pos name args
-- EXPRES... | PelleJuul/popl | src/Parser/Expression.hs | Haskell | mit | 1,279 |
{-# LANGUAGE FlexibleInstances #-}
import Control.Applicative
import Control.DeepSeq
import Data.List (sort,unfoldr)
import Data.Word
import System.Process
import System.Vacuum.Cairo (viewFile)
import Test.QuickCheck
view x = rnf x `seq` do
viewFile "temp.svg" x
system "opera temp.svg"
data Heap a = E | T a (Hea... | olsner/sbmalloc | PairingHeap.hs | Haskell | mit | 4,311 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
module Template (
render
) where
import Data.Data
import Data.FileEmbed (embedDir)
import Data.ByteString (ByteString)
import Data.ByteString.UTF8 (toString)
import Text.Hastache.Context (mkGenericContext)
import Text.Hastache (
hastacheStr,
... | prasmussen/magmod | Template.hs | Haskell | mit | 774 |
---------------------------------------------------------------------
--
-- | Ascetic
--
-- @Text\/Ascetic.hs@
--
-- Data structure, combinators, and functions for assembling
-- data and emitting files in any XML-like or HTML-like
-- markup language (consisting of tags, elements, attributes,
-- declarations, a... | lapets/ascetic | Text/Ascetic.hs | Haskell | mit | 3,749 |
-- Pretty.hs ---
--
-- Filename: Pretty.hs
-- Description:
-- Author: Manuel Schneckenreither
-- Maintainer:
-- Created: Thu Sep 4 10:42:24 2014 (+0200)
-- Version:
-- Package-Requires: ()
-- Last-Updated: Mon Jul 23 10:23:54 2018 (+0200)
-- By: Manuel Schneckenreither
-- Update #: 62
-- URL:
-- Doc URL:... | ComputationWithBoundedResources/ara-inference | src/Data/Rewriting/ARA/Exception/Pretty.hs | Haskell | mit | 1,503 |
--------------------------------------------------------------------------------
-- |
-- Module : AI.Clustering.KMeans.Types
-- Copyright : (c) 2015 Kai Zhang
-- License : MIT
--
-- Maintainer : kai@kzhang.org
-- Stability : experimental
-- Portability : portable
--
-- <module description starting a... | kaizhang/clustering | src/AI/Clustering/KMeans/Types.hs | Haskell | mit | 2,205 |
-- Copyright (C) 2009-2012 John Millikin <john@john-millikin.com>
--
-- 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 require... | rblaze/haskell-dbus | lib/DBus.hs | Haskell | apache-2.0 | 8,863 |
{-# LANGUAGE OverloadedStrings #-}
-- |
-- Module : Geography.VectorTile.Util
-- Copyright : (c) Colin Woodbury 2016 - 2018
-- License : BSD3
-- Maintainer: Colin Woodbury <colingw@gmail.com>
module Data.Geometry.VectorTile.Util where
import Data.Geometry.VectorTile.Geometry (Point (..))
import qualif... | sitewisely/zellige | src/Data/Geometry/VectorTile/Util.hs | Haskell | apache-2.0 | 1,189 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE FlexibleContexts #-}
module FormatHandler.Html
( htmlFormatHandler
, YesodAloha (..)
, splitTitle
, titleForm
) where
import FormatHandler
import Text.Julius (julius)
import Text.HTML.SanitizeXSS (sanitizeBalance)
import q... | snoyberg/yesodcms | FormatHandler/Html.hs | Haskell | bsd-2-clause | 3,767 |
module Propellor.Property.Network where
import Propellor
import Propellor.Property.File
type Interface = String
ifUp :: Interface -> Property NoInfo
ifUp iface = cmdProperty "ifup" [iface]
-- | Resets /etc/network/interfaces to a clean and empty state,
-- containing just the standard loopback interface, and with
--... | shosti/propellor | src/Propellor/Property/Network.hs | Haskell | bsd-2-clause | 3,366 |
module WebToInk.Converter.ConverterService ( prepareKindleGeneration
, getTitle
, getMobi
) where
import System.Directory (createDirectoryIfMissing, getDirectoryContents)
import System.I... | thlorenz/WebToInk | webtoink-converter/WebToInk/Converter/ConverterService.hs | Haskell | bsd-2-clause | 10,328 |
{-# LANGUAGE OverloadedStrings, DuplicateRecordFields #-}
{- Example "data-point" from a "daily" result:
"time":1475564400,
"summary":"Partly cloudy until evening.",
"icon":"partly-cloudy-day",
"sunriseTime":1475590177,
"sunsetTime":1475632150,
"moonPhase":0.12,
"precipIntensity":0,
"p... | jasonkuhrt/weather | source/WeatherPoint.hs | Haskell | bsd-3-clause | 2,782 |
{-# LANGUAGE TypeSynonymInstances, FlexibleInstances, FlexibleContexts #-}--, OverlappingInstances #-}
module Language.SPL.Analyzer where
import Language.SPL.Program
import Language.SPL.Position
--import Language.SPL.Environment
type Error = (Position,String)
type Errors = [Error]
--report :: (Show a, MonadWriter E... | timjs/spl-compiler | Old/Analyzer.hs | Haskell | bsd-3-clause | 3,466 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
data Binary = Bin Binary Binary | Tip
deriving Show
louds :: Binary -> [Bool]
louds binary = True : encode binary
where
encode :: Binary -> [Bool]
encode (Bin l r) = True : (encode... | haskell-works/succinct-playground | app/Main.hs | Haskell | bsd-3-clause | 836 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-|
Module : Text.XML.Xleb
Description : The Xleb XML-parsing monad
Copyright : (c) Getty Ritter, 2017
License : BSD
Maintainer : Getty Ritter <xleb@infinitenegativeutility.com>
Stability : experimental
The 'Xleb' monad (and the corresponding 'XlebT' monad tran... | aisamanra/xleb | src/Text/XML/Xleb.hs | Haskell | bsd-3-clause | 12,279 |
{-# LANGUAGE DeriveDataTypeable, RecordWildCards, TemplateHaskell, MagicHash #-}
{-# OPTIONS_GHC -fno-warn-missing-fields #-}
module System.Console.CmdArgs.Test.Implicit.Diffy where
import System.Console.CmdArgs
import System.Console.CmdArgs.Quote
import System.Console.CmdArgs.Test.Implicit.Util
data Diffy = Create {s... | ndmitchell/cmdargs | System/Console/CmdArgs/Test/Implicit/Diffy.hs | Haskell | bsd-3-clause | 2,681 |
-- -----------------------------------------------------------------------------
-- Alex wrapper code.
--
-- This code is in the PUBLIC DOMAIN; you may copy it freely and use
-- it for any purpose whatsoever.
import Control.Applicative (Applicative (..))
import Data.Word (Word8)
#if defined(ALEX_BASIC_BYTESTRING) || d... | kumasento/alex | templates/wrappers.hs | Haskell | bsd-3-clause | 16,536 |
{-# LANGUAGE
DeriveDataTypeable
, DeriveGeneric
, LambdaCase
, OverloadedStrings
, ScopedTypeVariables
, TemplateHaskell
, TypeFamilies
#-}
module Api.Test where
import Control.Monad.Reader
import Control.Monad.Trans.Error
import Data.Aeson
import Data.Data
import Data.JSON.Schema
import Data.Text (T... | tinkerthaler/basic-invoice-rest | example-api/Api/Test.hs | Haskell | bsd-3-clause | 3,901 |
{-# LANGUAGE DeriveDataTypeable #-}
module ApiAnnotation (
getAnnotation, getAndRemoveAnnotation,
getAnnotationComments,getAndRemoveAnnotationComments,
ApiAnns,
ApiAnnKey,
AnnKeywordId(..),
AnnotationComment(..),
LRdrName -- Exists for haddocks only
) where
import RdrName
import Outputable
import SrcL... | green-haskell/ghc | compiler/parser/ApiAnnotation.hs | Haskell | bsd-3-clause | 8,957 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
--------... | cchalmers/geometry | src/Geometry/Combinators.hs | Haskell | bsd-3-clause | 10,535 |
import Test.Hspec
import EratosthenesSieve
main :: IO ()
main = hspec $ do
describe "The sieve of Eratosthenes" $ do
it "should return a list with all the prime numbers up to a given number" $ do
primesUpTo 2 `shouldBe` [2]
primesUpTo 3 `shouldBe` [2, 3]
primesUpTo 5 `shouldBe` [2, 3, 5]
... | theUniC/eratosthenes-sieve.hs | test/Spec.hs | Haskell | bsd-3-clause | 405 |
module Pipe
( TSink
, TSource
, TPipe
, newTPipe
, writeTSink
, readTSource
) where
import Control.Concurrent.STM
newtype TSink a = TSink (TChan a)
newtype TSource a = TSource (TChan a)
type TPipe a = (TSink a, TSource a)
writeTSink :: TSink a -> a -> STM ()
writeTSink (TSink chan) = writ... | frerich/lambdacrawler | src/Pipe.hs | Haskell | bsd-3-clause | 512 |
-- 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.
module Duckling.Duration.HU.Tests
( tests
) where
import Data.String
import Prelude
import Test.Tasty
impor... | facebookincubator/duckling | tests/Duckling/Duration/HU/Tests.hs | Haskell | bsd-3-clause | 509 |
-- |
-- Module : Language.SequentCore.Plugin
-- Description : GHC plugin library
-- Maintainer : maurerl@cs.uoregon.edu
-- Stability : experimental
--
-- Tools for writing a GHC plugin using the Sequent Core language in place of
-- GHC Core.
module Language.SequentCore.Plugin (
sequentPass, sequentPassWithFl... | lukemaurer/sequent-core | src/Language/SequentCore/Plugin.hs | Haskell | bsd-3-clause | 1,741 |
{-# LANGUAGE BangPatterns, DeriveDataTypeable, DeriveGeneric, FlexibleInstances, MultiParamTypeClasses #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Web.RTBBidder.Protocol.Adx.BidRequest.AdSlot.NativeAdTemplate.Fields (Fields(..)) where
import Prelude ((+), (/), (.))
import qualified Prelude as Prelude'
impo... | hiratara/hs-rtb-bidder | src/Web/RTBBidder/Protocol/Adx/BidRequest/AdSlot/NativeAdTemplate/Fields.hs | Haskell | bsd-3-clause | 4,477 |
-- |
-- Helper methods used to construct requests.
--
module Network.TableStorage.Request (
propertyList,
entityKeyResource,
columnToTypeString,
printEntityColumn,
printComparisonType,
buildFilterString,
buildQueryString
) where
import Data.Time ( formatTime )
import System.Locale ( defaultTimeLocale )
... | paf31/tablestorage | src/Network/TableStorage/Request.hs | Haskell | bsd-3-clause | 5,280 |
{-# LANGUAGE PolyKinds #-}
module Data.Flip
( Flip (..)
) where
newtype Flip f a b = Flip { getFlip :: f b a }
| sonyandy/unify | examples/unify-hm/Data/Flip.hs | Haskell | bsd-3-clause | 126 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Ty... | Garygunn94/DFS | TransactionServer/src/TransactionServer.hs | Haskell | bsd-3-clause | 8,739 |
-- 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.
module Duckling.Temperature.IT.Tests
( tests ) where
import Data.String
import Prelude
import Test.Tasty
impor... | facebookincubator/duckling | tests/Duckling/Temperature/IT/Tests.hs | Haskell | bsd-3-clause | 515 |
{-# LANGUAGE ScopedTypeVariables #-}
module Rad.QL.Define.Schema where
import Data.Monoid ((<>))
import qualified Data.Trie as Trie
import Rad.QL.Internal.Types
import Rad.QL.AST
import Rad.QL.Types
import Rad.QL.Query
defineSchema :: forall m b. (GraphQLType OBJECT m b) => b -> Schema m
define... | jqyu/bustle-chi | src/Rad/QL/Define/Schema.hs | Haskell | bsd-3-clause | 1,685 |
{-# LANGUAGE OverloadedStrings #-}
module Milter.Base (
Packet (..)
, getPacket
, getIP
, getKeyVal
, getBody
, negotiate
, accept, discard, hold, reject, continue
) where
import Blaze.ByteString.Builder
import Blaze.ByteString.Builder.Char8
import Control.Applicative
import Control.Monad
import qua... | kazu-yamamoto/rpf | Milter/Base.hs | Haskell | bsd-3-clause | 3,325 |
{-
Gifcurry
(C) 2017 David Lettier
lettier.com
-}
{-# LANGUAGE
NamedFieldPuns
, DuplicateRecordFields
#-}
module GuiKeyboard where
import Control.Monad
import Data.IORef
import Data.Word
import qualified GI.Gdk
import qualified GI.Gtk
import qualified GuiRecords as GR
import qualified GuiPreview
import ... | lettier/gifcurry | src/gui/GuiKeyboard.hs | Haskell | bsd-3-clause | 2,707 |
{-
This file is part of the Haskell package distinfo. It is subject to
the license terms in the LICENSE file found in the top-level directory
of this distribution and at git://pmade.com/distinfo/LICENSE. No part
of the distinfo package, including this file, may be copied, modified,
propagated, or distributed except ac... | devalot/distinfo | src/DistInfo.hs | Haskell | bsd-3-clause | 644 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{- |
Core types for content.
The whole site is a list of categories ('Category'). Categories have items
('Item') in th... | aelve/hslibs | src/Guide/Types/Core.hs | Haskell | bsd-3-clause | 9,043 |
-- | Testing what work is shared by GHC. In general you can't assume
-- work will be shared. Sometimes GHC will do CSE and top level
-- floating to share work but not for say papLots which really requires
-- some partial evalutation kind of work. (e.g Max's super evaluator)
module Main where
papLots :: [Double] -> Dou... | dterei/Scraps | haskell/PapWorkShare.hs | Haskell | bsd-3-clause | 745 |
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__
{-# LANGUAGE MagicHash, UnboxedTuples #-}
#endif
{-# OPTIONS_HADDOCK prune #-}
#if __GLASGOW_HASKELL__ >= 701
{-# LANGUAGE Trustworthy #-}
#endif
-- |
-- Module : Data.ByteString.Char8
-- Copyright : (c) Don Stewart 2006-2008
-- (c) Duncan Coutts 2006-2... | markflorisson/hpack | testrepo/bytestring-0.10.2.0/Data/ByteString/Char8.hs | Haskell | bsd-3-clause | 40,569 |
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE TemplateHaskell #-}
module Language.LSP.Types.SelectionRange where
import Data.Aeson.TH
import Language.LSP.Types.Common
import Language.LSP.Types.Location
import Language.LSP.Types.Progress
import Language.LSP.Types.StaticRegistrationOptions
import Language.LSP.Typ... | alanz/haskell-lsp | lsp-types/src/Language/LSP/Types/SelectionRange.hs | Haskell | mit | 1,753 |
-- |
-- Description : The convinience module to re-export public definitions
-- Copyright : (c) 2015 Egor Tensin <Egor.Tensin@gmail.com>
-- License : MIT
-- Maintainer : Egor.Tensin@gmail.com
-- Stability : experimental
-- Portability : Windows-only
--
-- An empty module to re-export everything required by the... | egor-tensin/windows-env | src/WindowsEnv.hs | Haskell | mit | 445 |
module Data.Wright.Types where
import Data.Vector (Vector(..), vmap)
data XYZ t = XYZ t t t deriving (Show)
data LAB t = LAB t t t deriving (Show)
data RGB t = RGB t t t deriving (Show)
data Yxy t = Yxy t t t deriving (Show) -- "xyY"
type ℝ = Double
data Gamma = Gamma ℝ | LStar | SRGB
data Application = Graphics |... | fmap-archive/wright | src/Data/Wright/Types.hs | Haskell | mit | 1,149 |
module System.LookupEnv (lookupEnv) where
import System.Environment (getEnvironment)
lookupEnv :: String -> IO (Maybe String)
lookupEnv envVar = fmap (lookup envVar) $ getEnvironment
| yesodweb/clientsession | src/System/LookupEnv.hs | Haskell | mit | 185 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Perform a build
module Stack.Build.Execute... | rubik/stack | src/Stack/Build/Execute.hs | Haskell | bsd-3-clause | 66,832 |
{-# LANGUAGE NoMonomorphismRestriction #-}
module Numeric.Units.Dimensional.Test where
import Numeric.Units.Dimensional.Prelude
import qualified Prelude
import Test.HUnit
testPower = TestLabel "Power test" $ TestList
[ TestCase $ (9 *~ one) @=? (3 *~ one) ^ pos2
, TestCase $ (1 *~ one) @=? (12.1231 *~ one) ^... | bjornbm/dimensional-classic | Numeric/Units/Dimensional/Test.hs | Haskell | bsd-3-clause | 1,009 |
import Data.Attoparsec.ByteString.Char8
import qualified Data.ByteString.Lazy as BL
import Options.Applicative (execParser)
import System.IO (hPutStrLn, stdout, stderr)
import CSV
import CommandLineArgs
import File
import Parse.Log
import Types
chooseParsingFunction :: CommandLineOpts -> (Parser LogEntry)
choosePars... | safarijv/ncsa-logparse | src/Main.hs | Haskell | bsd-3-clause | 793 |
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"
| erantapaa/parse-complex | src/Lib.hs | Haskell | bsd-3-clause | 89 |
<?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="sl-SI">
<title>Server-Sent Events | ZAP Extension</title>
<maps>
<homeID>top</homeID>
... | 0xkasun/security-tools | src/org/zaproxy/zap/extension/sse/resources/help_sl_SI/helpset_sl_SI.hs | Haskell | apache-2.0 | 980 |
{-
Some tests to verify that serialisation works as expected
-}
module AllTests(tests)
where
import GHC.Packing
import qualified Data.Array.IArray as A
import Control.Concurrent
import System.Environment
import System.IO
import System.Directory
import qualified Data.ByteString as B
import Control.Exception
imp... | ajnsit/packman | Test/AllTests.hs | Haskell | bsd-3-clause | 3,030 |
--------------------------------------------------------------------------------
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
module Hakyll.Check
( Check (..)
, check
) where
--------------------------------------------------------------------------------
import Control.... | Minoru/hakyll | src/Hakyll/Check.hs | Haskell | bsd-3-clause | 9,141 |
module PackageTests.ReexportedModules.Check where
import Data.Version
import PackageTests.PackageTester
import System.FilePath
import Test.Tasty.HUnit
import Data.Maybe
import Data.List
import Control.Monad
import Data.Char
import Text.ParserCombinators.ReadP
orFail :: String -> [(a, String)] -> a
orFail err r = case... | corngood/cabal | Cabal/tests/PackageTests/ReexportedModules/Check.hs | Haskell | bsd-3-clause | 1,220 |
{-# LANGUAGE ScopedTypeVariables, JavaScriptFFI, ForeignFunctionInterface #-}
module Main where
import Prelude hiding (print, putStrLn)
import Control.Concurrent
import Control.Concurrent.MVar
import Control.Exception
import Control.Monad
import Data.List (intersperse)
import GHCJS.Types
import GHCJS.Concurrent
im... | seereason/ghcjs | test/conc/syncThreads.hs | Haskell | mit | 4,442 |
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts, GADTs #-}
module FDsFromGivens2 where
class C a b | a -> b where
cop :: a -> b -> ()
data KCC where
KCC :: C Char Char => () -> KCC
f :: C Char [a] => a -> a
f = undefined
bar :: KCC -> a -> a
bar (KCC _) = f
| ezyang/ghc | testsuite/tests/typecheck/should_fail/FDsFromGivens2.hs | Haskell | bsd-3-clause | 297 |
module Bowling (score, BowlingError(..)) where
data BowlingError = IncompleteGame
| InvalidRoll { rollIndex :: Int, rollValue :: Int }
deriving (Eq, Show)
score :: [Int] -> Either BowlingError Int
score rolls = error "You need to implement this function."
| exercism/xhaskell | exercises/practice/bowling/src/Bowling.hs | Haskell | mit | 279 |
{-# LANGUAGE Safe #-}
{-# LANGUAGE DoAndIfThenElse #-}
module Control.Concurrent.Singular.Event.Primitive (
Event (), newEvent, always, sync
) where
import Control.Concurrent.Singular.Event.Status
import Data.List.Util
import Control.Concurrent.MVar (newEmptyMVar, putMVar, takeMVar)
import Control.Monad (unless)... | YellPika/Hannel | src/Control/Concurrent/Singular/Event/Primitive.hs | Haskell | mit | 1,667 |
{-# LANGUAGE TypeOperators #-}
import Numeric.Noise.Perlin
import System.Random (randomIO,randomIO,randomRs,newStdGen,mkStdGen)
import Graphics.Gloss
import Graphics.Gloss.Data.Color (makeColor8)
import qualified Data.Array.Repa as R
type Seed = Int
rangeMap :: (Ord a) => b -> [(a,b)] -> a -> b
rangeMap def rs x = c... | RTS2013/RTS | tests/mapGeneration_test/PerlinNoise/HaskellPerlin.hs | Haskell | mit | 2,801 |
module Data.BigBunnyAndDeer.DeerInfo
( findDeerEntry
, updateDeerInfo
, writeDeerInfo
, parseRawDeerInfo
, fetchDeerInfo
) where
import Data.Maybe
import Control.Arrow
import Control.Monad.IO.Class
import System.Directory
import qualified System.IO.Strict as SIO
import qualified Data.IntMap as IM
import Da... | Javran/BigBunnyAndDeer | src/Data/BigBunnyAndDeer/DeerInfo.hs | Haskell | mit | 1,674 |
{-# LANGUAGE OverloadedStrings #-}
module System.Directory.Watchman.Expression
( Expression
, renderExpression
, true
, false
, System.Directory.Watchman.Expression.all
, System.Directory.Watchman.Expression.any
, (.&&)
, (.||)
, dirname
, dirname'
, empty
, exists
... | bitc/hs-watchman | src/System/Directory/Watchman/Expression.hs | Haskell | mit | 8,617 |
module Problem7 ( flattenList, NestedList(..) ) where
data NestedList a = Elem a | List [NestedList a]
flattenList :: NestedList a -> [a]
flattenList (Elem a) = [a]
flattenList (List a) = concatMap flattenList a | chanind/haskell-99-problems | Problem7.hs | Haskell | mit | 213 |
module Sudoku.Strategy.HiddenSingle where
import Prelude
import Sudoku
import Sudoku.Strategy
import Data.List
concatRowCandidates :: Sudoku -> Int -> String
concatRowCandidates su i = concat [ findCandidates su i j | j<-[0..(columnCount su - 1)] ]
concatColumnCandidates :: Sudoku -> Int -> String
concatColumnCandid... | thomasbrus/sudoku-solver | src/Sudoku/Strategy/HiddenSingle.hs | Haskell | mit | 2,092 |
{-# LANGUAGE OverloadedStrings #-}
module TypePlay.Check.SimplyTyped where
import Prelude hiding (map,foldl,elem)
import Data.List (map,foldl,(\\),union,elem)
import Data.Text (Text)
import qualified Data.Text as T
import Control.Monad (when)
import Control.Monad.Trans.Error (throwError)
import Data.Monoid ((<>))
t... | mankyKitty/TypePlay | src/TypePlay/Check/SimplyTyped.hs | Haskell | mit | 4,823 |
{-# LANGUAGE OverloadedStrings #-}
import System.Environment
import Globals
import ProcessChain
main :: IO ()
main = do
args <- getArgs
case args of
[] -> statsOn gDefaultUniverse
u:_ -> statsOn u
| mihaimaruseac/petulant-octo-avenger | src/Main.hs | Haskell | mit | 212 |
{-
This file handles the passing of parameters and manages things to do with
the fields within a header comment.
Author(s): Lewis Deane
License: MIT
Last Modified: 20/7/2016
-}
module FieldTools (getFields) where
import Control.Applicative
import Data.List (isPrefi... | lewisjdeane/Comet | FieldTools.hs | Haskell | mit | 7,335 |
-- |
-- The types and functions are trivial and self-descriptive,
-- hence this sentence is the sole documentation you get on them.
module Success.Pure
(
Success,
-- * Creation
nothing,
failure,
success,
-- * Execution
asEither,
asMaybe,
)
where
import Prelude
import Data.Foldable
import Data.Traversab... | nikita-volkov/success | library/Success/Pure.hs | Haskell | mit | 1,387 |
{-# LANGUAGE OverloadedStrings #-}
module Static (mkEmbedded) where
import Crypto.Hash.MD5 (hashlazy)
import qualified Data.ByteString.Base64 as B64
import qualified Data.ByteString.Lazy as BL
import qualified Data.Text as T
import qualified Data.Text.Encodi... | bitemyapp/hterm | Static.hs | Haskell | mit | 1,326 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.