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 |
|---|---|---|---|---|---|
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGU... | tolysz/prepare-ghcjs | spec-lts8/aeson/Data/Aeson/Types/ToJSON.hs | Haskell | bsd-3-clause | 97,291 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1993-1998
\section[IdInfo]{@IdInfos@: Non-essential information about @Ids@}
(And a pretty good illustration of quite a few things wrong with
Haskell. [WDP 94/11])
-}
module IdInfo (
-- * The IdDetails type
IdDetail... | oldmanmike/ghc | compiler/basicTypes/IdInfo.hs | Haskell | bsd-3-clause | 18,548 |
module IxEnvMT (HasEnv(..), MT(..), at, Z, S, Top, Under, WithEnv, withEnv, mapEnv) where
import MT
import Control_Monad_Fix
import Control.Monad(liftM,MonadPlus(..))
newtype WithEnv e m a = E { unE :: e -> m a }
withEnv :: e -> WithEnv e m a -> m a
withEnv e (E f) = f e
mapEnv :: Monad m => (e2 -> e1) -> WithEn... | mpickering/HaRe | old/tools/base/lib/Monads/IxEnvMT.hs | Haskell | bsd-3-clause | 2,210 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.Functor
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : l... | rahulmutt/ghcvm | libraries/base/Data/Functor.hs | Haskell | bsd-3-clause | 3,644 |
{-# LANGUAGE MultiParamTypeClasses, FunctionalDependencies,
FlexibleInstances, UndecidableInstances, FlexibleContexts #-}
-- UndecidableInstances now needed because the Coverage Condition fails
module ShouldFail where
-- A stripped down functional-dependency
-- example that causes GHC 4.08.1 to crash wit... | ezyang/ghc | testsuite/tests/typecheck/should_fail/tcfail093.hs | Haskell | bsd-3-clause | 1,102 |
newtype MkT2 a = MkT2 [Maybe a] deriving Show
f :: t Int -> t Int
f x = x
f2 :: t Int -> t Int -> (t Int, t Int)
f2 x y = (x,y) | urbanslug/ghc | testsuite/tests/ghci.debugger/scripts/print029.hs | Haskell | bsd-3-clause | 129 |
{-# LANGUAGE LambdaCase #-}
module WykopProfile (
indexProfile
, addedProfile
, publishedProfile
, commentedProfile
, diggedProfile
, buriedProfile
, observeProfile
, unobserveProfile
, blockProfile
, unblockProfile
, followersProfile
, followedProfile
, favoritesP... | mikusp/hwykop | WykopProfile.hs | Haskell | mit | 3,055 |
{-# LANGUAGE OverloadedStrings #-}
module System.PassengerCheck.Health (queuedRequests, status) where
import System.PassengerCheck.Types
import System.Nagios.Plugin (CheckStatus(..))
import Data.Text (Text)
queuedRequests :: PassengerStatus -> Integer
queuedRequests stat =
requestsInTopLevelQueue stat + sum (requ... | stackbuilders/passenger-check | src/System/PassengerCheck/Health.hs | Haskell | mit | 755 |
--This script orients sequences according to a PWM. The sequences must
--be in the first column of the input file
--Author: Tristan Bepler (tbepler@gmail.com)
import qualified Data.Map as Map
import System.Environment
import System.Exit
import Debug.Trace
data Orientation = Fwd | Rvs
main = getArgs >>= parse >>= pu... | tbepler/PBM-Analysis | orientseqs.hs | Haskell | mit | 3,061 |
module GHCJS.DOM.DeviceProximityEvent (
) where
| manyoo/ghcjs-dom | ghcjs-dom-webkit/src/GHCJS/DOM/DeviceProximityEvent.hs | Haskell | mit | 50 |
module Inputs (getInput) where
import qualified Data.Map as M
import Board (Coords, Board, getBlankCoords, getNeighbors)
getKeyMoveMapping :: Board -> M.Map Char Coords
getKeyMoveMapping board =
case getBlankCoords board of
Just coords -> buildMap coords
Nothing -> M.empty
where
buildMap (x,y) = M.... | lshemesh/Slide | src/Inputs.hs | Haskell | mit | 674 |
module Network.Gazelle.Types.Artist (
Artist(..),
ArtistEntry(..),
ArtistStatistics(..),
Tag(..)
) where
import Network.Gazelle.Types.Gazelle
import Network.Gazelle.Types.Id
import Data.Aeson
import Data.Scientific
import Data.Text (Text)
import Network.API.Builder
data Tag = Tag {
tagName :: Te... | mr/gazelle | src/Network/Gazelle/Types/Artist.hs | Haskell | mit | 2,047 |
module Glucose.Test.IR.Core where
import Control.Comonad
import Data.Text (Text)
import Glucose.Identifier (Identifier (..))
import Glucose.IR
import Glucose.Parser.Source
import Glucose.Test.Source
-- * Without source locations
constantAnywhere :: Text -> Literal -> FromSource (Definition ann)
constantA... | sardonicpresence/glucose | test/Glucose/Test/IR/Core.hs | Haskell | mit | 1,431 |
module Main where
import System.Environment
import PropDoc.Core
import PropDoc.Input.JavaProps
-- IO
main = do
args <- getArgs
name <- return (head args)
contents <- readFile name
let defs = props nameValuePair Nothing [] (lines contents)
putStr $ foldr (\a acc -> acc ++ (show a)) "" defs | chrislewis/PropDoc | src/Main.hs | Haskell | mit | 302 |
{-# LANGUAGE OverloadedStrings #-}
module Data.IP.Extra where
import Data.IP
-- Return a List of AddrRanges within a given AddrRange
-- that have the given netmask. If the given netmask is
-- greater than the netmask of the original AddrRange,
-- an empty List is returned.
ranges :: AddrRange IPv4 -> Int -> [AddrRan... | rjosephwright/awstemplate | src/Data/IP/Extra.hs | Haskell | mit | 909 |
module Main where
import Prelude
import qualified Hasql.Connection as A
import qualified Hasql.Session as B
import qualified Hasql.Transaction as C
import qualified Hasql.Transaction.Sessions as G
import qualified Main.Statements as D
import qualified Main.Transactions as E
import qualified Control.Concurrent.Async as... | nikita-volkov/hasql-transaction | conflicts-test/Main.hs | Haskell | mit | 3,586 |
module HsSearch.SearchResultTest
( getBinaryFileSearchResultTests
, getMultiLineSearchResultTests
, getSingleLineSearchResultTests
) where
import qualified Data.ByteString.Char8 as BC
import HsSearch.Config
import HsSearch.SearchResult
import HsSearch.SearchSettings
import Test.Framework
import Test.Framework... | clarkcb/xsearch | haskell/hssearch/test/HsSearch/SearchResultTest.hs | Haskell | mit | 4,148 |
module Shipper (
startShipper,
Event,
Input(..),
Output(..),
) where
import Shipper.Inputs
import Shipper.Outputs
import Shipper.Types
import Shipper.Event (maxPacketSize)
import Control.Concurrent.STM (atomically)
import Control.Concurrent.STM.TBQueue
import Control.Concurrent
import Control.Monad
... | christian-marie/pill-bug | Shipper.hs | Haskell | mit | 2,463 |
module FactorTable (computeForList, toList) where
import qualified Data.Map as M
import qualified Data.List as L
import qualified Data.Set as S
import Types
toList :: FactorTable -> [(Int, [Int])]
toList = M.toList
computeForList :: [Int] -> FactorTable
computeForList = L.foldl' insert empty . L.sort . unique
inse... | mg50avant/factorizer | src/FactorTable.hs | Haskell | mit | 1,305 |
module ChatCore.Util.Error where
import Control.Exception
import Control.Monad
-- | Runs the given IO action and wraps the return value in Nothing if an
-- exception is raised.
tryMaybe :: IO a -> IO (Maybe a)
tryMaybe f = catch (Just `liftM` f) (return . catchNothing)
where
catchNothing :: SomeException -> May... | Forkk/ChatCore | ChatCore/Util/Error.hs | Haskell | mit | 355 |
module Exercise where
data OA = Add | Mul
data OB = EQu | GTh | LTh
data ExprA = Const Int
| Var Char
| OpA OA ExprA ExprA
| If ExprB ExprA ExprA
data ExprB = OpB OB ExprA ExprA
evalA :: ExprA -> Int
evalA (Const a) = a
evalA (OpA Add expr1 expr2) = (evalA expr1) + (evalA expr2)
eval... | tcoenraad/functioneel-programmeren | 2012/opg2a.hs | Haskell | mit | 683 |
{-# OPTIONS_GHC -Wall -}
{-
- Module about terms. Used after parsing eMOD
-
-
- Copyright 2013 -- name removed for blind review, all rights reserved! Please push a git request to receive author's name! --
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in complian... | DatePaper616/code | Terms.hs | Haskell | apache-2.0 | 1,324 |
{-# LANGUAGE LambdaCase, Rank2Types #-}
module Drasil.ExtractDocDesc (getDocDesc, egetDocDesc, ciGetDocDesc, sentencePlate) where
import Control.Lens((^.))
import Drasil.DocumentLanguage.Core
import Drasil.Sections.SpecificSystemDescription (inDataConstTbl, outDataConstTbl)
import Language.Drasil hiding (Manual, Vecto... | JacquesCarette/literate-scientific-software | code/drasil-docLang/Drasil/ExtractDocDesc.hs | Haskell | bsd-2-clause | 7,905 |
module Permissions.Onping.InternalSpec (main, spec) where
import Test.Hspec
import Permissions.Onping.Internal
import Database.Persist
import Persist.Mongo.Settings
import Data.Aeson
import Control.Applicative
import qualified Data.Yaml as Y
import Data.Traversable
import Data.Maybe
main :: IO ()
main = do
hspec $... | smurphy8/onping-permissions | test/Permissions/Onping/InternalSpec.hs | Haskell | bsd-3-clause | 920 |
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, PatternGuards #-}
{- Implements a proof state, some primitive tactics for manipulating
proofs, and some high level commands for introducing new theorems,
evaluation/checking inside the proof system, etc. --}
module Idris.Core.ProofTerm(ProofTerm, Goal(..), ... | andyarvanitis/Idris-dev | src/Idris/Core/ProofTerm.hs | Haskell | bsd-3-clause | 12,408 |
module Main (main) where
import Control.Arrow
import Crypto.Random
import Data.Ratio
import Crypto.Ed25519.Pure
import Text.Read
import Data.Thyme.Clock
import System.IO
import System.FilePath
import qualified Data.Yaml as Y
import qualified Data.Set as Set
import Data.Map.Strict (Map)
import qualified Data.Map.Stric... | haroldcarr/juno | app/GenerateConfigFiles.hs | Haskell | bsd-3-clause | 3,940 |
{-# LANGUAGE DeriveDataTypeable #-}
module Internal.Types
( DTree (..)
, DElemType (..)
, DAttr (..)
) where
import qualified Data.Text as T
import Data.Data
import qualified Data.Map as M
-- DOM tree: either a text node or an element with some children
data DTree = DText T.Text
| DElem DEl... | qnnguyen/howser | src/Internal/Types.hs | Haskell | bsd-3-clause | 1,354 |
module Network.Email.Render where
import Data.Monoid
import Data.Maybe
import Control.Monad
import Data.Bits
import qualified Data.Map as M
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Char8 as BL
import qualified Data.ByteString.Builder as BL
import qualified Data.Text as T
import... | abbradar/email | src/Network/Email/Render.hs | Haskell | bsd-3-clause | 3,202 |
module Algebra.Structures.Group
( module Algebra.Structures.Monoid
, Group(..)
, (<->)
) where
import Algebra.Structures.Monoid
class Monoid a => Group a where
neg :: a -> a
(<->) :: Group a => a -> a -> a
a <-> b = a <+> neg b
infixl 6 <->
| Alex128/abstract-math | src/Algebra/Structures/Group.hs | Haskell | bsd-3-clause | 268 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
-- ... | ambiata/mismi | mismi-s3/src/Mismi/S3/Patch/PutObjectACL.hs | Haskell | bsd-3-clause | 7,476 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Ivory.Tower.AST.SyncChan where
#if MIN_VERSION_mainland_pretty(0,6,0)
import Text.PrettyPrint.Mainland.Class
#endif
import Text.PrettyPrint.Mainland
import qualified Ivory.Language.Syntax.Type as I
data SyncChan... | GaloisInc/tower | tower/src/Ivory/Tower/AST/SyncChan.hs | Haskell | bsd-3-clause | 543 |
import System.GlobalLock
import Control.Concurrent.MVar
import Criterion.Main
main :: IO ()
main = do
mVar <- newMVar ()
defaultMain
[ bench "bare" $ (return () :: IO ())
, bench "MVar" $ withMVar mVar (const $ return ())
, bench "global" $ lock (return ()) ]
| kmcallister/global-lock | test/bench.hs | Haskell | bsd-3-clause | 298 |
module Chapter01 where
import Control.Monad ( liftM2 )
import Control.Monad.Trans.Class ( lift )
import Control.Monad.Trans.State ( StateT, evalStateT, modify, gets )
import Data.List ( intersperse )
import Data.Maybe ( fromMaybe )
--------------------------------------------------------------------------------
type... | svenpanne/tiger | chapter01/SLP.hs | Haskell | bsd-3-clause | 4,884 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE PatternGuards #-}
{- |
Module : V... | GaloisInc/saw-script | saw-core/src/Verifier/SAW/Term/Pretty.hs | Haskell | bsd-3-clause | 29,774 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Imo.App
import Network.Wai.Middleware.Gzip (gzip, def)
import Network.Wai.Handler.Warp (run, Port)
import System.Environment (getEnvironment)
import Control.Monad (liftM)
main :: IO ()
main = do
port <- getPort
run port $ gzip def imoApp
getPort :: IO... | IMOKURI/wai-example-using-buildpack-stack | src/Main.hs | Haskell | bsd-3-clause | 468 |
{-|
Module : Data.Number.MPFR.Assignment
Description : wrappers for assignment functions
Copyright : (c) Aleš Bizjak
License : BSD3
Maintainer : ales.bizjak0@gmail.com
Stability : experimental
Portability : non-portable
Conversion from basic Haskell types to MPFR.
S... | ekmett/hmpfr | src/Data/Number/MPFR/Assignment.hs | Haskell | bsd-3-clause | 5,290 |
-- | RGBA
module Graphics.FreetypeGL.RGBA
( RGBA(..), noColor, toVec4, withVec
) where
import Bindings.FreetypeGL.Vec234 (C'vec4(..))
import Foreign.Marshal.Alloc (alloca)
import Foreign.Ptr (Ptr)
import Foreign.Storable (Storable(..))
data RGBA = RGBA !Float !Float !Float !Float
deriving (Eq, Ord, Read,... | Peaker/FreeTypeGL | src/Graphics/FreetypeGL/RGBA.hs | Haskell | bsd-3-clause | 658 |
{-# LANGUAGE Haskell2010 #-}
{-# LINE 1 "dist/dist-sandbox-261cd265/build/System/Posix/Process.hs" #-}
{-# LINE 1 "System/Posix/Process.hsc" #-}
{-# LINE 2 "System/Posix/Process.hsc" #-}
{-# LANGUAGE Safe #-}
{-# LINE 6 "System/Posix/Process.hsc" #-}
-------------------------------------------------------------------... | phischu/fragnix | tests/packages/scotty/System.Posix.Process.hs | Haskell | bsd-3-clause | 3,920 |
{-# LANGUAGE Haskell2010 #-}
{-# LINE 1 "Control/DeepSeq.hs" #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE Safe #-}
{-# LANGUAGE PolyKinds #-}
------... | phischu/fragnix | tests/packages/scotty/Control.DeepSeq.hs | Haskell | bsd-3-clause | 17,982 |
{-# LANGUAGE Haskell98 #-}
{-# LINE 1 "Network/Wai/Handler/Warp/Request.hs" #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
... | phischu/fragnix | tests/packages/scotty/Network.Wai.Handler.Warp.Request.hs | Haskell | bsd-3-clause | 11,536 |
{-# LANGUAGE MagicHash, UnboxedTuples, TypeFamilies #-}
-- |
-- Module : Control.Monad.Primitive
-- Copyright : (c) Roman Leshchinskiy 2009
-- License : BSD-style
--
-- Maintainer : Roman Leshchinskiy <rl@cse.unsw.edu.au>
-- Portability : non-portable
--
-- Primitive state-transformer monads
--
module Co... | rleshchinskiy/primitive | Control/Monad/Primitive.hs | Haskell | bsd-3-clause | 3,400 |
{-# LANGUAGE CPP, BangPatterns #-}
module Network.Wai.Handler.Warp.MultiMap (
MMap
, isEmpty
, empty
, singleton
, insert
, search
, searchWith
, pruneWith
, toList
, merge
) where
#if __GLASGOW_HASKELL__ < 709
import Control.Applicative ((<$>))
#endif
import Data.IntMap.Strict (IntMap)
import... | utdemir/wai | warp/Network/Wai/Handler/Warp/MultiMap.hs | Haskell | mit | 2,151 |
-- |
-- The integration tests have no ghc present, initially. Stack should not
-- require ghc present to run the `clean` command.
import StackTest
main :: IO ()
main = do
-- `stack clean` should succeed even though there is no ghc available.
-- See the stack.yaml file for how this works.
stackIgnoreException ["... | juhp/stack | test/integration/tests/4181-clean-wo-dl-ghc/Main.hs | Haskell | bsd-3-clause | 345 |
{-# LANGUAGE StandaloneDeriving #-}
module Distribution.Server.Packages.UnpackTest (
testPermissions,
) where
import qualified Codec.Archive.Tar as Tar
import qualified Codec.Archive.Tar.Entry as Tar
import qualified Codec.Archive.Tar.Check as Tar
import qualified Codec.Compression.GZip as GZip
import qualif... | ocharles/hackage-server | tests/Distribution/Server/Packages/UnpackTest.hs | Haskell | bsd-3-clause | 1,271 |
{-# LANGUAGE GADTs, DisambiguateRecordFields #-}
module CmmProcPoint
( ProcPointSet, Status(..)
, callProcPoints, minimalProcPointSet
, splitAtProcPoints, procPointAnalysis
, attachContInfoTables
)
where
import Prelude hiding (last, unzip, succ, zip)
import DynFlags
import BlockId
import CLabel
i... | green-haskell/ghc | compiler/cmm/CmmProcPoint.hs | Haskell | bsd-3-clause | 20,858 |
{-# OPTIONS_GHC -Wall #-}
module Canonicalize.Type (tipe) where
import Control.Applicative ((<$>),(<*>))
import qualified Data.Traversable as Trav
import qualified AST.Type as T
import qualified AST.Variable as Var
import qualified Reporting.Annotation as A
import qualified Reporting.Error.Canonicalize as Error
impo... | pairyo/elm-compiler | src/Canonicalize/Type.hs | Haskell | bsd-3-clause | 2,329 |
module HAD.Y2014.M04.D11.Exercise where
{- | thirdOfFive
return the third of five arguments
No other interest than pointFree
prop> \(x1, x2, x3, x4, x5) -> thirdOfFive x1 x2 x3 x4 x5 == (x3 :: Int)
-}
thirdOfFive :: a -> b -> c -> d -> e -> c
thirdOfFive = undefined
| weima/1HAD | exercises/HAD/Y2014/M04/D11/Exercise.hs | Haskell | mit | 282 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds, PolyKinds #-}
module T13398b where
import GHC.TypeLits
class C a where
type T a (b :: Bool) :: a
instance C Nat where
type T Nat 'True = 1
type T Nat 'False = 0
| sdiehl/ghc | testsuite/tests/indexed-types/should_compile/T13398b.hs | Haskell | bsd-3-clause | 225 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
-- | Some helpers for parsing data out of a raw WAI 'Request'.
module Network.Wai.Parse
( parseHttpAccept
, parseRequestBody
, RequestBodyType (..)
, ... | AndrewRademacher/wai | wai-extra/Network/Wai/Parse.hs | Haskell | mit | 14,638 |
module Main (main) where
import B
main = print b
| urbanslug/ghc | testsuite/tests/driver/recomp007/b/Main.hs | Haskell | bsd-3-clause | 51 |
module Estruturas.Complexidade
where
data Complexidade = Simples
| Multigrafo
deriving (Show, Eq)
instance Ord Complexidade where
Simples `compare` Simples = EQ
Simples `compare` Multigrafo = LT
Multigrafo `compare` Simples = GT
Multigrafo `compare` ... | jean-lopes/grafos | src/Estruturas/Complexidade.hs | Haskell | mit | 336 |
{-# htermination exponent :: Float -> Int #-}
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/Prelude_exponent_1.hs | Haskell | mit | 46 |
import qualified Data.Array.Unboxed as A
import qualified Data.HashMap.Strict as M
factorial :: Int -> Int
factorial 0 = 1
factorial n = go n 1
where go 1 acc = acc
go n' acc = go (n' - 1) (n' * acc)
solve :: Int -> Int
solve n = sum [x | x <- [3..n], (sum $ digitFactorials x) == x]
where
digitFactori... | jwtouron/haskell-play | ProjectEuler/Problem34.hs | Haskell | mit | 641 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE UndecidableSuperClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-|
Type family and class definitions for de... | clintonmead/indextype | src/Control/IndexT/Tuple.hs | Haskell | mit | 8,225 |
module MaybeUtils where
import Data.Maybe
import Control.Monad
--http://hackage.haskell.org/package/syb-0.5.1/docs/src/Data-Generics-Aliases.html#orElse
-- | Left-biased choice on maybes
orElse :: Maybe a -> Maybe a -> Maybe a
x `orElse` y = case x of
Just _ -> x
Nothing -... | holdenlee/fluidity | MaybeUtils.hs | Haskell | mit | 793 |
{-# LANGUAGE ConstraintKinds #-}
module Test where
import ClassyPrelude
import Control.Monad.Classes
import Control.Monad.Writer (runWriterT)
import Text.Printf
import N
import GUI.Fake
import Helpers
import Notes
import Command
import ClassesLens
type Test' m = (M' m, Fake' m, MonadWriter [Text] m)
type Test = ... | aelve/Jane | Test.hs | Haskell | mit | 1,526 |
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
import qualified Commands.Servers.Simple
main = Commands.Servers.Simple.main
| sboosali/commands | commands-server-simple/executables/Main.hs | Haskell | mit | 126 |
-- vim: set ts=2 sw=2 sts=0 ff=unix foldmethod=indent:
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PostfixOperators #-}
module MixKenallGeocode.KenAllCsvSpec
where
import SpecHelper
import qualified Text.Parsec as P
import MixKenallGeocode.KenAllCsv
spec :: Spec
spec = do
describe "parseAreaOption" $ do
c... | eji/mix-kenall-geocode | test/MixKenallGeocode/KenAllCsvSpec.hs | Haskell | mit | 2,684 |
{-# LANGUAGE PackageImports #-}
{-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-}
-- | Reexports "Control.Monad.Fail.Compat"
-- from a globally unique namespace.
module Control.Monad.Fail.Compat.Repl.Batteries (
module Control.Monad.Fail.Compat
) where
import "this" Control.Monad.Fail.Compat
| haskell-compat/base-compat | base-compat-batteries/src/Control/Monad/Fail/Compat/Repl/Batteries.hs | Haskell | mit | 314 |
-- Tree.hs
module Tree where
import Data.Monoid
data TravelGuide = TravelGuide { title :: String, authors :: [String],
price :: Double } deriving (Show, Eq, Ord)
newtype TravelGuidePrice = TravelGuidePrice TravelGuide deriving Eq
instance Ord TravelGuidePrice where
(TravelGuidePri... | hnfmr/beginning_haskell | Tree.hs | Haskell | mit | 1,568 |
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveDataTypeable #-}
--------------------------------------------------------------------
-- |
-- Copyright : © Oleg Grenrus 2014
-- License : MIT
-- Maintainer: Oleg Grenrus <oleg.grenrus@iki.fi>
-- Stability : experimental
-- Portabil... | phadej/boolean-normal-forms | src/Data/Algebra/Boolean/FreeBoolean.hs | Haskell | mit | 2,158 |
{-# htermination plusFM_C :: (Ord a, Ord k) => (b -> b -> b) -> FiniteMap (a,k) b -> FiniteMap (a,k) b -> FiniteMap (a,k) b #-}
import FiniteMap
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/FiniteMap_plusFM_C_12.hs | Haskell | mit | 145 |
-- Problems/Problem014.hs
module Problems.Problem014 (p14) where
import Data.List
import Helpers.Numbers
main = print p14
p14 :: Int
p14 = snd $ foldl1' max $ map (\x -> ((length $ collatz x),x)) [500001,500003..999999]
collatzList :: Int -> [(Int,Int)]
collatzList num
| num == 1 = [(1,1)]
| otherwise = (n... | Sgoettschkes/learning | haskell/ProjectEuler/src/Problems/Problem014.hs | Haskell | mit | 588 |
module Handler.HomeSpec (spec) where
import TestImport
spec :: Spec
spec = withApp $ do
it "loads the index and checks it looks right" $ do
get HomeR
statusIs 200
htmlAllContain "h1" "Welcome to Yesod"
request $ do
setMethod "POST"
setUrl HomeR
... | ruHaskell/ruhaskell-yesod | test/Handler/HomeSpec.hs | Haskell | mit | 668 |
-- Copyright 2012-2014 Samplecount S.L.
--
-- 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 agr... | samplecount/shake-language-c | src/Development/Shake/Language/C/Target/Linux.hs | Haskell | apache-2.0 | 2,090 |
module Listener (main) where
import Ros.Node
import qualified Ros.Std_msgs.String as S
showMsg :: S.String -> IO ()
showMsg = putStrLn . ("I heard " ++) . S._data
main = runNode "listener" $ runHandler showMsg =<< subscribe "chatter"
| rgleichman/roshask | Examples/PubSub/src/Listener.hs | Haskell | bsd-3-clause | 236 |
{-# LANGUAGE DeriveGeneric, FlexibleInstances, OverlappingInstances, UndecidableInstances #-}
--
-- 0k/pong message definitions. Incoming/outgoing datatype and the corresponding
-- JSON and on-the-wire protobuf representations.
--
-- Caveat: datatype definitions themself entail protobuf encoding. No .proto
-- files.
-... | element-doo/ekade | code/haskell/src/Types.hs | Haskell | bsd-3-clause | 1,294 |
-- BNF Converter: Error Monad
-- Copyright (C) 2004 Author: Aarne Ranta
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
module ErrM where
-- the Error monad: like Maybe type with error msgs
import Control.Monad (MonadPlus(..), liftM)
import Control.Applicative (Applicative(..), Altern... | MichaelMcCulloch/MPlusPlus | src/ErrM.hs | Haskell | bsd-3-clause | 835 |
{-# OPTIONS_HADDOCK show-extensions #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
module Control.THEff.Reader (
-- * Overview
-- |
-- This version builds its output lazily; for a strict version with
-- the same interface, see "Control.THEff.Re... | KolodeznyDiver/THEff | src/Control/THEff/Reader.hs | Haskell | bsd-3-clause | 3,599 |
module Main where
import App
main :: IO ()
main = run ":memory:"
| CatzScience/sassy | server/src/Main.hs | Haskell | bsd-3-clause | 67 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ScopedTypeVariables #-}
-- | Note - this API is designed to support a narrow (but common!) set
-- of use cases. If you find that you need more customization than this
-- offers, then you will need to ... | sjakobi/brick | src/Brick/Forms.hs | Haskell | bsd-3-clause | 36,986 |
module Wigner.Transformations(
wignerTransformation,
positivePTransformation,
truncateDifferentials,
showTexByDifferentials,
wignerOfLossTerm,
) where
import Wigner.Complex
import Wigner.Expression
import Wigner.Deltas
import Wigner.ExpressionHelpers
import Wigner.Texable
import qualified Wigne... | fjarri/wigner | src/Wigner/Transformations.hs | Haskell | bsd-3-clause | 9,470 |
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -fno-warn-missing-import-lists #-}
{-# OPTIONS_GHC -fno-warn-implicit-prelude #-}
module Paths_StartStopFRP (
version,
getBinDir, getLibDir, getDataDir, getLibexecDir,
getDataFileName, getSysconfDir
) where
import qualified Control.Exception as Exception
import Data.V... | tylerwx51/StartStopFRP | dist/build/autogen/Paths_StartStopFRP.hs | Haskell | bsd-3-clause | 1,883 |
module Network.DNS.Pocket (
Port
, runServer
, setDomain
, getDomain
, deleteDomain
, listDomain
)
where
--import Network.DNS.Pocket.Type
import Network.DNS.Pocket.Server
| junjihashimoto/pocket-dns | Network/DNS/Pocket.hs | Haskell | bsd-3-clause | 176 |
{-
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
\section{SetLevels}
***************************
Overview
***************************
1. We attach binding levels to Core bindings, in preparation for floating
outwards (@FloatOut@).
2. We also let... | GaloisInc/halvm-ghc | compiler/simplCore/SetLevels.hs | Haskell | bsd-3-clause | 48,135 |
import System.Random (randomIO)
import Data.Time.Clock (getCurrentTime, UTCTime)
import Database.HDBC
import Database.HDBC.PostgreSQL
import Database.NySQL.TH
import Database.NySQL.Options
import Control.Monad
import Control.Monad.Trans
import Control.Exception
import Control.Monad.Catch
$(mkSqlWith (defOpts { paramM... | broma0/nysql | src/test/Example.hs | Haskell | bsd-3-clause | 1,052 |
-- | This module is meant to be imported qualified:
--
-- @
-- import qualified Web.KISSmetrics as KISSmetrics
-- @
module Web.KISSmetrics
( -- * Data types
APIKey
, SimpleText
, Property
, Timestamp(..)
, generateTimestamp
-- * Making calls
, call
, CallType(..)
-- * Type ... | prowdsponsor/hissmetrics | src/Web/KISSmetrics.hs | Haskell | bsd-3-clause | 7,062 |
module Core.Compiler where
import Control.Monad.Identity
import Control.Monad.State
import Core.Raw
import Data.List (intercalate)
import Data.Reify
import qualified Core.Val as Ix
frpValues :: Ix.FRP () -> IO (Graph Val)
frpValues = fromIxValues . runIdentity . flip execStateT []
compiler :: Ix.FRP () -> IO String
... | sebastiaanvisser/frp-js | src/Core/Compiler.hs | Haskell | bsd-3-clause | 915 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ParallelListComp #-}
module FillText (benchmark, summary) where
import Control.Monad.Compat
import qualified Data.Text as T
import Data.Text (Text)
import Graphics.Blank
import Prelude.Compat
... | ku-fpg/blank-canvas-mark | hs/FillText.hs | Haskell | bsd-3-clause | 1,122 |
module Data.Intern (
Interned
, InternSet
, empty
, singleton
, insert
, fromList
, toList
, delete
, member
, notMember
) where
import qualified Data.Map as M
type Cache a = M.Map a a
type Interned a = a
newtype InternSet a = InternSet { toCache :: Cache a }
empty ... | thomaseding/intern | src/Data/Intern.hs | Haskell | bsd-3-clause | 1,293 |
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE FlexibleContexts #-}
module Statistics.Distribution.Random.Exponential (
exponential
) where
import Random.CRI
import Statistics.Distribution.Random.Uniform
-- q[k-1] = sum(log(2)^k / k!) k=1,..,n,
q :: [Double]
-- q = let factorial = foldr (*) 1 . enumFromTo 1
-- ... | finlay/random-dist | Statistics/Distribution/Random/Exponential.hs | Haskell | bsd-3-clause | 1,676 |
module System.Nemesis.DSL where
import Control.Arrow ((>>>))
import Control.Lens
import Control.Monad (when)
import Data.List (sort, nub)
import System.Directory (doesFileExist, doesDirectoryExist, removeFile, removeDirectoryRecursive)
import System.Exit (ExitCode( ExitSuccess, ExitFailure), exitWith)
import System.Fi... | nfjinjing/nemesis | src/System/Nemesis/DSL.hs | Haskell | bsd-3-clause | 1,939 |
-- 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.AmountOfMoney.Tests
( tests
) where
import Data.String
import Prelude
import Test.Tasty
imp... | facebookincubator/duckling | tests/Duckling/AmountOfMoney/Tests.hs | Haskell | bsd-3-clause | 1,944 |
module Unification.TyContext where
import qualified Data.Map as Map
import Data.Map (Map)
import Unification.Substitutable
import Unification.Scheme
newtype TyContext = TyContext (Map String Scheme)
deriving (Monoid)
instance Substitutable TyContext where
apply s (TyContext env) = T... | letsbreelhere/egg | src/Unification/TyContext.hs | Haskell | bsd-3-clause | 850 |
{-# LANGUAGE DefaultSignatures
, EmptyDataDecls
, FunctionalDependencies
, ScopedTypeVariables #-}
module Rad.QL.Types
( OBJECT
, INTERFACE
, UNION
, SCALAR
, ENUM
, GraphQLScalar(..)
, GraphQLType(..)
, GraphQLValue(..)
-- utilities
, resolveScalar
) where
i... | jqyu/bustle-chi | src/Rad/QL/Types.hs | Haskell | bsd-3-clause | 7,424 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE BangPatterns #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.IndexUtils
-- Copyright : (c) Duncan Coutts 2008
-- License : BSD-like
--
-- Maintainer : duncan@communit... | martinvlk/cabal | cabal-install/Distribution/Client/IndexUtils.hs | Haskell | bsd-3-clause | 23,788 |
--------------------------------------------------------------------------
-- --
-- NfaMisc.hs --
-- --
-- Misecllaneous definitions for the NFA system. Includes --
-- examples of machines, and functions to print an NFA and the --
-- equivalence classes produces by minimisation. --
-- ... | AidanDelaney/Mira | src/Language/Mira/NfaMisc.hs | Haskell | bsd-3-clause | 2,791 |
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
-- |
-- Module: $HEADER$
-- Description: Example of using @DerivingStrategies@ along with default
-- HasVerbosity implementation based on generic-lens package.
-- Copyright: (c) 2015-2019, Peter Tr... | trskop/verbosity | example/Example/ConfigGenericLens.hs | Haskell | bsd-3-clause | 801 |
{-# LANGUAGE TupleSections #-}
module Main where
import AdventOfCode
import qualified Data.Set as S
data TurnDirection
= L
| R
data Instruction = Instruction
{ iDir :: TurnDirection
, iBlocks :: Blocks
}
data Direction
= N
| E
| S
| W
deriving (Show)
type Blocks = Int
data Position = Position... | purcell/adventofcode2016 | src/Day1.hs | Haskell | bsd-3-clause | 2,021 |
{-# LANGUAGE MultiParamTypeClasses, RankNTypes, FunctionalDependencies #-}
{-# LANGUAGE ConstraintKinds, UndecidableInstances #-}
module FunDeps where
------------------------------------------------------------------------------
{- TEST 1: MultiParamTypeClass but NO functional dependencies -}
class TCa a b where
... | dterei/Scraps | haskell/FunDeps.hs | Haskell | bsd-3-clause | 5,788 |
{-# LANGUAGE
DeriveGeneric
, OverloadedStrings
, RecordWildCards
#-}
module Docker.JSON.Types.Container where
import Data.Aeson
import Data.Default
import qualified Data.Map as Map
import Data.Maybe
import qualified Data.Text as T
import GHC.Generics
--------------------------------------------------... | wayofthepie/docker-client | src/Docker/JSON/Types/Container.hs | Haskell | bsd-3-clause | 21,168 |
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module T16976 where
import Language.Haskell.TH (reifyType, runIO)
import Language.Haskell.TH.Ppr (ppr_sig)
import Data.Foldable (for_)
import System.IO (hPrint, stderr)
data T s = MkT1 | MkT2
aNumber = 5
aString = "hi"
pattern P = MkT1
do... | sdiehl/ghc | testsuite/tests/th/T16976.hs | Haskell | bsd-3-clause | 1,131 |
import Control.Exception
import Control.Monad (when)
import qualified Data.ByteString.Char8 as B
import Data.Loc
import System.Environment (getArgs)
import Text.PrettyPrint.Mainland
import qualified Language.C.Parser as P
import qualified Language.C.Parser.Tokens as T
import qualified Language.C.Syntax as C
import Lan... | flowbox-public/language-c-quote | examples/parse/Main.hs | Haskell | bsd-3-clause | 2,170 |
{-# LANGUAGE TypeFamilies #-}
module T6018failclosed12 where
-- This exposed a subtle bug in the implementation during development. After
-- unifying the RHS of (1) and (2) the LHS substitution was done only in (2)
-- which made it look like an overlapped equation. This is not the case and this
-- definition should b... | acowley/ghc | testsuite/tests/typecheck/should_fail/T6018failclosed11.hs | Haskell | bsd-3-clause | 676 |
{-# LANGUAGE TemplateHaskell, GADTs, FlexibleInstances, ViewPatterns, CPP #-}
-- |
-- Module : Language.C.Inline.TH
-- Copyright : 2014 Manuel M T Chakravarty
-- License : BSD3
--
-- Maintainer : Manuel M T Chakravarty <chak@justtesting.org>
-- Stability : experimental
-- Portability : non-portable (GHC ... | beni55/language-c-inline | Language/C/Inline/TH.hs | Haskell | bsd-3-clause | 5,745 |
{-# LANGUAGE QuasiQuotes,
BangPatterns,
ScopedTypeVariables,
TemplateHaskell,
OverloadedStrings #-}
{-
The compactor does link-time optimization. It is much simpler
than the Optimizer, no fancy dataflow analysis here.
Optimizations:
- rewrite all variables s... | manyoo/ghcjs | src/Gen2/Compactor.hs | Haskell | mit | 19,376 |
{-# LANGUAGE CPP, MagicHash #-}
-----------------------------------------------------------------------------
-- |
-- Module : Haddock.Interface.AttachInstances
-- Copyright : (c) Simon Marlow 2006,
-- David Waern 2006-2009,
-- Isaac Dupree 2009
-- License : BSD-like... | adamse/haddock | haddock-api/src/Haddock/Interface/AttachInstances.hs | Haskell | bsd-2-clause | 9,235 |
{-# LANGUAGE GADTs, AllowAmbiguousTypes #-}
module T8392a where
-- Should complain even with AllowAmbiguousTypes
--
-- But (#12466) we now don't complain about
-- contradictory signatures
-- Instead we get a redundant pattern-match warning,
-- in the post-typechecking pattern-match checks
foo :: (Int ~ Bool) => a -> a... | sdiehl/ghc | testsuite/tests/typecheck/should_fail/T8392a.hs | Haskell | bsd-3-clause | 331 |
module NameMapsPropDecorate where
import NameMaps
import TiPropDecorate
--import PropSyntax(AssertionI,PredicateI)
import NameMapsDecorate(mts)
import TiTypes
--import TiKinds
import NameMapsProp()
--import NameMapsPropStruct(bothtype,bothval)
import HsIdent(mapHsIdent2)
import MapDeclM
--import MapDeclMBaseStruct()
im... | forste/haReFork | tools/property/TI/NameMapsPropDecorate.hs | Haskell | bsd-3-clause | 2,930 |
-- | Extra Maybe utilities.
module Data.Maybe.Extra where
import Control.Monad
import Data.Maybe
-- | Monadic 'mapMaybe'.
mapMaybeM :: Monad f => (a -> f (Maybe b)) -> [a] -> f [b]
mapMaybeM f = liftM catMaybes . mapM f
| mathhun/stack | src/Data/Maybe/Extra.hs | Haskell | bsd-3-clause | 223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.