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 |
|---|---|---|---|---|---|
-- | Unsafe coerce.
module Unsafe.Coerce where
import FFI
unsafeCoerce :: a -> b
unsafeCoerce = ffi "%1"
| beni55/fay | fay-base/src/Unsafe/Coerce.hs | Haskell | bsd-3-clause | 108 |
module Network.MPD.Applicative (
Command
, runCommand
-- * Querying MPD's status
, module Network.MPD.Applicative.Status
-- * Playback options
, module Network.MPD.Applicative.PlaybackOptions
-- * Controlling playback
, module Network.MPD.Applicative.PlaybackControl
-- * The current playlist
, module Network.MPD.... | matthewleon/libmpd-haskell | src/Network/MPD/Applicative.hs | Haskell | mit | 1,428 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TupleSections #-}
module HERMIT.Dictionary.Induction
( -- * Induction
externals
, caseSplitOnR
)
where
import Control.Arrow
import Control.Monad
import Data.String
import HERMIT.Context
import HE... | ku-fpg/hermit | src/HERMIT/Dictionary/Induction.hs | Haskell | bsd-2-clause | 2,691 |
module Nat where
import Prelude hiding ((+))
data Nat = Zero | Succ Nat deriving (Eq,Show)
(+) :: Nat -> Nat -> Nat
Zero + n = n
(Succ m) + n = Succ (m + n)
toNat :: Integer -> Nat
toNat 0 = Zero
toNat n = Succ (toNat (pred n))
fromNat :: Nat -> Integer
fromNat Zero = 0
fromNat (Succ n) = succ (fromNat n) | conal/hermit | examples/fib-stream/Nat.hs | Haskell | bsd-2-clause | 315 |
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE DeriveGeneric #-}
module RWPAS.Actor
( sentinelActor
, Actor()
, ActorID
, ActorAppearance(..)
-- * Appearance, position, AI
, appearance
, position
, actorName
, ai
-- * Hit points
, hurt
, actorHitPoints
, emp... | Noeda/rwpas | src/RWPAS/Actor.hs | Haskell | mit | 2,485 |
module Nifty.BEB where
import Nifty.Message
import Control.Exception
import Network.Socket hiding (send)
import Network.Socket.ByteString (sendAll)
import qualified Data.ByteString as L
broadcastOnce :: (L.ByteString, L.ByteString) -- (message content, history)
... | adizere/nifty-urb | src/Nifty/BEB.hs | Haskell | mit | 1,017 |
-- Unsafe functions
-- ref: https://wiki.haskell.org/Unsafe_functions
unsafePerformIO :: IO a -> a
unsafeInterleaveIO :: IO a -> IO a
unsafeInterleaveST :: ST s a -> ST s a
unsafeIOToST :: IO a -> ST s a
unsafeIOToSTM :: IO a -> STM a
unsafeFreeze, unsafeThaw
unsafeCoerce# :: a -> b
seq :: a -> b -> b
-- Unsafe funct... | Airtnp/Freshman_Simple_Haskell_Lib | Idioms/Unsafe-functions.hs | Haskell | mit | 687 |
-----------------------------------------------------------------------------
-- |
-- Module : Algebra.Graph.Test.Graph
-- Copyright : (c) Andrey Mokhov 2016-2022
-- License : MIT (see the file LICENSE)
-- Maintainer : andrey.mokhov@gmail.com
-- Stability : experimental
--
-- Testsuite for "Algebra.Graph" and ... | snowleopard/alga | test/Algebra/Graph/Test/Graph.hs | Haskell | mit | 6,109 |
{-# LANGUAGE OverloadedStrings #-}
module Config.Internal.RabbitMQ
( RabbitMQConfig (..)
, readRabbitMQConfig
) where
import Data.Text (Text, pack)
import System.Environment (getEnv)
data RabbitMQConfig =
RabbitMQConfig { getHost :: Text
, getPath :: Text
, getUser :: Text
... | gust/feature-creature | legacy/lib/Config/Internal/RabbitMQ.hs | Haskell | mit | 808 |
import Text.Parsec
import Text.Parsec.String
import Data.Maybe (fromJust)
value :: Char -> Int
value c = fromJust . lookup c $ [
('I', 1),
('V', 5),
('X', 10),
('L', 50),
('C', 100),
('D', 500),
('M', 1000)]
single :: Char -> Parser Int
single c = do
x <- many (char c)
return $ len... | Russell91/roman | 09.hs | Haskell | mit | 981 |
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE RankNTypes, GADTs #-}
-- This module requires GHC 8 to compile.
module Lang where
import Common
import DataDynamic
-- | This module defines a simple untyped language using the Dynamic module.
-- =========================================================================... | plclub/cis670-16fa | projects/DynamicLang/src/Lang.hs | Haskell | mit | 2,007 |
module Minibas.Util (
totalScore
, quarterUrls
, buildScoreData
, buildGameData
, buildGameData'
) where
import Import
import Control.Lens ((^.))
import qualified Data.List as L (foldl, sortOn, (!!))
import qualified Data.Map as M (Map, lookup)
import Data.Maybe (fromJust)
import ... | jabaraster/minibas-web | Minibas/Util.hs | Haskell | mit | 4,054 |
{-# Language TemplateHaskell #-}
module Labyrinth.Move where
import Control.Lens hiding (Action)
import Labyrinth.Map
data MoveDirection = Towards Direction | Next
deriving (Eq)
type ActionCondition = String
data Action = Go { _amdirection :: MoveDirection }
| Shoot { _asdirection :... | koterpillar/labyrinth | src/Labyrinth/Move.hs | Haskell | mit | 4,391 |
module Monad where
import Control.Monad.Except (ExceptT, runExceptT)
import Control.Monad.Reader (ReaderT, runReaderT)
import Text.Parsec (ParseError)
import Config.Types
-- | The base monad
type Sparker = ExceptT SparkError (ReaderT SparkConfig IO)
runSparker :: Spa... | badi/super-user-spark | src/Monad.hs | Haskell | mit | 757 |
{-# LANGUAGE OverloadedStrings #-}
module DarkSky.Client
( getForecast
, httpRequest
) where
import DarkSky.Request
import DarkSky.Response (Response)
import Data.ByteString.Char8 (pack)
import Network.HTTP.Simple as HTTP
getForecast :: DarkSky.Request.Request -> IO DarkSky.Response.Response
getForecast reques... | peterstuart/dark-sky | src/DarkSky/Client.hs | Haskell | mit | 739 |
{------------------------------------------------------------------------------
uPuppet: Main program
------------------------------------------------------------------------------}
import UPuppet.Errors
import UPuppet.Options
import UPuppet.CState
import UPuppet.AST
import UPuppet.Catalog
import UPuppet.Parser
i... | dcspaul/uPuppet | Src/uPuppet.hs | Haskell | mit | 2,694 |
module Control.Monad.Classes.Zoom where
import Control.Applicative
import Control.Monad
import Control.Monad.Trans.Class
import Control.Monad.Base
import Control.Monad.IO.Class
import Control.Monad.Trans.Control
import Control.Monad.Classes.Core
import Control.Monad.Classes.Effects
import Control.Monad.Classes.Reader
... | feuerbach/monad-classes | Control/Monad/Classes/Zoom.hs | Haskell | mit | 2,504 |
module Problem6 ( isPalindrome ) where
isPalindrome :: (Eq a) => [a] -> Bool
isPalindrome str = (reverse str) == str | chanind/haskell-99-problems | Problem6.hs | Haskell | mit | 117 |
{-# LANGUAGE PatternSynonyms, ForeignFunctionInterface, JavaScriptFFI #-}
module GHCJS.DOM.JSFFI.Generated.CSSFontFaceRule
(js_getStyle, getStyle, CSSFontFaceRule, castToCSSFontFaceRule,
gTypeCSSFontFaceRule)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, ... | plow-technologies/ghcjs-dom | src/GHCJS/DOM/JSFFI/Generated/CSSFontFaceRule.hs | Haskell | mit | 1,396 |
{-# LANGUAGE PackageImports #-}
import "tomato" Application (getApplicationDev)
import Network.Wai.Handler.Warp
(runSettings, defaultSettings, settingsPort)
import Control.Concurrent (forkIO)
import System.Directory (doesFileExist, removeFile)
import System.Exit (exitSuccess)
import Control.Concurrent (threadDelay)... | twopoint718/tomato | devel.hs | Haskell | bsd-2-clause | 700 |
{-# LANGUAGE Arrows #-}
module OSM.XML (parseXMLFile)
where
import Data.Int (Int64)
import Text.XML.HXT.Core
import qualified OSM
import qualified Data.Map.Strict as Map
import qualified Data.Text as T
tagElementToKeyValue :: ArrowXml t => t XmlTree (OSM.TagKey, T.Text)
tagElementToKeyValue = proc el -> do
key <- g... | kolen/ptwatch | src/OSM/XML.hs | Haskell | bsd-2-clause | 3,325 |
{-# LANGUAGE Arrows #-}
{-# LANGUAGE FlexibleContexts #-}
module Main where
import qualified QuickCheck
import Opaleye (Column, Nullable, Query, QueryArr, (.==), (.>))
import qualified Opaleye as O
import qualified Database.PostgreSQL.Simple as PGS
import qualified Data.Profunctor.Product.Default as D
imp... | benkolera/haskell-opaleye | Test/Test.hs | Haskell | bsd-3-clause | 22,190 |
{-# LANGUAGE CPP, ScopedTypeVariables, NoImplicitPrelude #-}
-- | Compatibility module to work around differences in the
-- types of functions between pandoc < 2.0 and pandoc >= 2.0.
module Text.CSL.Compat.Pandoc (
writeMarkdown,
writePlain,
writeNative,
writeHtmlString,
readNative,
readHtml,
readMarkdown... | jgm/pandoc-citeproc | compat/Text/CSL/Compat/Pandoc.hs | Haskell | bsd-3-clause | 3,016 |
module Main where
import System.IO
import System.Environment
import System.Exit
import Config
import Store
import Twitter
main :: IO ()
main = do
config <- getConfig
articles <- unpostedArticles def
let keys = twKeys
(cfg_consumer_key config)
(cfg_consumer_secret config)
(cf... | yunomu/nicodicbot | src/NdPost.hs | Haskell | bsd-3-clause | 687 |
module Codegen.Monad
(
) where
import Control.Monad.Trans.Class
import Control.Monad.Writer
import LLVM.General.AST
import Core.Unique
newtype GeneratorT m a = GeneratorT { runGeneratorT' :: WriterT [Definition] m a }
deriving (Functor, Applicative, Monad)
class MonadGenerator m wher... | abbradar/dnohs | src/Codegen/Monad.hs | Haskell | bsd-3-clause | 944 |
{-# LANGUAGE OverloadedStrings #-}
module Data.Text.ExtraTest (test_tests) where
import Elm.Utils ((|>))
import Test.Tasty
import Test.Tasty.HUnit
import Data.Text.Extra
test_tests :: TestTree
test_tests =
testGroup "Data.Text.ExtraTest"
[ testCase "when there is no span of the given character" $
l... | avh4/elm-format | avh4-lib/test/Data/Text/ExtraTest.hs | Haskell | bsd-3-clause | 704 |
module Main where
import Tkhs
import Parser
import System.Environment
import System.IO.UTF8 as U
import qualified Zipper
import Data.Maybe
main :: IO ()
main = getArgs >>= U.readFile . headOrUsage
>>= either (error . show)
(runP presentation . fromJust . Zipper.fromList . (++... | nonowarn/tkhs | src/Main.hs | Haskell | bsd-3-clause | 518 |
module Util.HTML.Attributes where
import Util.HTML
action, align, alt, autocomplete, background, border, charset, checked, _class, cols, colspan, content, enctype, for, height, href, http_equiv, _id, maxlength, method, name, placeholder, role, rows, rowspan, selected, size, src, style, tabindex, target, title, _type,... | johanneshilden/liquid-epsilon | Util/HTML/Attributes.hs | Haskell | bsd-3-clause | 1,642 |
module Main where
import System.Console.GetOpt
import System.Environment
import qualified TextUI as TUI
data Flag = Help
| Text TUI.Config
options :: [OptDescr Flag]
options =
[ Option ['?','h'] ["help"] (NoArg Help)
"Help message."
, Option ['t'] ["text"] (OptArg textConfig "uc")
... | sakhnik/FreeCell | Main.hs | Haskell | bsd-3-clause | 1,539 |
-- Copyright (c) 2011, Colin Hill
-- | Implementation of ridged multi-fractal noise.
--
-- Example of use:
--
-- @
--main = putStrLn (\"Noise value at (1, 2, 3): \" ++ show x)
-- where seed = 1
-- octaves = 5
-- scale = 0.005
-- frequency = 1
-- lacunarity = 2... | colinhect/hsnoise | src/Numeric/Noise/Ridged.hs | Haskell | bsd-3-clause | 2,686 |
import Debug.Trace
import Test.Hspec
import Test.Hspec.QuickCheck
import Test.QuickCheck
import Text.Unidecode
main :: IO ()
main = hspec spec
spec = describe "unidecode" $ do
it "doesn't hurt ascii text" $ do
unidecode 'a' `shouldBe` "a"
it "doesn't crash" $... | mwotton/unidecode | test/Spec.hs | Haskell | bsd-3-clause | 463 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiWayIf #-}
module Game.Monsters.MGladiator where
import Control.Lens (use, preuse, ix, (^.), (.=), (%=), zoom, (&), (.~), (%~))
import Control.Monad (when, unless, liftM, void)
import Data.Bits ((.&.), (.|.))
import Data.Maybe (isJust)
import Linear (V3(..), normaliz... | ksaveljev/hake-2 | src/Game/Monsters/MGladiator.hs | Haskell | bsd-3-clause | 19,821 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Graphics.Blank.DeviceContext where
import Control.Concurrent.STM
import Data.Set (Set)
import Data.Text.Lazy (Text, toStrict)
import Graphics.Blank.Events
import Graphics.Blank.JavaScript
i... | ku-fpg/blank-canvas | Graphics/Blank/DeviceContext.hs | Haskell | bsd-3-clause | 3,158 |
{-# LANGUAGE RecordWildCards #-}
module Day7 where
import Data.List
import Data.List.Split
data IP = IP
{ supernet :: [String]
, hypernet :: [String]
}
input :: IO String
input = readFile "day7"
parse :: String -> IP
parse s = IP (map head parts) (concatMap tail parts)
where
parts = chunksOf 2 $ ... | mbernat/aoc16-haskell | src/Day7.hs | Haskell | bsd-3-clause | 1,137 |
module Interpret
( interpret
)
where
import Ast
import Control.Monad.Trans.State
import Data.Map (Map)
import qualified Data.Map as M
import Control.Monad
import Control.Monad.IO.Class
import Control.Arrow (first)
interpret :: Program -> IO (Maybe String)
interpret p =
let ftab = buildFunctionTable p
... | davidpdrsn/alisp | src/Interpret.hs | Haskell | bsd-3-clause | 6,671 |
------------------------------------------------------------------------
-- |
-- Module : Data.CSV.BatchAverage
-- Copyright : (c) Amy de Buitléir 2014
-- License : BSD-style
-- Maintainer : amy@nualeargais.ie
-- Stability : experimental
-- Portability : portable
--
-- Groups the records of a CSV int... | mhwombat/amy-csv | src/Data/CSV/BatchAverage.hs | Haskell | bsd-3-clause | 1,433 |
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Ivory.ModelCheck.CVC4 where
import qualified Data.ByteString.Char8 as B
import Data.Int
import Data.List ... | Hodapp87/ivory | ivory-model-check/src/Ivory/ModelCheck/CVC4.hs | Haskell | bsd-3-clause | 11,945 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Typ... | Garygunn94/DFS | DirectoryServer/.stack-work/intero/intero16528ftM.hs | Haskell | bsd-3-clause | 9,535 |
{-# LANGUAGE OverloadedStrings #-}
-- |
module Main where
import Cache
import Commands
import qualified System.Process as P
import Options.Applicative
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Shelly (shelly, Sh, fromText, FilePath)
import Dat... | bergey/hscache | src/Main.hs | Haskell | bsd-3-clause | 2,821 |
module Problem37 where
import Prime
main :: IO ()
main = print . sum . take 11 . filter truncablePrime $ [11 ..]
truncablePrime :: Int -> Bool
truncablePrime n
| n < 10 = isPrimeNaive n
| otherwise = isPrimeNaive n && leftTruncablePrime n && rightTruncablePrime n
leftTruncablePrime :: Int -> Bool
leftTru... | adityagupta1089/Project-Euler-Haskell | src/problems/Problem37.hs | Haskell | bsd-3-clause | 609 |
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module Main where
import Control.Monad (mzero)
import Data.Aeson
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as BL
import Data.... | reactormonk/hoauth2 | example/Fitbit/test.hs | Haskell | bsd-3-clause | 3,662 |
{-# LANGUAGE BangPatterns, ScopedTypeVariables, RecordWildCards #-}
-- |
-- Module : AI.HNN.Recurrent.Network
-- Copyright : (c) 2012 Gatlin Johnson
-- License : LGPL
-- Maintainer : rokenrol@gmail.com
-- Stability : experimental
-- Portability : GHC
--
-- An implementation of recurrent neural netw... | fffej/hnn | AI/HNN/Recurrent/Network.hs | Haskell | bsd-3-clause | 4,375 |
{-
foo
bar
a) foo
foo
b) bar
bar
baa
-}
{-
foo
bar
* @foo
* @bar
baa
-}
{-
foo
bar
> foo
> bar
baa
-}
| itchyny/vim-haskell-indent | test/comment/list.out.hs | Haskell | mit | 126 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
-- Module: Gpg.EditKey
--
-- Edit keys with Gpg's interactive mode
module Gpg.EditKey where
import Control.Monad
import qualified Control.Exception as Ex
import Control.Applicative
import ... | Philonous/pontarius-gpg | src/Gpg/EditKey.hs | Haskell | mit | 2,786 |
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeOperators #-}
modu... | ababkin/qmuli | library/Qi/Program/SQS/Lang.hs | Haskell | mit | 1,453 |
-- | Specification for Pos.Chain.Ssc.GodTossing.Toss.Pure
module Test.Pos.Ssc.Toss.PureSpec
( spec
) where
import Universum
import qualified Crypto.Random as Rand
import Data.Default (def)
import Test.Hspec (Spec, describe)
import Test.Hspec.QuickCheck (modifyMax... | input-output-hk/pos-haskell-prototype | lib/test/Test/Pos/Ssc/Toss/PureSpec.hs | Haskell | mit | 5,450 |
--ProbabFP.hs
--Author: Chad Myles
--Date: 9/26/16
module Probab (
Dist,
unit,
uniformDist,
weightedDist,
toList,
mergeEqual,
possibilities,
probabilityOf,
adjoin,
distFil,
transform,
combine,
duplicate
) where
import Data.List
data Dist a = Dist [(a, Float)]
... | seabornloyalis/probabilistic-haskell | ProbabFP.hs | Haskell | mit | 3,417 |
module Main where
main :: IO ()
main = putStrLn "Hello, World!"
| nixdog/helloworld | haskell.hs | Haskell | apache-2.0 | 69 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, AutoDeriveTypeable, MagicHash,
ExistentialQuantification #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.IO.Excep... | green-haskell/ghc | libraries/base/GHC/IO/Exception.hs | Haskell | bsd-3-clause | 12,430 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, MagicHash, ImplicitParams #-}
{-# LANGUAGE RankNTypes, PolyKinds, DataKinds #-}
{-# OPTIONS_HADDOCK not-home #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.Err
-- Copyright : (c) The University... | sdiehl/ghc | libraries/base/GHC/Err.hs | Haskell | bsd-3-clause | 3,686 |
{-# OPTIONS_GHC -funbox-strict-fields #-}
module RestyScript.Emitter.Stats (
Stats,
emit,
emitJSON
) where
import RestyScript.AST
import Text.JSON
data Stats = Stats {
modelList :: ![String], funcList :: ![String],
selectedMax :: !Int, joinedMax :: !Int,
comparedCount :: !Int, queryCount :: !... | beni55/old-openresty | haskell/src/RestyScript/Emitter/Stats.hs | Haskell | bsd-3-clause | 2,506 |
{- $Id: AFRPTestsSwitch.hs,v 1.2 2003/11/10 21:28:58 antony Exp $
******************************************************************************
* A F R P *
* *
* Module: ... | meimisaki/Yampa | tests/AFRPTestsSwitch.hs | Haskell | bsd-3-clause | 7,509 |
-------------------------------------------------------------------------
--
-- QCStoreTest.hs
--
-- QuickCheck tests for stores. --
-- (c) Addison-Wesley, 1996-2011.
--
-------------------------------------------------------------------------
module QCStoreTest wh... | c089/haskell-craft3e | Chapter16/QCStoreTest.hs | Haskell | mit | 707 |
{-# LANGUAGE PatternGuards, CPP, ForeignFunctionInterface #-}
-----------------------------------------------------------------------------
--
-- (c) The University of Glasgow 2004-2009.
--
-- Package management tool
--
-----------------------------------------------------------------------------
module HastePkg708 (m... | szatkus/haste-compiler | utils/haste-pkg/HastePkg708.hs | Haskell | bsd-3-clause | 72,226 |
{-# LANGUAGE TemplateHaskell, TypeFamilies, PolyKinds #-}
module T9692 where
import Data.Kind (Type)
import Language.Haskell.TH hiding (Type)
import Language.Haskell.TH.Syntax hiding (Type)
import Language.Haskell.TH.Ppr
import System.IO
class C a where
data F a (b :: k) :: Type
instance C Int where
... | sdiehl/ghc | testsuite/tests/th/T9692.hs | Haskell | bsd-3-clause | 460 |
#!/usr/bin/env runhaskell
{-|
This Haskell script prints a random quote from my quote
collection in `data/finished.yaml`.
I email myself quotes every few days with a cron job piping
the output of this to a command-line mailing program (mutt).
Appropriate packages can be installed with `cabal`.
Brandon Amos
http://b... | BIPOC-Books/BIPOC-Books.github.io | scripts/random-quote.hs | Haskell | mit | 2,086 |
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude, DeriveDataTypeable, MagicHash #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
{-# OPTIONS_HADDOCK hide #-}
-----------------------------------------------------------------------------
-- |
-- Module : GHC.IO.Exception
-- Copyright : (c) The Universit... | beni55/haste-compiler | libraries/ghc-7.8/base/GHC/IO/Exception.hs | Haskell | bsd-3-clause | 11,036 |
{-# LANGUAGE GADTs #-}
module CmmSink (
cmmSink
) where
import Cmm
import CmmOpt
import BlockId
import CmmLive
import CmmUtils
import Hoopl
import CodeGen.Platform
import Platform (isARM, platformArch)
import DynFlags
import UniqFM
import PprCmm ()
import Data.List (partition)
import qualified Data.Set as Set... | urbanslug/ghc | compiler/cmm/CmmSink.hs | Haskell | bsd-3-clause | 29,851 |
module Models.Task where
import Control.Monad.IO.Class (MonadIO, liftIO)
import Control.Monad.Logger (NoLoggingT, runNoLoggingT)
import Control.Monad.Trans.Resource (ResourceT, runResourceT)
import Data.Text (Text)
import Data.Time (UTCTime)
import Database.Persist (Entity, Key, SelectOpt(LimitTo), (=.), deleteWhere, ... | quephird/todo.hs | src/Models/Task.hs | Haskell | mit | 1,563 |
module Logic.Data.Units where
import Logic.Types
import qualified Data.Map as Map
import Control.Lens
unitsBase :: Map.Map UnitType UnitData
unitsBase = Map.fromList [
(UnitType 1, marine)
]
marine = UnitData {
_maxHp = 50,
_attackValue = 8,
_attackSpeed = 0.5,
_movementSpeed =... | HarvestGame/logic-prototype | src/Logic/Data/Units.hs | Haskell | mit | 331 |
--
--
--
------------------
-- Exercise 13.24.
------------------
--
--
--
module E'13'24 where
| pascal-knodel/haskell-craft | Chapter 13/E'13'24.hs | Haskell | mit | 106 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
-- | Copyright 2014-2015 Anchor Systems, Pty Ltd and Others
--
-- The code in this file, and the program it is a part of, is
-- made available to you by its authors as open source software:
-- you can redistribute it and/or modify it under the terms... | anchor/borel | lib/Borel/Types/Result.hs | Haskell | mit | 2,690 |
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{- |
Module : Orville.PostgreSQL.Expr.Where.ValueExpression
Copyright : Flipstone Technology Partners 2016-2021
License : MIT
-}
module Orville.PostgreSQL.Internal.Expr.ValueExpression
( ValueExpression,
columnReference,
valueExpression,
rowValueConstructo... | flipstone/orville | orville-postgresql-libpq/src/Orville/PostgreSQL/Internal/Expr/ValueExpression.hs | Haskell | mit | 1,066 |
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
-- |
-- Module: Network.SIP.Parser.ResponseLine
-- Description: Response line parser.
-- Copyright: Copyright (c) 2015-2016 Jan Sipr
-- License: MIT
module Network.SIP.Parser.ResponseLine
( firstLineParser
)
where
import Con... | Siprj/ragnarok | src/Network/SIP/Parser/ResponseLine.hs | Haskell | mit | 2,017 |
-- Copyright (C) 2014 Google Inc. All rights reserved.
--
-- Licensed under the Apache License, Version 2.0 (the "License"); you may not
-- use this file except in compliance with the License. You may obtain a copy
-- of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable... | MostAwesomeDude/gemstone | Gemstone/Maths.hs | Haskell | mit | 739 |
a = fmap (+1) $ read "[1]" :: [Int]
b = (fmap . fmap) (++ "lol") (Just ["Hi,","Hello"])
-- same as (*2) . (\x -> x - 2)
c = fmap (*2) (\x -> x - 2)
d = fmap ((return '1'++) . show) (\x -> [x,1..3])
e :: IO Integer
e = let ioi = readIO "1" :: IO Integer
--changed = fmap read $ fmap ("123"++) $ fmap show ioi... | JustinUnger/haskell-book | ch16/functor-ex1.hs | Haskell | mit | 399 |
{--
Copyright (c) 2012 Gorka Suárez García
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, distri... | gorkinovich/Haskell | Others/Primes.hs | Haskell | mit | 1,751 |
{-# htermination (compareChar :: Char -> Char -> Ordering) #-}
import qualified Prelude
data MyBool = MyTrue | MyFalse
data List a = Cons a (List a) | Nil
data Char = Char MyInt ;
data MyInt = Pos Nat | Neg Nat ;
data Nat = Succ Nat | Zero ;
data Ordering = LT | EQ | GT ;
primCmpNat :: Nat -> Nat -> ... | ComputationWithBoundedResources/ara-inference | doc/tpdb_trs/Haskell/basic_haskell/compare_4.hs | Haskell | mit | 993 |
module SSH.Key
( KeyBox
, PublicKey(..)
, PrivateKey(..)
, parseKey
, serialiseKey
, publicKeys
, privateKeys
, putPublicKey
) where
import Control.Applicative ((<$>), (<*>))
import Control.Monad (unless, replicateM)
import Da... | mithrandi/ssh-key-generator | SSH/Key.hs | Haskell | mit | 4,843 |
-- | Traversing mutable vectors.
module Data.Vector.Generic.Mutable.Loops where
import Control.Monad.Primitive
import Data.Vector.Generic.Mutable as MG
type Loop m v a = v (PrimState m) a -> (a -> m ()) -> m ()
type ILoop m v a = v (PrimState m) a -> (Int -> a -> m ()) -> m ()
{-# INLINE iForM_ #-}
iForM_ :: (MG.MVe... | Lysxia/twentyseven | src/Data/Vector/Generic/Mutable/Loops.hs | Haskell | mit | 645 |
module Main ( main ) where
import OpenGLRenderer
import Utils
import Utils.GL
import Tiles
import Tiles.Renderer
import TestTiles as TT
import TestRenderer
import Data.Map (fromList)
import Data.IORef
import Graphics.UI.GLUT hiding (Point)
player1 = Owner "1" "xxPLAYERxx"
player2 = Owner "2" "__player__"
coords :... | fehu/hgt | tiles-test/src/Main.hs | Haskell | mit | 4,728 |
{-
-- LoGoff system
-}
module Logoff where
import Datatypes
import Data.Maybe
{------------------------------------------------------------------------------}
-- Axiom block
{------------------------------------------------------------------------------}
-- isAx verifies if a sequent is an Ax-type axiom
isAx :: Sequ... | DrSLDR/logoff | src/Logoff.hs | Haskell | mit | 20,224 |
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TupleSections #-}
-- | http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-elasticmapreduce-instancegroupconfig-scalingaction.html
module Stratosphere.ResourceProperties.EMRInstanceGro... | frontrowed/stratosphere | library-gen/Stratosphere/ResourceProperties/EMRInstanceGroupConfigScalingAction.hs | Haskell | mit | 2,841 |
{-
Copyright 2020 The CodeWorld Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicab... | google/codeworld | codeworld-auth/src/CodeWorld/Auth/Token.hs | Haskell | apache-2.0 | 5,737 |
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE RecordWildCards #-}
import Data.List
import Data.Maybe
import Data.Char
hypotenuse a b = sqrt(a^2 + b^2)
--Conditionals --
identifyCamel humps = if humps == 1
then "Dromeday"
else "Bactrian"
--Recursive Function --
increasing :: (Ord a) => [a] -> Bool
incr... | hungaikev/learning-haskell | Hello.hs | Haskell | apache-2.0 | 5,386 |
{-# LANGUAGE DeriveGeneric, StandaloneDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Main (main) where
import Control.Applicative ((<|>))
import Control.Exception (IOException, catch)
import Control.Monad (when)
import Data.Foldable (traverse_)
import Data.List (foldl')
import Data.Traversable (for)
import ... | haskell/haddock | haddock-library/fixtures/Fixtures.hs | Haskell | bsd-2-clause | 4,689 |
module NLP.Tools.Convenience (smap) where
smap :: (b -> c) -> (a, b) -> (a, c)
smap f (a,b) = (a,f b)
| RoboNickBot/nlp-tools | src/NLP/Tools/Convenience.hs | Haskell | bsd-2-clause | 103 |
{-# LANGUAGE StandaloneDeriving, TemplateHaskell, FlexibleContexts, DeriveTraversable #-}
import Data.StructuralTraversal.Class
import Data.StructuralTraversal.Instances
import Data.StructuralTraversal.TH
import Data.StructuralTraversal.Indexing
import Data.Traversable
import Control.Applicative
import Control.Monad.W... | nboldi/structural-traversal | test/Example.hs | Haskell | bsd-3-clause | 3,371 |
{-# LANGUAGE CPP #-}
-- | Paths, host bitness and other environmental information about Haste.
module Haste.Environment (
hasteSysDir, jsmodSysDir, hasteInstSysDir, pkgSysDir, pkgSysLibDir, jsDir,
hasteUserDir, jsmodUserDir, hasteInstUserDir, pkgUserDir, pkgUserLibDir,
hostWordSize, ghcLibDir,
ghcBinary, ghcPkg... | joelburget/haste-compiler | src/Haste/Environment.hs | Haskell | bsd-3-clause | 4,455 |
{-# LANGUAGE OverloadedStrings #-}
module Fragment (
readFragment, writeFragment, fragmentUpdateHash,
TlsIo, evalTlsIo, liftIO, throwError, readCached, randomByteString,
Partner(..),
setVersion, setClientRandom, setServerRandom,
getClientRandom, getServerRandom, getCipherSuite,
cacheCipherSuite, flushCipherSui... | YoshikuniJujo/forest | subprojects/tls-analysis/client/Fragment.hs | Haskell | bsd-3-clause | 1,602 |
{-# LANGUAGE TupleSections, OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies, RecordWildCards,
DeriveGeneric ,MultiParamTypeClasses ,FlexibleInstances #-}
module Protocol.ROC.PointTypes.PointType17 where
import GHC.Generics
import qualified Data.ByteString as BS
import Data.Word
import Data... | jqpeterson/roc-translator | src/Protocol/ROC/PointTypes/PointType17.hs | Haskell | bsd-3-clause | 3,881 |
module Metrics.RegexTiming(timingRegex2) where
import Metrics.Common
import qualified Data.ByteString.Lazy.Char8 as B
import Text.Regex.Base.RegexLike (matchAllText, MatchText)
import Text.Regex.PCRE.ByteString.Lazy
import qualified Data.Map as M
import Data.Array ... | zsol/hlogster | Metrics/RegexTiming.hs | Haskell | bsd-3-clause | 2,336 |
module Main where
import Control.Concurrent (forkIO)
import Control.Concurrent.Async
import Control.Monad.IO.Class
import Control.Monad.Trans.Resource
import Data.Conduit (Sink, Conduit, Source, await, awaitForever, yield)
import Data.Conduit.Async
import qualified Data.Conduit.Combinators as DCC
import Data.Conduit.Fi... | sweeks-imvu/bullshit | src/Main.hs | Haskell | bsd-3-clause | 2,126 |
{-# LANGUAGE CPP, NoImplicitPrelude, FlexibleContexts #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Safe #-}
#endif
-------------------------------------------------------------------------------
-- |
-- Module : System.Timeout.Lifted
-- Copyright : (c) The University of Glasgow 2007
-- License : BSD-... | basvandijk/lifted-base | System/Timeout/Lifted.hs | Haskell | bsd-3-clause | 1,610 |
{-# LANGUAGE ConstraintKinds, FlexibleContexts, RankNTypes, OverloadedStrings #-}
{-# LANGUAGE UndecidableInstances, ScopedTypeVariables, AllowAmbiguousTypes #-}
-----------------------------------------------------------------------------------------------------
------------------------------------------------------... | lingxiao/GoodGreatIntensity | src/Score.hs | Haskell | bsd-3-clause | 2,707 |
module Graphics where
import Prelude
import FPPrac.Graphics
import System.FilePath (splitPath, dropExtension)
data Thickness = Thin | Thick
deriving (Eq,Show)
alphabet = ['a'..'z']
type Node = (Char,Color,Point)
type Edge = (Char,Char,Color,Int)
data Graph = Graph
{ name :: String
, directed :: Bool
... | christiaanb/fpprac | examples/Graphics.hs | Haskell | bsd-3-clause | 8,201 |
module Logging
( logInfo
, logDebug
, logError
)
where
import Control.Monad ( when )
import Data.Monoid ( (<>) )
import Data.Time
import Lens.Simple ( (^.) )
import qualified Configuration as C
getT... | rumblesan/proviz | src/Logging.hs | Haskell | bsd-3-clause | 780 |
module Sex
( Sex (..)
) where
data Sex = M | F deriving (Eq, Show, Ord)
| satai/FrozenBeagle | Simulation/Lib/src/Sex.hs | Haskell | bsd-3-clause | 81 |
{-# LANGUAGE TypeSynonymInstances #-}
--
-- IO.hs
--
-- Basic input and output of expressions.
--
-- Gregory Wright, 22 April 2011
--
module Math.Symbolic.Wheeler.IO where
import Control.Monad.Identity
import Text.Parsec
import Text.Parsec.Expr as Ex
import Text.Parsec.Language
import Text.Parsec.String
import quali... | gwright83/Wheeler | src/Math/Symbolic/Wheeler/IO.hs | Haskell | bsd-3-clause | 5,099 |
{-# LANGUAGE QuasiQuotes #-}
module Main where
import Test.Hspec
import Test.QuickCheck
import Test.QuickCheck.Instances
import Data.Aeson as A
import qualified Data.Text as T
import qualified Data.Bson as B
import Text.RawString.QQ
import Data.Maybe
import Data.Either
import Transfuser.Lib
import Transfuser.Types
... | stephenpascoe/mongo-sql | test/Spec.hs | Haskell | bsd-3-clause | 2,384 |
{-# OPTIONS_HADDOCK hide #-}
{-# LANGUAGE ExistentialQuantification #-}
module Network.TLS.Crypto
( HashContext
, HashCtx
, hashInit
, hashUpdate
, hashUpdateSSL
, hashFinal
, module Network.TLS.Crypto.DH
, module Network.TLS.Crypto.ECDH
-- * Hash
, hash
, Hash(..)
, ha... | AaronFriel/hs-tls | core/Network/TLS/Crypto.hs | Haskell | bsd-3-clause | 7,539 |
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE QuasiQuotes #-}
-- | Main entry point to hindent.
--
-- hindent
module Main where
import HIndent
import HIndent.Types
import Control.Applicative
import Control.Applica... | adamse/hindent | src/main/Main.hs | Haskell | bsd-3-clause | 3,616 |
module Types.Common
( sanitizeUserText
, sanitizeUserText'
, sanitizeChar
)
where
import Prelude ()
import Prelude.MH
import qualified Data.Text as T
import Network.Mattermost.Types ( UserText, unsafeUserText )
sanitizeUserText :: UserText -> T.Text
sanitizeUserText = sanitizeUserText' . unsafeUserText
san... | aisamanra/matterhorn | src/Types/Common.hs | Haskell | bsd-3-clause | 550 |
-- 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 #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NoRebindableSyntax #-}
module Duckling.Nu... | facebookincubator/duckling | Duckling/Numeral/AR/EG/Rules.hs | Haskell | bsd-3-clause | 6,691 |
{-
n! means n × (n − 1) × ... × 3 × 2 × 1
For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.
Find the sum of the digits in the number 100!
-}
import Data.Char
fact :: Integer -> Integer
fact n = product [1..n]
digit_sum :: Int
digit... | bgwines/project-euler | src/solved/problem20.hs | Haskell | bsd-3-clause | 433 |
module Bounded where
import Base
instance Bounded () where
minBound = ()
maxBound = ()
instance (Bounded a, Bounded b) => Bounded (a,b) where
minBound = (minBound, minBound)
maxBound = (maxBound, maxBound)
instance (Bounded a, Bounded b, Bounded c) => Bounded (a,b,c) where
minBound = (minBound,... | rodrigogribeiro/mptc | src/Libs/Bounded.hs | Haskell | bsd-3-clause | 1,366 |
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import Control.Concurrent
import System.IO
import Text.XML.Pipe
import Network
import HttpPullSv
main :: IO ()
main = do
soc <- listenOn $ PortNumber 80
forever $ do
(h, _, _) <- accept soc
void . forkIO $ testPusher
(undefined :: HttpPullSv Handle) (O... | YoshikuniJujo/forest | subprojects/xml-push/testHttpPullSv.hs | Haskell | bsd-3-clause | 495 |
{-# LANGUAGE ForeignFunctionInterface #-}
{-# CFILES csrc/gsl_interp.c #-}
-- | Cubic-spline interpolation (natural boundary conditions) with the GNU Scientific Library
--
-- All @Double@ @Vector@ types are @Unboxed@ - conversion to @Storable@ @CDouble@ is performed internally.
--
-- TODO: Possible improvements includ... | swfrench/GSLInterp | src/Math/GSLInterp.hs | Haskell | bsd-3-clause | 5,691 |
{-#LANGUAGE TemplateHaskell #-}
module Parser.Rename
(runRename)
where
import Data.DataType
import Control.Lens
import qualified Data.Map.Strict as M
import Control.Monad.State
import Control.Monad.Except
data Buffer = Buffer { _counter :: Int
, _upper :: M.Map String Int
, _current :: M.Map String Int
, _v... | jyh1/mini | src/Parser/Rename.hs | Haskell | bsd-3-clause | 2,846 |
module Watch.Spew where
import Data.Foldable
import Data.List.NonEmpty
import qualified Data.Map as M
import System.Console.ANSI
import System.FilePath
import System.FilePath.Glob
import Watch.Types
showConcerns :: Refs -> IO ()
showConcerns cMap =
forM_ (M.toList cMap) $ \ (file, d :| ds) -> do
setSGR [S... | pikajude/src-watch | src/Watch/Spew.hs | Haskell | bsd-3-clause | 601 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.