Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 2.17.3.1-spanfix
  • T1004
  • T1015
  • T1015-take-two
  • T1050
  • T1050-take-two
  • T1103
  • T16110-T16356
  • T16185
  • T16185-2
  • T16185-3
  • T6018-injective-type-families
  • adamse-D1033
  • alexbiehl-patch-1
  • alp/error-adts
  • at-defaults
  • boot-disambig
  • change-tests-for-type-naturals
  • class-default-sigs
  • danya/the-char-kind-updates
  • danya/the-char-kind-updates-one-more-branch
  • danya/the-char-kind-updates-other-branch
  • data-kind-syntax
  • dependabot/npm_and_yarn/haddock-api/resources/html/acorn-5.7.4
  • dependabot/npm_and_yarn/haddock-api/resources/html/cached-path-relative-1.0.2
  • dependabot/npm_and_yarn/haddock-api/resources/html/mixin-deep-1.3.2
  • deriving-forall-cleanup
  • fix/8.10-ci
  • gb/bump-contrast
  • ghc-7.10.3-facebook
  • ghc-7.2
  • ghc-7.4
  • ghc-7.6
  • ghc-7.8
  • ghc-8.0
  • ghc-8.0-facebook
  • ghc-8.10
  • ghc-8.10-backports
  • ghc-8.2
  • ghc-8.4
  • ghc-8.6
  • ghc-8.8
  • ghc-8.8-az
  • ghc-8.8-merges
  • ghc-8.8.2
  • ghc-head
  • ghc-new-co
  • haddock-quick
  • headdock-library-1.4.5
  • hi-haddock-0
  • hsyl20/modules-config
  • imp-param-class
  • int-index/no-data-decl-rn
  • issue-475
  • known-key-serialization
  • mpickering/import
  • overlapping-tyfams
  • prepare-2.23
  • rae/wip/kind-app
  • relocatable-bin
  • revert-1044-wip/over-poly-kinds-3
  • sjakobi/always-keep-rn-source
  • v2.14
  • v2.15
  • v2.16
  • v2.17
  • v2.18
  • v2.19
  • v2.20
  • visible-dependent-quantification
  • visible-dependent-quantification-take-2
  • visible-dependent-quantification-take-3
  • visible-dependent-quantification-take-4
  • visible-dependent-quantification-take-5
  • visible-dependent-quantification-take-6
  • visible-dependent-quantification-take-7
  • wip-hsyl20-modules-coresyn
  • wip-hsyl20-modules-driver
  • wip-hsyl20-modules-renamer
  • wip-hsyl20-modules-runtime
  • wip-hsyl20-package-refactor
  • wip-located-module-as
  • wip/10268
  • wip/10313
  • wip/10692
  • wip/10692-2
  • wip/10692-3
  • wip/D2418
  • wip/D5036-ttg
  • wip/M838
  • wip/M838-2
  • wip/MR1970
  • wip/T10483
  • wip/T11017
  • wip/T11019
  • wip/T11028
  • wip/T11028-2
  • wip/T11028-3
  • wip/T11080-open-data-kinds
  • wip/T11258
  • 1.13.1
  • 2.13.0
  • 2.13.2
  • 2.13.2.1
  • 2_0_0_0
  • 2_10_0
  • 2_11_0
  • 2_11_1
  • 2_12_0
  • 2_1_0
  • 2_2_1
  • 2_2_2
  • 2_5_0
  • 2_7_0
  • 2_7_1
  • 2_7_2
  • 2_8_0
  • 2_9_0
  • 2_9_1
  • 2_9_2
  • 2_9_3
  • 2_9_4
  • 6_10_branch_has_been_forked
  • darcs-git-switchover
  • ghc-7.2.1-release
  • ghc-7.2.2-release
  • ghc-7.4.1-release
  • ghc-7.4.2-release
  • ghc-7.6.1-release
  • ghc-7.6.2-release
  • ghc-7.6.3-release
  • ghc-7.8.1-release
  • ghc-7.8.2-release
  • haddock-2.13.2
  • haddock-2.14.0-release
  • haddock-2.14.1-release
  • haddock-2.14.2-release
  • haddock-2.14.3-release
  • haddock-2.15-start
  • haddock-2.15.0-release
  • haddock-2.15.0.1-release
  • haddock-2.15.0.2-release
  • haddock-2.16.0-release
  • haddock-2.16.1-release
  • haddock-2.17.0-release
  • haddock-2.17.1-release
  • haddock-2.17.2-release
  • haddock-2.17.3-release
  • haddock-2.17.4-release
  • haddock-2.17.5-release
  • haddock-2.18.1-release
  • haddock-2.19.0.1-release
  • haddock-2.21.0-release
  • haddock-2.22.0-release
  • haddock-2.23.0-release
  • haddock-2.23.1-release
  • haddock-2.24.0-release
  • haddock-api-2.17.3.1-release
  • haddock-library-1.4.5-release
