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 : Distribution.Simple.JHC
-- Copyright : Isaac Jones 2003-2006
-- License : BSD3
--
-- Maintainer : cabal-devel@haskell.org
-- Portability : portable
--
-- This module contains most of the JHC-specific code for... | martinvlk/cabal | Cabal/Distribution/Simple/JHC.hs | Haskell | bsd-3-clause | 8,758 |
{-# OPTIONS_GHC -fwarn-unsafe #-}
{-# LANGUAGE FlexibleInstances #-}
module SH_Overlap9_A (
C(..)
) where
import SH_Overlap9_B
instance
{-# OVERLAPS #-}
C [Int] where
f _ = "[Int]"
| urbanslug/ghc | testsuite/tests/safeHaskell/overlapping/SH_Overlap9_A.hs | Haskell | bsd-3-clause | 198 |
-- !!! Test passing doubles to a ccall
import Foreign.C
foreign import ccall unsafe "math.h sin"
c_sin :: CDouble -> IO CDouble
main = c_sin 1.0 >>= print
| urbanslug/ghc | testsuite/tests/ffi/should_run/ffi003.hs | Haskell | bsd-3-clause | 160 |
{-# LANGUAGE UnicodeSyntax, MultiParamTypeClasses, FlexibleInstances #-}
module T2902_B_PairingSum (Sum(..), PSum) where
import T2902_Sum
data PSum a b = Empty | Tree a b [PSum a b]
instance (Ord a, Eq b, Num b) ⇒ Sum PSum a b where
insert v r = union $ Tree v r []
union x Empty = x
union Empty x = x
uni... | ghc-android/ghc | testsuite/tests/perf/should_run/T2902_B_PairingSum.hs | Haskell | bsd-3-clause | 876 |
module Main where
import HIRST (mainH)
main = mainH
| mihaimaruseac/hirst-v00 | src/Main.hs | Haskell | mit | 54 |
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified SDL.Image as Img
import qualified SDL as SDL
import Control.Concurrent (threadDelay)
import Control.Monad (unless)
import Linear.Affine
import Linear.V2
import Linear.V4
frameRate = 25
main :: IO ()
main = do
SDL.initialize [SDL.InitVideo]
... | jaiyalas/sdl2-image | example/unsorted/Example02.hs | Haskell | mit | 1,241 |
import Data.List (sort)
import Text.ParserCombinators.ReadP (ReadP)
import Text.ParserCombinators.ReadPrec (lift)
import Text.Read (readPrec)
import qualified Text.ParserCombinators.ReadP as RP
import Common (rpInt)
main :: IO ()
main = do
partOne >>= print
partTwo >>= prin... | wizzup/advent_of_code | 2015/haskell/exe/Day02.hs | Haskell | mit | 1,330 |
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Core.InputGLFW() where
import Core.Input
import qualified Graphics.UI.GLFW as GLFW
instance ToKey GLFW.Key where
toKey k = case k of
GLFW.Key'Space -> CharKey ' '
GLFW.Key'Apostrophe -> CharKey '\''
GLFW.Key'Comma -> CharKey ','
GLFW.Key'Minus -> Char... | NCrashed/sinister | src/client/Core/InputGLFW.hs | Haskell | mit | 5,161 |
module GOL where
import Data.Array.IArray
import Data.Array.Unboxed
data World = World {
gridWidth :: Int,
gridHeight :: Int,
grid :: Grid
} deriving (Show)
type Grid = UArray (Int, Int) Bool
setupGrid :: Int -> Int -> World
setupGrid x y = let cells = replicate (x*y) False
grid = li... | Lateks/gol | src/GOL.hs | Haskell | mit | 1,414 |
-- xmonad config used by Vic Fryzel
-- Author: Vic Fryzel
-- https://github.com/vicfryzel/xmonad-config
import System.IO
import System.Exit
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Layout.Fullscreen
import... | evan886/myxmonad | 4bsd/2020/xmonad.hs | Haskell | mit | 12,793 |
module MattermostBot.Data (
module MattermostBot.Data.Config
, module MattermostBot.Data.Slack
) where
import MattermostBot.Data.Config
import MattermostBot.Data.Slack
| marcelbuesing/mattermost-bot | src/MattermostBot/Data.hs | Haskell | mit | 177 |
{-# LANGUAGE OverloadedStrings #-}
module Test.Smoke.App.PrintResults
( printResult,
)
where
import Control.Monad (forM_, when)
import Control.Monad.IO.Class (liftIO)
import Control.Monad.Trans.Reader (ask)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.String (fromString)
import... | SamirTalwar/Smoke | src/app/Test/Smoke/App/PrintResults.hs | Haskell | mit | 5,383 |
module Mockups.Parsers.Box where
import Control.Applicative
import Data.Attoparsec.Char8
import qualified Data.ByteString.Char8 as BS
import Mockups.Parsers.Combinators
import Mockups.Elements.Element
boxParser :: Parser ContainerAttr
boxParser = vboxParser <|> hboxParser
vb... | ostapneko/tiny-mockups | src/main/Mockups/Parsers/Box.hs | Haskell | mit | 609 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Main where
import Nanomsg
import Test.Framework.TH (defaultMainGenerator)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.QuickCheck
import Test.QuickCheck.Monadic
import Data.ByteString (ByteString)
import qualified D... | christianlavoie/nanomsg-haskell | tests/Properties.hs | Haskell | mit | 6,271 |
longest :: [String] -> String -> String
longest (word:rest) current =
if length word > length current
then longest rest word
else longest rest current
longest [] current = current
longestWord :: String -> String
longestWord text = longest (words text) ""
main :: IO ()
main = do
contents <- getContents
print $ l... | considerate/progp | Haskell/longest.hs | Haskell | mit | 349 |
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE UndecidableInstances #-}
module KMC.SymbolicFST
(FST(..)
,Edge
,fstStateSize
,fstTransSize
,edgesToList
,edgesFromList
,fstEvalEpsilonEdges
,fstEdges
... | diku-kmc/kleenexlang | src/KMC/SymbolicFST.hs | Haskell | mit | 17,283 |
{-# LANGUAGE OverloadedStrings #-}
-- | Legacy types from Keter version 0.4. Retained to keep backwards
-- compatibility in config file format.
module Keter.Types.V04 where
import Control.Applicative
import Data.Aeson
import Data.Bool
import Data.Conduit.Network (Ho... | tolysz/keter | Keter/Types/V04.hs | Haskell | mit | 5,798 |
module Main where
import Criterion.Main
import Control.Lens
import Control.Monad.Trans.Class ( lift )
import Control.Monad.Trans.Either ( EitherT(..)
, runEitherT
, hoistEither )
import ... | mkiefel/trueskill | bench_app.hs | Haskell | bsd-2-clause | 4,239 |
{-# LANGUAGE BangPatterns #-}
import Data.List
import Data.Maybe
data Mintree = Leaf !Integer !Integer
| Node !Integer !Integer !Integer !Mintree !Mintree deriving Show
tmin (Leaf m _) = m
tmin (Node m _ _ _ _) = m
buildtree xs = snd (buildtree' 0 (fromIntegral $ (length xs) - 1) xs)
buildtree' a b x... | pbl64k/HackerRank-Contests | 2014-02-07-FP/RangeMinimumQuery/rmq.accepted.hs | Haskell | bsd-2-clause | 1,587 |
-- | fluid_log is not present because it is a vararg function
-- and ffi to them is deprecated:
--
-- \"Note that for a C function defined to accept a variable number of arguments,
-- all arguments beyond the explicitly typed arguments suffer argument promotion.
-- However, because C permits the calling convent... | projedi/fluidsynth-hs-complete | src/Sound/Fluidsynth/Log.hs | Haskell | bsd-3-clause | 2,534 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE KindSignatures #-}
module High.Functor.Bifunctor where
import High.Functor.PFunctor (PFunctor)
import High.Functor.QFunctor (QFunctor)
data Bifunctor :: ((* -> *) -> (* -> *) -> *) -> ((* -> *) -> (* -> *) -> *) -... | Hexirp/untypeclass | src/High/Functor/Bifunctor.hs | Haskell | bsd-3-clause | 553 |
import System.Nemesis
import System.Nemesis.Utils
import Prelude hiding ((-))
main = run nemesis
nemesis = do
clean
[ "**/*.hi"
, "**/*.o"
, "manifest"
]
desc "dist"
task "dist" - do
sh "cabal clean"
sh "cabal configure"
sh "cabal sdist"
desc "watch hs"
task "watch-hs" - do
... | nfjinjing/nemesis | Nemesis.hs | Haskell | bsd-3-clause | 482 |
module Network.LambNyaa.Sink (
Sink (..), sink, sink_, printItem, seen, unseen
) where
import Data.Monoid
import Network.LambNyaa.Config
import Network.LambNyaa.Item
import Network.LambNyaa.Database
newtype Sink = Sink {unSink :: Config -> [Item] -> IO ()}
-- | Create a Sink from any IO action.
sink :: (Config ... | valderman/lambnyaa | Network/LambNyaa/Sink.hs | Haskell | bsd-3-clause | 999 |
module TaskList
( dispatch
) where
import Euclid
import FastDegree
import GeneratePrimeNumber
import qualified RSA as R
import Factorization
import CustomCodes
dispatch :: String -> [String] -> IO ()
dispatch "-extend-euclid" params = case params of
... | GOGEN/rsa | app/TaskList.hs | Haskell | bsd-3-clause | 3,545 |
divide :: Double -> Double -> Double
divide 0 b = b
divide a b = b / a
| YoshikuniJujo/funpaala | samples/07_polymorphic/divide0.hs | Haskell | bsd-3-clause | 71 |
{-# OPTIONS -cpp #-}
-- OPTIONS required for ghc-6.4.x compat, and must appear first
{-# LANGUAGE CPP #-}
{-# OPTIONS_GHC -cpp #-}
{-# OPTIONS_NHC98 -cpp #-}
{-# OPTIONS_JHC -fcpp #-}
-----------------------------------------------------------------------------
-- |
-- Module : Distribution.Client.InstallSymlink... | IreneKnapp/Faction | faction/Distribution/Client/InstallSymlink.hs | Haskell | bsd-3-clause | 10,568 |
module Day24 where
import Data.Function
import Data.List
partOne = product $ head $ sortOn product $ head $
groupBy ((==) `on` length) $
sortOn length $
filter (\xs -> genericSum xs == weightNeeded 3 && g xs 3) $ subsequences input
partTwo = product $ head $ sortOn product $ head $
groupB... | z0isch/advent-of-code | src/Day24.hs | Haskell | bsd-3-clause | 822 |
{-# OPTIONS_GHC -w #-}
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- |
-- Module : Text.PrettyPrint.Leijen
-- Copyright : Daan Leijen (c) 2000, http://www.cs.uu.nl/~daan
-- License : BSD-style (see the file LICENSE)
--
--... | osa1/language-lua | src/Text/PrettyPrint/Leijen.hs | Haskell | bsd-3-clause | 31,470 |
module Karamaan.Opaleye.Operators (operatorName) where
-- TODO vv I put this take 5 in here because the query strings were getting
-- too long and postgres was complaining that it was truncating them.
-- This is really just a temporary fix, because I'd like to keep the
-- possibility of long names but postprocess the ... | karamaan/karamaan-opaleye | Karamaan/Opaleye/Operators.hs | Haskell | bsd-3-clause | 530 |
{- | This module provides the /Simplify RHS/ processor.
@
|- <simp(S#) / simp(W#) + W, Q, T#> :f
------------------------------------------
|- <S# / W# + W, Q, T#> :f
@
, where @simp(R#)@ removes @ri@ from right-hand sides @c_n(r_1,...,r_n)@ if no instance of @ri@ can be rewritten, ie. if
there is no o... | ComputationWithBoundedResources/tct-trs | src/Tct/Trs/Processor/DP/DPGraph/SimplifyRHS.hs | Haskell | bsd-3-clause | 5,310 |
{- |
Module : Ptk.Journal
Description : `ptk journal` command tree for the puffy toolkit
Copyright : 2014, Peter Harpending
License : BSD3
Maintainer : Peter Harpending <pharpend2@gmail.com>
Stability : experimental
Portability : Linux
-}
module Ptk.Journal (jTree, journalTree, journalHelp) where... | pharpend/puffytools | ptk/Ptk/Journal.hs | Haskell | bsd-3-clause | 1,424 |
module Ivory.BSP.STM32.Peripheral.UART
( module Ivory.BSP.STM32.Peripheral.UART.Peripheral
, module Ivory.BSP.STM32.Peripheral.UART.Regs
, module Ivory.BSP.STM32.Peripheral.UART.Types
) where
import Ivory.BSP.STM32.Peripheral.UART.Peripheral
import Ivory.BSP.STM32.Peripheral.UART.Regs
import Ivory.BSP.STM32.P... | GaloisInc/ivory-tower-stm32 | ivory-bsp-stm32/src/Ivory/BSP/STM32/Peripheral/UART.hs | Haskell | bsd-3-clause | 342 |
module Main where
-- This is a Haskell translation of the official GLFW quick example
-- found at <http://www.glfw.org/docs/3.0/quick.html#quick_example>
-- using the GLFW-b library, version 1.x
-- I tried hard to keep the same structure so that it is simple
-- enough to go back and forth between the C version and th... | alpmestan/glfw-b-quick-example | Main.hs | Haskell | bsd-3-clause | 3,002 |
module T where -- this shits me
import Sample
test_sanity = True | peteg/TBC | Sample/Tests/00_loadable.hs | Haskell | bsd-3-clause | 64 |
module Graph where
import Control.Monad
import Control.Monad.State
import Index
import Verilog
import Data.Graph.Inductive
import Data.Graph.Inductive.Query.DFS
import Data.Graph.Inductive.Dot
import Data.Graph.Inductive.NodeMap
import Data.List
import Control.Arrow
import Debug.Trace
import System.Random
import quali... | wuerges/vlsi_verification | src/Graph.hs | Haskell | bsd-3-clause | 7,727 |
{-# LANGUAGE OverloadedStrings, CPP #-}
module Main where
#ifndef TLS
import Control.Monad (when)
#endif
import Data.Version (showVersion)
import Network.Wai.Application.Classic hiding ((</>), (+++))
import System.Directory (getCurrentDirectory)
import System.Environment (getArgs, getEnvironment)
import System.Exit (... | mietek/mighttpd2 | src/Mighty.hs | Haskell | bsd-3-clause | 3,290 |
{-# LANGUAGE OverloadedStrings #-}
module Webcrank.Internal.ETag where
import Control.Applicative
import Data.Attoparsec.ByteString.Char8 (parseOnly, string)
import Data.ByteString (ByteString)
import Webcrank.Internal.Parsers
import Webcrank.Internal.Types
-- | Compares two @ETag@s for equality, only considering t... | webcrank/webcrank.hs | src/Webcrank/Internal/ETag.hs | Haskell | bsd-3-clause | 1,040 |
module System.TellMe where
import Control.Monad (void)
import Data.Default (Default(..))
import Graphics.UI.Gtk
data Position = Top | Bottom
deriving (Show, Eq)
data Config = Config { screenNumber :: Int
, monitorNumber :: Int
, barHeight :: Int
, barP... | izuk/tellme | src/System/TellMe.hs | Haskell | bsd-3-clause | 2,067 |
-- | This module defines messages from player to debugger
module IMsg
(
IMsg(..),
AMF(..),
AMFValue(..),
amfUndecoratedName,
nextIMessage
)
where
import Data.Word (Word8, Word16, Word32)
import Data.ByteString (ByteString, pack)
import qualified Data.ByteString.Char8 as BSChar
import qualified Data.Iteratee as I
imp... | Yuras/hfd | src/IMsg.hs | Haskell | bsd-3-clause | 10,504 |
-- Given N,M, this runs N copies of an M-deep pipeline1.
| rrnewton/Haskell-CnC | examples/empty_task_topologies/par_pipelines.hs | Haskell | bsd-3-clause | 59 |
module Homework7.Tree where
import Data.Monoid
data Tree v a = Leaf v a | Branch v (Tree v a) (Tree v a)
tag :: Monoid v => Tree v a -> v
tag (Leaf _ _) = mempty
tag (Branch _ x y) = tag x <> tag y
branch :: Monoid v => Tree v a -> Tree v a -> Tree v a
branch x y = Branch (tag x <> tag y) x y
search :: Monoid v => ... | gabluc/CIS194-Solutions | src/Homework7/Tree.hs | Haskell | bsd-3-clause | 561 |
{-# LANGUAGE TupleSections, OverloadedStrings #-}
module Himpress.Compile
(compile)
where
import Himpress.Transitions
import Data.Lenses (fetch)
import Data.Monoid
import Data.List (mapAccumL)
import Data.Text (pack)
import Data.Map (fromList)
import Text.Blaze (Html,toHtml)
-- Protoslides - ie. slides w... | matthewSorensen/himpress | Himpress/Compile.hs | Haskell | bsd-3-clause | 2,685 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE OverloadedStrings #-}
module Pact.MockDb where
import Pact.Types.Runtime
import Data.Aeson
import Data.String
import Data.Default
import Pact.Interpreter
rc :: a -> Method e a
rc = const . return
newtype MockRead =
MockRead (forall k v . (IsString k,FromJSON v) =>
... | kadena-io/pact | src-ghc/Pact/MockDb.hs | Haskell | bsd-3-clause | 2,063 |
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE RankNTypes #-}
-- | Network-related logic that's mostly methods and dialogs between
-- nodes. Also see "Pos.Chain.Block.Network.Retrieval" for retrieval worker
-- loop logic.
module Pos.Network.Block.Logic
(
BlockNetLogicException (..)
,... | input-output-hk/pos-haskell-prototype | lib/src/Pos/Network/Block/Logic.hs | Haskell | mit | 16,755 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DuplicateRecordFields #-}
module Language.LSP.Types.CodeLens where
import Data.Aeson
import Data.Aeson.TH
import Language.LSP.Types.Command
import Language.LSP.Types.Location
import Language.LSP.Types.Progress
import Language.LSP.Types.TextDocument
import Language.L... | alanz/haskell-lsp | lsp-types/src/Language/LSP/Types/CodeLens.hs | Haskell | mit | 2,015 |
------------------------------------------------------------------------
-- |
-- Module : ALife.Realtra.GeneratePopulation
-- Copyright : (c) Amy de Buitléir 2012-2014
-- License : BSD-style
-- Maintainer : amy@nualeargais.ie
-- Stability : experimental
-- Portability : portable
--
-- ???
--
-------... | mhwombat/creatur-realtra.OLD | src/ALife/Realtra/GeneratePopulation.hs | Haskell | bsd-3-clause | 2,239 |
module Network.AMQP.Protocol where
import Control.Monad
import Data.Binary
import Data.Binary.Get
import Data.Binary.Put
import qualified Data.ByteString.Lazy.Char8 as BL
import Network.AMQP.Types
import Network.AMQP.Generated
--True if a content (contentheader and possibly contentbody) will follow the method
hasCo... | bitemyapp/amqp | Network/AMQP/Protocol.hs | Haskell | bsd-3-clause | 3,169 |
module Vectorise.Type.TyConDecl (
vectTyConDecls
) where
import GhcPrelude
import Vectorise.Type.Type
import Vectorise.Monad
import Vectorise.Env( GlobalEnv( global_fam_inst_env ) )
import BuildTyCl( TcMethInfo, buildClass, buildDataCon, newTyConRepName )
import OccName
import Class
import Type
import TyCon
import... | shlevy/ghc | compiler/vectorise/Vectorise/Type/TyConDecl.hs | Haskell | bsd-3-clause | 9,526 |
import Util
import Timing
import Randomish
import System.Environment
import Control.Exception
import qualified TreeLookupVectorised as TD
import qualified Data.Array.Parallel.PArray as P
import qualified Data.Vector.Unboxed as V
main
= do args <- getArgs
case args of
... | mainland/dph | dph-lifted-vseg/examples/treeLookup/Main.hs | Haskell | bsd-3-clause | 908 |
<?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="ms-MY">
<title>Getting started Guide</title>
<maps>
<homeID>top</homeID>
<mapref locat... | rnehra01/zap-extensions | src/org/zaproxy/zap/extension/gettingStarted/resources/help_ms_MY/helpset_ms_MY.hs | Haskell | apache-2.0 | 967 |
{- System.Directory without its conflicting isSymbolicLink
-
- Copyright 2016 Joey Hess <id@joeyh.name>
-
- License: BSD-2-clause
-}
-- Disable warnings because only some versions of System.Directory export
-- isSymbolicLink.
{-# OPTIONS_GHC -fno-warn-tabs -w #-}
module Utility.SystemDirectory (
module System.D... | ArchiveTeam/glowing-computing-machine | src/Utility/SystemDirectory.hs | Haskell | bsd-2-clause | 399 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE OverloadedStrings #-}
module StaticFiles where
import Yesod.Static
staticFiles "static"
| danse/haskellers | StaticFiles.hs | Haskell | bsd-2-clause | 136 |
data TestType = Foo | Bar
hello :: String
hello = 'H':"ello World!"
-- ziguser = zig
zig :: [TestType]
zig = (Foo:zag)
zag :: [TestType]
zag = Bar:zig
main = print hello
| themattchan/tandoori | input/input-2.hs | Haskell | bsd-3-clause | 197 |
module DependencyTest
( tests
)
where
import Test.HUnit
import Data.Graph.Inductive.Graph ( Graph(..) )
import Database.Schema.Migrations.Dependencies
import Common
tests :: [Test]
tests = depGraphTests ++ dependencyTests
type DepGraphTestCase = ([TestDependable], Either String (DependencyGraph TestDependab... | nathankot/dbmigrations | test/DependencyTest.hs | Haskell | bsd-3-clause | 3,528 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
module T8455 where
ty = [t| 5 |]
| sdiehl/ghc | testsuite/tests/quotes/T8455.hs | Haskell | bsd-3-clause | 105 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
Utilities for desugaring
This module exports some utility functions of no great interest.
-}
{-# LANGUAGE CPP #-}
-- | Utility functions for constructing Core syntax, principally for desugaring
module DsUtils (
... | tjakway/ghcjvm | compiler/deSugar/DsUtils.hs | Haskell | bsd-3-clause | 35,951 |
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{... | sdiehl/ghc | testsuite/tests/dependent/should_compile/T14038.hs | Haskell | bsd-3-clause | 2,379 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAG... | ezyang/ghc | testsuite/tests/typecheck/should_compile/T12734.hs | Haskell | bsd-3-clause | 2,628 |
{-# LANGUAGE GADTs, RankNTypes #-}
-- Test pattern bindings, existentials, and higher rank
module T12427a where
data T where
T1 :: a -> ((forall b. [b]->[b]) -> Int) -> T
T2 :: ((forall b. [b]->[b]) -> Int) -> T
-- Inference
-- Worked in 7.10 (probably wrongly)
-- Failed in 8.0.1
-- Fails in 8.2 because v is po... | ezyang/ghc | testsuite/tests/typecheck/should_compile/T12427a.hs | Haskell | bsd-3-clause | 976 |
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow 2012
--
-- Monadic streams
--
-- -----------------------------------------------------------------------------
{-# LANGUAGE CPP #-}
module Stream (
Stream(..), yield, liftIO,
collect, fromList,
... | urbanslug/ghc | compiler/utils/Stream.hs | Haskell | bsd-3-clause | 3,608 |
-- Test grouping with both a using and a by clause
{-# OPTIONS_GHC -XMonadComprehensions -XTransformListComp #-}
module Main where
import Data.List(groupBy)
import GHC.Exts(the)
groupRuns :: Eq b => (a -> b) -> [a] -> [[a]]
groupRuns f = groupBy (\x y -> f x == f y)
main = putStrLn (show output)
where
output... | siddhanathan/ghc | testsuite/tests/deSugar/should_run/mc06.hs | Haskell | bsd-3-clause | 464 |
{-# LANGUAGE PackageImports #-}
module Rocketfuel.Input (
keyIsPressed,
readMouse,
Click (..),
MouseStatus (..),
updateCommand
) where
import "GLFW-b" Graphics.UI.GLFW as GLFW
import Control.Monad
import Rocketfuel.Types
type Coords = (Integer, Integer)
data MouseStatus = Clicked | Released
data C... | Raveline/Rocketfuel | src/Rocketfuel/Input.hs | Haskell | mit | 2,938 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeOperators #-}
module Impl.TVar1 where
import Control.Concurrent.STM
import Control.Monad.IO.Class
import Control.Monad.Trans.Either
import Data.HashMap.Strict (HashMap)
import qual... | AndrewRademacher/whimsy | src/Impl/TVar1.hs | Haskell | mit | 2,001 |
module Main where
import Control.Monad (forever)
import Data.Char (toLower)
import Data.List (intersperse, nub)
import Data.Maybe (isJust)
import System.Exit (exitSuccess)
import System.Random (randomRIO)
main :: IO ()
main = do
word <- rand... | mikegehard/haskellBookExercises | hangman/src/Main.hs | Haskell | mit | 3,624 |
module Main where
import Prelude hiding (catch)
import Control.Exception ( AsyncException(..), catch )
import Control.Monad.Error
import Data.Version
import Data.List
import System.IO
import System.Environment
import System.Directory (getHomeDirectory)
import System.FilePath ((</>))
import System.Console.Haskeline h... | hatappo/egison-tutorial | Main.hs | Haskell | mit | 20,686 |
module ProgrammingInHaskell2.Chap05Spec (spec) where
import SpecHelper
import ProgrammingInHaskell2.Chap05
spec :: Spec
spec = do
describe "5.1" $ do
it "[x^2 | x <- [1..5]]" $ do
[x^2 | x <- [1..5]] `shouldBe` [1,4,9,16,25]
describe "5.2 Guards" $ do
it "factors" $ do
factors 15 `should... | akimichi/haskell-labo | test/ProgrammingInHaskell2/Chap05Spec.hs | Haskell | mit | 1,031 |
{-# htermination addListToFM_C :: (b -> b -> b) -> FiniteMap (Ratio Int) b -> [((Ratio Int),b)] -> FiniteMap (Ratio Int) b #-}
import FiniteMap
| ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/full_haskell/FiniteMap_addListToFM_C_7.hs | Haskell | mit | 144 |
module NES.Emulator.Debug where
import Data.Word (Word8, Word16)
import Data.Bits ((.|.))
import Debug.Trace (trace)
import Text.Printf (printf)
import NES.CPU(Flag(..))
import NES.Instruction
import NES.MonadEmulator
import NES.Emulator
import NES.EmulatorHelpers
emulateCycles :: MonadEmulator m => Int -> m ()
emul... | ksaveljev/hNES | NES/Emulator/Debug.hs | Haskell | mit | 1,560 |
{-# LANGUAGE
TypeOperators
, MultiParamTypeClasses
, FlexibleInstances
, OverlappingInstances
, FlexibleContexts #-}
module Calculus.Expr where
{-
This module generalizes expressions.
-}
import Auxiliary.List
import Auxiliary.NameSource
import Data.Functor
import Control.Monad.State
-- Coproduct type definit... | wowofbob/calculus | Calculus/Expr.hs | Haskell | mit | 3,924 |
module Zwerg.Data.HP
( HP
, adjustHP
, adjustMaxHP
) where
import Zwerg.Prelude
newtype HP = MkHP (Int, Int)
deriving stock Generic
deriving anyclass Binary
validHP :: (Int,Int) -> Bool
validHP (curHP, maxHP) = curHP >= 0 && curHP <= maxHP && maxHP > 0
instance ZWrapped HP (Int, Int) where
unwra... | zmeadows/zwerg | lib/Zwerg/Data/HP.hs | Haskell | mit | 962 |
-- file: ch03/ListADT.hs
-- From chapter 3, http://book.realworldhaskell.org/read/defining-types-streamlining-functions.html
data List a = Cons a (List a)
| Nil
deriving (Show)
fromList (x:xs) = Cons x (fromList xs)
fromList [] = Nil
| Sgoettschkes/learning | haskell/RealWorldHaskell/ch03/ListADT.hs | Haskell | mit | 244 |
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.SVGStringList
(js_clear, clear, js_initialize, initialize, js_getItem, getItem,
js_insertItemBefore, insertItemBefore, js_replaceItem, replaceItem,
js_removeItem, removeItem, js_appendItem, ... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/JSFFI/Generated/SVGStringList.hs | Haskell | mit | 5,018 |
{-# LANGUAGE FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, TemplateHaskell, TupleSections, TypeFamilies, TypeSynonymInstances #-}
module SpaceWeather.FeaturePack where
import Control.Lens
import Control.Monad.Trans.Either
import Control.Monad.IO.Class
import qualified Data.Aeson.TH as Aeson
import qualif... | nushio3/UFCORIN | src/SpaceWeather/FeaturePack.hs | Haskell | mit | 4,218 |
module TestTCP (
tests4
,tests6
) where
-- local imports
import Network.Transport.Sockets.TCP
import TransportTestSuite
-- external imports
import Test.Framework
-----------------------------------------------------------------------------
--------------------------------------------------------------------... | hargettp/courier | tests/TestTCP.hs | Haskell | mit | 924 |
module ExLint.Types
( Block(..)
, Language(..)
, Example(..)
, CheckResult(..)
, Plugin(..)
) where
import Data.Monoid ((<>))
import Data.Text (Text)
import Text.Markdown.Block (Block(..))
data Language
= Haskell
| Unknown
deriving Show
data Example = Example
{ examplePlugin :... | pbrisbin/ex-lint | src/ExLint/Types.hs | Haskell | mit | 740 |
{-# LANGUAGE OverloadedStrings #-}
import CheckConcreteSyntax hiding (main)
import CheckQuantityBehaviour hiding (main)
import CheckSkeletonParser hiding (main)
import CheckTranslationPhase hiding (main)
import Core.System
import Test.Hspec (Spec, hspec)
main :: IO ()
main = do
finally (hspec suite) (putStrLn ".")
... | oprdyn/technique | tests/TestSuite.hs | Haskell | mit | 439 |
{-|
Module : Lambdajudge
Description : Easily host haskell based coding competitions using Lambdajudge library
Copyright : (c) Ankit Kumar, Venugopal, Safal 2015
License : MIT
Maintainer : ankitkumar.itbhu@gmail.com
Stability : experimental
Portability : POSIX
-}
{-# LANGUAGE OverloadedStrings #-}
{-# ... | venugangireddy/Lambdajudge | src/Lambdajudge.hs | Haskell | mit | 3,627 |
-----------------------------------------------------------------------------
--
-- Module : Language.PureScript.CodeGen.Common
-- Copyright : (c) Phil Freeman 2013
-- License : MIT
--
-- Maintainer : Phil Freeman <paf31@cantab.net>
-- Stability : experimental
-- Portability :
--
-- |
-- Common code ... | bergmark/purescript | src/Language/PureScript/CodeGen/Common.hs | Haskell | mit | 3,960 |
{-# LANGUAGE OverloadedStrings, TypeSynonymInstances, FlexibleInstances #-}
module Y2017.M10.D05.Exercise where
{--
Yesterday, I said: "Go out to the database, get some data, analyze it and chart
it." Well, that's all good if you can work on the problem when you have access
to the internet at large to retrieve your d... | geophf/1HaskellADay | exercises/HAD/Y2017/M10/D05/Exercise.hs | Haskell | mit | 3,937 |
import FPPrac
merge [] ys = ys
merge xs [] = xs
merge (x:xs) (y:ys) | x <= y = x : merge xs (y:ys)
| otherwise = y : merge (x:xs) ys
mSort :: Ord a => [a] -> [a]
mSort [] = []
mSort [x] = [x]
mSort xs = let (as, bs) = splitAt (length xs `quot` 2) xs
in merge (mSort as) (mSort bs)
| tcoenraad/functioneel-programmeren | practica/serie2/10.merge-sort.hs | Haskell | mit | 314 |
-- Atari 2600 6507 CPU --
module Cpu where
import Data.Word
import Data.Bits
import Data.Int
import Control.Monad.State.Strict
import Control.Applicative hiding ((<|>), many, optional, empty)
import qualified Data.Vector.Unboxed as VU
data CPU = CPU {
registers :: Registers,
memory :: Memory,
cycles :: ... | RossMeikleham/NesMonad | src/Cpu.hs | Haskell | mit | 10,856 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-cloudwatchalarmdefinition.html
module Stratosphere.ResourceProperties.EM... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/EMRInstanceGroupConfigCloudWatchAlarmDefinition.hs | Haskell | mit | 8,289 |
module FVL.EF
( F.Result(..)
, Expr(..)
, showTranslation
, run
, ParseError
, parseRun
, parseFileRun
) where
import FVL.Algebra
import qualified FVL.FAST as FAST
import qualified FVL.F as F
import FVL.EFAST
import FVL.Parser
argument :: String -> [String] -> Bool
argument s [] = False
argument s (x:xs) = if x == s ... | burz/Feval | FVL/EF.hs | Haskell | mit | 3,733 |
module Geometry (
sphereVolume,
sphereArea,
cubeVolume,
cubeArea,
cuboidVolume,
cuboidArea
) where
sphereVolume :: Float -> Float
sphereVolume radius = (4.0 / 3.0) * pi * (radius ^ 3)
sphereArea :: Float -> Float
sphereArea radius = 4 * pi * (radius ^ 2)
cubeVolume :: Float -> Float
cubeVolume side =... | afronski/playground-fp | books/learn-you-a-haskell-for-great-good/modules/Geometry.hs | Haskell | mit | 718 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Main where
import Nanomsg
import Test.Framework.TH (defaultMainGenerator)
import Test.Framework.Providers.QuickCheck2 (testProperty)
import Test.QuickCheck
import Test.QuickCheck.Monadic
import Data.ByteS... | ivarnymoen/nanomsg-haskell | tests/Properties.hs | Haskell | mit | 6,398 |
{-# LANGUAGE DeriveFunctor #-}
-- Non-monadic tree labeling:
import Control.Monad
data Tr a = Lf a | Br (Tr a) (Tr a)
deriving Show
tr1 = Br (Lf 'a') (Br (Br (Lf 'b') (Lf 'a')) (Lf 'd'))
type Lt a = (Tr (S, a))
type S = Int
label :: Tr a -> Lt a
label tr = snd (lab tr 0)
where
lab :: Tr a -> S ... | egaburov/funstuff | Haskell/monads/zenmonad/Mumble002.hs | Haskell | apache-2.0 | 1,521 |
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Spark.Core.Internal.TypesFunctions(
isNullable,
iInnerStrictType,
columnType,
unsafeCastType,
intType,
arrayType,
compatibleTypes,
arrayType',
frameTypeFromCol,
colTypeFromFrame,
canNull,
structField,
structType,
... | krapsh/kraps-haskell | src/Spark/Core/Internal/TypesFunctions.hs | Haskell | apache-2.0 | 8,712 |
module Step_3_2 where
import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
[ h1 << "A to-do list:"
, thediv << toDoHtml
]
]
-- We've changed the type of toDoItems to include a Bool value to
-- indicate if they've been done.
toDoItems :: [(Bool, String)]... | mzero/barley | seed/Chapter3/Step_3_2.hs | Haskell | apache-2.0 | 1,554 |
-- http://www.reddit.com/r/dailyprogrammer/comments/2z68di/20150316_challenge_206_easy_recurrence_relations/
module RecurrenceRelations where
type Operator = Integer -> Integer
type Expression = String
createExpression :: Integer -> [Operator] -> Integer
createExpression seed = foldl (\_ x -> x seed) seed
parse :: ... | fffej/haskellprojects | daily-programmer/17-03-2015/RecurrenceRelations.hs | Haskell | bsd-2-clause | 766 |
module Rules.Cabal (cabalRules) where
import Base
import Data.Version
import Distribution.Package as DP
import Distribution.PackageDescription
import Distribution.PackageDescription.Parse
import Distribution.Verbosity
import Expression
import GHC
import Rules.Actions
import Settings
cabalRules :: Rules ()
cabalRules ... | quchen/shaking-up-ghc | src/Rules/Cabal.hs | Haskell | bsd-3-clause | 2,669 |
module Prompt
(
promptData
) where
import System.IO
type ParseFuncType a = (String -> Maybe a)
promptData :: String -> ParseFuncType a -> String -> IO a
promptData sprompt parseFunc failstr = do
putStr sprompt
hFlush stdout
input <- getLine
let maybea = parseFunc input
case maybea of
Just somet... | monkeybits/rpgame | src/Prompt.hs | Haskell | bsd-3-clause | 429 |
module Main where
import System.Exit
main = do
putStrLn "This test always passes!"
exitSuccess
| vollmerm/shallow-fission | tests/Test.hs | Haskell | bsd-3-clause | 115 |
{-# LANGUAGE DeriveDataTypeable, PatternGuards #-}
-----------------------------------------------------------------------------
-- |
-- Module : Data.Pass.L.Estimator
-- Copyright : (C) 2012-2013 Edward Kmett
-- License : BSD-style (see the file LICENSE)
--
-- Maintainer : Edward Kmett <ekmett@gmail.co... | ekmett/multipass | Data/Pass/L/Estimator.hs | Haskell | bsd-3-clause | 4,644 |
-- {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
module C where
import Control.Monad.State.Strict
import Data.Data
import Data.Either
import Data.Typeable
import Data.String
import Data.ByteString.Char8 (ByteString,pack,unpack)
import qualified Data.ByteString... | grwlf/cake3 | app/UrEmbed/C.hs | Haskell | bsd-3-clause | 4,494 |
module Validate.US where
import Data.Char
regionStrict :: String -> Bool
regionStrict reg = reg `elem` ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH"... | jespino/haskell-validate | Validate/US.hs | Haskell | bsd-3-clause | 555 |
module SortCheck.Forall (
MetaCtx(..),
checkForallVars
) where
import Control.Monad.Trans.State.Lazy
import Control.Monad.Except (throwError)
import Control.Monad.Trans.Class (lift)
import Control.Lens
import Data.Maybe (isJust)
import Control.Monad (when, unless)
import qualified Data.Set as Set
import AST
impo... | esengie/fpl-exploration-tool | src/specLang/SortCheck/Forall.hs | Haskell | bsd-3-clause | 1,684 |
module Zero.KeyFetchToken.Relations
(
defineKeyFetchTokenRelation
, keyFetchStatesFromRelation
, keyFetchTokensFromRelation
, keyFetchTokenAttributes
) where
import qualified Data.Vector as V
import Zero.Persistence
import Zero.KeyFetchToken.Internal
import Zero.Token.Inter... | et4te/zero | server/src/Zero/KeyFetchToken/Relations.hs | Haskell | bsd-3-clause | 2,849 |
-- Samples of graphs useful for testing
-- Many examples come from organic chemistry. These were generated
-- from SMILES strings using a smiles parser which generates
-- LGraphs
module Data.Graph.Graphs (
methane, ethane, propane, butane, alkane
, isobutane, isopentane, neopentane
, cycloalkane, cyclopropa... | stefan-hoeck/labeled-graph | Data/Graph/Graphs.hs | Haskell | bsd-3-clause | 6,901 |
module Type (
typeOf
) where
import Context
import Base
typeOf :: Term -> TermType
typeOf t = go makeEmptyContext t
go :: Context -> Term -> TermType
{- T-True -}
go _ TermTrue = TypeBool
{- T-False -}
go _ TermFalse = TypeBool
{- T-If -}
go ctx (TermIfThenElse t t1 t2) = case go ctx t of
TypeBool -> if ty1 =... | foreverbell/unlimited-plt-toys | tapl/simplebool/Type.hs | Haskell | bsd-3-clause | 970 |
{-# LANGUAGE OverloadedStrings, CPP #-}
module RoundTripSpec where
import Control.Monad (replicateM)
import Data.IP (IP (..), IPv4, IPv6, toIPv4, toIPv6)
import qualified Data.ByteString.Char8 as BS
import Network.DNS.Internal
import Network.DNS.Decode
import Network.DNS.Encode
import Test.Hspec
import Test.Hspec.Qui... | greydot/dns | test/RoundTripSpec.hs | Haskell | bsd-3-clause | 5,178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.