code stringlengths 2 1.05M | repo_name stringlengths 5 101 | path stringlengths 4 991 | language stringclasses 3
values | license stringclasses 5
values | size int64 2 1.05M |
|---|---|---|---|---|---|
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Betfair.StreamingAPI.API.ToRequest
( ToRequest
, toRequest
) where
-- import Protolude
import Betfair.StreamingAPI.API.Request
import qualified Betfair.StreamingAPI.Requests.AuthenticationMessage as A
import qualified Bet... | joe9/streaming-betfair-api | src/Betfair/StreamingAPI/API/ToRequest.hs | Haskell | mit | 917 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
import Data.Attoparsec.ByteString.Char8 hiding (take)
import qualified Data.ByteString as B
import Control.Applicative
import Data.List (sortBy, groupBy, maximumBy, transpose)
import Data.Ord (comparing)
import Data.Function (on)
import qualified Data... | devonhollowood/adventofcode | 2015/day14/day14.hs | Haskell | mit | 2,114 |
lucky :: Int -> String
lucky 7 = "LUCKY NUMBER SEVEN!"
lucky x = "Sorry, you're out of luck, pal!"
sayMe :: Int -> String
sayMe 1 = "One!"
sayMe 2 = "Two!"
sayMe 3 = "Three!"
sayMe 4 = "Four!"
sayMe 5 = "Five!"
sayMe x = "Not between 1 and 5"
factrial :: Int -> Int
factrial 0 = 1
factrial n = n * factrial (n - 1)
ad... | yhoshino11/learning_haskell | ch3.hs | Haskell | mit | 4,601 |
module Compiler.GCC.JIT.Monad.Result where
import Compiler.GCC.JIT.Monad.Utilities
import Compiler.GCC.JIT.Monad.Types
import Compiler.GCC.JIT.Foreign.Types
import Compiler.GCC.JIT.Foreign.Context
import Foreign.Ptr
import Data.ByteString (ByteString)
import Control.Monad.IO.Class (liftIO)
-- * Result functions
... | Slowki/hgccjit | src/Compiler/GCC/JIT/Monad/Result.hs | Haskell | mit | 1,311 |
-----------------------------------------------------------------------------
-- |
-- Module : Aether.Parser
-- Copyright : (c) Allen Guo 2013
-- License : MIT
--
-- Maintainer : Allen Guo <guoguo12@gmail.com>
-- Stability : alpha
--
-- This module contains several simple XML-parsing regex
-- functions, as well ... | guoguo12/aether | src/Aether/Parser.hs | Haskell | mit | 2,275 |
module Main where
import Primes
import Digits
import Data.List
isPandigital :: Int -> Bool
isPandigital num = [1..length numDigits] == (sort numDigits)
where
numDigits = digits num
biggestPandigitalPrime = head [ x | x <- downwards(7654321), isPandigital x, isPrime x ]
where
downwards num = num:downwards... | kliuchnikau/project-euler | 041/Main.hs | Haskell | apache-2.0 | 367 |
{-# LANGUAGE TypeSynonymInstances #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TupleSections #-}
module Tetris.Board where
import Control.Lens
import Data.Bool
import Data.Maybe
import Data.Monoid
import Data.Eq
import Data.Function (($),... | melrief/tetris | src/Tetris/Board.hs | Haskell | apache-2.0 | 3,981 |
{-# LANGUAGE TemplateHaskell #-}
{-| PyType helper for Ganeti Haskell code.
-}
{-
Copyright (C) 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 mus... | yiannist/ganeti | src/Ganeti/THH/PyType.hs | Haskell | bsd-2-clause | 4,876 |
{-# LANGUAGE TypeFamilies, TypeOperators, TupleSections #-}
{-# OPTIONS_GHC -Wall #-}
----------------------------------------------------------------------
-- |
-- Module : FunctorCombo.Holey
-- Copyright : (c) Conal Elliott 2010
-- License : BSD3
--
-- Maintainer : conal@conal.net
-- Stability : e... | conal/functor-combo | src/FunctorCombo/Holey.hs | Haskell | bsd-3-clause | 5,004 |
{-# LANGUAGE ViewPatterns, RecordWildCards #-}
module Cabal(
Cabal(..), CabalSection(..), CabalSectionType,
parseCabal,
selectCabalFile,
selectHiFiles
) where
import System.IO.Extra
import System.Directory.Extra
import System.FilePath
import qualified Data.HashMap.Strict as Map
import Util
import ... | ndmitchell/weeder | src/Cabal.hs | Haskell | bsd-3-clause | 6,213 |
module Data.TTask.File.Compatibility.V0_0_1_0
( readProject
) where
import Data.Functor
import Safe
import Data.Time
import Control.Lens
import qualified Data.TTask.Types.Types as T
data Task = Task
{ taskId :: T.Id
, taskDescription :: String
, taskPoint :: Int
, taskStatus :: T.TStatus
, taskWorkTime... | tokiwoousaka/ttask | src/Data/TTask/File/Compatibility/V0_0_1_0.hs | Haskell | bsd-3-clause | 2,120 |
module DataParsers where
import CSV
import Text.ParserCombinators.Parsec hiding (labels)
import DataTypes
import Control.Monad.Except
import Data.IORef
import Data.Char
import Text.Read hiding (String)
fromRight :: Either a b -> b
fromRight (Right b) = b
maybeToTop :: Maybe WVal -> WVal
maybeToTop (Just w) = w
maybeT... | knalbant/wrangell | DataParsers.hs | Haskell | bsd-3-clause | 2,658 |
{-# LANGUAGE FlexibleContexts #-}
module Cologne.Shaders.Debug (
debug
) where
import Control.Monad.ST
import Data.STRef (newSTRef, readSTRef, writeSTRef)
import Control.Monad.State (State, runState)
import Data.Vect (Vec3(Vec3), (&+), (&*), (&.), (&^), len, normalize)
import Data.Vector.Mutable (MVector, new, ... | joelburget/Cologne | Cologne/Shaders/Debug.hs | Haskell | bsd-3-clause | 2,120 |
-- | 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 in the Yesod typeclass. That instance is
-- declared in the Foundation.hs file.... | mitchellwrosen/dohaskell | src/Settings.hs | Haskell | bsd-3-clause | 5,495 |
-- -----------------------------------------------------------------------------
--
-- Info.hs, part of Alex
--
-- (c) Simon Marlow 2003
--
-- Generate a human-readable rendition of the state machine.
--
-- ----------------------------------------------------------------------------}
module Text.Luthor.Info ( infoDFA... | ekmett/luthor | Text/Luthor/Info.hs | Haskell | bsd-3-clause | 1,781 |
module Network.Kafka.Protocol where
| iand675/hs-kafka | src/Network/Kafka/Protocol.hs | Haskell | bsd-3-clause | 36 |
{-# LANGUAGE DeriveDataTypeable #-}
module Main where
import System.Console.CmdArgs
import Com.DiagClient(sendData)
import DiagnosticConfig
import Control.Monad (when)
import Network.Socket
import Script.ErrorMemory
import Script.LoggingFramework
import Numeric(showHex,readHex)
import Util.Encoding
import Data.Word
im... | marcmo/hsDiagnosis | Main.hs | Haskell | bsd-3-clause | 3,113 |
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RankNTypes #-}
module Test.Themis.Keyword (
Keyword
, runKeyword
, Context(..)
, Action
, safeAction
, safeActionRollback
, action
, actionRollback
, Interpretation(..)
, step
, info
, assertEquals
, satisfies
... | andorp/themis | src/Test/Themis/Keyword.hs | Haskell | bsd-3-clause | 5,287 |
module Config where
import Data.List
import HSH
-- put any custom default excluded directories or aliased filetypes here etc
sourceFiles :: [String] -> String -> IO [String]
sourceFiles ftypes dir = run ("find", dir:args) where
args = intercalate ["-or"] [["-iname", "*." ++ ftype] | ftype <- ftypes]
| facebookarchive/lex-pass | src/Config.hs | Haskell | bsd-3-clause | 306 |
{-# LANGUAGE CPP, DisambiguateRecordFields, RecordWildCards, NamedFieldPuns #-}
{-# LANGUAGE BangPatterns #-}
-- | This module implements parsing and unparsing functions for
-- OpenFlow messages. It exports a driver that can be used to read messages
-- from a file handle and write messages to a handle.
module Nettle.... | brownsys/nettle-openflow | src/Nettle/OpenFlow/MessagesBinary.hs | Haskell | bsd-3-clause | 76,633 |
module Main where
import Data.List (intersperse)
import Data.List.Split (splitOn)
import System.Environment (getArgs)
import Control.Distributed.Task.Distribution.LogConfiguration (initDefaultLogging)
import Control.Distributed.Task.Distribution.RunComputation
import Control.Distributed.Task.Distribution.TaskDistribu... | michaxm/task-distribution | app/Main.hs | Haskell | bsd-3-clause | 4,444 |
module Mistral.TypeCheck.Interface (
genIface
) where
import Mistral.ModuleSystem.Interface
import Mistral.TypeCheck.AST
import Mistral.Utils.SCC ( groupElems )
import Data.Foldable ( foldMap )
import qualified Data.Map as Map
-- | Generate an interface from a core module.
genIface :: Module -> Ifac... | GaloisInc/mistral | src/Mistral/TypeCheck/Interface.hs | Haskell | bsd-3-clause | 927 |
module ETA.TypeCheck.TcFlatten(
FlattenEnv(..), FlattenMode(..), mkFlattenEnv,
flatten, flattenMany, flatten_many,
flattenFamApp, flattenTyVarOuter,
unflatten,
eqCanRewrite, eqCanRewriteFR, canRewriteOrSame,
CtFlavourRole, ctEvFlavourRole, ctFlavourRole
) where
import ETA.TypeCheck.TcRnTypes
import ... | alexander-at-github/eta | compiler/ETA/TypeCheck/TcFlatten.hs | Haskell | bsd-3-clause | 58,244 |
{-# LANGUAGE OverloadedStrings #-}
module Spin
( SourceID
, Source (..)
, session
, yield
, dedup
, Sink (..)
, sinkFile
, sinkYarn
, spin
) where
import Control.Monad (ap, liftM)
import Control.Monad.IO.Class (MonadIO (..), liftIO)
impor... | yuttie/fibers | Spin.hs | Haskell | bsd-3-clause | 3,531 |
-- Copyright (c) 2015 Eric McCorkle. 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 retain the above copyright
-- notice, this list of conditi... | emc2/iridium | src/IR/Common/Rename/Class.hs | Haskell | bsd-3-clause | 2,588 |
fibs :: [Integer]
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
main :: IO ()
main = print $ fst $ head $ dropWhile not1000 $ zip [0..] fibs
where not1000 (_,x) = (length $ show x) /= 1000
| stulli/projectEuler | eu25.hs | Haskell | bsd-3-clause | 192 |
module RefacWhereLet(whereToLet) where
import PrettyPrint
import PosSyntax
import AbstractIO
import Maybe
import TypedIds
import UniqueNames hiding (srcLoc)
import PNT
import TiPNT
import List
import RefacUtils hiding (getParams)
import PFE0 (findFile)
import MUtils (( # ))
import RefacLocUtils
import System
import ... | forste/haReFork | refactorer/RefacWhereLet.hs | Haskell | bsd-3-clause | 7,907 |
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE RecordWildCards #-}
module Iso where
import Data.Functor.Contravariant (Contravariant, (>$<), contramap)
import Person
import Control.Monad.Reader
import Data.Profunctor
import Data.Functor.Identity
import Getter (view)
-- | Exchange an ContraExchange types which are use... | sebashack/LensPlayground | src/Iso.hs | Haskell | bsd-3-clause | 2,440 |
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances, TupleSections, ScopedTypeVariables #-}
{-|
A module defining an interface for type attribution, the process by which
nodes in an AST are assigned constrained types.
-}
module Language.K3.TypeSystem.Monad.Iface.TypeAttribution
( TypeVarAttrI(..)
) where
impor... | DaMSL/K3 | src/Language/K3/TypeSystem/Monad/Iface/TypeAttribution.hs | Haskell | apache-2.0 | 761 |
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
module Kalium.Nucleus.Vector.Program where
import Kalium.Prelude
import Kalium.Util
import Control.Monad.Rename
data NameSpecial
= OpAdd
| OpSubtract
| OpMultiply
| OpDivide
| OpDiv
| OpMod
... | rscprof/kalium | src/Kalium/Nucleus/Vector/Program.hs | Haskell | bsd-3-clause | 5,397 |
{-# LANGUAGE Haskell98, BangPatterns #-}
{-# LINE 1 "Data/ByteString/Lazy/Search.hs" #-}
-- |
-- Module : Data.ByteString.Lazy.Search
-- Copyright : Daniel Fischer
-- Chris Kuklewicz
-- Licence : BSD3
-- Maintainer : Daniel Fischer <daniel.is.fischer@googlemail.com>
-- Stability... | phischu/fragnix | tests/packages/scotty/Data.ByteString.Lazy.Search.hs | Haskell | bsd-3-clause | 14,655 |
{-# LANGUAGE Haskell98, MultiParamTypeClasses, FunctionalDependencies, FlexibleInstances #-}
{-# LINE 1 "Control/Monad/Cont/Class.hs" #-}
{- |
Module : Control.Monad.Cont.Class
Copyright : (c) The University of Glasgow 2001,
(c) Jeff Newbern 2003-2007,
(c) Andriy Palamarchuk 2007
... | phischu/fragnix | tests/packages/scotty/Control.Monad.Cont.Class.hs | Haskell | bsd-3-clause | 5,256 |
{-#LANGUAGE RecordWildCards, ScopedTypeVariables, TypeFamilies#-}
module CV.Features (SURFParams, defaultSURFParams, mkSURFParams, getSURF
,moments,Moments,getSpatialMoment,getCentralMoment,getNormalizedCentralMoment) where
import CV.Image
import CV.Bindings.Types
import CV.Bindings.Features
import F... | BeautifulDestinations/CV | CV/Features.hs | Haskell | bsd-3-clause | 5,004 |
-- -----------------------------------------------------------------------------
--
-- (c) The University of Glasgow 1994-2004
--
-- -----------------------------------------------------------------------------
{-# OPTIONS_GHC -fno-warn-tabs #-}
-- The above warning supression flag is a temporary kludge.
-- While wor... | ryantm/ghc | compiler/nativeGen/SPARC/Regs.hs | Haskell | bsd-3-clause | 6,744 |
<?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="pl-PL">
<title>Common Library</title>
<maps>
<homeID>commonlib</homeID>
<mapref locatio... | thc202/zap-extensions | addOns/commonlib/src/main/javahelp/help_pl_PL/helpset_pl_PL.hs | Haskell | apache-2.0 | 965 |
{-# OPTIONS_GHC -cpp #-}
{-+
This module implements environments (symbol tables) as finite maps.
Finite maps are not necessarily faster than simple association lists, since
although lookups change from O(n) to O(log n), extension changes from
O(1) to O(log n), and the latter cost can be the dominating cost...
-}
modul... | kmate/HaRe | old/tools/base/TI/TiEnvFM.hs | Haskell | bsd-3-clause | 1,422 |
module B (name) where
name :: String
name = "Samantha"
| sdiehl/ghc | testsuite/tests/driver/T16511/B1.hs | Haskell | bsd-3-clause | 56 |
module Mod120_A(T) where
data T = Foo
| urbanslug/ghc | testsuite/tests/module/Mod120_A.hs | Haskell | bsd-3-clause | 39 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Main where
import Turtle
import qualified Data.Maybe as Maybe
import qualified Search as Search
main :: IO ()
main = sh $ do
boss <- options "Day 21" parser
let minimal = Loadout 0 Nothing Nothing Nothing
let won_fight load = battle (ma... | devonhollowood/adventofcode | 2015/day21/day21.hs | Haskell | mit | 5,700 |
module Three where
import Test.QuickCheck
import Test.QuickCheck.Checkers
data Three a b c = Three a b c
deriving (Eq, Ord, Show)
--
instance Functor (Three a b) where
fmap f (Three a b c) = Three a b (f c)
instance Foldable (Three a b) where
foldMap f (Three a b c) = f c
instance Traversable (Three a b) w... | NickAger/LearningHaskell | HaskellProgrammingFromFirstPrinciples/Chapter21/Exercises/src/Three.hs | Haskell | mit | 593 |
module Gen.Core
( surroundWith
, smallArbitrary
, maybeGen
, genNothing
, module Language.GoLite.Syntax
, module Control.Monad
, module Test.Hspec
, module Test.Hspec.QuickCheck
, module Test.QuickCheck
) where
import Language.GoLite.Syntax
import Control.Monad
import Test.Hspec
import Test.Hspec.QuickCheck
import Te... | djeik/goto | test/Gen/Core.hs | Haskell | mit | 1,104 |
module
Foo
| chreekat/vim-haskell-syntax | test/golden/module-firstline.hs | Haskell | mit | 11 |
--
-- Find the greatest product of five consecutive digits in the 1000-digit number.
--
number
= "73167176531330624919225119674426574742355349194934"
++ "96983520312774506326239578318016984801869478851843"
++ "85861560789112949495459501737958331952853208805511"
++ "12540698747158523863050715693290... | stu-smith/project-euler-haskell | Euler-008.hs | Haskell | mit | 1,556 |
{-# LANGUAGE FlexibleContexts #-}
module Dissent.Protocol.Shuffle.Leader where
import Control.Monad.Error
import Control.Monad.Trans.Resource
import Data.List (sortBy)
import qualified Network.Socket as NS
import qualified Dissent.Crypto.Rsa ... | solatis/dissent | src/Dissent/Protocol/Shuffle/Leader.hs | Haskell | mit | 3,730 |
#!/usr/bin/env stack
-- stack --install-ghc runghc --package turtle
{-# LANGUAGE OverloadedStrings #-}
import Turtle
main = stdout $ grep ((star dot) <> "monads" <> (star dot)) $ input "README.md"
| JoshuaGross/haskell-learning-log | Code/turtle/grep.hs | Haskell | mit | 210 |
Config
{ font = "xft:Inconsolata:size=13"
, bgColor = "#3a3a3a"
, fgColor = "#dcdccc"
, position = Top
, commands =
[ Run MPD
[ "--template", "<statei> <fc=#8cd0d3><title></fc> - <fc=#f0dfaf><artist></fc> - <lapsed>/<remaining>"
, "--"
... | randalloveson/dotfiles | xmonad/.xmonad/xmobar.hs | Haskell | mit | 2,230 |
module Rebase.Data.Functor.Sum
(
module Data.Functor.Sum
)
where
import Data.Functor.Sum
| nikita-volkov/rebase | library/Rebase/Data/Functor/Sum.hs | Haskell | mit | 92 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE TypeFamilies #-}
module App.State
( ServerState(..)
, HasConnections
, GameState
, IsConnection(..)
, defaultInitialState
, defaultInitialStateWithRandomPositions
) where
import App.ConnectionMgnt
import ClassyPrelude
import ... | Haskell-Praxis/core-catcher | src/App/State.hs | Haskell | mit | 1,560 |
{-|
Module : TrackParameter
Description : Short description
Copyright : (c) Laurent Bulteau, Romeo Rizzi, Stéphane Vialette, 2016-1017
License : MIT
Maintainer : vialette@gmail.com
Stability : experimental
Here is a longer description of this module, containing some
commentary with @some markup@.
-}
{-#... | vialette/ppattern-tmp | src/TrackParameter.hs | Haskell | mit | 1,823 |
{-# LANGUAGE DeriveGeneric #-}
module Kantour.KcData.Map.Image where
import Data.Aeson
import GHC.Generics
import qualified Data.HashMap.Strict as HM
import Kantour.KcData.Map.Sprite
import qualified Data.Text as T
data Image = Image
{ frames :: HM.HashMap T.Text Sprite
, meta :: Maybe Value
} deriving (Generic... | Javran/tuppence | src/Kantour/KcData/Map/Image.hs | Haskell | mit | 347 |
pertenece :: a -> ArbolG a -> Bool
pertenece a AVG = False
pertenece a (AG r s) = if ( a == r) then true else (aux a s)
aux :: (Eq a) => a -> [ArbolG a] -> Bool
aux a [] = False;
aux a (h:t) if pertenece a h then True else aux a t
| josegury/HaskellFuntions | Arboles/HojaPerteneceArbol.hs | Haskell | mit | 234 |
module Language.MSH.BuiltIn where
newClassName :: String
newClassName = "New"
newArgsTypeName :: String
newArgsTypeName = "Args"
newKwdName :: String
newKwdName = "new" | mbg/monadic-state-hierarchies | Language/MSH/BuiltIn.hs | Haskell | mit | 173 |
module TypeKwonDo where
chk :: Eq b => (a -> b) -> a -> b -> Bool
chk aToB a b = aToB a == b
arith :: Num b => (a -> b) -> Integer -> a -> b
arith aToB int a = aToB a + fromInteger int
| rasheedja/HaskellFromFirstPrinciples | Chapter6/typeKwonDo.hs | Haskell | mit | 187 |
module CostasLikeArrays.A320574 where
import Helpers.CostasLikeArrays (distinctDistances, countPermutationsUpToDihedralSymmetry)
import Helpers.Records (allMax)
import Data.List (permutations)
a320574 :: Int -> Int
a320574 n = countPermutationsUpToDihedralSymmetry n $ allMax distinctDistances $ permutations [0..n-1]
| peterokagey/haskellOEIS | src/CostasLikeArrays/A320574.hs | Haskell | apache-2.0 | 319 |
module Permutations.A329851Spec (main, spec) where
import Test.Hspec
import Permutations.A329851 (a329851)
main :: IO ()
main = hspec spec
spec :: Spec
spec = describe "A329851" $
it "correctly computes the first six elements" $
map a329851 [0..5] `shouldBe` expectedValue where
expectedValue = [0, 2, 12, ... | peterokagey/haskellOEIS | test/Permutations/A329851Spec.hs | Haskell | apache-2.0 | 338 |
{-# LANGUAGE OverloadedStrings, CPP #-}
module FormStructure.Countries where
#ifndef __HASTE__
import Data.Text.Lazy (Text)
#else
type Text = String
#endif
countries :: [(Text, Text)]
countries =
[ ("", "--select--")
, ("AF", "Afghanistan")
, ("AX", "Åland Islands")
, ("AL", "Albania")
, ("DZ", "... | DataStewardshipPortal/ds-elixir-cz | FormStructure/Countries.hs | Haskell | apache-2.0 | 6,814 |
module HuttonSScript where
import HERMIT.API
script :: Shell ()
script = return ()
| ku-fpg/better-life | examples/HERMIT/HuttonSScript.hs | Haskell | bsd-2-clause | 85 |
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UndecidableInstances #-}
{-|
Module : Numeric.AERN.RmToRn.Plot.FnView.State
Description : internal state of a FnView widget
Copyright : (c) Michal Konecny
License : BSD3
M... | michalkonecny/aern | aern-realfn-plot-gtk/src/Numeric/AERN/RmToRn/Plot/FnView/State.hs | Haskell | bsd-3-clause | 9,417 |
module Sesyrel.FaultTree.Elimination (findOrdering, pretend, Algorithm(..)) where
import Sesyrel.FaultTree.Base (Variable)
import Data.Function (on)
import Data.Foldable
import Data.Maybe (fromMaybe)
import Data.List (partition)
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as M
import Data.Set (Set... | balodja/sesyrel | src/Sesyrel/FaultTree/Elimination.hs | Haskell | bsd-3-clause | 3,159 |
import TCPServer(setupSocket)
import Prelude hiding (lookup)
import Network.Socket
import NaiveHttpRequestParser(naiveHttpRequestParser, Request(..), RequestType(..))
import Control.Concurrent(forkIO, threadDelay, MVar, newMVar, takeMVar, putMVar)
import Control.Monad(forM_, forever)
import Data.Map.Strict(Map, empty, ... | jvans1/haskell_servers | src/ThreadPool.hs | Haskell | bsd-3-clause | 1,758 |
-----------------------------------------------------------------------------
-- |
-- 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... | TomMD/cryptol | sbv/Data/SBV/Provers/SExpr.hs | Haskell | bsd-3-clause | 7,211 |
module Arhelk.Russian.Lemma.Adverb(
adverb
) where
import Arhelk.Core.Rule
import Arhelk.Russian.Lemma.Common
import Arhelk.Russian.Lemma.Data
import Control.Monad
import Data.Text as T
adverb :: Text -> Rule AdverbProperties
adverb w = do
when (w `endsWith` ["о"]) $ imply adverbDegree PositiveDegree
when... | Teaspot-Studio/arhelk-russian | src/Arhelk/Russian/Lemma/Adverb.hs | Haskell | bsd-3-clause | 382 |
{-# LANGUAGE ScopedTypeVariables, RecursiveDo #-}
import Data.Char
import System.Environment
import Control.Applicative
import Text.Earley
data Expr
= Expr :+: Expr
| Expr :*: Expr
| Var String
| Lit Int
deriving (Show)
grammar :: forall r. Grammar r String (Prod r String Char Expr)
grammar = mdo
whitesp... | Axure/Earley | examples/Expr2.hs | Haskell | bsd-3-clause | 1,013 |
{-
SkewHeap.hs
by Russell Bentley
A Haskell Implementation of a skew heap.
-}
module SkewHeap (Heap, emptyHeap, merge, insert, delete, minKey, minKeyValue, deleteMin ) where
-- | A binary tree data type.
data Heap k v = Nil | Node (k, v) (Heap k v) (Heap k v)
-- | Blank
emptyHeap :: Heap ... | ThermalSpan/haskell-euler | src/SkewHeap.hs | Haskell | bsd-3-clause | 1,914 |
-- | A module to contain the magnitude of s-expression parsing.
module Data.AttoLisp.Easy
(fromLispString
,module L)
where
import qualified Data.AttoLisp as L
import qualified Data.Attoparsec as P
import qualified Data.ByteString as B
-- | Parse a single s-expr followed by optional whi... | kini/ghc-server | src/Data/AttoLisp/Easy.hs | Haskell | bsd-3-clause | 725 |
main = print (foldl lcm 1 [1 .. 20]) | foreverbell/project-euler-solutions | src/5.hs | Haskell | bsd-3-clause | 36 |
-- | This module performs the translation of a parsed XML DTD into the
-- internal representation of corresponding Haskell data\/newtypes.
module Text.XML.HaXml.DtdToHaskell.Convert
( dtd2TypeDef
) where
import List (intersperse)
import Text.XML.HaXml.Types hiding (Name)
import Text.XML.HaXml.DtdToHaskell.Type... | FranklinChen/hugs98-plus-Sep2006 | packages/HaXml/src/Text/XML/HaXml/DtdToHaskell/Convert.hs | Haskell | bsd-3-clause | 5,118 |
{-# LANGUAGE OverloadedStrings #-}
module Templates.Home where
import Core
import Templates
import Templates.CoreForm
import Data.Int
import Text.Blaze ((!))
import qualified Text.Blaze.Html4.Strict as H
import qualified Text.Blaze.Html4.Strict.Attributes as A
homeHtml :: CoreId -> H.Html
homeHtml nbCor... | alpmestan/core-online | src/Templates/Home.hs | Haskell | bsd-3-clause | 941 |
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{- | The replay monad, for computations that can be replayed using traces
Example usage:
> running :: Replay Question Answer a -> IO a
> running prog = play emptyTrace
> where
> pla... | co-dan/warm_fuzzy_things | src/Control/Monad/Replay.hs | Haskell | bsd-3-clause | 4,350 |
{-
OnYourOwn1.hs (adapted from OpenGLApplication which is (c) 2004 Astle/Hawkins)
Copyright (c) Sven Panne 2004-2005 <sven.panne@aedion.de>
This file is part of HOpenGL and distributed under a BSD-style license
See the file libraries/GLUT/LICENSE
-}
import Control.Monad ( when, unless )
import Data.IORef (... | FranklinChen/hugs98-plus-Sep2006 | packages/GLUT/examples/BOGLGP/Chapter02/OnYourOwn1.hs | Haskell | bsd-3-clause | 8,277 |
{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998
-}
module ETA.Iface.BuildTyCl (
buildSynonymTyCon,
buildFamilyTyCon,
buildAlgTyCon,
buildDataCon,
buildPatSyn,
TcMethInfo, buildClass,
distinctAbstractTyConRhs, totall... | alexander-at-github/eta | compiler/ETA/Iface/BuildTyCl.hs | Haskell | bsd-3-clause | 14,445 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE EmptyDataDecls #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeSynonymInstances #-}
{-... | duairc/symbols | types/src/GHC/Generics/Compat.hs | Haskell | bsd-3-clause | 8,221 |
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneDeriving #-}
module GRIN.GrinCase where
import GRIN.GrinIdentifiers
import GRIN.GrinLiteral
import G... | spacekitteh/libgrin | src/GRIN/GrinCase.hs | Haskell | bsd-3-clause | 1,288 |
module Nut.Color.Spectrum.XYZ
( XYZ(..)
) where
import Control.Applicative
import Data.Foldable
import Data.Traversable
import Data.Monoid
import Nut.Numeric.Double
import Nut.Numeric.Float
data XYZ a = XYZ a a a deriving (Eq,Ord,Show,Read)
instance Functor XYZ where
fmap f (XYZ x y z) = XYZ (f x) (f y) (f z)
... | ekmett/colorimetry | Colorimetry/Spectrum/XYZ.hs | Haskell | bsd-3-clause | 1,454 |
-----------------------------------------------------------------------
--
-- Haskell: The Craft of Functional Programming, 3e
-- Simon Thompson
-- (c) Addison-Wesley, 1996-2011.
--
-- Chapter 14, part 1
-- Also covers the properties in Section 14.7
--
---------------------------------------------------------... | Numberartificial/workflow | snipets/src/Craft/Chapter14_1.hs | Haskell | mit | 5,523 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module LambdaCms.Core.Classes
( PageHeadProperties (..)
) where
import LambdaCms.Core.Import
import Data.Text (intercalate)
type Follow = Bool
type Index = Bool
class PageHeadProperties res where
... | lambdacms/lambdacms | lambdacms-core/LambdaCms/Core/Classes.hs | Haskell | mit | 1,358 |
{-# LANGUAGE LambdaCase #-}
module Cardano.Wallet.Kernel.Addresses (
createAddress
, newHdAddress
, importAddresses
-- * Errors
, CreateAddressError(..)
, ImportAddressError(..)
) where
import qualified Prelude
import Universum
import Control.Lens (to)
import ... | input-output-hk/pos-haskell-prototype | wallet/src/Cardano/Wallet/Kernel/Addresses.hs | Haskell | mit | 11,037 |
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-}
-- | Primitive Feldspar expressions
module Feldspar.Primitive.Representation where
import Data.Array
import Data.Bits
import Data.Complex
import Data.Int
import Data.Typeable
import Data.Word
import Data.Constraint (Dict (..))
impor... | kmate/raw-feldspar | src/Feldspar/Primitive/Representation.hs | Haskell | bsd-3-clause | 17,478 |
-- A simple let statement, to ensure the layout is detected
module Layout.LetStmt where
foo = do
{- ffo -}let x = 1
y = 2 -- baz
x+y
| mpickering/ghc-exactprint | tests/examples/ghc710/LetStmt.hs | Haskell | bsd-3-clause | 158 |
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
{- |
Module : Verifier.SAW.Change
Copyright : Galois, Inc. 2012-2015
License : BSD3
Maintainer : jhendrix@galois.com
Stability : experimental... | GaloisInc/saw-script | saw-core/src/Verifier/SAW/Change.hs | Haskell | bsd-3-clause | 4,832 |
{-# LANGUAGE CPP #-}
module Test(main) where
import Development.Shake.Command
import System.Directory.Extra
import System.IO.Extra
import System.Time.Extra
import System.Environment.Extra
import System.FilePath
import Control.Monad.Extra
import Control.Exception.Extra
import Control.Concurrent
import System.Process
i... | Pitometsu/bake | src/Test.hs | Haskell | bsd-3-clause | 6,242 |
{-
Copyright 2015 Google Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or a... | Ye-Yong-Chi/codeworld | codeworld-base/src/GHC/IO/Handle/FD.hs | Haskell | apache-2.0 | 747 |
{-# LANGUAGE CPP #-}
module TcInteract (
solveSimpleGivens, -- Solves [EvVar],GivenLoc
solveSimpleWanteds -- Solves Cts
) where
#include "HsVersions.h"
import BasicTypes ( infinity, IntWithInf, intGtLimit )
import HsTypes ( hsIPNameFS )
import FastString
import TcCanonical
import TcFlatten
import Var... | ml9951/ghc | compiler/typecheck/TcInteract.hs | Haskell | bsd-3-clause | 83,885 |
{-# OPTIONS_GHC -Wall -fno-warn-unused-do-bind #-}
module Parse.Type where
import Control.Applicative ((<$>),(<*>),(<*))
import Data.List (intercalate)
import Text.Parsec ((<|>), (<?>), char, many, optionMaybe, string, try)
import qualified AST.Type as T
import qualified AST.Variable as Var
import Parse.Helpers
tva... | avh4/elm-compiler | src/Parse/Type.hs | Haskell | bsd-3-clause | 2,080 |
module KeepCafs2 where
import KeepCafsBase
foreign export ccall "getX"
getX :: IO Int
getX :: IO Int
getX = return (x + 1)
| sdiehl/ghc | testsuite/tests/rts/KeepCafs2.hs | Haskell | bsd-3-clause | 128 |
{-# LANGUAGE ForeignFunctionInterface #-}
{-@ LIQUID "--c-files=../ffi-include/foo.c" @-}
{-@ LIQUID "-i../ffi-include" @-}
module Main where
import Foreign.C.Types
{-@ embed CInt as int @-}
{-@ embed Integer as int @-}
{-@ assume c_foo :: x:{CInt | x > 0} -> IO {v:CInt | v = x} @-}
foreign import ccall unsafe "foo.... | mightymoose/liquidhaskell | tests/pos/FFI.hs | Haskell | bsd-3-clause | 409 |
{-# LANGUAGE DataKinds, PolyKinds #-}
module T14209 where
data MyProxy k (a :: k) = MyProxy
data Foo (z :: MyProxy k (a :: k))
| sdiehl/ghc | testsuite/tests/polykinds/T14209.hs | Haskell | bsd-3-clause | 128 |
{-# OPTIONS_GHC -fno-warn-redundant-constraints #-}
{-# LANGUAGE RankNTypes #-}
module ShouldSucceed where
data Empty q = Empty (forall a. Ord a => q a)
q :: (Ord a) => [a]
q = []
e0, e1, e2 :: Empty []
e0 ... | olsner/ghc | testsuite/tests/typecheck/should_compile/tc092.hs | Haskell | bsd-3-clause | 458 |
-----------------------------------------------------------------------------
-- |
-- Module : GHC.ExecutionStack
-- Copyright : (c) The University of Glasgow 2013-2015
-- License : see libraries/base/LICENSE
--
-- Maintainer : cvs-ghc@haskell.org
-- Stability : internal
-- Portability : non-portabl... | tolysz/prepare-ghcjs | spec-lts8/base/GHC/ExecutionStack.hs | Haskell | bsd-3-clause | 1,463 |
{-# LANGUAGE TypeFamilies #-}
module T11408 where
type family UL a
type family UR a
type family MT a b
mkMerge :: a -> UL a -> UR a -> Int
mkMerge = undefined
merger :: a -> b -> MT a b
merger = undefined
{-
merge ::
forall a b. (UL (MT a b) ~ a, UR (MT a b) ~ b) => a -> b -> Int
or
forall t. (MT (UL t) (UR t) ~ ... | ezyang/ghc | testsuite/tests/indexed-types/should_compile/T11408.hs | Haskell | bsd-3-clause | 502 |
module T7312 where
-- this works
mac :: Double -> (Double->Double) -> (Double-> Double)
mac ac m = \ x -> ac + x * m x
-- this doesn't
mac2 :: Double -> (->) Double Double -> (->) Double Double
mac2 ac m = \ x -> ac + x * m x
| wxwxwwxxx/ghc | testsuite/tests/typecheck/should_compile/T7312.hs | Haskell | bsd-3-clause | 228 |
module Main where
import GHC.Conc
-- Create a new TVar, update it and check that it contains the expected value after the
-- transaction
main = do
putStr "Before\n"
t <- atomically ( newTVar 42 )
atomically ( writeTVar t 17 )
r <- atomically ( readTVar t )
putStr ("After " ++ (show r) ++ "\n")
| wxwxwwxxx/ghc | testsuite/tests/concurrent/should_run/conc043.hs | Haskell | bsd-3-clause | 318 |
{-# LANGUAGE CPP, MultiParamTypeClasses #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module System.Process.Text.Lazy where
#if !MIN_VERSION_base(4,8,0)
import Control.Applicative ((<$>))
#endif
import Control.DeepSeq (force)
import qualified Control.Exception as C (evaluate)
import Data.ListLike.IO (hGetContents)
import ... | seereason/process-extras | src/System/Process/Text/Lazy.hs | Haskell | mit | 1,392 |
module Exercises where
tensDigit :: Integral a => a -> a
tensDigit x = d
where
(xLast, _) = x `divMod` 10
d = xLast `mod` 10
foldBool :: a -> a -> Bool -> a
foldBool x y z =
case z of
True -> x
False -> y
foldBool2 :: a -> a -> Bool -> a
foldBool2 x y z
| z == True = x
| otherwise ... | andrewMacmurray/haskell-book-solutions | src/ch7/exercises.hs | Haskell | mit | 388 |
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-missing-signatures #-}
module Main where
import System.Random.TF.Init
import Types
import Encode
import Mix
import Melody.GameOfThrones
import Generator.Sin
import Generator.Rand
import Generator.KarplusStrong
import Envelope.ADSR
settings :: MixSettings
settings = M... | feuerbach/music | Main.hs | Haskell | mit | 556 |
scoreToLetter :: Int -> Char
scoreToLetter n
| n > 90 = 'A'
| n > 80 = 'B'
| n > 70 = 'C'
| otherwise = 'F'
len [] = 0
len (x:s) = 1 + len s
listCopy [] = []
listCopy (x:s) = x : listCopy s
ones = 1 : ones
twos = 2 : twos
lists = [ones, twos]
front :: Int -> [a] -> [a]
front _ [] = []
front 0 (x:s)... | hectoregm/lenguajes | class-notes/class-notes-30-september.hs | Haskell | mit | 1,452 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Gaia.SearchEngine (
runQuery2,
runQuery3
) where
import qualified Data.ByteString.Lazy.Char8 as Char8
import qualified Data.List as D
import qualified Gaia.AesonValuesFileSystemCorrespondance as XP1
import qualified Gaia.AesonValuesA... | shtukas/Gaia | src/Gaia/SearchEngine.hs | Haskell | mit | 9,015 |
main = putStrLn "Hello World"
//added some comments
//showing how to do stuff
| Yelmogus/Lambda_Interpreter | HW1.hs | Haskell | mit | 78 |
{- Copyright (C) 2015 Calvin Beck
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, ... | Chobbes/mathform | src/Text/MathForm/Readers/Sage.hs | Haskell | mit | 2,207 |
module HaskellBook.Case where
funcZ x =
case x + 1 == 1 of
True -> "AWESOME"
False -> "wut"
pal xs =
case xs == reverse xs of
True -> "yes"
False -> "no"
pal' xs =
case y of
True -> "yes"
False -> "no"
where y = xs == reverse xs
| brodyberg/Notes | ProjectRosalind.hsproj/LearnHaskell/lib/HaskellBook/Case.hs | Haskell | mit | 278 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.