159 results

Target

Select target project
  • ghc/haddock
  • rae/haddock
  • sjakobi/haddock
  • RyanGlScott/haddock
  • mynguyenbmc/haddock
  • kcsongor/haddock
  • wz1000/haddock
  • dten/haddock
  • bgamari/haddock
  • abrar/haddock
  • obsidiansystems/haddock
  • inaki/haddock
  • hsyl20/haddock
  • JoshMeredith/haddock
  • matheus23/haddock
  • Gertjan423/haddock
  • ulysses4ever/haddock
  • facundominguez/haddock
  • SuedeHead/haddock
  • Haskell-mouse/haddock
  • fgaz/haddock
  • arybczak/haddock
  • coot/haddock
  • hithroc/haddock
  • ani/haddock
  • supersven/haddock
  • alt-romes/haddock
  • sspencer/haddock
  • Joald/haddock
  • raehik/haddock
  • lexi.lambda/haddock
  • torsten.schmits/haddock
  • Bodigrim/haddock
  • doyougnu/haddock
  • barci2/haddock
  • Jade/haddock
  • wavewave/haddock
  • soulomoon/haddock
  • tvh/haddock
  • trac-sjoerd_visscher/haddock
  • Kleidukos/haddock
  • mmzk1526/haddock
  • stephenjudkins/haddock
  • KommuSoft1/haddock
