lang stringclasses 10
values | seed stringlengths 5 2.12k |
|---|---|
haskell | it "returns '3efbe78a8d82f29979031a4aa0b16a9d' for the input '1,2,3'" $ do
Day10.solve2 "1,2,3" `shouldBe` "3efbe78a8d82f29979031a4aa0b16a9d"
it "returns '63960835bcdc130f0b66d7ff4f6a5a8e' for the input '1,2,4'" $ do
Day10.solve2 "1,2,4" `shouldBe` "63960835bcdc130f0b66d7ff4f6a5a8e" |
haskell | range1 = [1..20]
range2 = ['a'..'z']
range3 = [2, 4 .. 20]
range4 = [3, 6..20]
range5 = [0.1,0.3..1]
--infinite list
--first 100 multiples of 13
take' = take 100 [13, 26..]
--cycle create infinite list
lol = take 12 (cycle "LOL")
repeat' = take 3 (repeat "1") |
haskell | module Builtin.Misc where
import Enum.Misc
minGatherRate :: Mineral
minGatherRate = 0.8
gasGatherRate :: Vespene
gasGatherRate = 0.8
|
haskell | instance Ord1 Var where
liftCompare :: (a -> b -> Ordering) -> Var a -> Var b -> Ordering
liftCompare cmp (FVar a) (FVar b) = a `cmp` b
liftCompare _ (BVar n) (BVar m) = n `compare` m
liftCompare _ FVar{} BVar{} = LT
liftCompare _ BVar{} FVar{} = GT
-- | Scope, optimizing 'lift'. Acce... |
haskell | module Fomorian.OpenGL.GLBoundThread where
import Control.Concurrent
import Control.Concurrent.STM
import Control.Exception |
haskell | | otherwise = False
main = do
x <- getLine
y <- getLine
let m = (read x :: Int)
let n = (read y :: Int)
print("Coprimos = " ++ (show (coprimos m n))) |
haskell | , isPerfectSquare csqr
, let c = floorSqrt csqr ]
-- | Generate ordered Pythagorean Triples lexiconically ordered
pythagTriplesOrdered2 :: [Triple]
pythagTriplesOrdered2 = [ (a, b, c) |
b <- [4 .. ]
, a <- [(floorSqrt $ 2*b + 1) .. b - 1]
, gcd b a == 1
, let csqr = a*a + b*b
, isPerfectS... |
haskell | , "not"
, "and"
, "or"
, "as"
]
, Token.reservedOpNames = ["+", "-", "*", "/", "="
... |
haskell | import SrcLoc (SrcSpan, )
import SysTools (initSysTools, )
import Data.Dynamic (Typeable, fromDynamic, )
import Data.IORef (newIORef, )
initGHC :: FilePath -> IO Session
initGHC pkgDir =
do s <- newSession' CompManager (Just pkgDir)
modifySessionDynFlags s (\dflags -> dflags{ hscTarget = HscInterpreted })... |
haskell | import qualified DocumentExamples as DE
import qualified GHC.Spec as GHC
#endif
main :: IO ()
main = do |
haskell |
module Version (CurrentFormat, parseCurrentFormat, pprintCurrentFormat, versionNumber, versionYeganesh, versionStrip) where
import Control.Monad (liftM2)
import Data.Char (isSpace)
import Data.Map (Map, assocs, elems, empty, fromList)
import Data.Time (UTCTime, getCurrentTime)
import Data.Version (showVersion)
import... |
haskell | transformerMLP TransformerMLP {..} train input =
residual f (pure . forward ln) input
where
f x =
dropoutForward dropout1 train
. forward linear1
=<< dropoutForward dropout0 train
. relu
. forward linear0
=<< pure x
instance
( All KnownNat '[embedDim, ffnDim]... |
haskell |
(-%) :: Int64 -> Int64 -> Int64
(-%) a b = modd (modd a - modd b + modNum)
infixl 6 -%
(*%) :: Int64 -> Int64 -> Int64
(*%) a b = modd (modd a * modd b)
infixl 7 *%
-- usable only if modNum is prime
(/%) :: Int64 -> Int64 -> Int64 |
haskell | module A2 where
import D2 hiding (f)
main = sumFun [1..4]
|
haskell | <gh_stars>1-10
module Data.Wright.CIE.DeltaE.CIE2000 (cie2000) where
import Data.Wright.Colour (Colour(..))
import Data.Wright.Types (Model, ℝ)
cie2000 :: Colour a => Model -> a ℝ -> a ℝ -> ℝ
cie2000 = undefined
|
haskell | then concatPrimes ps ns
else concatPrimes (ps ++ [n]) ns
nPrimesImpl :: [Integer] -> Int -> Integer -> Integer -> [Integer]
nPrimesImpl ps n x blockSize
| length ps >= n = ps
| otherwise = nPrimesImpl ps' n (x + blockSize + 1) blockSize
wh... |
haskell |
-- Modes
-- | A mode, when run, extracts from an action, a value and a new mode to be used as the next action.
newtype Mode' m a = Mode {
runMode :: m (a, Mode' m a) -- ^ The inverse of 'toMode'; converts a mode to the value and future mode pair.
} deriving (Functor)
-- | Convert an @m (a, Mode' m a)@ to @Mode'@... |
haskell | readField field raw >>= C.parse
-- | Set the struct's anonymous union to the given variant, with the
-- supplied value as its argument. Not applicable for variants whose
-- argument is a group; use 'initVariant' instead.
setVariant
:: forall a b m s.
( F.HasUnion a
, U.RWCtx m s
) => F.Variant 'F.S... |
haskell | (5 :: Int) ./ False ./ 'Y' ./ Just 'O' ./ (6 :: Int) ./ Just 'A' ./ nil
it "has getter for multiple fields using 'select'" $ do
let x = (5 :: Int) ./ False ./ 'X' ./ Just 'O' ./ nil
select @'[Int, Maybe Char] x `shouldBe` (5 :: Int) ./ Just 'O' ./ nil
it "has ge... |
haskell |
theTreeId :: UUID
theTreeId = $(UUID.liftName "theTree")
theTreeRef :: Ref GTree
theTreeRef = Ref theTreeId [] |
haskell | newtype State =
State Int
deriving (Show, Eq)
getInitialState :: State
getInitialState = State 0
|
haskell | import Graphics.Rendering.OpenGL.Raw (GLfloat, GLint)
import Engine.Mesh.Mesh (Mesh(..), createMesh)
import Engine.Graphics.Textures (juicyLoadTexture)
loadDatModel :: FilePath -> FilePath -> FilePath -> IO Mesh
loadDatModel f vert frag =
let attrNames = ["position", "texCoord", "normal", "color", "textureId"] |
haskell | k <- symbol
char '=' >> skip
v <- parseEntity
return (k, v)
parseList :: IO [Entity]
parseList = do
char '[' >> skip
vs <- many parseEntity |
haskell | module Main where
import Aws.Lambda
import qualified Lib
-- This action is run on each cold start, and the context returned |
haskell | ( someFunc
) where
import Part2.Problem60
someFunc :: IO ()
someFunc = print problem60 |
haskell | -- |
-- Configuration and state of the component.
--
-- /tag/ is required for identifying the type instance of 'Event'.
--
data Storage tag = Storage Config (MVar State)
-- |
-- Configuration of the component.
--
-- TODO: to implement.
--
data Config |
haskell | import qualified Data.Text.Encoding as B
import qualified Data.ByteString as C
basicCredentials :: ByteString -> Either Text (Text, Text)
basicCredentials =
dropPrefix >=> decodeBase64 >=> decodeText >=> splitText
where
dropPrefix =
maybe (Left "Not a basic authorization") Right .
C.stripPrefix "B... |
haskell | import Todo.QuickCheck ()
import Todo.Web
spec :: Spec
spec = validateEveryToJSON $ Proxy @TodoApi |
haskell | <gh_stars>0
-- {-# OPTIONS_GHC -Wall #-}
module App where
import Graphics.Gloss
import Graphics.Gloss.Data.ViewPort
-- import Graphics.Gloss.Interface.IO.Interact
import Graphics.Gloss.Interface.IO.Game
import Canvas
import Objects
type State = Float
|
haskell | import qualified Data.Model
data Either a b = Left a
| Right b
deriving (Prelude.Eq, Prelude.Ord, Prelude.Show, GHC.Generics.Generic, Flat.Flat)
instance ( Data.Model.Model a,Data.Model.Model b ) => Data.Model.Model ( Either a b )
|
haskell | Identity "s0" (ParameterRef 0) (RefType "java.lang.String"),
Invoke (SpecialInvoke "r0" throwableInitSignature [Local "s0"]),
Return Nothing
],
catchClauses = []
}
}
classCastExceptionFile :: CompilationUnit
classCastExceptionFile = CompilationUnit {
fileModifiers = [Public],
fileType =... |
haskell | #if __GLASGOW_HASKELL__ < 802
import Data.Monoid
#endif
mssqlCtx :: [(C.CIdentifier, TypeQ)] -> C.Context
mssqlCtx types = C.baseCtx <> C.bsCtx <> C.funCtx <> C.fptrCtx <> C.vecCtx <> mssqlCtx'
where
mssqlCtx' = mempty
{ ctxTypesTable = mssqlTypesTable types |
haskell | af_join_many :: Ptr AFArray -> CInt -> CUInt -> Ptr AFArray -> IO AFErr
foreign import ccall unsafe "af_tile"
af_tile :: Ptr AFArray -> AFArray -> CUInt -> CUInt -> CUInt -> CUInt -> IO AFErr
foreign import ccall unsafe "af_reorder"
af_reorder :: Ptr AFArray -> AFArray -> CUInt -> CUInt -> CUInt -> CUInt ->... |
haskell |
peelAnns :: ModGuts -> CoreBndr -> CoreM [Peel]
peelAnns = annotationsOn
unrollAnns :: ModGuts -> CoreBndr -> CoreM [Unroll]
unrollAnns = annotationsOn
annotationsOn :: Data a => ModGuts -> CoreBndr -> CoreM [a] |
haskell | module Modules.Modules.Modules.Modules.Modules.Modules.M443 () where
|
haskell | yield len
return rest
let warc :: Warc IO ()
warc = parseWarc (PBS.fromHandle stdin)
runEffect $ do
rest <- produceRecords docLength warc >-> PP.mapM_ (liftIO . print)
-- print the leftovers
rest >-> PBS.toHandle stdout |
haskell |
matchByteCondition :: ByteCondition -> Word8 -> Bool
matchByteCondition b byte =
go (byteCondition b)
where
go l =
case l of
[] -> False |
haskell |
import qualified Data.ByteString.Char8 as BC (ByteString)
import Data.Time (ZonedTime)
import Data.Word (Word8)
import Web.UAParser (OSResult, UAResult) |
haskell | --
-- features of a basic value
-- at least Int's and Bool's
-- must be representable in the machine
class BasicValue v where
asInt :: Prism' v Int
asBool :: Prism' v Bool
asBool = asInt . intBool
-- -------------------- |
haskell | -- License : BSD-style (see the file LICENSE)
-- Author : <NAME> <<EMAIL>>
--
-- Store and manipulate debugging output.
-----------------------------------------------------------------------------
module Hburg.Debug (
-- Types
Level(..),Entry,
-- Functions
new, filter, format,
) where |
haskell | in
x ++ (pair as b)
cmp (a,b) (c,d) = compare (a+b) (c+d)
search _ [] = [] |
haskell |
getLoadAvg :: RemuxM LoadAvg
getLoadAvg = do
text <- readShell (cmd "cat /proc/loadavg")
-- let loadAvg = do
-- last1 <- double |
haskell | instance MonadSample Gen where
randomWord = choose
-- Transformer instances
instance MonadSample m => MonadSample (IdentityT m) where randomWord = lift . randomWord
instance MonadSample m => MonadSample (ReaderT r m) where randomWord = lift . randomWord
instance MonadS... |
haskell |
instance CryptoHash SHA512 where
hashBlob = defaultHash @Crypto.SHA512
hashLazyBlob = defaultLazyHash @Crypto.SHA512
hashAlgorithmName = "SHA512"
instance CryptoHMAC SHA512 where
hmac = defaultHMAC @Crypto.SHA512
|
haskell | <gh_stars>10-100
module Flora.Import.Categories where
import Control.Monad.IO.Class
import qualified Data.Text.IO as T
import Database.PostgreSQL.Transact
import Flora.Import.Categories.Tuning as Tuning
import Flora.Model.Category.Types (Category, mkCategory, mkCategoryId) |
haskell | computeS .
extend (Z :. (1 :: Int) :. All :. All) .
makeFilter2DInverse .
fromUnboxed (Z :. numR2Freqs :. numR2Freqs) . VS.convert $
pinwheel
let pinwheel1 =
computeS $
createFrequencyArray
numR2Freqs |
haskell | import Data.Text ()
-- import Debug.Trace (trace, traceIO)
-- import System.Environment (getProgName, getArgs)
import qualified GI.Gio as Gio
import qualified GI.Gtk as Gtk
import Data.GI.Base
activateApp :: Gtk.Application -> IO ()
activateApp app = do
w <- new Gtk.ApplicationWindow [ #application := app
... |
haskell | {-# LANGUAGE OverloadedStrings #-}
module Secret where
import Data.ByteString (ByteString)
secret :: ByteString
secret = "host='postgres-server' port=5432 user='example-user' password='<PASSWORD>' dbname='example-db'"
|
haskell | parseInput :: String -> Deck
parseInput l = let x = splitOn "\n\n" l
a = lines (x !! 0)
b = lines (x !! 1)
a' = map (\x -> read x :: Int) (tail a)
b' = map (\x -> read x :: Int) (tail b)
in (a',b')
computeWinning :... |
haskell | {- 99 Questions / Problem 3 -}
elementAt :: [w] -> Int -> w
elementAt [w] index = w
elementAt (w:ws) index
| index == 1 = w
| otherwise = elementAt ws (index - 1)
|
haskell |
setOption :: Text -> Conf.Value -> MakePackage ()
setOption c x = MP $ modify (Map.insert c x)
-- | Get option from configuration file or prompt user
confOrPrompt :: Text.Text -> Text.Text -> Text.Text -> MakePackage Text.Text
confOrPrompt c p i = confLookup c >>= \case
Nothing -> prompt c p i
Just x -> ret... |
haskell | <gh_stars>1-10
module DupChanExample where
import Control.Concurrent.Chan
import Control.Concurrent (forkIO)
client_thread name input output = do
value <- readChan input
writeChan output ("Thread "++name++" saw value "++value++".")
-- infinite loop
forever m = m >> forever m
-- this will print one or other of:
... |
haskell | , toField . fmap authorId . retweet
, toField . fmap refTime . retweet
, BS.intercalate "," . fmap (either toField toField) . urls
]
-- | Text Wrapper for twitter handles (the @name)
newtype TwitterHandle = TwitterHandle { getHandle :: Text } |
haskell | +: (dynamicState
""
(\_ t -> (Just t, Nothing))
(\dynText ->
list noOps $
textInput (onTextChange id)
+: [dynamicMarkup dynText (\t -> label $ text t)]
))
+: empty
)
|
haskell | sendSong song = do
Just login <- P.annicomLogin
Just token <- P.annicomToken
request <- prepareRequest $ formBody login token song
answer <- httpLBS request
L.writeToLog answer
return ()
|
haskell | deriving (Eq)
instance Show TypeSig where
show (Tconst t ) = show t
show (Tfunc [] []) = "()"
show (Tfunc [] o ) = "( " ++ revcat o ++ ")"
show (Tfunc i o ) = "( " ++ revcat i ++ "-- " ++ revcat o ++ ")" |
haskell | -- Triangular Treasure
-- http://www.codewars.com/kata/525e5a1cb735154b320002c8/
module Triangular where
triangular :: Integer -> Integer
triangular n | n > 0 = n * (n + 1) `div` 2
| otherwise = 0
|
haskell | data Package = Package
{ name :: String
, version :: String
}
deriving (Eq, Ord)
type M = RWST Newest (Set.Set Package) (Set.Set String) IO
bootlibs :: Set.Set String
bootlibs = Set.fromList $ words
"containers ghc-binary ghc-prim Cabal base old-locale old-time time random syb template-haskell fil... |
haskell | ) where
import TH.KosherShow (deriveKosherShow)
data MyData = Foo String Int | Bar Int
data RecTest = R {a :: Int, b :: String}
data InfixTest = String :+ Int
deriveKosherShow ''MyData
deriveKosherShow ''RecTest
deriveKosherShow ''InfixTest |
haskell | main = getArgs >>= parseArgs defaultConfig
parseArgs :: Config -> [String] -> IO ()
parseArgs conf args = case args of
[] -> showHelp >> exitFailure
"-h":_ -> showHelp
"--help":_ -> showHelp
"-l":url:xs -> parseArgs (conf {loginURL = Just url}) xs
"-f":path:xs -> parseArgs (conf {configFile = Just... |
haskell | pure (l, scoreLetter l)
-- | Generate an arbitrary direction.
genDir :: Gen Dir
genDir = elements [ HZ, VT]
-- | Generate a pos in the range (0,0) to (ur,uc).
genPos :: (Int,Int) -> Gen Pos
genPos (ur,uc) = do
r <- choose (0, ur) :: Gen Int
c <- choose (0, uc) :: Gen Int
pure (r,c) |
haskell | <gh_stars>0
-- intercala lista 1
intercala1 [] [] = []
intercala1 x [] = x
intercala1 [] y = []
intercala1 (x:xs) (y:ys) = x:y:intercala1 xs ys
-- intercala lista 2
intercala2 [] [] = []
intercala2 x [] = []
intercala2 [] y = y |
haskell |
stmtFor :: [LispAST] -> Either MidError Statement
stmtFor (var:times:body) =
For <$> mkExpr var <*> mkExpr times <*> (Do <$> traverse mkStatement body)
stmtFor _ = Left $ InvalidArgumentsFor "for"
stmtWhen :: [LispAST] -> Either MidError Statement
stmtWhen (cond:body) =
IfElse <$> mkExpr cond <*> (Do <$> traverse... |
haskell | sumAll = mapM_ (modify . (+))
-- | Write a list of numbers and add them to the current state.
writeAndAdd :: ( [ Writer a
, State a
] <:: e
, Num a)
=> [a]
-> Eff e () |
haskell | {-# htermination readLn :: IO () #-}
|
haskell | module Binja.Types.MLIL.Op.FmulOp where
import Binja.Prelude
data FmulOp expr = FmulOp
{ _fmulOpLeft :: expr
, _fmulOpRight :: expr
} deriving (Eq, Ord, Show, Functor, Foldable, Traversable, Generic)
instance Hashable a => Hashable (FmulOp a)
|
haskell | import Test.Tasty.QuickCheck
( Property,
QuickCheckMaxSize (..),
QuickCheckTests (..),
counterexample,
label,
testProperty,
)
tests :: TestTree
tests = |
haskell | (f idx :+ 0) *
pinwheelFunc
(ft (Z :. t) - ft (Z :. t0))
(fs (Z :. s) + fs (Z :. s0))
rMax
0
(x - center xLen)
(y - center yLen)
(eigVal, eig... |
haskell | createInFake ref r = modifyIORef' ref (Map.insert (reservationId r) r)
readOneFromFake :: IORef DB -> UUID -> IO (Maybe Reservation)
readOneFromFake ref rid = Map.lookup rid <$> readIORef ref
readManyFromFake :: IORef DB -> LocalTime -> IO [Reservation]
readManyFromFake ref (LocalTime d _) = do
db <- readIORef ref
... |
haskell | | GHigh
| GExtCode
| GBalance
data GasCost |
haskell | withOriginated 2
(\(admin: wallet1:_) -> initialStorageWithExplictRegistryDAOConfig admin [wallet1]) $
\(_:wallet1:_) _ baseDao -> let
proposalMeta = DynamicRec mempty
proposalSize = metadataSize proposalMeta
in callFrom (AddressResolved wallet1) baseDao (... |
haskell |
twoSort :: (Bit 8, Bit 8) -> (Bit 8, Bit 8)
twoSort (a, b) = a .<. b ? ((a, b), (b, a))
{-
top :: Module ()
top = do
display "twoSort (1,2) = " (twoSort (1,2))
display "twoSort (2,1) = " (twoSort (2,1))
finish
-} |
haskell | worldDag :: World -> DAG
worldDag w = (S.unions nodes_list, S.unions edges_list)
where
-- The canonical islands of this world.
islands = eltsUFM $ canonicalIslands w
-- recursively compute DAG for each parent
(nodes_list, edges_list) = unzip $ map islandDag islands
islandDag :: Island -> DAG
islan... |
haskell |
type ParseResult = Either String
class Monad p => ParseMonad p where
failP :: (Int -> String) -> p a
lineP :: p Int
runFromStartP :: p a -> String -> Int -> ParseResult a |
haskell | prettyPrintAlgebra (List []) = string "()"
prettyPrintAlgebra (List (firstDoc:docs)) =
string "("
<> firstDoc
<> softline
<> group (nest 2 (mconcat (intersperse softline docs)))
<> string ")"
prettyPrintSExpr :: SExpr -> Doc
prettyPrintSExpr = fold prettyPrintAlgebra |
haskell | adjustVolumeBy,
audioDelay,
audios,
current,
duration,
expired,
info,
load,
pause, |
haskell | in s & environments . ix eid .~ newModel
updateEnvironment :: EnvironmentFormState -> Environment -> Environment
updateEnvironment form =
(name .~ form ^. name)
. (variables .~ form ^. variables)
. (safetyLevel .~ form ^. safetyLevel)
showEnvironmentEditScreen ::
EnvironmentContext -> AppState a -> App... |
haskell | , ((0, 9), (2, 9))
, ((3, 4), (1, 4))
, ((0, 0), (8, 8))
, ((5, 5), (8, 2))
]
spec :: Spec
spec = do
describe "Auxiliary Functions" $ do
it "readFileToVectors" $ |
haskell | parseJSON =
withObject "AuthorInfo" $ \o ->
AuthorInfo <$> o .: "authorName" <*> o .: "authorEmail" <*>
o .: "githubName"
instance ToJSON AuthorInfo where
toJSON AuthorInfo {..} =
object
[ "authorName" .= authorName
, "authorEmail" .= authorEmail
, "githubName" .= githubName
... |
haskell | -- Copyright: (c) 2019 <NAME>
-- License: MIT
-- Maintainer: <NAME> <<EMAIL>>
--
-- This module provides the abstract functionality of a cached font atlas.
module Typograffiti
( |
haskell | spec :: SpecWith Context
spec = describe "COMMON_CLI_NETWORK" $ do
it "CLI_NETWORK - bcc-wallet network information" $ \ctx -> do
info <- getNetworkInfoViaCLI ctx
let nextEpochNum =
(fromJust (info ^. #nextEpoch)) ^. #epochNumber . #getApiT
nextEpochNum `shouldBe` (currentEpo... |
haskell | symCI c = psym (on (==) toLower c)
-- case insenstive match on a string
stringCI :: String -> RE Char String
stringCI = traverse symCI
validName :: RE Char String
validName = (:) <$> psym isAlpha <*> many (psym (\c -> isAlphaNum c || c `elem` ("-_[]" :: String)))
-- only matches a line at a time and not nested comme... |
haskell | import Data.Bifunctor
import Data.Ratio
import Roll
import Roll.Internal
type Dice = Rolls Int
d :: Int -> Int -> Dice
d 1 f = Rolls $!map (\x -> Roll x ((%) 1 (fromIntegral f))) [1 .. f]
d n f
| even n = simplify $! mixFmap (+) ((n `div` 2) `d` f) ((n `div` 2) `d` f) |
haskell | lychrelStep n = n + reverseDigits n
lychrelSeq :: Integer -> [Integer]
lychrelSeq n = next:lychrelSeq next
where next = lychrelStep n |
haskell | onTheTable' :: Int -> Table -> Bool
onTheTable' x (Table size) = 0 <= x && x < size
onTheTable :: (Int, Int) -> Table -> Bool
onTheTable (x, y) t = all (`onTheTable'` t) [x, y]
data Robot = Robot {
x :: Int,
y :: Int,
direction :: Direction
}
deriving Eq
instance Show Robot where |
haskell |
hairColors :: [String]
hairColors = ["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]
isValidEcl :: String -> Bool
isValidEcl = (`elem` hairColors)
isValidPid :: String -> Bool
isValidPid pid = case splitAt 9 pid of
(digits, "") -> all isDigit digits
_ -> False
-- Very very very unsafe, but very ... |
haskell | import Text.Megaparsec (runParser)
countParsedTypes :: Text -> Int
countParsedTypes txt = either (const 0) length (parseTypeDefinitions txt)
parseTypeDefinitions :: Text -> Either Text [GQL.TypeSystemDefinition]
parseTypeDefinitions s =
case runParser GQL.document "<doc>" s of
Right (toList... |
haskell |
main :: IO()
main = do
-- tests for functions from src/MonoidAssoc.hs
monoidAssocTest
monoidBullTest
-- Testing an invalid Monoid
-- The test below should fail.
--
-- The reason is that mempty is Fools and any value
-- passed for mappend converts into Fools. |
haskell | -- (octave .~ n) a `octaveEq` a
octave :: (Semitones t, Transpose t) => Lens' t Int
octave = lens (div12 . steps) setOctave
where
setOctave :: (Semitones t, Transpose t) => t -> Int -> t
setOctave s b = shift x s
where x = 12 * (b - div12 (steps s))
{-
set :: t -> Int -> t
set s b... |
haskell | -- > fix :: ((Int -> Int) -> (Int -> Int)) -> (Int -> Int)
--
-- Then our factorial function becomes:
--
fac :: Int -> Int
fac = fix faco
-- What just happened?
--
-- > fix faco 5
-- > = { def. 'fix' }
-- > faco (fix faco) 5
-- > = { def. 'faco'} |
haskell | x : _ -> Just x
plus5minus5 :: Int -> Int
plus5minus5 n
= case n + 5 of
m -> m - 5
len :: [a] -> Int |
haskell | import OpenAFP.Types
import OpenAFP.Internals
data MPO = MPO {
mpo_Type :: !N3
,mpo_ :: !N3
,mpo :: !NStr
} deriving (Show, Typeable)
|
haskell | xPlace :: String -> IO ()
xPlace = mapOperation "sd: deleting a location using putative JSON" deletePlaces
aRoad :: String -> IO ()
aRoad = mapOperation "sd: adding/modifying one or more roads using putative JSON" upsertRoad
xRoad :: String -> IO ()
xRoad = mapOperation "sd: deleting one or more roads using putative ... |
haskell | import Howdy.Parser (MonadParse (parse), rest)
import Network.HTTP.Simple (getResponseBody, httpJSON,
parseRequest, setRequestIgnoreStatus,
setRequestMethod, setRequestPath,
... |
haskell | import Test.Hspec
spec :: SpecWith ()
spec = do
describe "equipo 4" $ do
let cerebro = UnRaton "cerebro" 13 1.3 ["obesidad"] ("normal",1)
context "iteracion 3 " $ do
context "al aplicarle un repressitol a un raton sin enfermedades" $ do
let cerebro = UnRaton "cerebro" 13 1.3 [] ("normal",1)
... |
haskell | -- | <https://developer.mozilla.org/en-US/docs/Web/API/HTMLKeygenElement.name Mozilla HTMLKeygenElement.name documentation>
getName ::
(MonadIO m, FromJSString result) => HTMLKeygenElement -> m result
getName self = liftIO (fromJSString <$> (js_getName self))
foreign import javascript unsafe "$1[\"type\"]" j... |
haskell | ("42", 42),
("43", 43),
("44", 44),
("45", 45),
("46", 46), |
haskell | putStrLn s
getLine
-- Put many string on the output and get a line after each.
putGetManyLn :: [String] -> IO [String] |
haskell | | otherwise = integrateAll (res + (enB - enA)*(nA+nB)*0.5) (b:as)
integrateAll _ _ = 99
sumRow :: Matrix Double -> Vector Double
sumRow a = a #> konst 1 (cols a)
getY0 :: Matrix Double -> Vector Double
getY0 dos = getY0' lowPos higNeg
where
rTDOS = toRows $ dos
highestNeg = (+) (-1) $ fromJust $ findIndex... |
haskell | )) $
Plot2D.list Graph2D.listLines dat) $ xs
-- boostErrComp :: [[(Color.T,(String,Double,[Double]))]] -> Frame.T (Graph2D.T Int Double)
boostErrComp xs = |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.