Skip to content

Commit 51d4e28

Browse files
committed
Add since annotations
1 parent 4ed8547 commit 51d4e28

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/Python/Inline/QQ.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ pyf = QuasiQuoter
9797
-- 'Python.Inline.Eval.exec'
9898
--
9999
-- It creates value of type @PyQuote@
100+
--
101+
-- @since 0.2@
100102
pycode :: QuasiQuoter
101103
pycode = QuasiQuoter
102104
{ quoteExp = \txt -> expQQ Exec txt

src/Python/Internal/Eval.hs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -681,13 +681,17 @@ checkThrowBadPyType = do
681681

682682
-- | Type class for values representing python dictionaries containing
683683
-- global or local variables.
684+
--
685+
-- @since 0.2@
684686
class Namespace a where
685687
-- | Returns dictionary object. Caller takes ownership of returned
686688
-- object.
687689
basicNamespaceDict :: a -> Py (Ptr PyObject)
688690

689691

690692
-- | Namespace for the top level code execution.
693+
--
694+
-- @since 0.2@
691695
data Main = Main
692696

693697
instance Namespace Main where
@@ -703,6 +707,8 @@ instance Namespace Main where
703707

704708

705709
-- | Temporary namespace which get destroyed after execution
710+
--
711+
-- @since 0.2@
706712
data Temp = Temp
707713

708714
instance Namespace Temp where
@@ -711,6 +717,8 @@ instance Namespace Temp where
711717

712718
-- | Newtype wrapper for bare python object. It's assumed to be a
713719
-- dictionary. This is not checked.
720+
--
721+
-- @since 0.2@
714722
newtype DictPtr = DictPtr (Ptr PyObject)
715723

716724
instance Namespace DictPtr where
@@ -719,6 +727,8 @@ instance Namespace DictPtr where
719727

720728
-- | Newtype wrapper for bare python object. It's assumed to be a
721729
-- dictionary. This is not checked.
730+
--
731+
-- @since 0.2@
722732
newtype Dict = Dict PyObject
723733

724734
instance Namespace Dict where
@@ -727,6 +737,8 @@ instance Namespace Dict where
727737
= unsafeWithPyObject d (basicNamespaceDict . DictPtr)
728738

729739
-- | Newtype wrapper over module object.
740+
--
741+
-- @since 0.2@
730742
newtype ModulePtr = ModulePtr (Ptr PyObject)
731743

732744
instance Namespace ModulePtr where
@@ -747,6 +759,8 @@ instance Namespace Module where
747759

748760

749761
-- | Evaluate python expression
762+
--
763+
-- @since 0.2@
750764
eval :: (Namespace global, Namespace local)
751765
=> global -- ^ Data type providing global variables dictionary
752766
-> local -- ^ Data type providing local variables dictionary
@@ -776,6 +790,8 @@ eval globals locals q = runProgram $ do
776790
{-# SPECIALIZE eval :: Main -> Temp -> PyQuote -> Py PyObject #-}
777791

778792
-- | Evaluate sequence of python statements
793+
--
794+
-- @since 0.2@
779795
exec :: (Namespace global, Namespace local)
780796
=> global -- ^ Data type providing global variables dictionary
781797
-> local -- ^ Data type providing local variables dictionary

src/Python/Internal/Types.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ instance PrimMonad Py where
136136

137137
-- | Quasiquoted python code. It contains source code and closure
138138
-- which populates dictionary with local variables.
139+
--
140+
-- @since 0.2@
139141
data PyQuote = PyQuote
140142
{ code :: !Code
141143
, binder :: !DictBinder
@@ -144,20 +146,28 @@ data PyQuote = PyQuote
144146

145147
-- | UTF-8 encoded python source code. Usually it's produced by
146148
-- Template Haskell's 'TH.lift' function.
149+
--
150+
-- @since 0.2@
147151
newtype Code = Code BS.ByteString
148152
deriving stock (Show, TH.Lift)
149153

150154
-- | Create properly encoded @Code@. This function doesn't check
151155
-- syntactic validity.
156+
--
157+
-- @since 0.2@
152158
codeFromText :: T.Text -> Code
153159
codeFromText = Code . T.encodeUtf8
154160

155161
-- | Create properly encoded @Code@. This function doesn't check
156162
-- syntactic validity.
163+
--
164+
-- @since 0.2@
157165
codeFromString :: String -> Code
158166
codeFromString = codeFromText . T.pack
159167

160168
-- | Closure which stores values in provided dictionary
169+
--
170+
-- @since 0.2@
161171
newtype DictBinder = DictBinder { bind :: Ptr PyObject -> Py () }
162172

163173
instance Semigroup DictBinder where

0 commit comments

Comments
 (0)