44 results
Select Git revision
  • 2.17.3.1-spanfix
  • Hh
  • Kleidukos-remove-ghc-head
  • Player205/DataDecl-newtype-data-where-tokens-support
  • Player205/Remove-NoGhcTc
  • Player205/tuple-ty-cons
  • T1004
  • T1015
  • T1015-take-two
  • T1050
  • T1050-take-two
  • T1103
  • T16110-T16356
  • T16185
  • T16185-2
  • T16185-3
  • T21684
  • T6018-injective-type-families
  • adamse-D1033
  • adinapoli/err-messages-rae
  • adinapoli/error-adts
  • adinapoli/remove-errdoc
  • alex/backport-pl
  • alex/bumps
  • alex/forward-port
  • alex/stable-cmp
  • alexbiehl-gc-patch-1
  • alexbiehl-patch-1
  • alp/error-adts
  • alp/error-types
  • at-defaults
  • az/T19834
  • az/T19834-2
  • az/T19845
  • az/T19845-2
  • az/T19845-3
  • az/T20372-noann-not-monoid
  • az/T20372-noann-not-monoid-2
  • az/T21805
  • az/T23885-unicode-funtycon
  • az/T23885-unicode-funtycon-1
  • az/T23885-unicode-funtycon-2
  • az/T23885-unicode-funtycon-ghc-9.8
  • az/epa-epadelta-comments
  • az/epa-epalocation-not-anchor
  • az/epa-full-range-for-anchor
  • az/epa-hslet-tokens
  • az/epa-hslet-tokens-2
  • az/epa-l2l-cleanup-2
  • az/epa-remove-anchoroperation
  • az/epa-remove-epannnotused
  • az/epa-remove-srcspanann
  • az/epa-srcspan-in-epaspan
  • az/epanns-cleanup
  • az/exactprint-48
  • az/exactprint-49
  • az/exactprint-50
  • az/exactprint-rename-apiann-epann-3
  • az/ghc-T23885-backport
  • az/maybe-context
  • az/no-srcspan-anno-instances
  • az/unicode-hsscaled-5
  • backport-ghc-mr-5747
  • boot-disambig
  • cg-tyapp-pat
  • change-tests-for-type-naturals
  • class-default-sigs
  • clean-up-unused-imports
  • danya/11342-type-level-characters
  • danya/ghc-11342-type-level-characters
  • data-kind-syntax
  • dependabot/github_actions/actions/checkout-4
  • dependabot/npm_and_yarn/haddock-api/resources/html/acorn-5.7.4
  • dependabot/npm_and_yarn/haddock-api/resources/html/bl-1.2.3
  • dependabot/npm_and_yarn/haddock-api/resources/html/browserify-sign-4.2.2
  • dependabot/npm_and_yarn/haddock-api/resources/html/cached-path-relative-1.0.2
  • dependabot/npm_and_yarn/haddock-api/resources/html/elliptic-6.5.3
  • dependabot/npm_and_yarn/haddock-api/resources/html/elliptic-6.5.4
  • dependabot/npm_and_yarn/haddock-api/resources/html/fsevents-1.2.13
  • dependabot/npm_and_yarn/haddock-api/resources/html/hosted-git-info-2.8.9
  • dependabot/npm_and_yarn/haddock-api/resources/html/ini-1.3.7
  • dependabot/npm_and_yarn/haddock-api/resources/html/ini-1.3.8
  • dependabot/npm_and_yarn/haddock-api/resources/html/lodash-4.17.19
  • dependabot/npm_and_yarn/haddock-api/resources/html/lodash-4.17.21
  • dependabot/npm_and_yarn/haddock-api/resources/html/mixin-deep-1.3.2
  • dependabot/npm_and_yarn/haddock-api/resources/html/set-value-and-union-value-2.0.1
  • dependabot/npm_and_yarn/haddock-api/resources/html/y18n-3.2.2
  • dependabot/npm_and_yarn/haddock-api/resources/html/yargs-parser-5.0.1
  • deriving-forall-cleanup
  • dn/dn-driver-refactor-and-split
  • enable-wall
  • expand-do-haddock
  • finley/fix-instances-test
  • finley/hi-haddock
  • finley/hi-haddock-9.6
  • finley/hi-haddock-optim
  • finley/hi-haddock-squashed
  • finley/no-tmp-comp-dir-by-default
  • finley/optimizations-ghc-head
  • finley/remove-sourcetext-nfdata
  • 1.13.1
  • 2.13.0
  • 2.13.2
  • 2.13.2.1
  • 2_0_0_0
  • 2_10_0
  • 2_11_0
  • 2_11_1
  • 2_12_0
  • 2_1_0
  • 2_2_1
  • 2_2_2
  • 2_5_0
  • 2_7_0
  • 2_7_1
  • 2_7_2
  • 2_8_0
  • 2_9_0
  • 2_9_1
  • 2_9_2
  • 2_9_3
  • 2_9_4
  • 6_10_branch_has_been_forked
  • darcs-git-switchover
  • ghc-7.2.1-release
  • ghc-7.2.2-release
  • ghc-7.4.1-release
  • ghc-7.4.2-release
  • ghc-7.6.1-release
  • ghc-7.6.2-release
  • ghc-7.6.3-release
  • ghc-7.8.1-release
  • ghc-7.8.2-release
  • haddock-2.13.2
  • haddock-2.14.0-release
  • haddock-2.14.1-release
  • haddock-2.14.2-release
  • haddock-2.14.3-release
  • haddock-2.15-start
  • haddock-2.15.0-release
  • haddock-2.15.0.1-release
  • haddock-2.15.0.2-release
  • haddock-2.16.0-release
  • haddock-2.16.1-release
  • haddock-2.17.0-release
  • haddock-2.17.1-release
  • haddock-2.17.2-release
  • haddock-2.17.3-release
  • haddock-2.17.4-release
  • haddock-2.17.5-release
  • haddock-2.18.1-release
  • haddock-2.19.0.1-release
  • haddock-2.21.0-release
  • haddock-2.22.0-release
  • haddock-2.23.0-release
  • haddock-2.23.1-release
  • haddock-2.24.0-release
  • haddock-2.24.2-release
  • haddock-2.25.0-release
  • haddock-2.26.0-release
  • haddock-2.27.0-release
  • haddock-2.28.0-release
  • haddock-2.29.0-release
  • haddock-2.29.1-release
  • haddock-api-2.17.3.1-release
  • haddock-api-2.24.2-release
  • haddock-api-2.25.0-release
  • haddock-api-2.26.0-release
  • haddock-api-2.27.0-release
  • haddock-api-2.28.0-release
  • haddock-api-2.29.0-release
  • haddock-api-2.29.1-release
  • haddock-library-1.10.0-release
  • haddock-library-1.11.0-release
  • haddock-library-1.4.5-release
