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 Dampf.ConfigFile.Pretty
( pShowDampfConfig
) where
import Control.Lens
import qualified Data.Map.Strict as Map
import qualified Data.Text as T
import Text.PrettyPrint
import Dampf.ConfigFile.Types
pShowDampfConfig :: DampfConfig -> String
pShowDampfConfig = render . hang (te... | diffusionkinetics/open | dampf/lib/Dampf/ConfigFile/Pretty.hs | Haskell | mit | 1,322 |
module Main where
import Console.Options
import Data.Char (isDigit)
import Data.Monoid
data MyADT = A | B | C
deriving (Show,Eq)
main = defaultMain $ do
programName "my-simple-program"
programDescription "an optional description of your program that can be found in the help"
-- a simple boolean fla... | NicolasDP/hs-cli | examples/Simple.hs | Haskell | bsd-3-clause | 1,477 |
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Arrays where
import Language.VHDL (Mode(..))
import Language.Embedded.Hardware
import Control.Monad.Identity
import Control.Monad.Operational.Higher
import Data.ALaCarte
i... | markus-git/imperative-edsl-vhdl | examples/Array.hs | Haskell | bsd-3-clause | 1,557 |
{-# LANGUAGE CPP #-}
#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
------------------------------------------------------------------------
-- |
-- Module : Data.Hashable
-- Copyright : (c) Milan Straka 2010
-- (c) Johan Tibell 2011
-- ... | ekmett/hashable | Data/Hashable.hs | Haskell | bsd-3-clause | 6,626 |
module WithCli.Normalize (
normalize,
matches,
) where
import Data.Char
matches :: String -> String -> Bool
matches a b =
normalize a == normalize b
normalize :: String -> String
normalize s =
if all (not . isAllowedChar) s
then s
else
slugify $
dropWhile (== '-') $
filt... | kosmikus/getopt-generics | src/WithCli/Normalize.hs | Haskell | bsd-3-clause | 700 |
{-# LANGUAGE Unsafe #-}
{-# LANGUAGE NoImplicitPrelude #-}
-----------------------------------------------------------------------------
-- |
-- Module : System.IO.Unsafe
-- Copyright : (c) The University of Glasgow 2001
-- License : BSD-style (see the file libraries/base/LICENSE)
--
-- Maintainer : li... | alexander-at-github/eta | libraries/base/System/IO/Unsafe.hs | Haskell | bsd-3-clause | 1,363 |
module MonadIn2 where
f (a, b, c)
= do let (z, y) = (a, b)
case (z, y) of
(l, m) -> return (l, m)
f_1 (a, b, c)
= do let (z, y) = (a, b)
case (z, y) of
(l, m) -> return 0
| kmate/HaRe | old/testing/simplifyExpr/MonadIn2AST.hs | Haskell | bsd-3-clause | 238 |
module DemoSpec where
import Test.Hspec
spec :: Spec
spec =
describe "demo" $
specify "trivial" $
() `shouldBe` ()
| Javran/misc | yesod-min/test/DemoSpec.hs | Haskell | mit | 130 |
{-# OPTIONS -XOverloadedStrings #-}
import Network.AMQP
import qualified Data.ByteString.Lazy.Char8 as BL
main :: IO ()
main = do
conn <- openConnection "127.0.0.1" "/" "guest" "guest"
ch <- openChannel conn
declareQueue ch newQueue {queueName = "hello",
queueAut... | yepesasecas/rabbitmq-tutorials | haskell/send.hs | Haskell | apache-2.0 | 625 |
-- !!! test RealFrac ops (ceiling/floor/etc.) on Floats/Doubles
--
main =
putStr $
unlines
[ -- just for fun, we show the floats to
-- exercise the code responsible.
'A' : show (float_list :: [Float])
, 'B' : show (double_list :: [Double])
-- {Float,Double} inputs, {Int,Integer} outputs... | siddhanathan/ghc | testsuite/tests/numeric/should_run/arith005.hs | Haskell | bsd-3-clause | 2,533 |
-- | Test for GHC 7.10+'s @BinaryLiterals@ extensions (see GHC #9224)
{-# LANGUAGE BinaryLiterals #-}
{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Types
main = do
print [ I# 0b0#, I# -0b0#, I# 0b1#, I# -0b1#
, I# 0b0000000000000000000000000000000000000000000000000000000000000000000000000000... | urbanslug/ghc | testsuite/tests/parser/should_run/BinaryLiterals1.hs | Haskell | bsd-3-clause | 1,148 |
{-# LANGUAGE Trustworthy #-}
module Main where
import Prelude
import safe M_SafePkg6
main = putStrLn "test"
| urbanslug/ghc | testsuite/tests/safeHaskell/check/pkg01/ImpSafeOnly07.hs | Haskell | bsd-3-clause | 111 |
module Test where
data Fun = MkFun (Fun -> Fun)
data LList a = Nill | Conss a (LList a)
g :: Fun -> Fun
g f = f
| siddhanathan/ghc | testsuite/tests/stranal/should_compile/fun.hs | Haskell | bsd-3-clause | 113 |
{-# LANGUAGE OverloadedStrings #-}
module ModelTests
( vertexFileParts
, normalFileParts
, texCoordFileParts
, vertexOnlyFaceFileParts
, vertexNormalFaceFileParts
, completeFaceFileParts
, completeModel
, splittedFileParts
, assembleVertP
, assembleVertPN
, assembleVertPNTx
... | psandahl/big-engine | test/ModelTests.hs | Haskell | mit | 8,876 |
{-# LANGUAGE RecursiveDo #-}
module Widgets where
import Reflex.Dom
import qualified GHCJS.DOM.HTMLInputElement as J
import qualified GHCJS.DOM.Element as J
import Control.Lens (view, (^.))
import Data.Monoid ((<>))
import Control.Monad (forM)
--------------- a link opening on a new tab ------
linkNewTab :: Mon... | paolino/LambdaCalculus | Widgets.hs | Haskell | mit | 2,506 |
module Indexing where
import Types
import Control.Monad.State
import Control.Lens ((^.), (&), (+~), (-~))
import Data.List
indexing :: UnIndexedTerm -> IndexedTerm
indexing t = evalState (indexing' t) []
indexing' :: UnIndexedTerm -> State [Name] IndexedTerm
indexing' t = case t of
TmApp t1 t2 -> TmApp <... | eliza0x/Mikan | src/Indexing.hs | Haskell | mit | 2,271 |
module Rebase.Data.Vector.Mutable
(
module Data.Vector.Mutable
)
where
import Data.Vector.Mutable
| nikita-volkov/rebase | library/Rebase/Data/Vector/Mutable.hs | Haskell | mit | 101 |
module Test where
import Prelude ()
import Zeno
data Nat = Zero | Succ Nat
length :: [a] -> Nat
length [] = Zero
length (x:xs) = Succ (length xs)
(++) :: [a] -> [a] -> [a]
[] ++ ys = ys
(x:xs) ++ ys = x : (xs ++ ys)
class Num a where
(+) :: a -> a -> a
instance Num Nat where
Zero + y = y
Succ x + y = Succ (... | Gurmeet-Singh/Zeno | test/test.hs | Haskell | mit | 868 |
module SpecHelper where
import Control.Monad (void)
import qualified System.IO.Error as E
import System.Environment (getEnv)
import qualified Data.ByteString.Base64 as B64 (encode, decodeLenient)
import Data.CaseInsensitive (CI(..))
import qualified Data.Set as S
import qualified Data.Map.Strict as M
import Data.Lis... | begriffs/postgrest | test/SpecHelper.hs | Haskell | mit | 6,950 |
module Lib
( pythagoreanTripletSummingTo
) where
pythagoreanTripletSummingTo :: Integer -> [Integer]
pythagoreanTripletSummingTo n =
head [ [a,b,c] | a <- [1..n-4], b <- [a+1..n-3], c <- [b+1..n-2], -- max. c can only be n-2, since a & b must be at least 1.
a^2 + b^2 == c^2,
a + b + c == n]... | JohnL4/ProjectEuler | Haskell/Problem009/src/Lib.hs | Haskell | mit | 321 |
-- Use a partially applied function to define a function that will return half
-- of a number and another that will append \n to the end of any string.
module Main where
half x = (/ 2)
addNewline s = (++ "\n")
| ryanplusplus/seven-languages-in-seven-weeks | haskell/day2/partial.hs | Haskell | mit | 215 |
{- | Support for resource pagination.
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
module Pos.Util.Pagination (
Page(..)
, PerPage(..)
, maxPerPageEntries
, defaultPer... | input-output-hk/cardano-sl | lib/src/Pos/Util/Pagination.hs | Haskell | apache-2.0 | 5,923 |
module Binary.A309576 (a309576, a309576_rows) where
import Helpers.Binary (lastBits)
-- Table read by rows: T(n, k) is the last k bits of n, 0 <= k <= A070939 n.
a309576_rows :: [[Int]]
a309576_rows = map (\n -> lastBits n ++ [n]) [1..]
a309576_list :: [Int]
a309576_list = concat a309576_rows
a309576 :: Int -> Int
a... | peterokagey/haskellOEIS | src/Binary/A309576.hs | Haskell | apache-2.0 | 355 |
{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, LambdaCase #-}
module HERMIT.Dictionary.Kure
( -- * KURE Strategies
externals
, anyCallR
, betweenR
, anyCallR_LCore
, testQuery
, hfocusR
, hfocusT
) where
import Control.Arrow
import Control.Monad (liftM)
import HERMIT.Core
i... | beni55/hermit | src/HERMIT/Dictionary/Kure.hs | Haskell | bsd-2-clause | 11,723 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QErrorMessage.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:18
Warning : this file is machine generated - do... | uduki/hsQt | Qtc/Gui/QErrorMessage.hs | Haskell | bsd-2-clause | 46,961 |
{-# OPTIONS -fglasgow-exts #-}
-----------------------------------------------------------------------------
{-| Module : QStyleOptionButton.hs
Copyright : (c) David Harley 2010
Project : qtHaskell
Version : 1.1.4
Modified : 2010-09-02 17:02:15
Warning : this file is machine generated... | uduki/hsQt | Qtc/Gui/QStyleOptionButton.hs | Haskell | bsd-2-clause | 5,615 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE CPP #-}
#ifdef LANGUAGE_DeriveDataTypeable
{-# LANGUAGE DeriveDataTypeable #-}
#endif
#if __GLASGOW_HASKELL__... | ekmett/tagged-transformer | src/Data/Functor/Trans/Tagged.hs | Haskell | bsd-2-clause | 12,208 |
-- |
-- Module : $Header$
-- Copyright : (c) 2013-2014 Galois, Inc.
-- License : BSD3
-- Maintainer : cryptol@galois.com
-- Stability : provisional
-- Portability : portable
module Cryptol.ModuleSystem.NamingEnv where
import Cryptol.ModuleSystem.Interface
import Cryptol.Parser.AST
import Cryptol.P... | dylanmc/cryptol | src/Cryptol/ModuleSystem/NamingEnv.hs | Haskell | bsd-3-clause | 7,203 |
-- © 2002 Peter Thiemann
module WASH.CGI.StateItem where
import Data.Char
--
-- |type of handles to a PE of type @a@
data T a = T String Int | Tvirtual { tvirtual :: a }
instance Show (T a) where
showsPrec _ (T s i) = showChar 'T' . shows s . shows i
showsPrec _ (Tvirtual _) = showChar 'V'
instance Read (T a) wh... | nh2/WashNGo | WASH/CGI/StateItem.hs | Haskell | bsd-3-clause | 574 |
-- |
-- Module: $Header$
-- Description: Implementation of internal command named version
-- Copyright: (c) 2018-2020 Peter Trško
-- License: BSD3
--
-- Maintainer: peter.trsko@gmail.com
-- Stability: experimental
-- Portability: GHC specific language extensions.
--
-- Implementation of internal command n... | trskop/command-wrapper | command-wrapper/src/CommandWrapper/Toolset/InternalSubcommand/Version.hs | Haskell | bsd-3-clause | 11,390 |
module Main (main) where
import Cudd
import Prop
import Control.Monad (guard)
import Data.List (sort)
import System.Mem (performGC)
import Text.Printf (printf)
isPermutationOf :: [Int] -> [Int] -> Bool
isPermutationOf vs vs' = sort vs == sort vs'
implies :: Prop -> Prop -> Prop
implies p q = PNot p `POr` q
conjoi... | bradlarsen/hs-cudd | test/SlidingTile.hs | Haskell | bsd-3-clause | 2,917 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE TemplateHaskell #-}
module Mapnik.Color (
Color(..)
, parse
, toText
, colorParser
) where
import Mapnik.Imports
import Mapnik.Util
import Data.Monoid
import Data.Word
import Data.Text (Text)
import Data.T... | albertov/hs-mapnik | pure/src/Mapnik/Color.hs | Haskell | bsd-3-clause | 7,184 |
{-# LANGUAGE CPP #-}
module Options.Applicative.Help.Chunk
( mappendWith
, Chunk(..)
, chunked
, listToChunk
, (<<+>>)
, (<</>>)
, vcatChunks
, vsepChunks
, isEmpty
, stringChunk
, paragraph
, extractChunk
, tabulate
) where
import Control.Applicative
import Control.Monad
import Data.Maybe
... | thielema/optparse-applicative | Options/Applicative/Help/Chunk.hs | Haskell | bsd-3-clause | 3,939 |
{--
--- Day 4: The Ideal Stocking Stuffer ---
Santa needs help mining some AdventCoins (very similar to bitcoins) to use as gifts for all the economically forward-thinking little girls and boys.
To do this, he needs to find MD5 hashes which, in hexadecimal, start with at least five zeroes. The input to the MD5 hash i... | hlmerscher/advent-of-code-2015 | src/Day4.hs | Haskell | bsd-3-clause | 1,766 |
{-# LANGUAGE OverloadedStrings #-}
module Trello.Request (
getBoardById
, getCardById
, getListById
, getMemberById
, getCardsByBoardId
, getListsByBoardId
, getMembersByBoardId
) where
import Trello.Data
import Control.Applicative ((<$>), (<*>))
import Control.Monad ... | vamega/haskell-trello | src/Trello/Request.hs | Haskell | bsd-3-clause | 3,115 |
module FindFlowCover where
import Control.Monad.ST
import Control.Monad.ST.Unsafe
import Data.Array.MArray (getElems)
import Grid (initG, updateCoord, Coord, Direction)
import FindTrails
-- | Solve the Grid used depth wise back tracking search
searchForTrails :: Grid -> [FTrail]
searchForTrails (Grid size endpoints... | habbler/GridFlowCover | src/FindFlowCover.hs | Haskell | bsd-3-clause | 2,416 |
--------------------------------------------------------------------------------
-- | Pretty print LLVM IR Code.
--
module Llvm.PpLlvm (
-- * Top level LLVM objects.
ppLlvmModule,
ppLlvmComments,
ppLlvmComment,
ppLlvmGlobals,
ppLlvmGlobal,
ppLlvmAliases,
ppLlvmAlias,
ppLlvmMetas,
... | lukexi/ghc-7.8-arm64 | compiler/llvmGen/Llvm/PpLlvm.hs | Haskell | bsd-3-clause | 16,501 |
c2n :: Num a => Char -> a
c2n x = case x of
'0' -> 0
'1' -> 1
'2' -> 2
'3' -> 3
'4' -> 4
'5' -> 5
'6' -> 6
'7' -> 7
'8' -> 8
'9' -> 9
main :: IO ()
main = print . sum [c2n x | x <- show (2 ^ 1000)] | tricorder42/project-euler | 16_sum_digits_power/16_sum_digits_power.hs | Haskell | bsd-3-clause | 277 |
module CVSU.Edges
( Orientation(..)
, Edge(..)
, EdgeImage(..)
, allocEdgeImage
, createEdgeImage
) where
import CVSU.Bindings.Types
import CVSU.Bindings.PixelImage
import CVSU.Bindings.Edges
import CVSU.PixelImage
import Foreign.Ptr
import Foreign.ForeignPtr
import Foreign.C.Types
import Foreign.Marshal.Array
import... | amnipar/hs-cvsu | CVSU/Edges.hs | Haskell | bsd-3-clause | 3,993 |
import Cookbook.Essential.IO
import Cookbook.Project.Preprocess.Preprocess
import Cookbook.Recipes.Sanitize
import Cookbook.Ingredients.Tupples.Look
import Cookbook.Essential.Continuous
import Cookbook.Ingredients.Lists.Modify
import Cookbook.Ingredients.Lists.Replace
import System.IO
import System.Environment
import ... | natepisarski/WriteUtils | preprocess.hs | Haskell | bsd-3-clause | 856 |
{-# LANGUAGE RankNTypes, TypeOperators, DefaultSignatures #-}
-- | Compare to indexed.Control.Comonad.Indexed (IxComonad)
module MHask.Indexed.Comonad where
import MHask.Arrow
import qualified MHask.Indexed.Functor as MHask
import qualified MHask.Indexed.Duplicate as MHask
import qualified MHask.Indexed.Copointe... | DanBurton/MHask | MHask/Indexed/Comonad.hs | Haskell | bsd-3-clause | 1,470 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE Safe #-}
module Data.Hexagon.LineDraw (lineDraw) where
import Control.Lens.Review
import Control.Lens.Getter
import Data.Hexagon.Distance
import Data.Hexagon.Types
import qualified Data.Sequence as Seq
import ... | alios/hexagon | src/Data/Hexagon/LineDraw.hs | Haskell | bsd-3-clause | 2,463 |
import qualified Data.ByteString.Char8 as BLC
import System.Environment (getArgs, getExecutablePath)
import qualified System.Log.Logger as L
import Control.Distributed.Task.TaskSpawning.DeployFullBinary
import Control.Distributed.Task.Types.TaskTypes
import Control.Distributed.Task.Util.Configuration
import Control.Di... | michaxm/task-distribution | object-code-app/RemoteExecutor.hs | Haskell | bsd-3-clause | 946 |
{-# LANGUAGE CPP #-}
-- | Prelude replacement
-- Remember to import Prelude () if using this
module Util.Prelewd ( module Prelude
, module Control.Applicative
, module Control.Monad
, module Data.Bool
, module Data.Eq
, ... | cgaebel/GPG-Chat | src/Util/Prelewd.hs | Haskell | bsd-3-clause | 9,213 |
{-# OPTIONS -Wall -Werror -cpp #-}
-- | POSIX time, if you need to deal with timestamps and the like.
-- Most people won't need this module.
module Data.Time.Clock.POSIX
(
posixDayLength,POSIXTime,posixSecondsToUTCTime,utcTimeToPOSIXSeconds,getPOSIXTime
) where
import Data.Time.Clock.UTC
import Data.Time.Calendar.Da... | FranklinChen/hugs98-plus-Sep2006 | packages/time/Data/Time/Clock/POSIX.hs | Haskell | bsd-3-clause | 1,904 |
{-
Copyright 2014 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | chpatrick/clang-lens | src/Language/C/Clang/Location.hs | Haskell | apache-2.0 | 943 |
<?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="es-ES">
<title>Customizable HTML Report</title>
<maps>
<homeID>top</homeID>
<mapref lo... | veggiespam/zap-extensions | addOns/customreport/src/main/javahelp/org/zaproxy/zap/extension/customreport/resources/help_es_ES/helpset_es_ES.hs | Haskell | apache-2.0 | 970 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Package
-- Copyright : Isaac Jones 2003-2004
-- License : BSD3
--
-- Maintainer : ca... | edsko/cabal | Cabal/src/Distribution/Package.hs | Haskell | bsd-3-clause | 7,999 |
module Servant.Swagger.Internal.TypeLevel (
module Servant.Swagger.Internal.TypeLevel.API,
module Servant.Swagger.Internal.TypeLevel.Every,
module Servant.Swagger.Internal.TypeLevel.TMap,
) where
import Servant.Swagger.Internal.TypeLevel.API
import Servant.Swagger.Internal.TypeLevel.Every
imp... | dmjio/servant-swagger | src/Servant/Swagger/Internal/TypeLevel.hs | Haskell | bsd-3-clause | 374 |
{-# LANGUAGE ScopedTypeVariables, TemplateHaskell #-}
module Main where
--------------------------------------------------------------------------
-- imports
import Test.QuickCheck
import Text.Show.Functions
import Data.List
( sort
, group
, nub
, (\\)
)
import Control.Monad
( liftM
, liftM2
)
impo... | nh2/quickcheck | examples/Set.hs | Haskell | bsd-3-clause | 5,702 |
--
-- (c) The University of Glasgow
--
{-# LANGUAGE DeriveDataTypeable #-}
module Avail (
Avails,
AvailInfo(..),
availsToNameSet,
availsToNameSetWithSelectors,
availsToNameEnv,
availName, availNames, availNonFldNames,
availNamesWithSelectors,
availFlds,
stableAvailCmp
) where
im... | AlexanderPankiv/ghc | compiler/basicTypes/Avail.hs | Haskell | bsd-3-clause | 6,603 |
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
module TcRnExports (tcRnExports) where
import HsSyn
import PrelNames
import RdrName
import TcRnMonad
import TcEnv
import TcMType
import TcType
import RnNames
import RnEnv
import ErrUtils
import Id
import IdInfo
import Module... | olsner/ghc | compiler/typecheck/TcRnExports.hs | Haskell | bsd-3-clause | 33,896 |
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Simple.LHC
-- Copyright : Isaac Jones 2003-2007
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- This is a fairly large module. It... | enolan/cabal | Cabal/Distribution/Simple/LHC.hs | Haskell | bsd-3-clause | 33,686 |
{-|
Module : CSH.Eval.Frontend.Data
Description : Yesod data declarations for the EvalFrontend site
Copyright : Stephen Demos, Matt Gambogi, Travis Whitaker, Computer Science House 2015
License : MIT
Maintainer : pvals@csh.rit.edu
Stability : Provisional
Portability : POSIX
Defines the web application la... | robgssp/csh-eval | src/CSH/Eval/Frontend/Data.hs | Haskell | mit | 3,013 |
{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-}
module SizedSeq
( SizedSeq(..)
, emptySS
, addToSS
, addListToSS
, ssElts
, sizeSS
) where
import Prelude -- See note [Why do we import Prelude here?]
import Control.DeepSeq
import Data.Binary
import Data.List
import GHC.Generics
data SizedSeq a = Sized... | sdiehl/ghc | libraries/ghci/SizedSeq.hs | Haskell | bsd-3-clause | 1,176 |
module C4 where
import D4
instance SameOrNot Double where
isSameOrNot a b = a ==b
isNotSame a b = a /=b
myFringe:: Tree a -> [a]
myFringe (Leaf x ) = [x]
myFringe (Branch left right) = myFringe left
| kmate/HaRe | old/testing/renaming/C4_TokOut.hs | Haskell | bsd-3-clause | 216 |
module A1 where
import C1
import D1
sumSq xs
= ((sum (map (sq sq_f) xs)) + (sumSquares xs)) +
(sumSquares1 xs)
main = sumSq [1 .. 4]
| kmate/HaRe | old/testing/addOneParameter/A1_AstOut.hs | Haskell | bsd-3-clause | 147 |
<?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="en-GB">
<title>Form Handler | ZAP Extension</title>
<maps>
<homeID>top</homeID>
... | veggiespam/zap-extensions | addOns/formhandler/src/main/javahelp/org/zaproxy/zap/extension/formhandler/resources/help/helpset.hs | Haskell | apache-2.0 | 986 |
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
{-# OPTIONS_GHC -Wall #-}
-- | Bug(?) in Coercible constraint solving
module T13083 where
import Data.Kind
import GHC.Generics (Par1(..),(:*:)(..))
import GHC.Exts (coerce)
-- Representation as free vector space
type... | sdiehl/ghc | testsuite/tests/typecheck/should_compile/T13083.hs | Haskell | bsd-3-clause | 1,966 |
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances, UndecidableInstances, FlexibleContexts #-}
class A a
class B a where b :: a -> ()
instance A a => B a where b = undefined
newtype Y a = Y (a -> ())
okIn701 :: B a => Y a
okIn701 = wrap $ const () . b
okIn702 :: B a => ... | ghc-android/ghc | testsuite/tests/indexed-types/should_compile/T5002.hs | Haskell | bsd-3-clause | 661 |
{-# LANGUAGE DeriveFunctor #-}
module Game.TurnCounter
( TurnCounter (..)
, newTurnCounter
, nextTurn, nextTurnWith
, previousTurn, previousTurnWith
, currentPlayer
, nextPlayer
, previousPlayer
, currentRound
) where
import Data.List (find)
data TurnCounter p
= TurnCounter
{ tcPlayers :: [p]
... | timjb/halma | halma/src/Game/TurnCounter.hs | Haskell | mit | 1,466 |
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE OverloadedStrings #-}
import Text.Hamlet (HtmlUrl, hamlet)
import Text.Blaze.Html.Renderer.String (renderHtml)
import Data.Text (Text)
import Yesod
data MyRoute = Home
render :: MyRoute -> [(Text, Text)] -> Text
render Home _ = "/home"
footer :: HtmlUrl MyRoute
footer = [ham... | cirquit/quizlearner | resources/html/footer.hs | Haskell | mit | 497 |
module Grammar.Common.Pretty where
import Data.Text (Text)
import qualified Data.Text as Text
import Grammar.Common.Types
textShow :: Show a => a -> Text
textShow = Text.pack . show
prettyMilestone :: Maybe Division :* Maybe Paragraph -> Text
prettyMilestone (Nothing, _) = ""
prettyMilestone (Just (Division b c v s ... | ancientlanguage/haskell-analysis | grammar/src/Grammar/Common/Pretty.hs | Haskell | mit | 1,199 |
module Hahet.Targets.Services where
import Hahet.Targets
import Hahet.Imports
type Started = Maybe Bool
data Service = Service Text Started
deriving (Typeable, Show)
instance Typeable c => Target c Service where
targetDesc _ (Service service _) = service
targetApply (Service _ Nothing) = return R... | SimSaladin/hahet | src/Hahet/Targets/Services.hs | Haskell | mit | 495 |
import Network
import System.IO
import Control.Exception
import Control.Concurrent
import Control.Concurrent.MVar
import Control.Monad
import Control.Monad.Fix (fix)
type Msg = (Int, String)
filename = "primes.log"
main :: IO ()
main = do
chan <- newEmptyMVar
-- sock <- socket AF_INET Stream 0
-- setSocketOpt... | Joss-Steward/Primality | logger.hs | Haskell | mit | 1,132 |
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeSynonymInstances #-}
import Prelude hiding ((.), id)
-- Morphisms
type (a ~> b) c = c a b
class Category (c :: k -> k -> *) where
id :: (a ~> a) c
(.) :: (y ~> z) c -> (x ~> y) c -> (x ~> z) c
type Hask = (->)
instance Category Hask whe... | riwsky/wiwinwlh | src/categories.hs | Haskell | mit | 356 |
main= return()
| geraldus/transient-universe | app/client/Transient/Move/Services/MonitorService.hs | Haskell | mit | 15 |
module Selection where
| fatuhoku/haskell-ball-mosaic | src/Selection.hs | Haskell | mit | 24 |
module Board where
import Data.List (intercalate, unfoldr)
data Cell = O | X | E deriving (Read, Show, Eq)
data Board = Board [Cell] deriving Eq
type Index = Int
instance Show Board where
show (Board cs) =
"\n" ++ intercalate "\n" (map unwords [topRow,midRow,botRow]) ++ "\n"
where lst = map show cs
... | mrkgnao/tictactoe-minimax | Board.hs | Haskell | mit | 1,742 |
{-|
Copyright: (c) Guilherme Azzi, 2014
License: MIT
Maintainer: ggazzi@inf.ufrgs.br
Stability: experimental
A 'Monitor' for the CPU activity.
This module is meant to be imported qualified, e.g.:
> import qualified Reactive.Banana.Monitors.Cpu as Cpu
-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-name-... | ggazzi/hzen | src/Reactive/Banana/Monitors/Cpu.hs | Haskell | mit | 4,494 |
-- chaper3.hs
safetail_1 :: [a] -> [a]
safetail_1 xs = if null xs
then []
else tail xs
safetail_2 :: [a] -> [a]
safetail_2 xs | null xs = []
| otherwise = tail xs
safetail_3 :: [a] -> [a]
safetail_3 [] = []
safetail_3 (_:xs) = xs
| hnfmr/fp101x | playground/chapter3.hs | Haskell | mit | 279 |
-- | Core functionality of the package. Import from either "System.Console.Ansigraph" or
-- "System.Console.Ansigraph.Core".
module System.Console.Ansigraph.Internal.Core where
import System.Console.ANSI
import System.IO (hFlush, stdout)
import Control.Monad.IO.Class (MonadIO, liftIO)
-- for GHC <= 7.8
import Contro... | BlackBrane/ansigraph | src/System/Console/Ansigraph/Internal/Core.hs | Haskell | mit | 5,951 |
module DevelMain where
import Control.Concurrent
import Control.Exception (finally)
import Control.Monad ((>=>))
import Data.IORef
import Data.Time.Clock
import Foreign.Store
import GHC.Word
import Main
import N... | yamadapc/git-issues | src/DevelMain.hs | Haskell | mit | 2,358 |
module PerfectNumbers (classify, Classification(..)) where
data Classification = Deficient | Perfect | Abundant deriving (Eq, Show)
classify :: Int -> Maybe Classification
classify = error "You need to implement this function."
| exercism/xhaskell | exercises/practice/perfect-numbers/src/PerfectNumbers.hs | Haskell | mit | 230 |
import Data.List
parts :: [Integer] -> [[(Integer, Integer)]]
parts ps = foldl' f [] (reverse ps)
where
f [] price = [(price, price)] : []
f result@(cur@((price', maxprice) : _) : rest') price | price > maxprice = [(price, price)] : result
... | pbl64k/CodeSprints | CodeSprint-2012-02-25-Systems/StockTrading/st.accepted.hs | Haskell | bsd-2-clause | 753 |
{-# LANGUAGE OverloadedStrings #-}
module Handler.TimesGallery where
import Import
import qualified Data.Map as M
import Andon.Types
import Andon.ClassData
import Andon.Gallery
getTimesGalleryR :: OrdInt -> Handler RepHtml
getTimesGalleryR times = defaultLayout $ do
setTitle $ toHtml $ "Gallery " ++ show times
... | amutake/andon-yesod | Handler/TimesGallery.hs | Haskell | bsd-2-clause | 416 |
{-# LANGUAGE FlexibleInstances #-}
import Test.Framework (defaultMain)
import Data.Object.Json
import Data.Object
import Test.Framework.Providers.HUnit
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.HUnit hiding (Test)
import Test.QuickCheck (Arbitrary (..), oneof)
import Control.Applicative
im... | snoyberg/data-object-json | runtests.hs | Haskell | bsd-2-clause | 2,098 |
module Main (main) where
import Control.Monad (when)
import Bankotrav.Formatting
import Bankotrav.Random
import Bankotrav.Compression
main :: IO ()
main = do
putStrLn "Generating random board..."
board <- randomBoardIO
putStr $ formatBoard board
putStrLn "Compressing board..."
let idx = compressBoard boar... | Athas/banko | bankotrav/src/bankotrav.hs | Haskell | bsd-2-clause | 556 |
module Hint.GHC (
module GHC,
module Outputable,
module ErrUtils, Message,
module Pretty,
module DriverPhases,
module StringBuffer,
module Lexer,
module Parser,
module DynFlags,
module FastString,
#if __GLASGOW_HASKELL__ >= 610
module Control.Monad.Ghc,
module HscTypes,
... | flowbox-public/hint | src/Hint/GHC.hs | Haskell | bsd-3-clause | 2,033 |
-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree. An additional grant
-- of patent rights can be found in the PATENTS file in the same directory.
{-# LANGUAGE GADT... | facebookincubator/duckling | Duckling/Numeral/FA/Rules.hs | Haskell | bsd-3-clause | 6,842 |
{-
-----------------------------------------------------------------------------
--
-- (c) The University of Glasgow 2001-2003
--
-- Access to system tools: gcc, cp, rm etc
--
-----------------------------------------------------------------------------
-}
{-# LANGUAGE CPP, ScopedTypeVariables #-}
module SysTools (
... | bitemyapp/ghc | compiler/main/SysTools.hs | Haskell | bsd-3-clause | 63,869 |
{-# LANGUAGE GeneralizedNewtypeDeriving,FlexibleInstances,MultiParamTypeClasses,UndecidableInstances #-}
module Counter (CounterT(CounterT), runCounterT, getAndInc) where
import Control.Applicative
import Control.Monad.Trans
import Control.Monad.Reader
import Control.Monad.Writer
import Control.Monad.State
newtype C... | olsner/m3 | Counter.hs | Haskell | bsd-3-clause | 1,122 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE LambdaCase #-}
module Data.Type.Product.Quote
( qP
) where
import Data.Type.Quote
import Data.Type.Product
import Language.Haskell.TH
import Language.Haskell.TH.Quote
qP :... | kylcarte/type-combinators-quote | src/Data/Type/Product/Quote.hs | Haskell | bsd-3-clause | 889 |
module Playground08 where
import qualified Data.Text.All as T
-- Using map 8.1
reverseMyDogs :: [[a]] -> [[a]]
reverseMyDogs dogs = map reverse dogs
filterMyDogs :: [String] -> [String]
filterMyDogs dogs = filter (\ x -> (T.toLower (T.pack x)) == (T.toLower ( T.pack "Axel")) ) dogs
-- Folding a list 8.4
foldMy... | stefanocerruti/haskell-primer-alpha | src/Playground08.hs | Haskell | bsd-3-clause | 490 |
{-# LANGUAGE TypeFamilies, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances, FlexibleContexts, RankNTypes, GADTs #-}
module QueryArrow.DBMap where
import QueryArrow.DB.DB
import QueryArrow.Syntax.Type
import QueryArrow.Semantics.TypeChecker
import QueryArrow.Config
import QueryArrow.Translation
i... | xu-hao/QueryArrow | QueryArrow-plugins/src/QueryArrow/DBMap.hs | Haskell | bsd-3-clause | 2,554 |
-- | Dyck paths, lattice paths, etc
--
-- For example, the following figure represents a Dyck path of height 5 with 3 zero-touches (not counting the starting point,
-- but counting the endpoint) and 7 peaks:
--
-- <<svg/dyck_path.svg>>
--
{-# LANGUAGE BangPatterns #-}
module Math.Combinat.LatticePaths where... | chadbrewbaker/combinat | Math/Combinat/LatticePaths.hs | Haskell | bsd-3-clause | 13,782 |
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
module Data.Gogol.DatastoreEntity (
EntityTransform(..)
, DatastoreEntity(..)
, _ToDatast... | jamesthompson/nosql-generic | src/Data/Gogol/DatastoreEntity.hs | Haskell | bsd-3-clause | 8,885 |
{-# LANGUAGE OverloadedStrings, LambdaCase, RankNTypes #-}
module Main where
import Criterion
import Criterion.Main
import Data.RDF
import qualified Data.Text as T
-- The `bills.102.rdf` XML file is needed to run this benchmark suite
--
-- $ wget https://www.govtrack.us/data/rdf/bills.102.rdf.gz
-- $ gzip -d bills.1... | jutaro/rdf4h | bench/MainCriterion.hs | Haskell | bsd-3-clause | 5,204 |
-- | Context-free grammars.
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Data.Cfg.Cfg(
-- * Class
Cfg(..),
-- * Vocabulary
V(..),
Vs,
isNT,
isT,
vocabulary,
usedVocabulary,
undeclaredVocabulary,
isFully... | nedervold/context-free-grammar | src/Data/Cfg/Cfg.hs | Haskell | bsd-3-clause | 5,238 |
module Passman.Engine.KeyDerivationSpec where
import Test.Hspec (Spec, describe, it)
import Test.Hspec.Expectations.Pretty
import qualified Passman.Engine.ByteString as B
import Passman.Engine.KeyDerivation
k :: String -> Key
k = Key . B.fromString
pbkdf2Salt :... | chwthewke/passman-hs | test/Passman/Engine/KeyDerivationSpec.hs | Haskell | bsd-3-clause | 6,604 |
module Day10 where
import Data.List
repeatLookAndSay :: Int -> String -> String
repeatLookAndSay n = (!! n) . iterate lookAndSay
lookAndSay :: String -> String
lookAndSay = (>>= say) . group
where say g = show (length g) ++ take 1 g | patrickherrmann/advent | src/Day10.hs | Haskell | bsd-3-clause | 237 |
{-# LANGUAGE DeriveDataTypeable #-}
-- | The central type in TagSoup
module Text.HTML.TagSoup.Type(
-- * Data structures and parsing
StringLike, Tag(..), Attribute, Row, Column,
-- * Position manipulation
Position(..), tagPosition, nullPosition, positionChar, positionString,
-- * Tag identificati... | ndmitchell/tagsoup | src/Text/HTML/TagSoup/Type.hs | Haskell | bsd-3-clause | 4,929 |
{-# LANGUAGE MagicHash #-}
-- |
-- Module: $HEADER$
-- Description: Splitting numbers in to digits and vice versa.
-- Copyright: (c) 2009, 2013, 2014 Peter Trsko
-- License: BSD3
--
-- Maintainer: peter.trsko@gmail.com
-- Stability: experimental
-- Portability: non-portable (MagicHash, uses GHC int... | trskop/hs-not-found | not-found-digits/src/Data/Digits.hs | Haskell | bsd-3-clause | 8,996 |
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS -fno-warn-unused-imports #-}
module Main where
import Control.Monad (unless)
import qualified Data.ByteString.Lazy.Char8 as L
import Data.Config.Parser
import Data.Config.Types (Config)
import Data.Config.Pretty (pretty)
import Data.Text (Text)
import qualified Data.Text... | afcowie/konvig | tests/RoundTrip.hs | Haskell | bsd-3-clause | 778 |
module Ivory.Tower.AST.Init where
data Init = Init
deriving (Eq, Show, Ord)
| GaloisInc/tower | tower/src/Ivory/Tower/AST/Init.hs | Haskell | bsd-3-clause | 80 |
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Real.CBOR (serialise, deserialise, deserialiseNull) where
import Real.Types
import Data.Binary.Serialise.CBOR.Class
import Data.Binary.Serialise.CBOR.Encoding hiding (Tokens(..))
import Data.Binary.Serialise.CBOR.Decoding
import Data.Binary.Se... | thoughtpolice/binary-serialise-cbor | bench/Real/CBOR.hs | Haskell | bsd-3-clause | 18,142 |
{-# LANGUAGE OverloadedStrings #-}
module Site
( app
) where
------------------------------------------------------------------------------
import Control.Applicative
import Control.Monad.Trans
import Data.ByteString (ByteString)
import qualified Data.Text... | faylang/snaplet-fay | example/src/Site.hs | Haskell | bsd-3-clause | 2,933 |
{-# Language ScopedTypeVariables #-}
module Symmetry.IL.Deadlock where
import Data.List
import Data.Maybe
import Data.Generics
import Symmetry.IL.AST as AST
import Symmetry.IL.Model
import Symmetry.IL.ConfigInfo
{-
A configuration is deadlocked if
1. Al... | gokhankici/symmetry | checker/src/Symmetry/IL/Deadlock.hs | Haskell | mit | 3,198 |
{-# LANGUAGE LambdaCase #-}
foo = f >>= \case
Just h -> loadTestDB (h ++ "/.testdb")
Nothing -> fmap S.Right initTestDB
{-| Is the alarm set - i.e. will it go off at some point in the future even if `setAlarm` is not called? -}
isAlarmSetSTM :: AlarmClock -> STM Bool
isAlarmSetSTM AlarmClock{..} = rea... | mpickering/ghc-exactprint | tests/examples/ghc710/LambdaCase.hs | Haskell | bsd-3-clause | 405 |
{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables #-}
-- |
-- Module : Scion.Configure
-- Copyright : (c) Thomas Schilling 2008
-- License : BSD-style
--
-- Maintainer : nominolo@googlemail.com
-- Stability : experimental
-- Portability : portable
--
module Scion.Configure where
import Scion.Types
imp... | CristhianMotoche/scion | lib/Scion/Configure.hs | Haskell | bsd-3-clause | 6,450 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.