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 |
|---|---|---|---|---|---|
import Test.Hspec
import Test.QuickCheck
import Lib
main :: IO ()
main = hspec $ do
describe "Prelude.head" $ do
it "returns the first element of a list" $ do
head [23..] `shouldBe` (23 :: Int)
it "returns the first element of an *arbitrary* list" $
property $ \x xs -> head (x:xs) == (x :: Int)... | kazeula/haskell-json-sample | test/Spec.hs | Haskell | bsd-3-clause | 322 |
{- |
Module : SAWScript.SBVModel
Description : Abstract representation for .sbv file format.
Maintainer : jhendrix
Stability : provisional
-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
module SAWScript.SBVModel where
import Data.Binary
import Data.List(sortBy)
import Control.Mon... | GaloisInc/saw-script | src/SAWScript/SBVModel.hs | Haskell | bsd-3-clause | 7,300 |
{-# LANGUAGE CPP #-}
-- #hide
--------------------------------------------------------------------------------
-- |
-- Module : Graphics.Rendering.OpenGL.Raw.Types
-- Copyright : (c) Sven Panne 2009
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : sven.panne@aedion.de
-- Stability : ... | Laar/OpenGLRawgen | BuildSources/Types.hs | Haskell | bsd-3-clause | 1,632 |
import System.Environment (getArgs)
import Data.List.Split (splitOn)
import Data.List (intercalate, intersect)
doIntersect :: Eq a => [[a]] -> [a]
doIntersect l = intersect (head l) (last l)
main :: IO ()
main = do
[inpFile] <- getArgs
input <- readFile inpFile
putStr . unlines . map (intercalate "," . d... | nikai3d/ce-challenges | easy/intersection.hs | Haskell | bsd-3-clause | 380 |
module Render.Stmts.Poke.SiblingInfo
where
import Prettyprinter
import Polysemy
import Polysemy.Input
import Relude
import Error
import Marshal.Scheme
import Spec.Name
data SiblingInfo a = SiblingInfo
{ siReferrer :: Doc ()
-- ^ How to ref... | expipiplus1/vulkan | generate-new/src/Render/Stmts/Poke/SiblingInfo.hs | Haskell | bsd-3-clause | 688 |
{-# LANGUAGE PackageImports #-}
module Camera where
import "linear" Linear
d0 = V3 0 (-1) 0
u0 = V3 0 0 (-1)
s0 p = (p,zero,zero,(0,0))
calcCam dt (dmx,dmy) (left,up,down,right,turbo) (p0,_,_,(mx,my)) = (p',p' + d,u,(mx',my'))
where
nil c n = if c then n else zero
p' = nil left (v ^* (-t)) + nil up (d ^* ... | csabahruska/gpipe-quake3 | Camera.hs | Haskell | bsd-3-clause | 763 |
{-# LANGUAGE UnicodeSyntax #-}
import Prelude.Unicode
paths ∷ Eq a ⇒ a → a → [(a, a)] → [[a]]
paths source sink edges
| source ≡ sink = [[sink]]
| otherwise = [[source] ++ path |
edge ← edges, (fst edge) ≡ source,
path ← (paths (snd edge) sink [e | e ← edges, e ≢ edge])
... | m00nlight/99-problems | haskell/p-81.hs | Haskell | bsd-3-clause | 362 |
{-# LANGUAGE OverloadedStrings #-}
module PersistenceSpec (spec) where
import Data.Foldable
import Test.Hspec
import Test.Hspec.QuickCheck (prop)
import Test.QuickCheck.Instances ()
import qualified Data.Aeson as Aeson
import qualified Data.ByteString.Lazy.Char8 as LBS8
import OrphanInstances ()
import Store (Modifi... | channable/icepeak | server/tests/PersistenceSpec.hs | Haskell | bsd-3-clause | 966 |
-----------------------------------------------------------------------------
--
-- Building info tables.
--
-- (c) The University of Glasgow 2004-2006
--
-----------------------------------------------------------------------------
module StgCmmLayout (
mkArgDescr,
emitCall, emitReturn, adjustHpBackwa... | ekmett/ghc | compiler/codeGen/StgCmmLayout.hs | Haskell | bsd-3-clause | 16,801 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
import Data.Functor.Identity
import Data.Proxy
import Data.Vinyl
import ... | andrewthad/graphite | example/main.hs | Haskell | bsd-3-clause | 7,763 |
module Main where
import System.Console.Haskeline
import System.IO
import System.Environment
import System.Exit
import System.FilePath ((</>), addTrailingPathSeparator)
import Data.Maybe
import Data.Version
import Control.Monad.Trans.Error ( ErrorT(..) )
import Control.Monad.Trans.State.Strict ( execStateT, get, put ... | ctford/Idris-Elba-dev | main/Main.hs | Haskell | bsd-3-clause | 5,886 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Test.Ambiata.Cli where
import qualified Data.Text as T
import P
import System.IO
import Turtle
testShell :: [Text] -> Shell Text -> IO (ExitCode, Text)
testShell args = shellStrict args'
where
a... | ambiata/tatooine-cli | test/Test/Ambiata/Cli.hs | Haskell | apache-2.0 | 429 |
<?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="si-LK">
<title>Plug-n-Hack | ZAP Extension</title>
<maps>
<homeID>top</homeID>
<mapref... | veggiespam/zap-extensions | addOns/plugnhack/src/main/javahelp/org/zaproxy/zap/extension/plugnhack/resources/help_si_LK/helpset_si_LK.hs | Haskell | apache-2.0 | 973 |
-- |Make URI an instance of Read and Ord, and add functions to
-- manipulate the uriQuery.
module Extra.URI
( module Network.URI
, relURI
, setURIPort
, parseURIQuery
, modifyURIQuery
, setURIQuery
, setURIQueryAttr
, deleteURIQueryAttr
) where
import Network.URI -- (URIAuth(..), UR... | eigengrau/haskell-extra | Extra/URI.hs | Haskell | bsd-3-clause | 3,659 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Headings
import PropertyDrawer
import Test.Tasty
import Timestamps
import Document
main :: IO ()
main = defaultMain tests
tests :: TestTree
tests = testGroup
"Or... | imalsogreg/orgmode-parse | test/Test.hs | Haskell | bsd-3-clause | 522 |
data BinaryTree a = Node a (BinaryTree a) (BinaryTree a)
| Empty
createTree :: Int -> [[Int]] -> BinaryTree Int
createTree n arr = head subtrees
where subtrees = [getSubtree x | x <- [0..n - 1]]
getSubtree x = (\[l, r] -> Node (x + 1) l r) . map (\x -> if x == -1 t... | EdisonAlgorithms/HackerRank | practice/fp/ds/swap-nodes/swap-nodes.hs | Haskell | mit | 1,189 |
{-# LANGUAGE CPP #-}
module Main where
import HList
rev :: [a] -> [a]
rev [] = []
rev (y:ys) = rev ys ++ [y]
main :: IO ()
main = print $ rev [1..10]
-- Should be in the "List" module
{-# RULES "++ []" forall xs . xs ++ [] = xs #-}
{-# RULES "++ strict" (++) undefined = undefined #-}
-- The "Algeb... | beni55/hermit | examples/concatVanishes/Rev.hs | Haskell | bsd-2-clause | 571 |
{-# LANGUAGE OverloadedStrings #-}
module Bead.View.Content.Assignment.Page (
newGroupAssignment
, newCourseAssignment
, modifyAssignment
, viewAssignment
, newGroupAssignmentPreview
, newCourseAssignmentPreview
, modifyAssignmentPreview
) where
import Control.Monad.Error
import qualified D... | pgj/bead | src/Bead/View/Content/Assignment/Page.hs | Haskell | bsd-3-clause | 10,185 |
{-# LANGUAGE OverloadedStrings #-}
module Yesod.Form.I18n.Japanese where
import Yesod.Form.Types (FormMessage (..))
import Data.Monoid (mappend)
import Data.Text (Text)
japaneseFormMessage :: FormMessage -> Text
japaneseFormMessage (MsgInvalidInteger t) = "無効な整数です: " `Data.Monoid.mappend` t
japaneseFormMessage (MsgIn... | s9gf4ult/yesod | yesod-form/Yesod/Form/I18n/Japanese.hs | Haskell | mit | 1,650 |
{-# LANGUAGE ScopedTypeVariables #-}
module Stackage.LoadDatabase where
import qualified Codec.Archive.Tar as Tar
import qualified Codec.Compression.GZip as GZip
import Control.Exception (IOException, handle)
import Control.Monad ... | Tarrasch/stackage | Stackage/LoadDatabase.hs | Haskell | mit | 12,417 |
{-# LANGUAGE PatternGuards #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Util.NamedScratchpad
-- Copyright : (c) Konstantin Sobolev <konstantin.sobolev@gmail.com>
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Konstantin Sobolev <konst... | markus1189/xmonad-contrib-710 | XMonad/Util/NamedScratchpad.hs | Haskell | bsd-3-clause | 7,541 |
{-# LANGUAGE DataKinds, ExistentialQuantification, GADTs, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeInType, TypeFamilies #-}
{- # LANGUAGE UndecidableInstances #-}
module T15552 where
import Data.Kind
data Elem :: k -> [k] -> Type where
Here :: Elem x (x : xs)
There :: Elem x xs -> Elem x (y : xs)
data Entr... | sdiehl/ghc | testsuite/tests/typecheck/should_fail/T15552a.hs | Haskell | bsd-3-clause | 1,051 |
module AddOneParameter.D1 where
{-add parameter 'f' to function 'sq' . This refactoring
affects module 'D1', 'C1' and 'A1'-}
sumSquares (x:xs) = sq x + sumSquares xs
sumSquares [] = 0
sq x = x ^ pow
pow =2
| RefactoringTools/HaRe | test/testdata/AddOneParameter/D1.hs | Haskell | bsd-3-clause | 215 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE Rank2Types #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.Machine.Wye
-- Copyright : (C) 2012 Edward Kmett, Rúnar Bjarnason, Paul Chiusano
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward ... | YoEight/machines | src/Data/Machine/Wye.hs | Haskell | bsd-3-clause | 4,564 |
module SubPatternIn3 where
-- takes into account general type variables
-- within type implementation.
-- here T has its arguments instantiated within g
-- selecting 'b' should instantiate list patterns
-- selecting 'c' should give an error.
--
data T a b = C1 a b | C2 b
g :: Int -> T Int [Int] -> Int
g z (C1 b c) ... | kmate/HaRe | old/testing/subIntroPattern/SubPatternIn3_TokOut.hs | Haskell | bsd-3-clause | 500 |
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS -fvia-C -optc-O3 -fexcess-precision -optc-msse3 #-}
import Control.Monad.ST
import Data.Array.ST
import Data.Array.Base
main = print $ runST
(do arr <- newArray (1,2000000) 137.0 :: ST s (STUArray s Int Double)
go arr 2000000 0.0 )
go :: STUArray s I... | urbanslug/ghc | testsuite/tests/perf/should_run/T3586.hs | Haskell | bsd-3-clause | 544 |
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TemplateHaskell #-}
module SuperUserSpark.CompilerSpec where
import TestImport hiding ((<.>))
import Data.Either (isLeft, isRight)
import Data.List (isPrefixOf)
import System.FilePath.Posix ((<.>))
import SuperUserSpark.Compiler
import SuperUserSpark.Compiler.Gen ()
im... | NorfairKing/super-user-spark | test/SuperUserSpark/CompilerSpec.hs | Haskell | mit | 18,597 |
module REPL.Parser where
import Letter.Core
import Letter.Parser
import Control.Monad (void)
data Command = Eval Line
| Describe Line
| Import String
| Quit
deriving Show
commandToken long short = choice' $ map (symbol . (':':)) [long, short]
importCmd = Import <$... | harlanhaskins/Letter | Haskell/app/REPL/Parser.hs | Haskell | mit | 587 |
{-# LANGUAGE OverloadedStrings #-}
module Idle.Screens.Home where
import Data.IORef
import Data.List.NonEmpty
import Data.Maybe
import Data.Monoid
import qualified Data.Text as T
import Idle.Ore
import Graphics.Vty hiding (string)
import Graphics.Vty.Widgets.All
import System.Exit
import System.IO.Unsafe
import Text.... | pikajude/idle | src/Idle/Screens/Home.hs | Haskell | mit | 2,879 |
-- BNF Converter: Error Monad
-- Copyright (C) 2004 Author: Aarne Ranta
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
module ComponentModel.Parsers.ErrM where
-- the Error monad: like Maybe type with error msgs
import Control.Monad (MonadPlus(..), liftM)
data Err a = Ok a | Bad String
der... | hephaestus-pl/hephaestus | willian/hephaestus-integrated/asset-base/component-model/src/ComponentModel/Parsers/ErrM.hs | Haskell | mit | 598 |
module Config.AppConfig
( AppConfig (..)
, getAppConfig
) where
import Auth0.Config as Auth0
import Config.Environment (Environment (..))
import Control.Monad (liftM)
import Data.Maybe (fromJust)
import Data.Text as T
import LoadEnv
import qualified Network.Wai.Middleware.RequestLogger.LogEntries as LE
import Sy... | gust/feature-creature | auth-service/src/Config/AppConfig.hs | Haskell | mit | 3,553 |
module Main where
import qualified Dropbox as DB
import System.Exit (exitFailure)
import System.Environment (getArgs)
import System.IO (hGetLine, hPutStrLn, stderr, stdout, stdin)
import qualified Data.ByteString.Char8 as C8
import Control.Monad.IO.Class (liftIO)
hostsDev = DB.Hosts "meta.dbdev.corp.dropbox.com" "ap... | cakoose/dropbox-sdk-haskell | Examples/Simple.hs | Haskell | mit | 3,524 |
{-# LANGUAGE PackageImports #-}
{-
Instead of generating C code directly, the STG compiler will instead build *abstract* C, a data structure representing the subset of C to which we want to compile.
Abstract C supports nested definitions of functions and static arrays. These are floated to the top level when transfor... | tcsavage/lazy-compiler | src/AbstractC.hs | Haskell | mit | 2,860 |
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, RecordWildCards #-}
module Text.Blaze.Html.Bootstrap where
import Text.Blaze
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A hiding (form, label)
import Text.Blaze.Html5
import Text.Blaze.Html5.Attributes hiding (form, labe... | glutamate/blaze-bootstrap | Text/Blaze/Html/Bootstrap.hs | Haskell | mit | 7,552 |
{-# LANGUAGE OverloadedStrings #-}
module Landing.Markdown (parseMarkdown) where
import Text.Pandoc
import Text.Pandoc.Options
import Data.Set (Set, fromList)
import Network.URI (isAbsoluteURI)
import Landing.Repo (Repo, joinPath)
import qualified Data.ByteString.Lazy.Char8 as C
parseMarkdown :: Repo -> C.ByteString... | dennis84/landing-haskell | Landing/Markdown.hs | Haskell | mit | 1,552 |
{-# LANGUAGE CPP #-}
module Cabal
( getPackageGhcOpts
, findCabalFile, findFile
) where
import Stack
import Control.Exception (IOException, catch)
import Control.Monad (when)
import Control.Monad.Trans.Class (lift)
import Control.Monad.Trans.State (execStateT, modify)
import Data.Char (isSpace)
import Data.List ... | hdevtools/hdevtools | src/Cabal.hs | Haskell | mit | 11,960 |
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE UnicodeSyntax #-}
module Unison.FileParsers where
import Unison.Prelude
import Control.Lens (view, _3)
import qualified Unison.Parser as Parser
import Control.Monad.State (evalStateT)
import Control.Monad.Wr... | unisonweb/platform | parser-typechecker/src/Unison/FileParsers.hs | Haskell | mit | 9,073 |
module Language.TaPL.TypedArith.Parser (parseString, parseFile) where
import qualified Text.Parsec.Token as Token
import Text.Parsec.Language (emptyDef)
import Text.Parsec.Prim (parse)
import Text.Parsec.String (Parser)
import Control.Applicative ((<|>))
import Control.Monad (liftM)
import Language.TaPL.TypedArith.Sy... | zeckalpha/TaPL | src/Language/TaPL/TypedArith/Parser.hs | Haskell | mit | 2,844 |
module Game where
import Linear
import Time
import Input
import Transform
data GameState a = GameState { worms :: [Worm a] }
data Worm a = Worm
type Position = V2
-- nextState :: State -> DTime -> [InputEvent] -> State
-- nextState s dt is = s -- TODO
| epeld/zatacka | old/Game.hs | Haskell | apache-2.0 | 257 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Network.GRPC.HighLevel.Client
( ClientError(..)
, ClientRegisterable(..)
, ClientRequest(..)
, ClientResult(..)
, GRP... | awakenetworks/gRPC-haskell | src/Network/GRPC/HighLevel/Client.hs | Haskell | apache-2.0 | 10,256 |
{-# LANGUAGE FlexibleContexts, TypeOperators, Rank2Types, TypeFamilies #-}
module Data.HMin where
import Data.MemoTrie
import Data.AdditiveGroup
import Data.VectorSpace
import Data.Maclaurin
import Data.Basis
import Data.LinearMap
import Control.Arrow
-- convenience type and eq operator
type Equation a b = (a -> b) ... | cspollard/hminimize | src/Data/HMin.hs | Haskell | apache-2.0 | 3,062 |
module OAuthToken
( AccessToken
, RequestToken
, OAuthToken
) where
import Prelude
import Yesod
import qualified Data.Text as T
import Database.Persist.Store
( SqlType (SqlString)
, PersistValue (PersistText)
)
class (Read a, Show a, PathPiece a, PersistField a) => OAuthToken a where
mkToken :: String -> May... | JanAhrens/yesod-oauth-demo | OAuthToken.hs | Haskell | bsd-2-clause | 2,945 |
-- Usage: xmacrorec2 | ConvertClicks > clicks.txt
module Main (main) where
import Control.Monad (void)
import Data.Char (isDigit)
import Data.List (isPrefixOf)
import System.Environment (getArgs)
main :: IO ()
main = do
args <- getArgs
let printFunc = toClick $ if "--haskell" `elem` args
... | KaiHa/GuiTest | src/ConvertClicks.hs | Haskell | bsd-3-clause | 1,984 |
-- | Simple prettified log
module Emulator.Log
( prettify
, state
, core
, registers
, ram
) where
import Control.Applicative ((<$>))
import Control.Monad (forM)
import Data.List (intercalate)
import Emulator
import Emulator.Monad
import Instruction
import Memory (Address (..))
import Util
pr... | jaspervdj/dcpu16-hs | src/Emulator/Log.hs | Haskell | bsd-3-clause | 1,573 |
{-# LANGUAGE TemplateHaskell #-}
module Cloud.AWS.EC2.Types.RouteTable
( PropagatingVgw
, Route(..)
, RouteOrigin(..)
, RouteState(..)
, RouteTable(..)
, RouteTableAssociation(..)
) where
import Cloud.AWS.EC2.Types.Common (ResourceTag)
import Cloud.AWS.Lib.FromText (deriveFromText)
import ... | worksap-ate/aws-sdk | Cloud/AWS/EC2/Types/RouteTable.hs | Haskell | bsd-3-clause | 1,682 |
{-# OPTIONS -fglasgow-exts #-}
----------------------------------------------------------------------
-- |
-- Module : Interface.TV.Misc
-- Copyright : (c) Conal Elliott 2006
-- License : LGPL
--
-- Maintainer : conal@conal.net
-- Stability : experimental
-- Portability : portable
--
-- Miscellan... | conal/TV | src/Interface/TV/Misc.hs | Haskell | bsd-3-clause | 1,361 |
{-# LANGUAGE NamedFieldPuns #-}
module Main where
import Control.Monad.Except
import Data.Foldable
import System.Environment
import System.IO
import Language.Scheme.Pretty
import Language.Scheme.Reader
data FormatError = FormatError deriving (Eq, Show)
type FormatM = ExceptT FormatError IO
-- FIXME: Don't ignore bl... | alldne/scheme | schemefmt/Main.hs | Haskell | bsd-3-clause | 923 |
-- -- | Values with a @public@ boolean accessor.
module Data.Geo.OSM.Lens.PublicL where
import Control.Lens.Lens
class PublicL a where
publicL ::
Lens' a Bool
| tonymorris/geo-osm | src/Data/Geo/OSM/Lens/PublicL.hs | Haskell | bsd-3-clause | 168 |
module Parser (
dimacs,
CNF, Clause, Lit, Var,
) where
import Control.Applicative
import Control.Monad
import Text.Trifecta
type CNF = [Clause]
type Clause = [Lit]
type Lit = Int
type Var = Int
dimacs :: Parser CNF
dimacs = do
skipMany $ char 'c' >> manyTill anyChar newline
(_... | tanakh/necosat | src/Parser.hs | Haskell | bsd-3-clause | 537 |
{-# LANGUAGE ViewPatterns, TupleSections, RecordWildCards, ScopedTypeVariables, PatternGuards, DeriveDataTypeable #-}
module Output.Items(writeItems, lookupItem) where
import Language.Haskell.Exts
import System.IO.Extra
import Data.List.Extra
import System.FilePath
import Control.Monad.Extra
import Data.Maybe
import ... | ndmitchell/hogle-dead | src/Output/Items.hs | Haskell | bsd-3-clause | 2,938 |
-- | This module exports functionality for generating a call graph of
-- an Futhark program.
module Futhark.Analysis.CallGraph
( CallGraph
, buildCallGraph
, FunctionTable
, buildFunctionTable
)
where
import Control.Monad.Reader
import qualified Data.HashMap.Lazy as HM
import Futhark.Representation.SOACS... | mrakgr/futhark | src/Futhark/Analysis/CallGraph.hs | Haskell | bsd-3-clause | 3,338 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE Rank2Types, GeneralizedNewtypeDeriving, TemplateHaskell, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
-- Module : Numeric.AD.Int... | yairchu/ad | src/Numeric/AD/Internal/Types.hs | Haskell | bsd-3-clause | 2,573 |
module Serv.Server
( bootstrap
) where
import Control.Concurrent.Async
import Serv.Server.Core.Runtime
import Serv.Server.Features.Runtime
import Serv.Server.ServerEnv
bootstrap :: IO ()
bootstrap = do
serverEnv <- setupServerEnv
concurrently_ (runCore se... | orangefiredragon/bear | src/Serv/Server.hs | Haskell | bsd-3-clause | 353 |
module Text.Liquid.Generators where
import Control.Monad (join)
import Data.List.NonEmpty
import Data.Monoid
import Data.Scientific
import Data.Text
import Prelude hiding (null)
import Test.QuickCheck
import Text.Liquid.Typ... | projectorhq/haskell-liquid | test/Text/Liquid/Generators.hs | Haskell | bsd-3-clause | 6,564 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE IncoherentInstances #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Control.Exception.Enclosed.Either
( eTry
, eExIO
, eIoTry
, eIOExIO
, eTextTry
, eTxIO
, eIOExTxIO
) where
import Data.Text a... | jcristovao/enclosed-exceptions-either | src/Control/Exception/Enclosed/Either.hs | Haskell | bsd-3-clause | 2,114 |
module T271 where
import Data.Kind (Type)
import Data.Singletons.Base.TH
$(singletons
[d| newtype Constant (a :: Type) (b :: Type) =
Constant a deriving (Eq, Ord)
data Identity :: Type -> Type where
Identity :: a -> Identity a
deriving (Eq, Ord)
|])
| goldfirere/singletons | singletons-base/tests/compile-and-dump/Singletons/T271.hs | Haskell | bsd-3-clause | 301 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -Wno-unused-top-binds #-}
module Nix.String
( NixString
, principledGetContext
, principledMakeNixString
, principledMempty
, StringContext(..)
, ContextFlavor(..)
, NixLikeContext... | jwiegley/hnix | src/Nix/String.hs | Haskell | bsd-3-clause | 8,970 |
import Control.Concurrent
import GHCJS.Marshal.Pure
import GHCJS.Require
helloWorld = putStrLn "[haskell] Hello World"
launchTheMissiles = do
threadDelay (1000 * 1000 * 5)
putStrLn "[haskell] OMG what did I do?!"
return $ Just $ pToJSVal (10 :: Double)
main = do
export0 ... | beijaflor-io/ghcjs-commonjs | old-examples/ghcjs-loader-test/Main.hs | Haskell | mit | 409 |
{-# LANGUAGE DeriveGeneric #-}
module Pos.DB.Epoch.Index
( writeEpochIndex
, getEpochBlundOffset
, SlotIndexOffset (..)
) where
import Universum
import Data.Binary (Binary, decode, encode)
import qualified Data.ByteString.Builder as Builder
import qualified Data.ByteSt... | input-output-hk/pos-haskell-prototype | db/src/Pos/DB/Epoch/Index.hs | Haskell | mit | 3,622 |
{-# LANGUAGE QuasiQuotes #-}
module CUDA (cudaTests) where
import Test.Framework
import Test.Framework.Providers.HUnit
import Test.HUnit (Assertion, (@?=))
import Language.C.Quote.CUDA
import Language.C.Syntax
import Data.Loc (noLoc)
mkDeclarator params mutability = LambdaDeclarator (Params params False noLoc) muta... | flowbox-public/language-c-quote | tests/unit/CUDA.hs | Haskell | bsd-3-clause | 2,423 |
module T3132 where
import Data.Array.Unboxed
step :: UArray Int Double -> [Double]
step y = [y!1 + y!0]
| mpickering/ghc-exactprint | tests/examples/ghc710/T3132.hs | Haskell | bsd-3-clause | 106 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
Pattern-matching bindings (HsBinds and MonoBinds)
Handles @HsBinds@; those at the top level require different handling,
in that the @Rec@/@NonRec@/etc structure is thrown away (whereas at
lower levels it is preserved with... | ml9951/ghc | compiler/deSugar/DsBinds.hs | Haskell | bsd-3-clause | 48,481 |
-- | Devel web server.
module DevelMain where
import HL.Dispatch ()
import HL.Foundation
import Control.Concurrent
import Data.IORef
import Foreign.Store
import Network.Wai.Handler.Warp
import System.Environment (getEnvironment)
import Yesod
import Yesod.Static
-- | Start the web server.
main :: IO (Store (IORef Ap... | mietek/hl | src/DevelMain.hs | Haskell | bsd-3-clause | 1,219 |
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-
Copyright (C) - 2017 Róman Joost <roman@bromeco.de>
This file is part of gtfsschedule.
gtfsschedule is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Fo... | romanofski/gtfsbrisbane | src/CSV/Import/Route.hs | Haskell | bsd-3-clause | 2,302 |
-- |
-- Module : Basement.These
-- License : BSD-style
-- Maintainer : Nicolas Di Prima <nicolas@primetype.co.uk>
-- Stability : stable
-- Portability : portable
--
-- @These a b@, sum type to represent either @a@ or @b@ or both.
--
module Basement.These
( These(..)
) where
import Basement.Compat.B... | vincenthz/hs-foundation | basement/Basement/These.hs | Haskell | bsd-3-clause | 951 |
{-
Copyright 2015 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 a... | xwysp/codeworld | codeworld-base/src/GHC/TypeLits.hs | Haskell | apache-2.0 | 739 |
{-# LANGUAGE CPP
, GADTs
, KindSignatures
, DataKinds
, Rank2Types
, ScopedTypeVariables
, MultiParamTypeClasses
, FlexibleContexts
, FlexibleInstances
#-}
{-# OPTIONS_GHC -Wall -fwarn-tabs #-}
--------------------------... | zaxtax/hakaru | haskell/Language/Hakaru/Evaluation/EvalMonad.hs | Haskell | bsd-3-clause | 12,638 |
foo f = (\ g x -> f (g x))
| bitemyapp/tandoori | input/lambda.hs | Haskell | bsd-3-clause | 27 |
{-# LANGUAGE NoImplicitPrelude #-}
{-|
Module : Stack.Sig
Description : GPG Signatures for Stack
Copyright : (c) 2015-2018, Stack contributors
License : BSD3
Maintainer : Tim Dysinger <tim@fpcomplete.com>
Stability : experimental
Portability : POSIX
-}
module Stack.Sig (module Sig) where
import Stack.Si... | anton-dessiatov/stack | src/Stack/Sig.hs | Haskell | bsd-3-clause | 362 |
{-# LANGUAGE DeriveGeneric, ScopedTypeVariables #-}
module GCoArbitraryExample where
import GHC.Generics (Generic)
import Test.QuickCheck
import Test.QuickCheck.Function
data D a = C1 a | C2 deriving (Eq, Show, Read, Generic)
instance Arbitrary a => Arbitrary (D a)
instance CoArbitrary a => CoArbitrary (D a)
inst... | srhb/quickcheck | tests/GCoArbitraryExample.hs | Haskell | bsd-3-clause | 480 |
{-# LANGUAGE Rank2Types, ScopedTypeVariables #-}
-- Test the handling of conditionals in rank-n stuff
-- Should fail, regardless of branch ordering
module ShouldFail where
-- These two are ok
f1 = (\ (x :: forall a. a->a) -> x)
f2 = (\ (x :: forall a. a->a) -> x) id 'c'
-- These fail
f3 v = (if v then
(\ (x :: ... | hvr/jhc | regress/tests/1_typecheck/4_fail/ghc/tcfail104.hs | Haskell | mit | 470 |
{-# LANGUAGE BangPatterns, CPP, Rank2Types #-}
-- |
-- Module : Data.Text.Internal.Encoding.Fusion
-- Copyright : (c) Tom Harper 2008-2009,
-- (c) Bryan O'Sullivan 2009,
-- (c) Duncan Coutts 2009
--
-- License : BSD-style
-- Maintainer : bos@serpentine.com
-- Stability : exper... | beni55/text | Data/Text/Internal/Encoding/Fusion.hs | Haskell | bsd-2-clause | 7,772 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
Utility functions on @Core@ syntax
-}
{-# LANGUAGE CPP #-}
module CoreSubst (
-- * Main data types
Subst(..), -- Implementation exported for supercompiler's Renaming.hs only
TvSubstEnv, IdSubstEnv,... | acowley/ghc | compiler/coreSyn/CoreSubst.hs | Haskell | bsd-3-clause | 59,475 |
module Parser where
import Ast
import Text.Trifecta
import Text.Trifecta.Delta
| Agrosis/haxpr | src/Parser.hs | Haskell | mit | 81 |
{-# htermination filterM :: Monad m => (a -> m Bool) -> [a] -> m [a] #-}
import Monad
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/Monad_filterM_2.hs | Haskell | mit | 86 |
{-# LANGUAGE OverloadedStrings #-}
module Web.Scotty.Blaze (
blaze
, builder
) where
import Network.Wai
import Web.Scotty (ActionM, header)
import qualified Control.Monad.State as MS
import Text.Blaze.Html (Html)
import Blaze.ByteString.Builder (Builder)
import Text... | jb55/scotty-blaze | src/Web/Scotty/Blaze.hs | Haskell | mit | 837 |
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, TemplateHaskell, TypeSynonymInstances #-}
module SpaceWeather.Regressor.Linear where
import qualified Data.Aeson.TH as Aeson
import SpaceWeather.Prediction
data LinearOption = LinearOption deriving (Eq, Ord, Show, Read)
Aeso... | nushio3/UFCORIN | src/SpaceWeather/Regressor/Linear.hs | Haskell | mit | 440 |
{-# htermination liftM2 :: Monad m => (a -> b -> c) -> (m a -> m b -> m c) #-}
import Monad
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/Monad_liftM2_1.hs | Haskell | mit | 92 |
-----------------------------------------------------------------------------
--
-- Module : SGC.Object
-- Copyright :
-- License : MIT
--
-- Maintainer :
-- Stability :
-- Portability :
--
-- |
--
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE Constrain... | fehu/hsgc | SGC/Object_OLD.hs | Haskell | mit | 2,381 |
newtype DiffList a = DiffList {getDiffList :: [a] -> [a]}
toDiffList :: [a] -> DiffList a
toDiffList xs = DiffList (xs++)
fromDiffList :: DiffList a -> [a]
fromDiffList (DiffList f) = f []
instance Monoid (DiffList a) where
mempty = DiffList (\xs -> [] ++ xs)
(DiffList f) `mappend` (DiffList ... | RAFIRAF/HASKELL | For a Few Monads More/difflist.hs | Haskell | mit | 353 |
-- necessary for `ToParamSchema Core.EpochIndex`
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Cardano.Node.API.Swagger where
import Universum
import Control.Lens (at, (?~))
import Data.Swagger
import Servant
import Servant.Swagger
import Servant.Swagger.UI ... | input-output-hk/pos-haskell-prototype | node/src/Cardano/Node/API/Swagger.hs | Haskell | mit | 2,254 |
{{hs_copyright}}
module {{module_name}}App.Types
( Milliseconds (..)
) where
newtype Milliseconds = Milliseconds Int
| rcook/ptool-templates | elm-haskell/app_Types.hs | Haskell | mit | 126 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeOperators #-}
{-|
Module : Ogma.Api.Definition
Copyright : (c) Ogma Project, 2016
License : MIT
Stability : experimental
-}
module Ogma.Api.Definition where
import Data.Aeson... | lgeorget/ogma | api/src/Ogma/Api/Definition.hs | Haskell | mit | 2,891 |
module MHMC.Error
(
--TODO: EVERYTHING
) where | killmous/MHMC | src/MHMC/Error.hs | Haskell | mit | 47 |
module Graphics.CG.Primitives.Triangle(Triangle, makeTriangle, sortTrianglePoints) where
import Data.List (sort)
import Graphics.Gloss.Data.Point
type Triangle = (Point, Point, Point)
makeTriangle :: Point -> Point -> Point -> Triangle
makeTriangle a b c = (a, b, c)
sortTriangleP... | jagajaga/CG-Haskell | Graphics/CG/Primitives/Triangle.hs | Haskell | mit | 425 |
module AlecAirport.A281511Spec (main, spec) where
import Test.Hspec
import AlecAirport.A281511 (a281511)
main :: IO ()
main = hspec spec
spec :: Spec
spec = describe "A281511" $
it "correctly computes the first 20 elements" $
take 20 (map a281511 [1..]) `shouldBe` expectedValue where
expectedValue = [1,1,... | peterokagey/haskellOEIS | test/AlecAirport/A281511Spec.hs | Haskell | apache-2.0 | 357 |
{-# LANGUAGE ForeignFunctionInterface, CPP #-}
module Format where
import Foreign
import Foreign.C
import Foreign.Marshal.Alloc
import qualified Data.ByteString as B
import qualified Data.ByteString.Unsafe as BU
import Data.Monoid
import System.Posix.Files
data Format = F {
formatName :: String,
formatEntry... | lih/Alpha | src/Format.hs | Haskell | bsd-2-clause | 1,277 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QDial_h.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:25
Warning : this file is machine generated - do not m... | keera-studios/hsQt | Qtc/Gui/QDial_h.hs | Haskell | bsd-2-clause | 58,905 |
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- Create a source distribution tarball
module Stack.SDist
( getSDistTarball
) where
import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archi... | bixuanzju/stack | src/Stack/SDist.hs | Haskell | bsd-3-clause | 7,020 |
{-# LANGUAGE DeriveDataTypeable, CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Xmobar
-- Copyright : (c) Andrea Rossato
-- License : BSD-style (see LICENSE)
--
-- Maintainer : Jose A. Ortega Ruiz <jao@gnu.org>
-- Stability : unstable
-- Portabi... | raboof/xmobar | src/Xmobar.hs | Haskell | bsd-3-clause | 9,113 |
{-# language CPP #-}
-- | = Name
--
-- VK_EXT_hdr_metadata - device extension
--
-- == VK_EXT_hdr_metadata
--
-- [__Name String__]
-- @VK_EXT_hdr_metadata@
--
-- [__Extension Type__]
-- Device extension
--
-- [__Registered Extension Number__]
-- 106
--
-- [__Revision__]
-- 2
--
-- [__Extension and Versi... | expipiplus1/vulkan | src/Vulkan/Extensions/VK_EXT_hdr_metadata.hs | Haskell | bsd-3-clause | 16,530 |
{-# LANGUAGE ScopedTypeVariables, DeriveGeneric #-}
import qualified Data.ByteString.Lazy as BL
import Data.Csv
import qualified Data.Vector as V
import GHC.Generics
data Person = Person String Int deriving Generic
instance FromRecord Person
instance ToRecord Person
persons :: [Person]
persons = [Person "John" 5000... | mikeizbicki/cassava | examples/IndexBasedGeneric.hs | Haskell | bsd-3-clause | 669 |
-- |Basic types and interfaces
module Data.Deciparsec.Parser ( -- * Types
Parser, Result, ParserT, IResult(..), TokenSeq
-- * Running Parsers
-- ** Resupplyable parsers
, runParserT, feedT, runP... | d3tucker/deciparsec | src/Data/Deciparsec/Parser.hs | Haskell | bsd-3-clause | 5,712 |
{-# LANGUAGE PatternGuards #-}
module Common.Draw
(drawLineU, drawLineA)
where
-- Repa
import Data.Array.Repa (Z (..), (:.) (..), U, DIM2, Array)
import qualified Data.Array.Repa as R
-- Acc
import Data.Array.Accelerate.IO
-- base
import Control.Monad
import Control.Monad.ST
import qualified D... | tranma/falling-turnip | common/Draw.hs | Haskell | bsd-3-clause | 3,473 |
module Notate.Actions
( runInstall
, runNotebook
, runKernel
, runEval
) where
import Control.Monad (unless, forM_)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.State.Strict
import qualified Data.Aeson as A
import qualified Data.ByteString.Lazy as BL
import Data.List (findIndex)
import IHaskel... | ejconlon/notate | src/Notate/Actions.hs | Haskell | bsd-3-clause | 2,885 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Overlo... | byteally/webapi | webapi/src/WebApi/Internal.hs | Haskell | bsd-3-clause | 13,144 |
#!/usr/bin/env runhaskell
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE OverlappingInstances #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
import Control.Monad
import Data... | pepeiborra/narradar | strategies/FLOPS08-search.hs | Haskell | bsd-3-clause | 2,230 |
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses, DeriveDataTypeable, RecordWildCards#-}
module CommandLine(withArgs,OutputFormat(..)) where
import System.Console.CmdLib
import qualified Math.Statistics.WCC as T
data OutputFormat = PNG | RAW deriving (Eq,Data,Typeable,Show)
data Opts = Opts { windowIncrement :: In... | runebak/wcc | Source/CommandLine.hs | Haskell | bsd-3-clause | 3,720 |
module Main (main) where
import Control.Concurrent (forkIO)
import Control.Concurrent.MVar (newEmptyMVar,
MVar,
takeMVar,
putMVar)
import Control.Concurrent.STM (TVar,
atomically,
... | zalora/Angel | src/Angel/Main.hs | Haskell | bsd-3-clause | 3,527 |
module Rash.Runtime.Interpreter where
import Control.Monad.IO.Class (liftIO)
import qualified Control.Monad.Trans.State as State
import qualified Data.Map.Strict as Map
import Data.Maybe (fromMaybe)
import qualified GHC.IO.Handle as Handle
import qualified Sy... | pbiggar/rash | src/Rash/Runtime/Interpreter.hs | Haskell | bsd-3-clause | 4,274 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.