lang
stringclasses
10 values
seed
stringlengths
5
2.12k
haskell
(\m i -> if m == 'X' then i else charIntToBool m) mask (intToBits val) ) in run (Map.insert mem newVal acc) mask as True -> let msk = a =~ "[X,0-9]+" :: String in run acc (replicate...
haskell
-- are counted from 0 and we wrap around cyclically if /i/ equals the -- length of the list. import Quipper import QuipperLib.Arith
haskell
primeFacsExp :: Integer -> [(Integer, Int)]
haskell
, eventsMonth , eventExpectedDelivery , eventEstimatedOvulation ) where import Data.Time.Calendar (Day, addDays) import ICalendar (Event, vEvent) standardDuration :: Num a => a
haskell
{-# LANGUAGE TypeOperators #-} {-| Entry point for the entire application. -} module Main where
haskell
return $ VkPipelineColorBlendStateCreateInfo { vkSType = VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO , vkPNext = nullPtr , vkFlags = zeroBits , vkLogicOpEnable = lo...
haskell
(return $ MkR CantReadFile p defaultValue) MkR SuccessfulResolution p a -> do let val = decode a case val of Just b ->
haskell
main = do [host, port, n] <- getArgs sok <- initSocket host port -- intialise the server socket putStrLn $ "staring server on " ++ host ++ ":" ++ port kill <- newEmptyMVar li <- newMVar (read n :: Int) rms <- newTVarIO [] let inf = ("IP:10.62.0.104\nPort:"++port++"\nStudentID:13319506\n") ser = Serv...
haskell
let programOps = withFileOperations fileOperationsDoesFileExistFail undefined org = GithubOrg "org1" repo = GithubRepo "repo1" configDir = mkTextTag "/some/dir/path" handlerProg = repoHandler programOps org repo configDir...
haskell
} newtype PubsubMessageBatch = PubsubMessageBatch { messages :: [PublishPubsubMessage] } deriving stock (Show, Eq, Generic) deriving anyclass Aeson.ToJSON newtype PublishResponse = PublishResponse { messageIds :: [MessageId] } deriving stock (Show, Eq, Generic) deriving anyclass Aeson.FromJSON
haskell
import Database.PostgreSQL.Simple.Migration import Database.PostgreSQL.Transact import GHC.Generics import GHC.IO (mkUserError) import GHC.Stack import GHC.TypeLits import Hedgehog (MonadGen (..)) import qualified Hedgehog.Gen as H
haskell
tickTime = do timeStateRef' <- view (env.monadTimeStateRef) timeNow <- Time.time liftIO $ modifyIORef' timeStateRef' (tickTimeState timeNow) tickTimeState :: Seconds -> MonadTimeState -> MonadTimeState tickTimeState timeNow ts = ts & previousTime .~ (ts ^. currentTime) & currentTime .~ timeNow deltaTime ...
haskell
instance Storable DevInfo where sizeOf _ = #size struct hidraw_devinfo alignment _ = 4 -- #alignment struct hidraw_devinfo peek p = do
haskell
, Options(..) , NodeFormat (..) , parse ) where import Control.Applicative ((<|>)) import Prelude hiding (FilePath)
haskell
dataFileName = baseOutputName ++ ".txt" results' = map ((\[a, b] -> (a, b)) . L.toList) results chartPlot2D results = do layout_title .= "Normal Coordinates" setColors [opaque red] plot (points "points" results) pp2DResults' :: FilePath -> [(Double,Double)] -> IO ()
haskell
import Text.Trifecta type Password = String data PasswordPolicy = PasswordPolicy { char :: Char, minLetters :: Integer, maxLetters :: Integer } deriving (Show, Eq) data PasswordRecord = PasswordRecord PasswordPolicy Password deriving (Show, Eq) newtype Error = Error { message :: String } deriving (Show, E...
haskell
defaultSystemOnTPTP = SystemOnTPTP { optAutoMode = "-cE" , optAutoModeSystemsLimit = "3" , optAutoModeTimeLimit = "300" , optCompleteness = False , optCorrectness = False , optCPUPassword = "" , optFORMULAEProblem = "" , optFormulaURL = "" ...
haskell
Stability : experimental Portability : POSIX Example using KeyHomomorphicPRF with AT. -} module KHPRFAccMain where
haskell
, dfa_D :: arrow (s, a) s , dfa_q_0 :: s , dfa_F :: Set s } -> DFA arrow s a data NFA arrow s a where
haskell
import RIO.Effect import RIO.Effect.TH data Teletype cfg a where GetL :: Teletype cfg String PutL :: String -> Teletype cfg () genSend ''Teletype teletypeIO :: EFF Teletype cfg :~> MonadIO teletypeIO = handleEffect $ \case GetL -> liftIO getLine PutL l -> liftIO ( putStrLn l )
haskell
-} type HomoFuncConstraint (n :: Nat) a = (HomoArgFuncConstraint n a, ResultT n a ~ IndexT 0 a) {-| Like 'HomoFuncConstraint', but only constrains all the arguments to be the same type, not the result. -} type family HomoArgFuncConstraint (n :: Nat) a :: Constraint type instance HomoArgFuncConstraint 0 a = (FuncConstr...
haskell
import Data.Word -- | Subwords of size 2 ^ 0 alternating between all bits cleared and all bits mu0 :: Word16 mu0 = 0x55 {-# INLINE mu0 #-} -- | Subwords of size 2 ^ 1 alternating between all bits cleared and all bits mu1 :: Word16 mu1 = 0x33 {-# INLINE mu1 #-} -- | Subwords of size 2 ^ 2 alternating between all bits...
haskell
data Number = One | Two data Tuple (a :: *) (b :: *) (c :: *) (d :: *) = Double a b | Triple a b c | Quad a b c d -- Test uses type constructors with more than two data contructors with -- more than 2 parameters. Contains incomplete patterns. (\i. case i of Double x (Double y y') -> y' Double x (Triple ...
haskell
instance (Arrow arr) => Applicative (FoldA arr i a) where pure x = FoldA (ret ()) (ret ()) (ret x) {-# INLINE pure #-} FoldA stepL startL doneL <*> FoldA stepR startR doneR = let step = arr (\(Pair (Pair xL xR) a) -> Pair (Pair xL a) (Pair xR a)) >>> (stepL **** stepR) ...
haskell
import PKCloud.Accounts.Import as Export import PKCloud.Accounts.Routes as Export instance PKCloudAccounts master => PKCloudApp (PKCloudAccountsApp master) where pkcloudAppName PKCloudAccountsApp = "Accounts" pkcloudAppIdentifier PKCloudAccountsApp = "accounts" pkcloudAppRoot = HomeR
haskell
module Generator.Smoother ( Smoother (..) , smooth , anneal , cluster ) where import Data.Foldable (toList) import Data.Kind (Type) import Data.List (delete) import Data.Maybe (fromMaybe) import Data.Nat (Nat) import qualified Map import Map (Map_)
haskell
exec_C_ADDI :: GPR_Addr -> InstrField -> Machine_State -> Machine_State exec_C_ADDI rd_rs1 nzimm6 mstate = let imm12 = sign_extend 6 12 nzimm6 instr_I = ADDI rd_rs1 rd_rs1 imm12 is_C = True mstate1 = exec_ADDI is_C instr_I mstate in mstate1 -- =====================...
haskell
genChildren tcn cs = do funD 'children (map (genChildrenClause tcn) cs) genChildrenClause :: TH.Name -> Con -> Q Clause genChildrenClause tcn (NormalC name fieldTypes) = do fieldNames <- replicateM (length fieldTypes) (newName "x") let pats = [conP name (map varP fieldNames)] body = return . NormalB ....
haskell
errHandler e = do resources' <- loggerHandler resources e writeIORef resourcesRef resources' when (predicate pri) action `C.catch` errHandler loggerHandler :: LoggerResources -> C.SomeException -> IO LoggerResources loggerHandler resources e = do logError stdHandler "fail...
haskell
<gh_stars>1-10 module Task2 where
haskell
<gh_stars>1-10 {- Problem 9 Find the product a*b*c of the only Pythagorean triplet (a, b, c) for which a + b + c = 1000. Result 31875000 .58 s -} module Problem9 (solution) where
haskell
compareLastNames name1 name2 = if lastNameCompare == EQ then firstNameCompare else lastNameCompare where lastName1 = snd name1 lastName2 = snd name2 firstName1 = fst name1 firstName2 = fst name2 lastNameCompare = compare lastName1 lastName2 firstNameCompare = compare firstName1 first...
haskell
convertTime = posixSecondsToUTCTime . realToFrac . diffPosix . fromWindowsTick where fromWindowsTick x = x `div` 10000000 diffPosix x = x - 11644473600
haskell
let newNode = ASTUtil.buildQName newName $ SrcLoc.SrcLoc (SrcLoc.srcSpanFilename span) (SrcLoc.srcSpanStartLine span) (SrcLoc.srcSpanStartColumn span) let newRewrite = ASTUtil.Rewrite (SrcLoc.srcInfoSpan $ Syntax.ann node) (length new...
haskell
NB: mapper takes as input a CONLL-parsed file (one sentence per line, #-separated tokens) NB: first line (containing tab-separated contexts elements) must be manually added to the file that is the result of hadoop
haskell
-- Module : Streamly.External.Posix.DirStream -- Copyright : © 2020 <NAME> -- License : BSD3 -- -- Maintainer : <NAME> <<EMAIL>> -- Stability : experimental -- Portability : portable
haskell
. fmap (\x -> bool x '@' $ x == 'b') . intercalate "." . fmap (\(z, o) -> nameOfNote (head ns) z ++ "/" ++ show o) . flip zip is $ intsFromNotes ns where (ns, is) = unzip nos
haskell
import System.IO.Unsafe -- | Native machine code JIT execution target -- data Native = Native { gangSize :: {-# UNPACK #-} !Int , linkCache :: {-# UNPACK #-} !LinkCache , fillS :: {-# UNPACK #-} !Executable , fillP :: {-# UNPACK #-} !Executable , segmentOffset :: !Bool
haskell
import Atcoder.Task myConfig :: WDConfig myConfig = defaultConfig { wdCapabilities = (defaultCaps { browser = chrome }) } main :: IO () main = defaultMain =<< tests tests :: IO TestTree
haskell
puncture :: PhaseVector -> (PhaseVector, PhaseVector) puncture v = let v' = AMV.toVector v u' = V.uniq v' gen i | i >= V.length v' = Nothing | v' V.! (i-1) == v' V.! i = Just (v' V.! i, i+1) | otherwise = gen $ i+1 in (fromVector u', fromVector $ V.unfoldr gen 1) unfold :: (b ->...
haskell
persistClassyRules :: LensRules persistClassyRules = persistDefaultRules & lensIso .~ const Nothing & handleSingletons .~ False & lensClass .~ classy & classRequired .~ True & partialLenses .~ False & buildTraversals .~ True where
haskell
import Control.Monad.IO.Class import Control.Monad.Trans.State.Lazy import Control.Monad (void) import App.Domain import App.State import App.Repositories import App.Data import App.Entities initialState :: App FakeRepo FakeRepo FakeRepo initialState = App { appDependencies = AppDependencies { accountRepository = Fa...
haskell
instance Show Color where show Transparent = " " show Black = "X" show White = "-" readRow :: [Int] -> Int -> ([Int], [Int]) readRow pixels w = foldl (\(result, h:t) i -> (result ++ [h], t)) ([], pixels) [1 .. w] readLayer :: [Int] -> Int -> Int -> ([[Int]], [Int])
haskell
module Data.List(BST) where data BST k v = Leaf | Branch (BST k v) k v (BST k v) deriving (Eq, Show) insert k v Leaf = Branch Leaf k v Leaf insert k v (Branch l k' v' r) | k<k' = Branch (insert k v l) k' v' r
haskell
-- Retorna o numero de valores acima da media na lista qtd_acima_media [_] = 1 qtd_acima_media lista = size_list (acima_media lista)
haskell
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DatatypeContexts #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE StandaloneKindSignatures #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UnliftedNewtypes #-} {-# LANGUAGE LinearTypes #-}
haskell
_ <- string "path:" _ <- spaces path <- manyTill anyChar endOfLine _ <- spaces _ <- string "version:" _<- spaces version <- manyTill anyChar (lookAhead endOfLine) pure $ PR name path version
haskell
module ForSyDe.Reactive ( module ForSyDe.Reactive.CoreTypeSY, module ForSyDe.Reactive.CoreSY, module ForSyDe.Reactive.CoreTypeCT, module ForSyDe.Reactive.CoreCT, module ForSyDe.Reactive.Utils ...
haskell
header bar = style [ ("position", "absolute") , ("left", px 0) , ("top", px 0) , ("width", "100%") , ("height", px (if bar then 24 else 0)) , ("background-color", "#333") , ("border-radius", "2px 2px 0px 0px") , ("user-select", "none") ] content bar = style...
haskell
module Main where import Date main :: IO () main = runDateDemo
haskell
writeToScreenWithPos :: Game -> ((Surface -> Const Surface Surface) -> Surfaces -> Const Surface Surfaces) -> Point V2 CInt -> IO () writeToScreenWithPos s source pos = surfaceBlit (s^.surfaces.source) Nothing (s^.surfaces.sc...
haskell
-- | Flat genomes -- prop> all in [0.0, 1.0] type ChromosomeType = Double type OrderPermutationGenome = [ChromosomeType] type SelectorGenome = [ChromosomeType] type PackingSelectorGenome = [ChromosomeType] type OrientationGenome = [ChromosomeType] type FillOrderGenome = [ChromosomeType] -- | Tupelization of all flat g...
haskell
listAll = do xs <- getPings putStrLn $ ppShow $ map head $ group $ sort $ map getName xs getName xs = case break (== '_') (reverse xs) of (as,_:bs) -> reverse bs
haskell
} return pa pulseM :: ((a -> IO ()) -> (String -> IO ()) -> ReaderT PulseAudio IO ()) -> PulseM a pulseM f = do pa <- lift ask contErrT $ \cont exit -> f (flip runReaderT pa . cont) (flip runReaderT pa . exit) resetContext :: PulseM () resetContext = contErrT $ \cont exit -> do pa <- ask
haskell
strictSAN :: forall s. (Stream s, SANToken (Token s), IsString (Tokens s)) => Position -> Parser s Ply strictSAN pos = case legalPlies pos of [] -> fail "No legal moves in this position" ms -> (castling pos <|> normal ms) >>= checkStatus where normal ms = do p <- sanPiece <|> pure Pawn case fil...
haskell
<gh_stars>0 module TreesThatGrows.Example where example :: IO () example = putStrLn "hello, trees that grows"
haskell
data TheFees = TheFees { k :: Float , c :: Int } deriving Show data Fees = Fees deriving Show type Proof = Map Address Account -- | Increment nonce. touchAccount :: Access Address Account m => Address -> m ()
haskell
case mKnownFields of Nothing -> return TcPluginNoRewrite Just knownFields -> return TcPluginRewriteTo { tcRewriterWanteds = [] , tcPluginReduction =
haskell
import Relude import qualified Data.Generics.Uniplate.Data as U import qualified Data.List as L import Expr distribute :: Expr -> Expr distribute = U.rewrite f where f :: Expr -> Maybe Expr f e@Or{} | res == e = Nothing | otherwise = Just res
haskell
module JosephusPermutationSpec (spec) where import JosephusPermutation (josephus) import Test.Hspec spec = do describe "josephus" $ do it "works with integers" $ do josephus [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 1 `shouldBe` [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] josephus [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] 2 `shoul...
haskell
, fail_ctr_rollover , fail_encrypt_gcm ) where import Ivory.Language import Ivory.Serialize newtype GecError = GecError Uint32
haskell
module X ) where import Game.GoreAndAsh.Core as X import Game.GoreAndAsh.Math as X
haskell
data RunconSwitch = DUMMY deriving (Bounded, Enum, Eq, Ord, Show) data OutputArgs = OA String runcon :: Utility RunconSwitch OutputArgs OutputArgs OutputArgs OutputArgs runcon = Utility "runcon" argDescs input parse core format output where input _ = return $ OA "" parse _ = id
haskell
| If | Cons | Add | Sub | Mul | Le | Lt | Eq deriving Eq -- | Associativty data Assoc = AssocLeft | AssocRight
haskell
let batchSize = BatchSize 1 let utxo = CoinMap $ Map.fromList [ ( mkInputId "|\243^\SUBg\242\231\&1\213\203" , unsafeCoin @Int 2 ) ] property $ prop_inputsGreaterThanOutputs @InputId @...
haskell
getHomeR :: Handler Html getHomeR = do defaultLayout $ do setTitle $ title "Home" $(widgetFile "homepage")
haskell
mockStackS1 = [Stone P1 S, Stone P2 F, Stone P1 F] mockStackC1 = [Stone P1 C, Stone P2 F] mockStackF2 = [Stone P2 F] mockCellA1 = Cell ('a', 1) mockStackS1 mockCellA2 = Cell ('a', 2) mockStackS1 mockCellA3 = Cell ('a', 3) mockStackF2 mockCellB3 = Cell ('b', 3) mockStackS1 mockCellC4 = Cell ('c', 4) mockStackC1 mockB...
haskell
-- | Creates a constant with a given value constantVar :: Constant -> Variable constantVar = ConstantVar isVariableChar :: Char -> Bool isVariableChar c = isAlphaNum c || c == '_' || c == '-' || c == '.' -- | Creates a variable with a given name. variable :: String -> Variable variable (x:y) = if isLetter x && all i...
haskell
) updateCountF :: Members '[BaseApp.WriteStore, Output BaseApp.Event, BaseApp.Logger] r => Count -> Sem r () updateCountF count = do V.putVar count countVar let event = CountSet count BaseApp.emit event BaseApp.logEvent event
haskell
LitPat _ l -> litToTokens l -- Aeson.object ["lit" .= l] IntervalPat _ x y -> error "paToToken IntervalPat TBD" -- Aeson.object ["interval" .= [x, y]] ConsPat _ x y -> error "paToToken ConsPat TBD" -- Aeson.object ["cons" .= [x, y]] ConPat _ x y -> error "paToToken ConPat TBD" -- Aeson.object ["con" .=...
haskell
withFixture1 :: String -> IO a -> IO () withFixture1 nm f = Exception.bracket setUp (\_ -> f) tearDown where setUp = Printf.hPrintf IO.stderr "(%s) SetUp ...\n" nm tearDown _ = Printf.hPrintf IO.stderr "... TearDown (%s)\n" nm epsilon = 0.001 (lst, revlst) = ([0..4], reverse (enumFromTo 0 4)) caseSquare = ...
haskell
case11_no x = let {-# NOINLINE y #-} y = x + 1 {-# NOINLINE f #-} f 0 = 1 f z = f (z-1) * y -- Could float into argument and contify (but shouldn't!)
haskell
cross f g = over _1 f . over _2 g newtype State s a = St{unSt :: s -> (s,a)} newtype Counter a = C{unC :: State Int a} instance Functor Counter where fmap f (C (St p)) = C . St $ (cross id f) . p
haskell
getBR :: Monad m => (BRH2 -> Double) -> Pipe (Maybe BRH2) (Maybe Double) (ReaderT InputParam m) () getBR select = do brs0 <- await yield $ case brs0 of Nothing -> Nothing Just brs -> Just (select brs) getBRHpW :: Monad m => Pipe (Maybe BRH2) (Maybe Double) (ReaderT ...
haskell
isAnagram :: (String, String) -> Bool isAnagram (str1, str2) = runST $ do ht :: HashTable s Char Int <- H.new mapM_ (flip (H.mutate ht) (f (+1))) str1 mapM_ (flip (H.mutate ht) (f (+(-1)))) str2
haskell
= mapDict toBackend . mapDict (Sub (Impl.inferBackendInstance @t @ds)) $ inferDeriveContext @t @ds @b undefined inferNum :: forall (t :: Type) (ds :: [Nat]) (b :: Type) (i :: Type) . (Num t, Impl.KnownBackend t ds b) => Dict (Num (Backend i t ds b)) inferNum = mapDict toBackend
haskell
let tip = CI.tipFromCardanoBlock block balance = TxUtxoBalance.fromBlock tip txs in case UtxoState.insert balance index of Left err -> error (show err) Right (UtxoState.InsertUtxoSuccess newIndex _insertPosition) -> n...
haskell
let unoffset (Offset i) = i pure $ T.unlines $ ls & _last %~ T.take (fromIntegral $ unoffset $ p_col end) & _head %~ T.drop (fromIntegral $ unoffset $ p_col start) positionToVim :: Pos' Int64 -> (Int64, Int64) positionToVim p = ( fromIntegral $ getVimLineNumber $ p_line p , fromIntegral $ p_...
haskell
) where import Types.Edge import Util.GenData (GenData(..), SuchThat(..)) import qualified Test.SmallCheck.Series as SS import qualified Test.Tasty.QuickCheck as QC import qualified Data.List.NonEmpty as NE import Data...
haskell
instance Bounded InitFlag where minBound = InitJPG maxBound = InitWEBP instance Enum InitFlag Word32 where
haskell
srcSpan (Endfile x sp s) = sp srcSpan (Exit x sp s) = sp srcSpan (Format x sp _) = sp srcSpan (Forall x sp es f) = sp srcSpan (Goto x sp s) = sp srcSpan (Nullify x sp e) = sp srcSpan (Inquire x sp s e) = sp srcSpan (Pause x sp _)...
haskell
{-#LANGUAGE QuasiQuotes#-} module Language.Thesaurus.RogetLite.Transcursion where import Language.Thesaurus transcursion :: ThProg transcursion = [thesaurus| # Space ## Transcursion noun: * transcursion transiliency, transgression, tresspass, encroachment, infringement, extravagation, transcendence, redundance
haskell
import qualified Chapter06.Caesar as C run :: IO () run = hspec $ do describe "Chapter06" $ do
haskell
, module Language.C99.Util.IsList , module Language.C99.Util.Expr ) where import Language.C99.Util.Wrap import Language.C99.Util.IsList
haskell
import Control.Monad import Control.Monad.IO.Class () import Control.Monad.Reader import Control.Monad.State import Control.Monad.Writer import Data.Functor.Identity import Control.DeepSeq import qualified Control.Exception (evaluate) import...
haskell
addPrefix _ _ = Prelude.id classNormalizer :: TargetIdNS -> XMLString -> XMLString classNormalizer TargetTypeName = normalizeTypeName classNormalizer TargetConsName = normalizeTypeName -- same normalization as type names, but separate space classNormalizer TargetFieldName = normalizeFieldName -- | Tra...
haskell
largestBasinProduct :: Grid -> Int largestBasinProduct grid = product $ take 3 $ reverse $ sort $ map (basinSizeForCoords grid) $ keys $ lowPoints grid main = do input <- parsedInput (2021, 9) lines print $ riskLevelSum $ gridMap input print $ largestBasinProduct $ gridMap input
haskell
01-first_steps -} ---------------------------------------------------------------------------------------------------- --Activate interactive mode in the GHC Haskell compilator. ghci --To change prompt. :set prompt "ghci> " --Simple aritmetic 12+2 14*2 16-2
haskell
module Main where import Hue main :: IO () main = putStrLn "Hello World"
haskell
import Data.Maybe import Distribution.PackageDescription import Distribution.Simple import Distribution.Simple.PreProcess main :: IO () main = defaultMainWithHooks hooks { hookedPreProcessors = hscDropCpp11 $ hookedPreProcessors hooks } where hooks = simpleUserHooks -- gcc shows a warning if -std=c++11 ...
haskell
module Day01 where import AOC main = do ns <- parseInput $ eachLine number print $ sum ns print $ firstDuplicate $ scanl (+) (0 :: Integer) $ cycle ns
haskell
roundRes :: Float -> Float roundRes d | dp > 0 = if dp1 - dp > (4 * 10 ^^ (-3)) && dp1 - dp < (5 * 10 ^^ (-3)) then dp + 0.01 else dp | dp < 0 = if dp1 - dp < (-4 * 10 ^^ (-3)) && dp1 - dp > (-5 * 10 ^^ (-3)) then dp - 0.01 else dp
haskell
-- add tasks to the global queue to allow canceling evaluateMany :: [Submission] -> Codex () evaluateMany submissions = do conf <- getSnapletUserConfig taskGroup <- liftIO $
haskell
Var x -> return $ env Map.! x Lam x _ body -> return $ VClosure x body env App a b -> do x <- eval env a y <- eval env b apply x y
haskell
3 return (a + b) baz = do a <- foo let b = a + 2 c = b + 3 bar c let d = c + 2 return d
haskell
-- | -- Pause request; value of command field is "pause". -- The request suspenses the debuggee. -- penDebug will respond with a StoppedEvent (event type 'pause') after a successful 'pause' command. -- data PauseRequest = PauseRequest { seqPauseRequest :: Int -- Sequence number , typePa...
haskell
-- import Network.HTTP.Req import Boreal.Anime import Boreal.Auth -- import Boreal.Config import Data.Aeson (Result (..)) import Data.Text (Text)
haskell
distanceF cxs xs = max 0 $ (disctance2 xs cxs) instance Figure Point where distanceF cxs (Point xs) = max 0 $ (disctance2 xs cxs) instance Figure Sphere where distanceF cxs (Sphere xs r _) = max 0 $ (disctance2 xs cxs - r)
haskell
data Value = Num Integer | Fun (Value -> M Value) | Wrong instance Show Value where show (Num x) = show x show (Fun _) = "<function>" show Wrong = "<wrong>"
haskell
uid' = case readMaybe ("0x" <> unpack uid) of Nothing -> Left ("Could not parse uid: " <> unpack uid) Just x -> Right x in case method of Add -> pure . addItem catname it -- @REFACTOR Mod -> \r -> (\u -> modItem it{_uid=u} r) <$> uid' Del -> \r -> flip delItem r <$>...