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
{- Mackerel: a strawman device definition DSL for Barrelfish Copyright (c) 2007-2011, ETH Zurich. All rights reserved. This file is distributed under the terms in the attached LICENSE file. If you do not find this file, copies can be found by writing to: ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092...
gandro/mackerel-standalone
src/Main.hs
Haskell
mit
6,947
{-# LANGUAGE RecordWildCards #-} import Data.Foldable (for_) import Test.Hspec (Spec, describe, it, shouldBe) import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith) import Yacht (yacht, Category(..)) main :: IO () main = hspecWith defaultConfig {configFastFail = True} specs specs :: Spec spe...
exercism/xhaskell
exercises/practice/yacht/test/Tests.hs
Haskell
mit
5,789
module Lists where import System.Random (getStdRandom, randomR) import Control.Monad import Data.List (sortBy, groupBy) {- - 1 Problem 1 - (*) Find the last element of a list. - - Example in Haskell: - Prelude> myLast [1,2,3,4] - 4 - Prelude> myLast ['x','y','z'] - 'z' -} myLast :: [a] -> a...
yyotti/99Haskell
src/main/Lists.hs
Haskell
mit
15,556
{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE GADTs #-} module Bench.Rec where import Data.Vinyl import Data.Vinyl.Syntax () type Fields = ...
VinylRecords/Vinyl
benchmarks/Bench/Rec.hs
Haskell
mit
1,312
{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-| Module : Web.Facebook.Messenger.Types.Requests.Attachment.Templates.AirlineBoardingPass Copyright : (c) Felix Paulusma, 2016 License : MIT Maintainer : felix.paulusma@gmail.com Stability : semi-experimental Send a message that contains boarding passes for ...
Vlix/facebookmessenger
src/Web/Facebook/Messenger/Types/Requests/Attachment/Templates/AirlineBoardingPass.hs
Haskell
mit
7,456
-- | Random AI (RAI) Charles, playing not really randomly. module RaiCharles (aiRaiCharles) where import AI import Yinsh heuristic :: RaiCharles -> AIValue heuristic _ = 42 -- yeah.. data RaiCharles = RaiCharles { gs :: GameState , pl :: Int } instance AIPl...
sharkdp/yinsh
src/RaiCharles.hs
Haskell
mit
553
import qualified Data.ByteString.Lazy as BL import qualified Data.ByteString.Lazy.Char8 as BL8 (putStrLn) import Data.List (sortBy, intersect) import Data.Function (on) import Crypto.Common (genCandidates) import System.Environment (getArgs) import Text.Printf (printf) ...
ckw/matasano
set1/challenge3.hs
Haskell
mit
1,092
-- Project Euler Problem 15 lattice paths -- -- Given a 20x20 grid and only movements down and to the right, how many paths are there from the top left to bottom right. -- factorial = scanl (*) 1 [1..] main = do print (factorial!!40 `div` (factorial!!20)^2)
yunwilliamyu/programming-exercises
project_euler/p015_lattice_path.hs
Haskell
cc0-1.0
263
<?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="ru-RU"> <title>Directory List v2.3</title> <maps> <homeID>directorylistv2_3</homeID> <m...
secdec/zap-extensions
addOns/directorylistv2_3/src/main/javahelp/help_ru_RU/helpset_ru_RU.hs
Haskell
apache-2.0
978
{- - Copyright 2012 Fabio Riga - - 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 i...
EffeErre/cbladmin
src/CblAdmin.hs
Haskell
apache-2.0
8,639
-- 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. {-# LANGUAGE GADTs #-} module Duckling.Rules.NB ( defaultRules , langRules , localeRules ) where impor...
facebookincubator/duckling
Duckling/Rules/NB.hs
Haskell
bsd-3-clause
1,587
{-# LANGUAGE ScopedTypeVariables, TemplateHaskell, TypeOperators #-} module World where import Data.Label import Data.Array import Data.Map (Map) import qualified Data.Map as Map type Coord = (Int, Int) -- operator to add 2 coordinates together (|+|) :: Coord -> Coord -> Coord (|+|) (x1, y1) (x2, y2) = (x1 + x2, y1 ...
pfynan/cabbagesandkings
World.hs
Haskell
bsd-3-clause
1,616
{-# LANGUAGE Rank2Types #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE EmptyDataDecls #-} module EFA.Application.Optimisation.Balance where --import qualified EFA.Application.Optimisation.Sweep as Sweep --import qualified EFA.Application.Optimisation.ReqsAndDofs as ReqsAndDofs import qualified EFA.Flow.State.Qu...
energyflowanalysis/efa-2.1
src/EFA/Application/Optimisation/Balance.hs
Haskell
bsd-3-clause
5,990
{-# LANGUAGE ForeignFunctionInterface #-} -- Test that the startEventLog interface works as expected. main :: IO () main = do putStrLn "Starting eventlog..." c_init_eventlog putStrLn "done" foreign import ccall unsafe "init_eventlog" c_init_eventlog :: IO ()
sdiehl/ghc
testsuite/tests/rts/InitEventLogging.hs
Haskell
bsd-3-clause
269
----------------------------------------------------------------------------- -- | -- Module : XMonad.Prompt.Window -- Copyright : Devin Mullins <me@twifkak.com> -- Andrea Rossato <andrea.rossato@unibz.it> -- License : BSD-style (see LICENSE) -- -- Maintainer : Devin Mullins <me@twifkak....
eb-gh-cr/XMonadContrib1
XMonad/Prompt/MyWindow.hs
Haskell
bsd-3-clause
3,593
-- Copyright © 2012 Frank S. Thomas <frank@timepit.eu> -- All rights reserved. -- -- Use of this source code is governed by a BSD-style license that -- can be found in the LICENSE file. -- | Ohloh API Reference: <http://meta.ohloh.net/referencecontributor_fact/> module Web.Ohloh.ContributorFact ( ContributorFact(..)...
fthomas/ohloh-hs
Web/Ohloh/ContributorFact.hs
Haskell
bsd-3-clause
2,299
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleInstances #-} module Util where import qualified Numeric import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as BSL import Control.Monad.RWS.Class import Data.List.Split (chunksOf) import qualified Data.Binary ...
isomorphism/labelled-hexdump-parser
Util.hs
Haskell
bsd-3-clause
5,165
module Language.CFamily.C.Analysis.TypeConversions ( arithmeticConversion, floatConversion, intConversion ) where import Language.CFamily.C.Analysis.SemRep -- | For an arithmetic operator, if the arguments are of the given -- types, return the type of the full expression. arithmeticConversion :: TypeNam...
micknelso/language-c
src/Language/CFamily/C/Analysis/TypeConversions.hs
Haskell
bsd-3-clause
1,609
-- | -- Module : Data.Pack.Endianness -- License : BSD-style -- Maintainer : capsjac <capsjac at gmail dot com> -- Stability : Experimental -- Portability : Portable -- {-# LANGUAGE CPP #-} module Data.Pack.Endianness ( swap16 , swap32 , swap64 , le16Host , le32Host , le64Host , be16Host ,...
capsjac/pack
Data/Pack/Endianness.hs
Haskell
bsd-3-clause
2,301
{-#LANGUAGE RecordWildCards #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE QuasiQuotes, TemplateHaskell, TypeFamilies, TypeApplications #-} {-# LANGUAGE OverloadedStrings, GADTs, FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses #-} module DirectoryServer where import Network hiding (a...
Garygunn94/DFS
.stack-work/intero/intero8753hOX.hs
Haskell
bsd-3-clause
15,452
{-# LANGUAGE CPP #-} {-# LANGUAGE DoAndIfThenElse #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} module Mismi.Control ( A.AWS , A.Error , A.AccessKey , A.SecretKey , A.SessionToken , A.Region (..) , runAWS , runAWST ...
ambiata/mismi
mismi-core/src/Mismi/Control.hs
Haskell
bsd-3-clause
8,864
module Rules.Program (buildProgram) where import Hadrian.Haskell.Cabal import Hadrian.Haskell.Cabal.PackageData as PD import Base import Context import Expression hiding (stage, way) import GHC import Oracles.ModuleFiles import Oracles.Flag (crossCompiling) import Settings import Settings.Packages.Rts import Target i...
bgamari/shaking-up-ghc
src/Rules/Program.hs
Haskell
bsd-3-clause
3,525
-- -- Circuit compiler for the Faerieplay hardware-assisted secure -- computation project at Dartmouth College. -- -- Copyright (C) 2003-2007, Alexander Iliev <sasho@cs.dartmouth.edu> and -- Sean W. Smith <sws@cs.dartmouth.edu> -- -- All rights reserved. -- -- This code is released under a BSD license. -- Please see LI...
ailiev/faerieplay-compiler
Faerieplay/Tree.hs
Haskell
bsd-3-clause
3,329
module CS.JsonDotNet.Internal.Types where import Data.Aeson import Data.Text data FieldType = FInteger | FNumber | FString | FBool | FDay | FUTCTime | FEnum Text [Value] | FObject Text [(Text, FieldType)] ...
cutsea110/servant-csharp
src/CS/JsonDotNet/Internal/Types.hs
Haskell
bsd-3-clause
1,446
module REPL where import Parser import Syntax import PrettyPrinter import Compiler import Evaluator import System.Console.Haskeline import Control.Monad.Trans import System.IO processProgram :: String -> IO () processProgram input = do case parseTopLevelProgram_P input of Left err -> print ...
MarkX95/TinyHask
REPL.hs
Haskell
bsd-3-clause
1,109
{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RebindableSyntax #-} module KnockoutOption where import RebindableEDSL -- knock-out barrier option -- knockout :: Exp R -> Exp R -> Exp R -> Int -> Contr knockout barrier strike notional maturity = if rObs (FX EUR DKK) 0 <= barrier `within` maturity then zero el...
douglas-larocca/contracts
Coq/Extraction/Examples/KnockoutOption.hs
Haskell
mit
465
{-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -Wall #-} {- | Module : Core Description : Abstract syntax and pretty printer for Core. Copyright : (c) 2014—2015 The F2J Project Developers (given in AUTHORS.txt) License : BSD3 Maintainer : Zhiyuan Shi <zhiyuan.shi@gmail.com>, Haoyuan Zhang ...
wxzh/fcore
lib/Core.hs
Haskell
bsd-2-clause
13,701
{-# LANGUAGE RecordWildCards #-} module Main (main) where import Data.Traversable import Control.Monad.Except import Options.Applicative import qualified Kalium data Options = Options { filenameIn :: String , filenameOut :: String , logSwitch :: Bool , patSigSwitch :: Bool } pOptions :: Parser...
rscprof/kalium
kalium-cli/Main.hs
Haskell
bsd-3-clause
1,193
{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} #ifndef MIN_VERSION_profunctors #define MIN_VERSION_profunctors(x,y,z) 1 #endif #if __GLASGOW_HASKELL__ < 708 || !(MIN_VERSION_profunctors(4,4,0)) {-# LANGUAGE Trustworthy #-} #endif #if __GLAS...
rpglover64/lens
src/Control/Lens/Getter.hs
Haskell
bsd-3-clause
18,862
{- | This is the main module of FunGEN (Functional Game Engine), which re-exports the rest. -} {- FunGEN - Functional Game Engine http://joyful.com/fungen Copyright (C) 2002 Andre Furtado <awbf@cin.ufpe.br> 2008, 2011-2013 Simon Michael <simon@joyful.com> This code is distributed in the hope that it will...
fffej/fungen
Graphics/UI/Fungen.hs
Haskell
bsd-3-clause
1,848
f = a b (\x -> c x d)
mpickering/hlint-refactor
tests/examples/Lambda25.hs
Haskell
bsd-3-clause
22
{-# LANGUAGE PatternGuards #-} module Idris.Elab.Clause where import Idris.AbsSyntax import Idris.ASTUtils import Idris.DSL import Idris.Error import Idris.Delaborate import Idris.Imports import Idris.Elab.Term import Idris.Coverage import Idris.DataOpts import Idris.Providers import Idris.Primitives import Idris.Inli...
uwap/Idris-dev
src/Idris/Elab/Clause.hs
Haskell
bsd-3-clause
47,429
module HAD.Y2114.M03.D21.Solution where import Control.Applicative import Control.Arrow import Data.Maybe -- $setup -- >>> import Test.QuickCheck -- >>> import Data.Maybe (fromJust) -- | minmax -- get apair of the min and max element of a list (in one pass) -- returns Nothing on empty list -- -- Point-free: checked ...
1HaskellADay/1HAD
exercises/HAD/Y2014/M03/D21/Solution.hs
Haskell
mit
1,049
{-# LANGUAGE BangPatterns,CPP #-} import System.Directory import System.FilePath import Control.Concurrent.Async import System.Environment import Data.List hiding (find) import Control.Exception (finally) import Data.Maybe (isJust) import Control.Concurrent.MVar import Control.Concurrent.STM import Data.IORef import GH...
prt2121/haskell-practice
parconc/findpar3.hs
Haskell
apache-2.0
2,096
{-# LANGUAGE BangPatterns, MagicHash, UnboxedTuples, DefaultSignatures, TypeOperators, FlexibleContexts #-} module Parallel (NFData, parMap, rdeepseq) where import Control.Monad import GHC.Exts import Control.DeepSeq infixl 0 `using` type Strategy a = a -> Eval a newtype Eval a = Eval (State# RealWorld -> (# ...
ezyang/ghc
testsuite/tests/concurrent/T13615/Parallel.hs
Haskell
bsd-3-clause
1,432
{-# LANGUAGE PatternSynonyms #-} -- For HasCallStack compatibility {-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} module JSDOM.Generated.SVGPoint (matrixTransform, matrixTransform_, setX, getX, setY, getY, SVGPoint(..), gTypeSVGPoint) ...
ghcjs/jsaddle-dom
src/JSDOM/Generated/SVGPoint.hs
Haskell
mit
2,558
-- -- (C)opyright 2007 Ricardo Martins <ricardo at scarybox dot net> -- Licensed under the MIT/X11 License. -- See LICENSE file for license details. -- module Main where import System (getArgs) import Text.Regex.Posix import StrictIO import Test.QuickCheck -- strip the email message from those stupid signatures m...
meqif/tools
hashishin/hashishin.hs
Haskell
mit
1,249
module DevelMain where import Prelude import Application (getApplicationRepl, shutdownApp) import Control.Exception (finally) import Control.Monad ((>=>)) import Control.Concurrent import Data.IORef import Foreign.Store import Network.Wai.Handler.Warp import GHC.Word update :: IO () update = do mtidStore <- look...
pbrisbin/tee-io
app/DevelMain.hs
Haskell
mit
1,883
{-# LANGUAGE UndecidableInstances #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE DataKinds #-} module Data.HighJson ( -- * A json specification for any type HighS...
agrafix/highjson
highjson/src/Data/HighJson.hs
Haskell
mit
7,271
------------------------------------------------------------------------------------------------------------------------------ -- ROSE TREES, FUNCTORS, MONOIDS, FOLDABLES ------------------------------------------------------------------------------------------------------------------------------ data Rose a = a :> [R...
mitochon/hexercise
src/mooc/fp101/Lab6RoseTemplate.hs
Haskell
mit
3,871
-- Generated by protobuf-simple. DO NOT EDIT! module Types.StringMsg where import Control.Applicative ((<$>)) import Prelude () import qualified Data.ProtoBufInt as PB newtype StringMsg = StringMsg { value :: PB.Text } deriving (PB.Show, PB.Eq, PB.Ord) instance PB.Default StringMsg where defaultVal = StringMsg...
sru-systems/protobuf-simple
test/Types/StringMsg.hs
Haskell
mit
848
import Control.Monad.Reader data GameState = NotOver | FirstPlayerWin | SecondPlayerWin | Tie data Game position = Game { getNext :: position -> [position], getState :: position -> GameState } getNext' :: position -> Reader (Game position) [position] getNext' position = do g...
Muzietto/geiesmonads
es6/Megamax.hs
Haskell
mit
990
module TicTacToe.ResultSpec where import Test.Hspec import qualified TicTacToe.Fixtures as Fixtures import qualified TicTacToe.Result as Result spec :: Spec spec = describe "TicTacToe.Result" $ do context "for in play board" $ do let board = Fixtures.inPlayBoard let result = Result.fromBoard boar...
tomphp/haskell-tictactoe
test/TicTacToe/ResultSpec.hs
Haskell
mit
2,912
{-# LANGUAGE GeneralizedNewtypeDeriving, OverloadedStrings #-} module Reddit.Types where import Control.Applicative import Control.Monad import Data.Aeson (FromJSON (..), ToJSON, (.:)) import Data.Text (Text) newtype DisplayName = DisplayName { unDisplayName :: Text } deriving (Show,Read,FromJS...
sifisifi/subscribe-jpsubreddits
src/Reddit/Types.hs
Haskell
mit
1,201
{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} -- http://stackoverflow.com/questions/27591266/telling-cabal-where-the-main-module-is module Betfair.StreamingAPI.API.StreamingState ( Streami...
joe9/streaming-betfair-api
src/Betfair/StreamingAPI/API/StreamingState.hs
Haskell
mit
1,457
import System.Random import System.IO.Unsafe import Data.List import Data.Char --Problem 1: Retrieve the last element from a list myLast :: [a] -> a myLast [x] = x myLast (_:xs) = myLast xs -- --Problem 2: Retrieve the second to last element from a list myButLast :: [a] -> a myButLast xs = myLast (init xs) -- --Pr...
ostrowr/99-Haskell-Problems
99problems.hs
Haskell
mit
13,000
module Main where import Prelude hiding (lookup) import Control.Applicative ((<$>)) import Control.Monad (join) import Control.Concurrent.Object import Control.Concurrent.STM import qualified Control.Exception as E import qualified Data.Map as Map import Con...
ruicc/structured-concurrent-object
tests/group.hs
Haskell
mit
4,108
module Y2015.D20Spec (spec) where import Y2015 import Test.Hspec spec :: Spec spec = parallel $ describe "Day 20" $ describe "withMinPresents" $ it "finds 70 presents at house four" $ withMinPresents 70 `shouldBe` 4
tylerjl/adventofcode
test/Y2015/D20Spec.hs
Haskell
mit
258
module Cube where import Graphics.Rendering.OpenGL import Graphics.UI.GLUT import Data.Tuple.HT cube w = do renderPrimitive Quads $ do vertex $ Vertex3 w w w vertex $ Vertex3 w w (-w) vertex $ Vertex3 w (-w) (-w) vertex $ Vertex3 w (-w) w vertex $ Vertex3 w w w vertex $ Vertex3 w w (-w) ...
fatuhoku/haskell-yampa-bouncing-ball
src/Cube.hs
Haskell
mit
896
{- Created : 2015 Feb 05 (Thu) 14:56:08 by Harold Carr. Last Modified : 2016 Feb 04 (Thu) 20:04:24 by Harold Carr. -} {-# OPTIONS_GHC -fno-warn-unused-do-bind #-} module ThreepennyExternalNewEventDemo where import Control.Concurrent (forkIO) import Graphics.UI.Threepenny import ...
haroldcarr/rdf-triple-browser
experiments/haskell-threepenny-gui-experiments/src/ThreepennyExternalNewEventDemo.hs
Haskell
apache-2.0
1,095
{-# LANGUAGE DeriveFunctor #-} module Ast where import RecursionSchemes data Literal = IntLit Int | StringLit String | UnitLit deriving Show data ExpF a = Var String | App a a | Lam String a | Lit Literal | Let String a a | IfThenElse a a a deri...
holoed/Junior
src/Ast.hs
Haskell
apache-2.0
741
{-# LANGUAGE DeriveDataTypeable #-} module Main where import Data.Typeable import Data.Data import Text.JSON (decode, Result(Ok, Error)) import Text.JSON.Generic (fromJSON) import System.IO (hFlush, stdout) data InMsg = InMsg { problem :: String, state :: String } de...
disco-framework/disco
priv/squares/components/barkeeper/Main.hs
Haskell
apache-2.0
845
-- program fails if year entered from command-line is not a number main = do putStrLn "Please Enter Your Birthyear: " year <- getLine putStrLn $ "In 2020, you will be : " ++ show (2020 - read year)
dongarerahul/edx-haskell
main.hs
Haskell
apache-2.0
205
module Main where import qualified SimpleService_Client as Client import Simple_Types import Thrift import Thrift.Protocol.Binary import Thrift.Server import Thrift.Transport import Thrift.Transport.Handle import Control.Exception import Data.Either import Data.Int import Data.List import Data.Maybe import Data.Time...
maxeler/maxskins
examples/Simple/client/hs/Dynamic/SimpleClient.hs
Haskell
bsd-2-clause
8,580
{-# LANGUAGE OverloadedStrings, TemplateHaskell, DeriveGeneric, ScopedTypeVariables #-} module Dashboardh.Status( getJenkins , getJobs , getViewJobs , getJob , getAvgBuildTime ) where import Dashboardh.Prelude import Dashboardh.Job import Dashboardh.BuildTime import Dashboardh.Core import Data.Text ...
nhibberd/dashboardh
src/Dashboardh/Status.hs
Haskell
bsd-3-clause
2,259
-- | Parsing items. module Data.Cfg.Item ( AugItem, Item, -- * Creation mkInitialItem, nextItem, -- * Query production, mark, atEnd, beforeMark, afterMark, nextV ) where import Data.Cfg.Augment import Data.Cfg.Cfg -- | A parsing \"item\": a partially processed produ...
nedervold/context-free-grammar
src/Data/Cfg/Item.hs
Haskell
bsd-3-clause
1,686
{-# LANGUAGE DataKinds #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} module Layers.Flatten where import Network import Static import Util import Data.Singletons.TypeLits import Data.Singletons.Prelude.Num import Data.Serialize data Flatten = Flatt...
jonascarpay/convoluted
src/Layers/Flatten.hs
Haskell
bsd-3-clause
946
module Primitives (primitives) where import Value ( Value(Nil, Integer, Char, Con, Fun, IOAction, Err), Env, initialize) primitives :: Env primitives = initialize [ ("+", Fun $ mkBinIntFun (+)), ("-", Fun $ mkBinIntFun (-)), ("*", Fun $ mkBinIntFun (*)), ("div", Fun $ mkBinIntFun div), ("^", Fun $ mkBinIntF...
YoshikuniJujo/toyhaskell_haskell
src/Primitives.hs
Haskell
bsd-3-clause
1,517
-- | Example 2: Parsing a list of tokens instead of a 'String' and computing -- the desired result directly. -- In this example it is assumed that there exists a lexer -- that goes from @'String' -> 'CToken'@, so that an input -- 'String' can be fed into the lexer an...
ollef/Grempa
examples/Ex2Calculator.hs
Haskell
bsd-3-clause
3,072
{-# LANGUAGE FlexibleContexts,FlexibleInstances #-} {- Some functions that are used across the program -} module HOCHC.Utils((%),errorPart,fromRight,xor,(>><),check,(?),throwError) where import Control.Monad.Except import qualified Control.Monad.Fail instance Control.Monad.Fail.MonadFail (Either String) where ...
penteract/HigherOrderHornRefinement
HOCHC/Utils.hs
Haskell
bsd-3-clause
1,185
{-# LANGUAGE ConstraintKinds, DeriveDataTypeable, FlexibleContexts, OverloadedStrings, PatternGuards #-} -- | refunds on payins and transfers module Web.MangoPay.Refunds where import Web.MangoPay.Monad import Web.MangoPay.Payins import Web.MangoPay.Types import Web.MangoPay.Users import Web.MangoPay.Walle...
prowdsponsor/mangopay
mangopay/src/Web/MangoPay/Refunds.hs
Haskell
bsd-3-clause
4,998
{-# LANGUAGE OverloadedStrings #-} -- This modules keeps track of the probabilities of a word following two other -- words. This can be used to generate a third item from a sequence of two -- items, and by extension, a string of many items. module Text.Ribot.Mimic ( mimic , FreqMap , getWeightedChoice ...
erochest/ribot
src/Text/Ribot/Mimic.hs
Haskell
bsd-3-clause
8,354
{-# LANGUAGE TemplateHaskell #-} module Ariadne.Macros where import Language.Haskell.TH import Data.Generics.Zipper import Control.Monad justE e = [| Just $e |] cmatch :: Q Exp -> Q Exp cmatch exp = do ConE conNm <- exp varNm <- newName "e" lamCaseE [ match (asP varNm $ recP conNm []) (nor...
apsk/ariadne
src/Ariadne/Macros.hs
Haskell
bsd-3-clause
494
{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE UndecidableInstances #-} module Sequent.Env ( EnvT, evalEnvT , Env, evalEnv , next ) where import Control.Monad.State.Lazy (MonadState, State...
matthieubulte/sequent
src/Sequent/Env.hs
Haskell
bsd-3-clause
1,062
{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# LANGUAGE TupleSections #-} {-# LANGUAGE PatternSynonyms #-} module Language.Indescript.Parser.Lexer ( Token(..) , LinkedPos , PosedToken , lexIndescript ) where import Data.Char (ord) import Text.Regex.Applicative import Language.Indescript...
notcome/indescript
src/Language/Indescript/Parser/Lexer.hs
Haskell
bsd-3-clause
9,280
{-# LANGUAGE QuasiQuotes #-} import LiquidHaskell -- Note: `partialmeasureOld.hs` works fine [lq| cons :: x:a -> _ -> {v:[a] | hd v = x} |] cons x xs = x : xs [lq| test :: {v:_ | hd v = 0} |] test :: [Int] test = cons 0 [1,2,3,4] [lq| measure hd |] hd :: [a] -> a hd (x:_) = x -- Instead of rejecting, ...
spinda/liquidhaskell
tests/gsoc15/unknown/pos/partialmeasure.hs
Haskell
bsd-3-clause
508
-- A significant part of this code has been borrowed from other -- hakyll users, mostly Jasper through his site and hakyll's, -- but also skybluetrades.net and chromaticleaves.com {-# LANGUAGE OverloadedStrings #-} import Control.Applicative ((<$>)) import Data.Char import Data.Maybe (catMaybes) import Data.Monoid (m...
JoeyEremondi/eremondi.com-hakyll
site.hs
Haskell
bsd-3-clause
8,484
module Import ( module Import ) where import Prelude as Import hiding (head, init, last, readFile, tail, writeFile) import Yesod as Import hiding (Route (..)) import Control.Applicative as Import (pure,...
jabaraster/MetShop
Import.hs
Haskell
bsd-3-clause
1,154
{-| Copyright : (c) Dave Laing, 2017 License : BSD3 Maintainer : dave.laing.80@gmail.com Stability : experimental Portability : non-portable -} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE TypeOperators #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ...
dalaing/type-systems
src/Ast.hs
Haskell
bsd-3-clause
2,511
-- | -- Module : Language.SequentCore.OccurAnal -- Description : Occurrence analysis for Sequent Core -- Maintainer : maurerl@cs.uoregon.edu -- Stability : experimental -- -- Normally occurrence analysis is performed by the simplifier, but if needed, this -- module can update a module or a single term on deman...
lukemaurer/sequent-core
src/Language/SequentCore/OccurAnal.hs
Haskell
bsd-3-clause
81,219
{-| Copyright : (c) Dave Laing, 2017 License : BSD3 Maintainer : dave.laing.80@gmail.com Stability : experimental Portability : non-portable -} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE KindSi...
dalaing/type-systems
src/Fragment/TyArr/Ast/Error.hs
Haskell
bsd-3-clause
1,687
{-# LANGUAGE OverloadedStrings #-} module LiteralWithEnvVar ( script ) where import Prelude import Shell -- This test ensures that we escape string literals properly if they -- have an embedded variable expansion. script :: ShellM () script = do run $ command "echo" ["${SHELL}"] return ()
travitch/shellDSL
tests/inputs/LiteralWithEnvVar.hs
Haskell
bsd-3-clause
296
{- <TEST> {- MISSING HASH #-} -- {-# MISSING HASH #-} <COMMENT> {- INLINE X -} {- INLINE Y -} -- {-# INLINE Y #-} {- INLINE[~k] f -} -- {-# INLINE[~k] f #-} {- NOINLINE Y -} -- {-# NOINLINE Y #-} {- UNKNOWN Y -} <COMMENT> INLINE X </TEST> -} module Hint.Comment(commentHint) where import Hint.Type import Data.Char i...
fpco/hlint
src/Hint/Comment.hs
Haskell
bsd-3-clause
1,075
----------------------------------------------------------------------------- -- | -- Module : Data.SBV.Provers.SExpr -- Copyright : (c) Levent Erkok -- License : BSD3 -- Maintainer : erkokl@gmail.com -- Stability : experimental -- -- Parsing of S-expressions (mainly used for parsing SMT-Lib get-valu...
dylanmc/cryptol
sbv/Data/SBV/Provers/SExpr.hs
Haskell
bsd-3-clause
7,288
{-# LANGUAGE StandaloneDeriving, DeriveGeneric #-} module Fragnix.Core.Slice where import Data.Aeson (FromJSON, ToJSON) import Data.Hashable (Hashable) import Data.Text (Text) import GHC.Generics (Generic) -- Slices type SliceID = Text data Slice = Slice { sliceID :: SliceID -- ^ The hash by which this slice ...
phischu/fragnix
src/Fragnix/Core/Slice.hs
Haskell
bsd-3-clause
3,541
import Control.Arrow ( second ) import Control.Concurrent ( forkIO, threadDelay ) import Control.Exception ( mask_ ) import Control.Monad ( when ) import qualified Data.ByteString as B ( ByteString ) import qualified Data.ByteString.Char8 as C ( ByteStrin...
danchoi/imapget
src/Main.hs
Haskell
bsd-3-clause
5,715
<?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="id-ID"> <title>Server-Sent Events | ZAP Extension</title> <maps> <homeID>top</homeID> ...
veggiespam/zap-extensions
addOns/sse/src/main/javahelp/org/zaproxy/zap/extension/sse/resources/help_id_ID/helpset_id_ID.hs
Haskell
apache-2.0
979
{-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MonoLocalBinds #-} {-# LANGUAGE...
advancedtelematic/quickcheck-state-machine-model
src/Test/StateMachine/Types.hs
Haskell
bsd-3-clause
5,165
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TemplateHaskell #-} module Ros.Sensor_msgs.Range where import qualified Prelude as P import Prelude ((.), (+), (*)) import qualified Data.Typeable as T import Control.Applicative import Ros.Internal.RosBin...
acowley/roshask
msgs/Sensor_msgs/Ros/Sensor_msgs/Range.hs
Haskell
bsd-3-clause
1,705
{-# LANGUAGE Unsafe #-} {-# LANGUAGE NoImplicitPrelude, AutoDeriveTypeable, RoleAnnotations #-} {-# OPTIONS_GHC -funbox-strict-fields #-} {-# OPTIONS_HADDOCK hide #-} ----------------------------------------------------------------------------- -- | -- Module : GHC.IOArray -- Copyright : (c) The University of...
alexander-at-github/eta
libraries/base/GHC/IOArray.hs
Haskell
bsd-3-clause
2,530
import System.Environment import System.IO import Text.ParserCombinators.Parsec import Control.Monad import Data.ByteString.Lazy.Char8 as BS hiding (length,take,drop,filter,head,concat) import Control.Applicative hiding ((<|>), many) import Data.List as DL import Data.Char import Text.Printf {-- han(Open usp Tukubai) ...
ShellShoccar-jpn/Open-usp-Tukubai
COMMANDS.HS/han.hs
Haskell
mit
8,489
{-# OPTIONS_GHC -cpp #-} {-+ Instance declarations in the source code are assigned names and added to the instance database, which gets used during context reduction. -} module TiInstanceDB( IDB,Instance,InstEntry(..),emptyIdb,extendIdb,classInstances,findInst,findInst', addInstKind,instType) where import TiTypes...
kmate/HaRe
old/tools/base/TI/TiInstanceDB.hs
Haskell
bsd-3-clause
3,912
module LiftToToplevel.WhereIn7 where --A definition can be lifted from a where or let to the top level binding group. --Lifting a definition widens the scope of the definition. --In this example, lift 'addthree' defined in 'fun'. --This example aims to test adding parenthese. fun x y z =inc addthree where in...
kmate/HaRe
test/testdata/LiftToToplevel/WhereIn7.hs
Haskell
bsd-3-clause
358
{-# LANGUAGE GADTs #-} {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -Wincomplete-patterns #-} module T15385 where import Data.Type.Equality data T a where TInt :: T Int TBool :: T Bool f1, f2 :: a :~: Int -> T a -> () f1 eq t | Refl <- eq = case t of TInt -> () f2 eq t ...
sdiehl/ghc
testsuite/tests/pmcheck/should_compile/T15385.hs
Haskell
bsd-3-clause
382
{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE OverloadedStrings #-} -- -- Licensed to the Apache Software Foundation (ASF) under one -- or more contributor license agreements. See the NOTICE file -- distributed with this work for additional information -- regarding copyright ownership. The ASF l...
johnbelamaric/themis
vendor/github.com/apache/thrift/lib/hs/src/Thrift/Protocol.hs
Haskell
apache-2.0
4,484
-- This one should succeed; M.x is unambiguous module ShouldCompile (module M) where import Rn043_A as M -- x, M.x import Rn043_B -- x, Rn043_A.x
olsner/ghc
testsuite/tests/rename/should_compile/rn043.hs
Haskell
bsd-3-clause
161
-- Check overlap in n+k patterns {-# LANGUAGE NPlusKPatterns #-} module Foo where g :: Int -> Int g (x+1) = x g y = y g _ = 0 -- Overlapped h :: Int -> Int h (x+1) = x h _ = 0 -- Not overlapped
olsner/ghc
testsuite/tests/deSugar/should_compile/ds056.hs
Haskell
bsd-3-clause
218
{-# LANGUAGE ConstrainedClassMethods #-} module Main where class C a where op :: (Show a, Show b) => a -> b -> String -- This class op adds a constraint on 'a' -- In GHC 7.0 this is fine, and it's a royal -- pain to reject it when in H98 mode, so -- I'm just allowing it instance C Int where op x y = show x...
urbanslug/ghc
testsuite/tests/typecheck/should_fail/tcfail149.hs
Haskell
bsd-3-clause
368
{-# LANGUAGE TemplateHaskell, MultiParamTypeClasses, TypeFamilies, FlexibleInstances #-} module T4135a where import Control.Monad import Language.Haskell.TH class Foo a where type FooType a createInstance' :: Q Type -> Q Dec createInstance' t = liftM head [d| instance Foo $t where type Fo...
urbanslug/ghc
testsuite/tests/th/T4135a.hs
Haskell
bsd-3-clause
341
module Print1 where main :: IO () main = putStrLn "Hello world!"
nkbt/haskell-book
3.3.hsproj/Print1.hs
Haskell
mit
68
type Church a = (a -> a) -> a -> a zero :: Church a zero = \s z -> z one :: Church a one = \s z -> s z two :: Church a two = \s z -> (s . s) z -- lambda eta reduction, gets rid of z three :: Church a three = \s -> (s . s . s) church2string :: Church String -> String church2string x = ...
anwb/fp-one-on-one
church-numerals.hs
Haskell
mit
810
{- | module: $Header$ description: OpenTheory packages license: MIT maintainer: Joe Leslie-Hurd <joe@gilith.com> stability: provisional portability: portable -} module HOL.OpenTheory.Package where import Control.Concurrent (forkIO) import Control.Concurrent.MVar (newEmptyMVar,putMVar,readMVar) import Control.Monad (...
gilith/hol
src/HOL/OpenTheory/Package.hs
Haskell
mit
15,844
module TicTacToe.PlayerSpec where import Test.Hspec import TicTacToe.Player (Player(..)) import qualified TicTacToe.Player as Player spec :: Spec spec = describe "TicTacToe.Player" $ do describe "show" $ it "shows the player" $ do show O `shouldBe` "Naughts" show X `shouldBe` "Crosses" ...
tomphp/haskell-tictactoe
test/TicTacToe/PlayerSpec.hs
Haskell
mit
440
module QualifiedDot where twoDots = (Prelude..)
Pnom/haskell-ast-pretty
Test/examples/QualifiedDot.hs
Haskell
mit
48
{-# LANGUAGE DeriveDataTypeable #-} module Main where import System.Console.ANSI import System.IO (hFlush, stdout) import System.Directory import System.FilePath.Posix (takeDirectory, (</>)) import Data.List (intercalate) import Data.List.Split (splitOneOf) import Data.Char (toLower, toUpper, isNumber, isLetter) impor...
duikboot/holyhaskell
src/Main.hs
Haskell
mit
4,063
module Simple where import Prelude (Bool(..), otherwise, Maybe(..), Show) data Weekday = Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday deriving Show isWeekend :: Weekday -> Bool isWeekend Saturday = True isWeekend Sunday = True isWeekend _ = False lazyAppl...
antalsz/hs-to-coq
examples/simple/Simple.hs
Haskell
mit
594
module Parse.Post.Internal ( PostBodyHtml (PostBodyHtml) , PostHeaderHtml (PostHeaderHtml) , PostHtml ( .. ) ) where import Data.ByteString.Char8 (ByteString) import Text.HTML.TagSoup (Tag) data PostHeaderHtml = PostHeaderHtml [Tag ByteString] deriving (Show) data PostBodyHtml = PostBodyHtml [Tag ByteStri...
JacobLeach/xen-parsing
app/Parse/Post/Internal.hs
Haskell
mit
433
module Lexer where import Text.Parsec.String (Parser) import Text.Parsec.Language (emptyDef) import qualified Text.Parsec.Token as Tok lexer :: Tok.TokenParser () lexer = Tok.makeTokenParser styles where ops = ["+", "*", "-", "/"] names = ["def", "extern"] styles = emptyDef { ...
tgkokk/kaleidoscope
src/Lexer.hs
Haskell
mit
949
module Main where import Test.HUnit (Assertion, (@=?), runTestTT, Test(..), Counts(..)) import System.Exit (ExitCode(..), exitWith) import qualified Data.RevisionsTest as RevisionsTest main :: IO () main = exitProperly $ runTestTT $ TestList [ TestList RevisionsTest.tests ] exitProperly :: IO Counts -> IO ...
AKST/wikit
socket-server/tests/Main.hs
Haskell
mit
455
module QR.Beam where import Data.Char import Data.Sequence(Seq) import qualified Data.Sequence as S getMinChange :: String -> String getMinChange xs = let inputs = words xs totalDamage = read (head inputs)::Int program = last inputs shootCount = length $ filter (== 'S') program in if shootC...
lihlcnkr/codejam
src/QR/Beam.hs
Haskell
apache-2.0
1,077