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
-- The task is to refactor given functions into more Haskell idiomatic style ------------------------ (1) ---------------------------- -- Before: fun1 :: [Integer] -> Integer fun1 [] = 1 fun1 (x:xs) | even x = (x - 2) * fun1 xs | otherwise = fun1 xs -- After: fun1' :: [Integer] -> Integer fun1' = product . map ...
vaibhav276/haskell_cs194_assignments
higher_order/Wholemeal.hs
Haskell
mit
702
module Instances where import Language.Haskell.Syntax import qualified Language.Haskell.Pretty as P import Niz import Data.List ------------------------------------------------------------------------------- ---------------- INSTANCE DECLARATIONS ---------------------------------------- ----------------------------...
arnizamani/occam
Instances.hs
Haskell
mit
19,725
{-# LANGUAGE OverloadedStrings,NoImplicitPrelude #-} module TypePlay.Infer.HM where import Prelude hiding (map,concat) import Data.List (map,concat,nub,union,intersect) import Data.Text (Text) import qualified Data.Text as T import Data.Monoid ((<>),mconcat) type Id = Text enumId :: Int -> Id enumId = ("v" <>) . T...
mankyKitty/TypePlay
src/TypePlay/Infer/HM.hs
Haskell
mit
6,014
import Data.Tree import Data.Tree.Zipper import Data.Maybe import Test.QuickCheck import System.Random import Text.Show.Functions instance Arbitrary a => Arbitrary (Tree a) where arbitrary = sized arbTree where arbTree n = do lbl <- arbitrary children <- resize (n-1) arbitra...
yav/haskell-zipper
test.hs
Haskell
mit
6,455
-- Examples from chapter 5 -- http://learnyouahaskell.com/recursion maximum' :: (Ord a) => [a] -> a maximum' [] = error "maximum of empty list" maximum' [x] = x maximum' (x:xs) = max x (maximum' xs) replicate' :: (Num i, Ord i) => i -> a -> [a] replicate' n x | n <= 0 = [] | otherwise = x:replicate' (n-1) x ...
Sgoettschkes/learning
haskell/LearnYouAHaskell/05.hs
Haskell
mit
902
module Main (main) where import System.Console.GetOpt import System.IO import System.Environment import System.Exit import qualified System.IO as SIO import Data.ByteString import Data.Word import Data.ListLike.CharString import qualified Data.Iter...
danidiaz/haskell-sandbox
iteratee.hs
Haskell
mit
2,218
-- Primes in numbers -- http://www.codewars.com/kata/54d512e62a5e54c96200019e/ module Codewars.Kata.PrFactors where import Data.List (unfoldr, findIndex, group) import Data.Maybe (fromJust) prime_factors :: Integer -> String prime_factors k | isPrime k = "("++ show k ++")" | otherwise = concatMap g ....
gafiatulin/codewars
src/5 kyu/PrFactors.hs
Haskell
mit
1,095
module Main where import Synonyms import Test.Hspec main :: IO () main = hspec $ do let d = Definition "foo" ["b"] in describe "lookupDefinition" $ do it "returns Nothing when no matches" $ lookupDefinition "a" [d] `shouldBe` Nothing it "returns Just Definition whe...
justincampbell/synonyms
Spec.hs
Haskell
mit
720
{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Simulation.Node.Service.Http ( HttpService , Service , Routes (..) , activate , as , toSnapRoutes , selfStore , basePrefix , module Snap.Core ) where import Control.Applicative (Applicative, Alterna...
kosmoskatten/programmable-endpoint
src/Simulation/Node/Service/Http.hs
Haskell
mit
3,288
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} module Alder.Html.Internal ( -- * Elements Node(..) -- * Attributes , Id , Handlers , Attributes(..) , defaultAttributes -- * Html , Html , HtmlM(..) , runHtml , parent , lea...
ghcjs/ghcjs-sodium
src/Alder/Html/Internal.hs
Haskell
mit
4,281
module Main where data MyBool = MyTrue | MyFalse foo a MyFalse b = 0 foo c MyTrue d = 1 bar a = 2 main_ = foo 1 MyFalse 2
Ekleog/hasklate
examples/BasicPatternMatching.hs
Haskell
mit
126
module Propellor.Property.Tor where import Propellor import qualified Propellor.Property.File as File import qualified Propellor.Property.Apt as Apt import qualified Propellor.Property.Service as Service import Utility.FileMode import Utility.DataUnits import System.Posix.Files import Data.Char import Data.List type...
sjfloat/propellor
src/Propellor/Property/Tor.hs
Haskell
bsd-2-clause
5,177
{-# LANGUAGE TypeFamilies, OverloadedStrings #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Xournal.Map -- Copyright : (c) 2011, 2012 Ian-Woo Kim -- -- License : BSD3 -- Maintainer : Ian-Woo Kim <ianwookim@gmail.com> -- Stability : experimental --...
wavewave/xournal-types
src/Data/Xournal/Map.hs
Haskell
bsd-2-clause
875
module Interface.LpSolve where -- standard modules -- local modules import Helpful.Process --import Data.Time.Clock (diffUTCTime, getCurrentTime) --import Debug.Trace zeroObjective :: String -> Maybe Bool zeroObjective p = case head answer of "This problem is infeasible" -> Nothing "This problem is unbounde...
spatial-reasoning/zeno
src/Interface/LpSolve.hs
Haskell
bsd-2-clause
1,952
{-# LANGUAGE MultiParamTypeClasses, TypeSynonymInstances #-} module Lambda.DataType.SExpr where import DeepControl.Applicative import DeepControl.Monad import Lambda.DataType.Common import Lambda.DataType.PatternMatch (PM) import qualified Lambda.DataType.PatternMatch as PM import Lambda.DataType.Type (Type((:->))) i...
ocean0yohsuke/Simply-Typed-Lambda
src/Lambda/DataType/SExpr.hs
Haskell
bsd-3-clause
6,954
{-# LANGUAGE ViewPatterns #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE StandaloneDeriving #-} -- | Model for wiki. module HL.Model.Wiki where import HL.Controller import Control.Exception.Lifted (catch) import Control.Spoon import Data.Conduit import Data.Maybe import Da...
erantapaa/hl
src/HL/Model/Wiki.hs
Haskell
bsd-3-clause
2,701
{-# LANGUAGE CPP #-} #include "overlapping-compat.h" module Servant.ForeignSpec where import Data.Monoid ((<>)) import Data.Proxy import Servant.Foreign import Test.Hspec spec :: Spec spec = describe "Servant.Foreign" $ do camelCaseSpec listFromAPISpec camelCaseSpec :: Spec camelCaseSpec = descri...
zerobuzz/servant
servant-foreign/test/Servant/ForeignSpec.hs
Haskell
bsd-3-clause
4,035
{- (c) The University of Glasgow 2011 The deriving code for the Generic class (equivalent to the code in TcGenDeriv, for other classes) -} {-# LANGUAGE CPP, ScopedTypeVariables, TupleSections #-} {-# LANGUAGE FlexibleContexts #-} module TcGenGenerics (canDoGenerics, canDoGenerics1, GenericKind...
ghc-android/ghc
compiler/typecheck/TcGenGenerics.hs
Haskell
bsd-3-clause
37,323
-- 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 Over...
rfranek/duckling
Duckling/Email/EN/Corpus.hs
Haskell
bsd-3-clause
983
module SimpleLang.Syntax where import Data.Functor.Identity import Data.Maybe (fromMaybe) import qualified SimpleLang.Parser as P import Text.Parsec import qualified Text.Parsec.Expr as Ex import qualified Text.Parsec.Token as Tok data Expr = Tr | Fl |...
AlphaMarc/WYAH
src/SimpleLang/Syntax.hs
Haskell
bsd-3-clause
2,692
{-# LANGUAGE OverloadedStrings, TemplateHaskell #-} module Config where import Control.Applicative import Control.Exception import Data.ByteString (ByteString) import Data.Configurator as C import HFlags import System.Directory import System.FilePath import System.IO import Paths_sproxy_web defineFlag "c:config" ("...
alpmestan/spw
src/Config.hs
Haskell
bsd-3-clause
1,432
module Module1.Task10 where fibonacci :: Integer -> Integer fibonacci n | n == 0 = 0 | n == 1 = 1 | n < 0 = -(-1) ^ (-n) * fibonacci (-n) | n > 0 = fibonacciIter 0 1 (n - 2) fibonacciIter acc1 acc2 0 = acc1 + acc2 fibonacciIter acc1 acc2 n = fibonacciIter (acc2) (acc1 + acc2) (n - 1)
dstarcev/stepic-haskell
src/Module1/Task10.hs
Haskell
bsd-3-clause
309
{-# LANGUAGE BangPatterns #-} module Network.HPACK.Table.DoubleHashMap ( DoubleHashMap , empty , insert , delete , fromList , deleteList , Res(..) , search ) where import Data.HashMap.Strict (HashMap) import qualified Data.HashMap.Strict as H import Data.List (foldl') import Network.HPACK.Types n...
bergmark/http2
Network/HPACK/Table/DoubleHashMap.hs
Haskell
bsd-3-clause
2,210
{-# LANGUAGE OverloadedStrings #-} module Network.IRC.Bot.Part.Channels where import Control.Concurrent.STM (atomically) import Control.Concurrent.STM.TVar (TVar, newTVar, readTVar, writeTVar) import Control.Monad.Trans (MonadIO(liftIO)) import Data.Monoid ((<>)) import Data.Set (Set, insert, toList) import Data.ByteS...
eigengrau/haskell-ircbot
Network/IRC/Bot/Part/Channels.hs
Haskell
bsd-3-clause
1,451
{-# LANGUAGE MultiParamTypeClasses #-} -- | -- Module: $HEADER$ -- Description: Command line tool that generates random passwords. -- Copyright: (c) 2013 Peter Trsko -- License: BSD3 -- -- Maintainer: peter.trsko@gmail.com -- Stability: experimental -- Portability: non-portable (FlexibleContexts, d...
trskop/hpwgen
src/Main/Application.hs
Haskell
bsd-3-clause
11,354
{-# LANGUAGE ViewPatterns #-} module Plunge.Analytics.C2CPP ( lineAssociations ) where import Data.List import Plunge.Types.PreprocessorOutput -- Fill in any gaps left by making associations out of CPP spans. lineAssociations :: [Section] -> [LineAssociation] lineAssociations ss = concat $ snd $ mapAccumL fillGap...
sw17ch/plunge
src/Plunge/Analytics/C2CPP.hs
Haskell
bsd-3-clause
1,653
{-# LANGUAGE GADTs, TypeOperators #-} module Compiler.InstantiateLambdas (instantiate, dump) where import Compiler.Generics import Compiler.Expression import Control.Applicative import Control.Arrow hiding (app) import Control.Monad.Reader import Data.List (intercalate) import qualified Lang.Value as V instantiate ...
tomlokhorst/AwesomePrelude
src/Compiler/InstantiateLambdas.hs
Haskell
bsd-3-clause
1,251
{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} import Db import Parser import Trains import Result import Data.List import System.IO import System.Directory import Control.Arrow import Control.Applicative import ...
fadeopolis/prog-spr-ue3
ue3.hs
Haskell
bsd-3-clause
11,533
a :: Int a = 123 unittest "quote" [ (show {a}, "a"), (show {,a}, ",a"), (show {pred ,a}, "pred ,a"), ] unittest "quasiquote" [ (`a, a), (`(,a), 123), (`(pred ,a), pred 123), (let x = `(pred ,a) in x , 122...
ocean0yohsuke/Simply-Typed-Lambda
Start/UnitTest/Quote.hs
Haskell
bsd-3-clause
650
module Test.Pos.Crypto.Gen ( -- Protocol Magic Generator genProtocolMagic , genProtocolMagicId , genRequiresNetworkMagic -- Sign Tag Generator , genSignTag -- Key Generators , genKeypair , genPublicKey , genSecretKey , g...
input-output-hk/pos-haskell-prototype
crypto/test/Test/Pos/Crypto/Gen.hs
Haskell
mit
11,486
{- --Task 4 --power x*y = --if x*y==0 --then 0 --else if (x*y) != 0 --then x+(x*(y-1)) --These are home tasks --bb bmi --| bmi <= 10 ="a" --| bmi <= 5 = "b" --| otherwise = bmi slope (x1,y1) (x2,y2) = dy / dx where dy = y2-y1 dx = x2 - x1 --Task 2 reci x = 1/x; --Task 3 --abst x --Task 4 sign x | x<0 = ...
badarshahzad/Learn-Haskell
week 2 & 3/function.hs
Haskell
mit
974
{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NoMonomorphismRestriction #-} {-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE TupleSections #-} #if MIN_VERS...
Gabriel439/succinct
src/Succinct/Sequence.hs
Haskell
bsd-2-clause
19,162
{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RecordWildCards #-} -- | Run sub-processes. module System.Process.Run (run...
Heather/stack
src/System/Process/Run.hs
Haskell
bsd-3-clause
4,928
{-# LANGUAGE Rank2Types #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Choose.ST -- Copyright : Copyright (c) , Patrick Perry <patperry@stanford.edu> -- License : BSD3 -- Maintainer : Patrick Perry <patperry@stanford.edu> -- Stability : experimental -- -...
patperry/permutation
lib/Data/Choose/ST.hs
Haskell
bsd-3-clause
1,074
{-# LANGUAGE CPP #-} module Main where import Prelude hiding ( catch ) import Test.HUnit import System.Exit import System.Process ( system ) import System.IO ( stderr ) import qualified DependencyTest import qualified MigrationsTest import qualified FilesystemSerializeTest import qualified FilesystemParseTest import ...
nick0x01/dbmigrations
test/TestDriver.hs
Haskell
bsd-3-clause
3,047
module Graphics.UI.Gtk.Layout.EitherWidget where import Control.Monad import Data.IORef import Graphics.UI.Gtk import System.Glib.Types data EitherWidget a b = EitherWidget Notebook (IORef EitherWidgetParams) type EitherWidgetParams = Bool instance WidgetClass (EitherWidget a b) instance ObjectClass (EitherWidget ...
keera-studios/gtk-helpers
gtk3/src/Graphics/UI/Gtk/Layout/EitherWidget.hs
Haskell
bsd-3-clause
1,612
module E.Binary() where import Data.Binary import E.Type import FrontEnd.HsSyn() import Name.Binary() import Support.MapBinaryInstance import {-# SOURCE #-} Info.Binary(putInfo,getInfo) instance Binary TVr where put TVr { tvrIdent = eid, tvrType = e, tvrInfo = nf} = do put eid put e putIn...
m-alvarez/jhc
src/E/Binary.hs
Haskell
mit
5,542
<?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="hu-HU"> <title>Directory List v2.3</title> <maps> <homeID>directorylistv2_3</homeID> <m...
thc202/zap-extensions
addOns/directorylistv2_3/src/main/javahelp/help_hu_HU/helpset_hu_HU.hs
Haskell
apache-2.0
978
{-# LANGUAGE FlexibleInstances, MultiParamTypeClasses #-} ---------------------------------------------------------------------------- -- | -- Module : XMonad.Layout.NoFrillsDecoration -- Copyright : (c) Jan Vornberger 2009 -- License : BSD3-style (see LICENSE) -- -- Maintainer : jan.vornberger@informat...
pjones/xmonad-test
vendor/xmonad-contrib/XMonad/Layout/NoFrillsDecoration.hs
Haskell
bsd-2-clause
1,703
{-# LANGUAGE TypeFamilies, TypeSynonymInstances, FlexibleContexts, FlexibleInstances, ScopedTypeVariables, Arrows, GeneralizedNewtypeDeriving, PatternSynonyms #-} module Graphics.GPipe.Internal.PrimitiveStream where import Control.Monad.Trans.Class import Control.Monad.Trans.Writer.Lazy import Control.Monad.Trans.Sta...
Teaspot-Studio/GPipe-Core
src/Graphics/GPipe/Internal/PrimitiveStream.hs
Haskell
mit
22,384
module ASPico.Handler.Root.Affiliate ( ApiAffiliate , serverAffiliate ) where import ASPico.Prelude hiding (product) import Database.Persist.Sql (Entity(..), fromSqlKey) import Servant ((:>), FormUrlEncoded, JSON, Post, ReqBody, ServerT) import ASPico.Envelope (Envelope, returnSuccess) import ASPico.Error (App...
arowM/ASPico
src/ASPico/Handler/Root/Affiliate.hs
Haskell
mit
905
module StackLang where import Prelude hiding (EQ,If) -- Grammar for StackLang: -- -- num ::= (any number) -- bool ::= `true` | `false` -- prog ::= cmd* -- cmd ::= int push a number on the stack -- | bool push a boolean on the stack -- | `add` ad...
siphayne/CS381
scratch/StackLang.hs
Haskell
mit
1,454
module Utils where import Import hiding (group) import Data.Char (isSpace) import Data.Conduit.Binary (sinkLbs) import qualified Data.ByteString.Lazy.Char8 as LB8 import qualified Data.HashMap.Strict as M import qualified Data.List as L -- import ...
ranjitjhala/gradr
Utils.hs
Haskell
mit
1,752
-- | Specification for the exercises of Chapter 6. module Chapter06Spec where import qualified Chapter06 as C6 import Data.List (sort) import Data.Proxy import Test.Hspec (Spec, describe, it, shouldBe) import Test.QuickCheck (Arbitrary (..), Property, property...
EindhovenHaskellMeetup/meetup
courses/programming-in-haskell/pih-exercises/test/Chapter06Spec.hs
Haskell
mit
5,372
module ProjectEuler.Problem004 (solve) where isPalindrome :: Integer -> Bool isPalindrome n = reverse xs == xs where xs = show n nDigitIntegers :: Integer -> [Integer] nDigitIntegers n = [10^(n-1)..(10^n)-1] solve :: Integer -> Integer solve n = maximum $ filter isPalindrome xs where xs = [a * b | a <- y...
hachibu/project-euler
src/ProjectEuler/Problem004.hs
Haskell
mit
358
{-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE ExplicitForAll #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} -- | This module introduces functions that allow to run action in parallel with logging. module System.Wlog.Concurrent ( WaitingDelta (..) , CanLogInParalle...
serokell/log-warper
src/System/Wlog/Concurrent.hs
Haskell
mit
4,062
{-# htermination negate :: Float -> Float #-}
ComputationWithBoundedResources/ara-inference
doc/tpdb_trs/Haskell/full_haskell/Prelude_negate_3.hs
Haskell
mit
46
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} module SchoolOfHaskell.Scheduler.API where import Control.Applicative ((<$>), (<*>)) import Control.Lens (makeLenses) import Data.Aeson (ToJSON(..), FromJSON(..)) import ...
fpco/schoolofhaskell
soh-scheduler-api/src/SchoolOfHaskell/Scheduler/API.hs
Haskell
mit
2,070
length' [] = 0 length' (x:xs) = 1 + (length' xs) append' [] = id append' (x:xs) = (x:).append' xs -- A trivial way reverse' [] = [] reverse' (x:xs) = (reverse' xs) ++ [x] reverse2 = rev [] where rev a [] = a rev a (x:xs) = rev (x:a) xs fix f = f (fix f) reverse3 = fix (\ f a x -> case x of ...
MaKToff/SPbSU_Homeworks
Semester 3/Classwork/cw01.hs
Haskell
mit
760
szachy is xD mialo byc warcaby xD w erlangu zrobic strange sort itp.. wszysstko to co w haskelu
RAFIRAF/HASKELL
CHESS2016.hs
Haskell
mit
97
{- ****************************************************************************** * JSHOP * * * * Module: ParseMonad * *...
nbrunt/JSHOP
src/old/ver2/ParseMonad.hs
Haskell
mit
4,096
----------------------------------------------------------------------------- -- -- Module : Topology -- Copyright : -- License : AllRightsReserved -- -- Maintainer : -- Stability : -- Portability : -- -- | -- ----------------------------------------------------------------------------- module Topology...
uvNikita/TopologyRouting
src/Topology.hs
Haskell
mit
1,494
{-# LANGUAGE PackageImports #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE NoImplicitPrelude #-} {- Copyright 2020 The CodeWorld Authors. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a co...
google/codeworld
codeworld-base/src/Internal/Exports.hs
Haskell
apache-2.0
2,352
{- Primitive.hs - Primitive shapes. - - Timothy A. Chagnon - CS 636 - Spring 2009 -} module Primitive where import Math import Ray import Material data Primitive = Sphere RealT Vec3f -- Sphere defined by radius, center | Plane Vec3f Vec3f Vec3f -- Plane defined by 3 points deriving ...
tchagnon/cs636-raytracer
a5/Primitive.hs
Haskell
apache-2.0
2,060
{-# LANGUAGE CPP #-} {-# LANGUAGE TemplateHaskell #-} #include "settings.h" -- | Settings are centralized, as much as possible, into this file. This -- includes database connection settings, static file locations, etc. -- In addition, you can configure a number of different aspects of Yesod -- by overriding methods i...
sseefried/funky-foto
Settings.hs
Haskell
bsd-2-clause
5,570
-- | Provides functionality of rendering the application model. module Renderer ( Descriptor , initialize , terminate , render ) where import Foreign.Marshal.Array import Foreign.Ptr import Foreign.Storable import Graphics.Rendering.OpenGL import System.IO import qualified LoadShaders as LS -- ...
fujiyan/toriaezuzakki
haskell/opengl/rectangle/Renderer.hs
Haskell
bsd-2-clause
4,665
{-# LANGUAGE OverloadedStrings #-} -- | This module contains convertions from LDAP types to ASN.1. -- -- Various hacks are employed because "asn1-encoding" only encodes to DER, but -- LDAP demands BER-encoding. So, when a definition looks suspiciously different -- from the spec in the comment, that's why. I hope all ...
supki/ldap-client
src/Ldap/Asn1/ToAsn1.hs
Haskell
bsd-2-clause
11,863
module HSNTP.Util.Daemon (daemonize, childLives) where import System.Posix daemonize :: IO () -> IO () -> IO ProcessID daemonize hup comp = forkProcess cont where cont = do createSession installHandler lostConnection (Catch hup) Nothing comp childLives :: ProcessID -> IO Bool childLives pid = do sle...
creswick/hsntp
HSNTP/Util/Daemon.hs
Haskell
bsd-3-clause
413
-- -fno-warn-deprecations for use of Map.foldWithKey {-# OPTIONS_GHC -fno-warn-deprecations #-} ----------------------------------------------------------------------------- -- | -- Module : Distribution.PackageDescription.Configuration -- Copyright : Thomas Schilling, 2007 -- License : BSD3 -- -- Maintai...
edsko/cabal
Cabal/src/Distribution/PackageDescription/Configuration.hs
Haskell
bsd-3-clause
25,834
{-# LANGUAGE BangPatterns, MultiParamTypeClasses, FunctionalDependencies, FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Data.Permute.MPermute -- Copyright : Copyright (c) , Patrick Perry <patperry@stanford.edu> -- License : BSD3 -- M...
patperry/permutation
lib/Data/Permute/MPermute.hs
Haskell
bsd-3-clause
17,466
{-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} -- | Interface for GraphQL API. -- -- __Note__: This module is highly subject to change. We're still figuring -- where to...
jml/graphql-api
src/GraphQL.hs
Haskell
bsd-3-clause
6,404
module QueryArrow.BuiltIn where import System.IO (FilePath, readFile) import Text.Read (readMaybe) import QueryArrow.Syntax.Term import QueryArrow.Syntax.Type standardBuiltInPreds = [ Pred (UQPredName "le") (PredType ObjectPred [ParamType True True False False Int64Type, ParamType True True False False Int64T...
xu-hao/QueryArrow
QueryArrow-common/src/QueryArrow/BuiltIn.hs
Haskell
bsd-3-clause
4,200
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} module EFA.Utility.List where vhead :: String -> [a] -> a vhead _ (x:_) = x vhead caller _ = error $ "vhead, " ++ caller ++ ": empty list" vlast :: String -> [a] -> a vlast _ xs@(_:_) = last xs vlast caller _ = error $ "vlast, " ++ caller ++ "...
energyflowanalysis/efa-2.1
src/EFA/Utility/List.hs
Haskell
bsd-3-clause
531
{-| Copyright : (c) Dave Laing, 2017 License : BSD3 Maintainer : dave.laing.80@gmail.com Stability : experimental Portability : non-portable -} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE ConstraintKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAG...
dalaing/type-systems
src/Rules/Kind/Infer/Offline.hs
Haskell
bsd-3-clause
3,672
{-# LANGUAGE ExistentialQuantification #-} module Data.IORef.ReadWrite ( ReadWriteIORef , toReadWriteIORef ) where import Data.Bifunctor (first) import Data.IORef (IORef) import Data.IORef.Class data ReadWriteIORef a = forall b. ReadWriteIORef (IORef b) (a -> b) (b -> a) toReadWriteIORef :: IORef a -> ReadWri...
osa1/privileged-concurrency
Data/IORef/ReadWrite.hs
Haskell
bsd-3-clause
1,251
module Main where main :: IO () main = print $ length ('a', 'b')
stepcut/safe-length
example/BrokenTuple.hs
Haskell
bsd-3-clause
66
module Main where import Control.Lens import Numeric.Lens (binary, negated, adding) import Test.Tasty (TestTree, defaultMain, testGroup) import Test.Tasty.ExpectedFailure (allowFail) import Test.DumbCheck -- (TestTree, defaultMain, testGroup) import qualified Test.Tasty.Lens.Iso as Iso import qualified Test.Tasty.Len...
jdnavarro/tasty-lens
tests/tasty.hs
Haskell
bsd-3-clause
2,255
{-# LANGUAGE BangPatterns #-} -- need a fast way to represent a sudo puzzle -- use vector reference: https://wiki.haskell.org/Numeric_Haskell:_A_Vector_Tutorial -- * End users should use Data.Vector.Unboxed for most cases -- * If you need to store more complex structures, use Data.Vector -- * If you need to pass to ...
niexshao/Exercises
src/Euler96-Sudoku/sudoku1.hs
Haskell
bsd-3-clause
3,446
{-# LANGUAGE CPP #-} ----------------------------------------------------------------------------- -- | -- Module : Xmobar.Plugins.Monitors -- Copyright : (c) 2010, 2011, 2012, 2013 Jose Antonio Ortega Ruiz -- (c) 2007-10 Andrea Rossato -- License : BSD-style (see LICENSE) -- -- Maintainer...
apoikos/pkg-xmobar
src/Plugins/Monitors.hs
Haskell
bsd-3-clause
5,554
{-# LANGUAGE RecordWildCards #-} module Helper ( emptyEnv , newUserAct , midnight , stubRunner , stubCommand , addUser , createEnv , createUser , createPost , stubUsers , secAfterMidnight , usersEnv , newSysAct ) where import Types import qualified Data.Map.Lazy as Map (insert, empty, from...
lpalma/hamerkop
test/Helper.hs
Haskell
bsd-3-clause
2,747
-- | Collection of types (@Proc_*@ types and others), and -- some functions on these types as well. module Graphics.Web.Processing.Core.Types ( -- * Processing Script ProcScript (..) , emptyScript -- ** Script rendering , renderScript , renderFile -- ** Processing Code , ProcCode -- * Contexts ...
Daniel-Diaz/processing
Graphics/Web/Processing/Core/Types.hs
Haskell
bsd-3-clause
1,582
module MakeTerm where import BruijnTerm import Value import Name val :: Value -> LamTerm () () n val = Val () var :: String -> LamTerm () () Name var = Var () . fromString double :: Double -> LamTerm () () n double = Val () . Prim . MyDouble true :: LamTerm () () n true = Val () $ Prim $ MyBool True false :: LamT...
kwibus/myLang
tests/MakeTerm.hs
Haskell
bsd-3-clause
779
module Main where import GHC.IO.Handle import System.Console.GetOpt import System.Environment import System.Exit import System.IO import Data.Aeson import Sampler import Control.Monad ( replicateM ) import qualified Da...
maciej-bendkowski/boltzmann-brain
scripts/sampler-template/app/Main.hs
Haskell
bsd-3-clause
4,877
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE ScopedTypeVariables #-} -- | Simple program to proxy a SFTP session. I.e. a SFTP client will spawn us -- through SSH instead of a real sftp executable. It won't see any difference -- as we are fully transparent, but we can se what the protoc...
noteed/sftp-streams
bin/sftp-mitm.hs
Haskell
bsd-3-clause
4,471
{-# LANGUAGE MonadComprehensions #-} -- | A big-endian binary PATRICIA trie with fixed-size ints as keys. module BinaryTrie where import Prelude hiding (lookup) import Data.Bits import Data.Monoid import Text.Printf -- | A PATRICIA trie that inspects an @Int@ key bit by bit...
silky/different-tries
src/BinaryTrie.hs
Haskell
bsd-3-clause
5,963
module B1.Data.Technicals.StockData ( StockData , StockDataStatus(..) , StockPriceData(..) , newStockData , createStockPriceData , getStockDataStatus , getStockPriceData , getErrorMessage , handleStockData ) where import Control.Concurrent import Control.Concurrent.MVar import Data.Either import Da...
btmura/b1
src/B1/Data/Technicals/StockData.hs
Haskell
bsd-3-clause
4,249
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleInstances #-} -- | The commented code summarizes what will be auto-generated below module Main where import Control.Lens -- import Test.QuickCheck (quic...
np/lens
tests/templates.hs
Haskell
bsd-3-clause
2,743
module Idris.DeepSeq(module Idris.DeepSeq, module Idris.Core.DeepSeq) where import Idris.Core.DeepSeq import Idris.Core.TT import Idris.AbsSyntaxTree import Control.DeepSeq -- All generated by 'derive' instance NFData Forceability where rnf Conditional = () rnf Unconditional = () instance NFData In...
ctford/Idris-Elba-dev
src/Idris/DeepSeq.hs
Haskell
bsd-3-clause
10,810
{-# LANGUAGE BangPatterns #-} {-# OPTIONS_GHC -Wall #-} module Main where import Control.Concurrent import Control.Exception as Ex import Control.Monad import Data.IORef import System.Posix.CircularBuffer import System.Environment -- read Int's from the supplied buffer as fast as possible, and print the -- number re...
smunix/shared-buffer
benchmarks/Reader.hs
Haskell
bsd-3-clause
989
{-| Implementation of the RAPI client interface. -} {- Copyright (C) 2009, 2010, 2011, 2012, 2013 Google Inc. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must re...
apyrgio/ganeti
src/Ganeti/HTools/Backend/Rapi.hs
Haskell
bsd-2-clause
10,150
----------------------------------------------------------------------------- -- -- Machine-specific parts of the register allocator -- -- (c) The University of Glasgow 1996-2004 -- ----------------------------------------------------------------------------- {-# OPTIONS -fno-warn-tabs #-} -- The above warning supress...
lukexi/ghc-7.8-arm64
compiler/nativeGen/PPC/RegInfo.hs
Haskell
bsd-3-clause
2,380
{-# Language PatternGuards #-} module Blub ( blub , foo , bar ) where import Ugah.Foo ( a , b ) import Control.Applicative import Ugah.Blub f :: Int -> Int f = (+ 3) g :: Int -> Int g = where
jystic/hsimport
tests/inputFiles/ModuleTest28.hs
Haskell
bsd-3-clause
240
-- FrontEnd.Tc.Type should be imported instead of this. module FrontEnd.Representation( Type(..), Tyvar(..), tyvar, Tycon(..), fn, Pred(..), Qual(..), Class, tForAll, tExists, MetaVarType(..), prettyPrintType, fromTAp, fromTArrow, tassocToAp, MetaVar(..), ...
hvr/jhc
src/FrontEnd/Representation.hs
Haskell
mit
10,748
{-# LANGUAGE BangPatterns, CPP #-} module RegAlloc.Graph.TrivColorable ( trivColorable, ) where #include "HsVersions.h" import RegClass import Reg import GraphBase import UniqFM import FastTypes import Platform import Panic -- trivColorable ---------------------------------------------------------------...
christiaanb/ghc
compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
Haskell
bsd-3-clause
12,047
{-# LANGUAGE TypeFamilies, FlexibleInstances, FlexibleContexts, UndecidableInstances, MultiParamTypeClasses, FunctionalDependencies #-} {-# OPTIONS_GHC -fno-warn-redundant-constraints #-} module T10139 where import Data.Monoid import Data.Kind import Data.Coerce class Monoid v => Measured v a | a -> v w...
sdiehl/ghc
testsuite/tests/indexed-types/should_compile/T10139.hs
Haskell
bsd-3-clause
1,165
{-# OPTIONS_GHC -fcontext-stack=1000 #-} {-# LANGUAGE FlexibleContexts, FlexibleInstances, FunctionalDependencies, MultiParamTypeClasses, OverlappingInstances, TypeSynonymInstances, TypeOperators, UndecidableInstances, TypeFamilies #-} module T5321Fun where -- As the below code demonstrates, the sa...
frantisekfarka/ghc-dsi
testsuite/tests/perf/compiler/T5321Fun.hs
Haskell
bsd-3-clause
3,485
{-# LANGUAGE Trustworthy #-} {-# LANGUAGE NoImplicitPrelude #-} ----------------------------------------------------------------------------- -- | -- Module : Foreign.ForeignPtr.Safe -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/base/LICENSE) -- -- Main...
ryantm/ghc
libraries/base/Foreign/ForeignPtr/Safe.hs
Haskell
bsd-3-clause
1,340
{-# LANGUAGE TypeFamilies #-} module Hadrian.Oracles.ArgsHash ( TrackArgument, trackAllArguments, trackArgsHash, argsHashOracle ) where import Control.Monad import Development.Shake import Development.Shake.Classes import Hadrian.Expression hiding (inputs, outputs) import Hadrian.Target -- | 'TrackArgument' ...
snowleopard/shaking-up-ghc
src/Hadrian/Oracles/ArgsHash.hs
Haskell
bsd-3-clause
2,494
module NegativeIn1 where f x y = x + y
kmate/HaRe
old/testing/introCase/NegativeIn1_TokOut.hs
Haskell
bsd-3-clause
42
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-} {-# LANGUAGE FlexibleInstances, TypeSynonymInstances, UndecidableInstances #-} module Tc173a where class FormValue value where isFormValue :: value -> () isFormValue _ = () class FormTextField value instance FormTextField String instance {-# OVERLAPPABLE #...
christiaanb/ghc
testsuite/tests/typecheck/should_compile/Tc173a.hs
Haskell
bsd-3-clause
533
{-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE CPP #-} module Text.Regex.Applicative.Types where import Control.Applicative import Control.Monad ((<=<)) import Data.Filtrable (Filtrable (..)) import Data.Functor.Identity (Identity (..)) import Data.String #if !MIN_...
feuerbach/regex-applicative
Text/Regex/Applicative/Types.hs
Haskell
mit
6,009
module Rocketfuel.Grid ( generateRandomGrid, afterMove, applySwap, getFallingTiles, hasMoves ) where import Data.Array import Data.List import Data.List.Split (chunksOf) import Data.Maybe import Data.Natural import Control.Monad.Writer import Control.Monad.Random import Rocketfuel.Types -- These...
Raveline/Rocketfuel
src/Rocketfuel/Grid.hs
Haskell
mit
6,579
{-# LANGUAGE PatternGuards #-} module Tarefa3_2017li1g180 where import LI11718 import Tarefa2_2017li1g180 import Test.QuickCheck.Gen import Data.List import Data.Maybe import Safe testesT3 :: [(Tabuleiro,Tempo,Carro)] testesT3 = unitTests randomizeCarro :: Tabuleiro -> Double -> Carro -> Gen Carro randomizeCarro ta...
hpacheco/HAAP
examples/plab/svn/2017li1g180/src/Tarefa3_2017li1g180.hs
Haskell
mit
19,467
newtype Stack a = Stk [a] deriving(Show) -- The follwing Functions are supposed declared in the exams' question (just to make it work) -- Start top/pop/push/empty top :: Stack a -> a top (Stk []) = error "Stack is empty, can't call top function on it!" top (Stk (x:_)) = x pop :: Stack a -> Stack a pop (Stk []) = err...
NMouad21/HaskellSamples
HaskellFinalExV.hs
Haskell
mit
3,112
{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DefaultSignatures #-} module Solar.Utility.NoCache where import Data.Typeable import Data.Generics as D import GHC.Generics as G import Data.Monoid -- | The "No Cache" data type, use 'kvNoCache' to provide a typed 'Nothing' data KVNoCach...
Cordite-Studios/solar
solar-shared/Solar/Utility/NoCache.hs
Haskell
mit
589
module HistogramTest where import Control.Concurrent.Async import Data.Metrics.Histogram.Internal import Data.Metrics.Snapshot import Data.Metrics.Types import System.Random.MWC import System.Posix.Time import Test.QuickCheck histogramTests :: [Test] histogramTests = [ testUniformSampleMin , testUniformSampleMax ...
graydon/metrics
tests/HistogramTest.hs
Haskell
mit
4,609
{-# LANGUAGE TypeOperators, OverloadedStrings, FlexibleContexts, ScopedTypeVariables #-} module Wf.Control.Eff.Run.Session ( runSession , getRequestSessionId , genSessionId ) where import Control.Eff (Eff, (:>), Member, freeMap, handleRelay) import Control.Eff.Reader.Strict (Reader, ask) import Wf.Control.Eff.Session ...
bigsleep/Wf
wf-session/src/Wf/Control/Eff/Run/Session.hs
Haskell
mit
4,197
main :: IO () main = error "undefined"
mlitchard/cosmos
executable/old.hs
Haskell
mit
40
{-# LANGUAGE OverloadedStrings #-} module Bce.BlockChainSerialization where import Bce.Hash import Bce.Crypto import qualified Bce.BlockChain as BlockChain import Bce.BlockChainHash import qualified Data.Binary as Bin import GHC.Generics (Generic) import qualified Data.Binary.Get as BinGet import qualified Data....
dehun/bce
src/Bce/BlockChainSerialization.hs
Haskell
mit
2,013
{-# LANGUAGE PackageImports #-} {-# OPTIONS_GHC -fno-warn-dodgy-exports -fno-warn-unused-imports #-} -- | Reexports "Data.Word.Compat" -- from a globally unique namespace. module Data.Word.Compat.Repl.Batteries ( module Data.Word.Compat ) where import "this" Data.Word.Compat
haskell-compat/base-compat
base-compat-batteries/src/Data/Word/Compat/Repl/Batteries.hs
Haskell
mit
278