175 results
Show changes
Showing
with 3900 additions and 3309 deletions
This diff is collapsed.
-----------------------------------------------------------------------------
-- |
-- Module : Haddock.Interface.LexParseRn
-- Copyright : (c) Isaac Dupree 2009,
-- License : BSD-like
--
-- Maintainer : haddock@projects.haskell.org
-- Stability : experimental
-- Portability : portable
-----------------------------------------------------------------------------
module Haddock.Interface.LexParseRn
( HaddockCommentType(..)
, lexParseRnHaddockComment
, lexParseRnHaddockCommentList
, lexParseRnMbHaddockComment
, lexParseRnHaddockModHeader
) where
import Haddock.Types
import Haddock.Lex
import Haddock.Parse
import Haddock.Interface.ParseModuleHeader
import Haddock.Doc
import Control.Applicative
import Data.Maybe
import FastString
import GHC
import Name
import Outputable
import RdrName
import RnEnv
data HaddockCommentType = NormalHaddockComment | DocSectionComment
lexParseRnHaddockCommentList :: DynFlags -> HaddockCommentType -> GlobalRdrEnv -> [HsDocString] -> ErrMsgM (Maybe (Doc Name))
lexParseRnHaddockCommentList dflags hty gre docStrs = do
docMbs <- mapM (lexParseRnHaddockComment dflags hty gre) docStrs
let docs = catMaybes docMbs
let doc = foldl docAppend DocEmpty docs
case doc of
DocEmpty -> return Nothing
_ -> return (Just doc)
lexParseRnHaddockComment :: DynFlags -> HaddockCommentType ->
GlobalRdrEnv -> HsDocString -> ErrMsgM (Maybe (Doc Name))
lexParseRnHaddockComment dflags hty gre (HsDocString fs) = do
let str = unpackFS fs
let toks = tokenise dflags str (0,0) -- TODO: real position
let parse = case hty of
NormalHaddockComment -> parseParas
DocSectionComment -> parseString
case parse toks of
Nothing -> do
tell ["doc comment parse failed: "++str]
return Nothing
Just doc -> return (Just (rename gre doc))
lexParseRnMbHaddockComment :: DynFlags -> HaddockCommentType -> GlobalRdrEnv -> Maybe HsDocString -> ErrMsgM (Maybe (Doc Name))
lexParseRnMbHaddockComment _ _ _ Nothing = return Nothing
lexParseRnMbHaddockComment dflags hty gre (Just d) = lexParseRnHaddockComment dflags hty gre d
-- yes, you always get a HaddockModInfo though it might be empty
lexParseRnHaddockModHeader :: DynFlags -> GlobalRdrEnv -> SafeHaskellMode -> GhcDocHdr
-> ErrMsgM (HaddockModInfo Name, Maybe (Doc Name))
lexParseRnHaddockModHeader dflags gre safety mbStr = do
(hmi, docn) <-
case mbStr of
Nothing -> return failure
Just (L _ (HsDocString fs)) -> do
let str = unpackFS fs
case parseModuleHeader dflags str of
Left mess -> do
tell ["haddock module header parse failed: " ++ mess]
return failure
Right (info, doc) -> return (renameHmi gre info, Just (rename gre doc))
return (hmi { hmi_safety = Just $ showPpr safety }, docn)
where
failure = (emptyHaddockModInfo, Nothing)
renameHmi :: GlobalRdrEnv -> HaddockModInfo RdrName -> HaddockModInfo Name
renameHmi gre hmi = hmi { hmi_description = rename gre <$> hmi_description hmi }
rename :: GlobalRdrEnv -> Doc RdrName -> Doc Name
rename gre = rn
where
rn d = case d of
DocAppend a b -> DocAppend (rn a) (rn b)
DocParagraph doc -> DocParagraph (rn doc)
DocIdentifier x -> do
let choices = dataTcOccs x
let names = concatMap (\c -> map gre_name (lookupGRE_RdrName c gre)) choices
case names of
[] ->
case choices of
[] -> DocMonospaced (DocString (showSDoc $ ppr x))
[a] -> outOfScope a
a:b:_ | isRdrTc a -> outOfScope a | otherwise -> outOfScope b
[a] -> DocIdentifier a
a:b:_ | isTyConName a -> DocIdentifier a | otherwise -> DocIdentifier b
-- If an id can refer to multiple things, we give precedence to type
-- constructors.
DocEmphasis doc -> DocEmphasis (rn doc)
DocMonospaced doc -> DocMonospaced (rn doc)
DocUnorderedList docs -> DocUnorderedList (map rn docs)
DocOrderedList docs -> DocOrderedList (map rn docs)
DocDefList list -> DocDefList [ (rn a, rn b) | (a, b) <- list ]
DocCodeBlock doc -> DocCodeBlock (rn doc)
DocIdentifierUnchecked x -> DocIdentifierUnchecked x
DocModule str -> DocModule str
DocURL str -> DocURL str
DocPic str -> DocPic str
DocAName str -> DocAName str
DocExamples e -> DocExamples e
DocEmpty -> DocEmpty
DocString str -> DocString str
outOfScope :: RdrName -> Doc a
outOfScope x =
case x of
Unqual occ -> monospaced occ
Qual mdl occ -> DocIdentifierUnchecked (mdl, occ)
Orig _ occ -> monospaced occ
Exact name -> monospaced name -- Shouldn't happen since x is out of scope
where
monospaced a = DocMonospaced (DocString (showSDoc $ ppr a))
-----------------------------------------------------------------------------
-- |
-- Module : Haddock.Interface.ParseModuleHeader
-- Copyright : (c) Simon Marlow 2006, Isaac Dupree 2009
-- License : BSD-like
--
-- Maintainer : haddock@projects.haskell.org
-- Stability : experimental
-- Portability : portable
-----------------------------------------------------------------------------
module Haddock.Interface.ParseModuleHeader (parseModuleHeader) where
import Haddock.Types
import Haddock.Lex
import Haddock.Parse
import RdrName
import DynFlags
import Data.Char
-- -----------------------------------------------------------------------------
-- Parsing module headers
-- NB. The headers must be given in the order Module, Description,
-- Copyright, License, Maintainer, Stability, Portability, except that
-- any or all may be omitted.
parseModuleHeader :: DynFlags -> String -> Either String (HaddockModInfo RdrName, Doc RdrName)
parseModuleHeader dflags str0 =
let
getKey :: String -> String -> (Maybe String,String)
getKey key str = case parseKey key str of
Nothing -> (Nothing,str)
Just (value,rest) -> (Just value,rest)
(_moduleOpt,str1) = getKey "Module" str0
(descriptionOpt,str2) = getKey "Description" str1
(_copyrightOpt,str3) = getKey "Copyright" str2
(_licenseOpt,str4) = getKey "License" str3
(_licenceOpt,str5) = getKey "Licence" str4
(maintainerOpt,str6) = getKey "Maintainer" str5
(stabilityOpt,str7) = getKey "Stability" str6
(portabilityOpt,str8) = getKey "Portability" str7
description1 :: Either String (Maybe (Doc RdrName))
description1 = case descriptionOpt of
Nothing -> Right Nothing
-- TODO: pass real file position
Just description -> case parseString $ tokenise dflags description (0,0) of
Nothing -> Left ("Cannot parse Description: " ++ description)
Just doc -> Right (Just doc)
in
case description1 of
Left mess -> Left mess
-- TODO: pass real file position
Right docOpt -> case parseParas $ tokenise dflags str8 (0,0) of
Nothing -> Left "Cannot parse header documentation paragraphs"
Just doc -> Right (HaddockModInfo {
hmi_description = docOpt,
hmi_portability = portabilityOpt,
hmi_stability = stabilityOpt,
hmi_maintainer = maintainerOpt,
hmi_safety = Nothing
}, doc)
-- | This function is how we read keys.
--
-- all fields in the header are optional and have the form
--
-- [spaces1][field name][spaces] ":"
-- [text]"\n" ([spaces2][space][text]"\n" | [spaces]"\n")*
-- where each [spaces2] should have [spaces1] as a prefix.
--
-- Thus for the key "Description",
--
-- > Description : this is a
-- > rather long
-- >
-- > description
-- >
-- > The module comment starts here
--
-- the value will be "this is a .. description" and the rest will begin
-- at "The module comment".
parseKey :: String -> String -> Maybe (String,String)
parseKey key toParse0 =
do
let
(spaces0,toParse1) = extractLeadingSpaces toParse0
indentation = spaces0
afterKey0 <- extractPrefix key toParse1
let
afterKey1 = extractLeadingSpaces afterKey0
afterColon0 <- case snd afterKey1 of
':':afterColon -> return afterColon
_ -> Nothing
let
(_,afterColon1) = extractLeadingSpaces afterColon0
return (scanKey True indentation afterColon1)
where
scanKey :: Bool -> String -> String -> (String,String)
scanKey _ _ [] = ([],[])
scanKey isFirst indentation str =
let
(nextLine,rest1) = extractNextLine str
accept = isFirst || sufficientIndentation || allSpaces
sufficientIndentation = case extractPrefix indentation nextLine of
Just (c:_) | isSpace c -> True
_ -> False
allSpaces = case extractLeadingSpaces nextLine of
(_,[]) -> True
_ -> False
in
if accept
then
let
(scanned1,rest2) = scanKey False indentation rest1
scanned2 = case scanned1 of
"" -> if allSpaces then "" else nextLine
_ -> nextLine ++ "\n" ++ scanned1
in
(scanned2,rest2)
else
([],str)
extractLeadingSpaces :: String -> (String,String)
extractLeadingSpaces [] = ([],[])
extractLeadingSpaces (s@(c:cs))
| isSpace c =
let
(spaces1,cs1) = extractLeadingSpaces cs
in
(c:spaces1,cs1)
| True = ([],s)
extractNextLine :: String -> (String,String)
extractNextLine [] = ([],[])
extractNextLine (c:cs)
| c == '\n' =
([],cs)
| True =
let
(line,rest) = extractNextLine cs
in
(c:line,rest)
-- comparison is case-insensitive.
extractPrefix :: String -> String -> Maybe String
extractPrefix [] s = Just s
extractPrefix _ [] = Nothing
extractPrefix (c1:cs1) (c2:cs2)
| toUpper c1 == toUpper c2 = extractPrefix cs1 cs2
| True = Nothing
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
{-# OPTIONS_GHC -cpp -fglasgow-exts #-}
--
-- (c) The University of Glasgow 2002
--
-- Unboxed mutable Ints
module Haddock.Utils.FastMutInt2(
FastMutInt, newFastMutInt,
readFastMutInt, writeFastMutInt,
incFastMutInt, incFastMutIntBy
) where
#include "MachDeps.h"
#ifndef SIZEOF_HSINT
#define SIZEOF_HSINT INT_SIZE_IN_BYTES
#endif
#if __GLASGOW_HASKELL__ < 503
import GlaExts
import PrelIOBase
#else
import GHC.Base
import GHC.IOBase
#endif
#if __GLASGOW_HASKELL__ < 411
newByteArray# = newCharArray#
#endif
#ifdef __GLASGOW_HASKELL__
data FastMutInt = FastMutInt (MutableByteArray# RealWorld)
newFastMutInt :: IO FastMutInt
newFastMutInt = IO $ \s0 ->
case newByteArray# size s0 of { (# s, arr #) ->
(# s, FastMutInt arr #) }
where I# size = SIZEOF_HSINT
readFastMutInt :: FastMutInt -> IO Int
readFastMutInt (FastMutInt arr) = IO $ \s0 ->
case readIntArray# arr 0# s0 of { (# s, i #) ->
(# s, I# i #) }
writeFastMutInt :: FastMutInt -> Int -> IO ()
writeFastMutInt (FastMutInt arr) (I# i) = IO $ \s0 ->
case writeIntArray# arr 0# i s0 of { s ->
(# s, () #) }
incFastMutInt :: FastMutInt -> IO Int -- Returns original value
incFastMutInt (FastMutInt arr) = IO $ \s0 ->
case readIntArray# arr 0# s0 of { (# s1, i #) ->
case writeIntArray# arr 0# (i +# 1#) s1 of { s ->
(# s, I# i #) } }
incFastMutIntBy :: FastMutInt -> Int -> IO Int -- Returns original value
incFastMutIntBy (FastMutInt arr) (I# n) = IO $ \s0 ->
case readIntArray# arr 0# s0 of { (# s1, i #) ->
case writeIntArray# arr 0# (i +# n) s1 of { s ->
(# s, I# i #) } }
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.