Skip to content

Commit a93c09a

Browse files
committed
Value: upd documentation
1 parent 1a099c4 commit a93c09a

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/Nix/Value.hs

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ hoistNValueF lft = \case
198198
NVBuiltinF s g -> NVBuiltinF s (lft . g)
199199

200200

201-
-- * @__NValue'__@: F(A) of the F-Algebra
201+
-- * @__NValue'__@: forming the (F(A))
202202

203203
-- | At the time of constructor, the expected arguments to closures are values
204204
-- that may contain thunks. The type of such thunks are fixed at that time.
205205
newtype NValue' t f m a =
206206
NValue
207207
{
208-
-- | Applying F-algebra functor (@NValueF@) to the F-algebra carrier (forming the \( F(A) \)).
208+
-- | Applying F-algebra carrier (@NValue@) to the F-algebra Base functor data type (@NValueF@), forming the \( F(A)-> A \)).
209209
_nValue :: f (NValueF (NValue t f m) m a)
210210
}
211211
deriving (Generic, Typeable, Functor, Foldable, Eq1)
@@ -312,15 +312,25 @@ unliftNValue'
312312
unliftNValue' = hoistNValue' lift
313313

314314

315-
-- ** Methods @F: Hask → NValue'@
315+
-- ** Bijective Hask subcategory <-> @NValue'@
316+
-- *** @F: Hask subcategory → NValue'@
316317
--
317318
-- #mantra#
318319
-- $Methods @F: Hask → NValue'@
319320
--
320321
-- Since Haskell and Nix are both recursive purely functional lazy languages.
321-
-- And since recursion-schemes also make easier just that.
322-
-- It is quite possible to create a functor between the Hask and Nix categories.
322+
-- And since recursion-schemes.
323+
-- It is possible to create a direct functor between the Hask and Nix categories.
323324
-- Or make Nix a DLS language of Haskell, embed it into a Hask, if you would like.
325+
-- Of course, we mean: pick Hask subcategory and form Nix Category from it.
326+
-- Take subcategory of Hask, and by applying functor to it - have a Nix Category.
327+
-- Wouldn't it be cool and fast?
328+
--
329+
-- In fact - it is what we do here.
330+
--
331+
-- Since it is a proper way of scientific implementation, we would eventually form a
332+
-- lawful functor.
333+
--
324334
-- Facts of which are seen below:
325335

326336

@@ -332,24 +342,24 @@ nvConstant' :: Applicative f
332342
nvConstant' = NValue . pure . NVConstantF
333343

334344

335-
-- | Haskell string & context to the Nix string & context,
336345
pattern NVStr' ns <- NValue (extract -> NVStrF ns)
346+
-- | Haskell text & context to the Nix text & context,
337347
nvStr' :: Applicative f
338348
=> NixString
339349
-> NValue' t f m r
340350
nvStr' = NValue . pure . NVStrF
341351

342352

343-
-- | Haskell FilePath to the Nix path,
344353
pattern NVPath' x <- NValue (extract -> NVPathF x)
354+
-- | Haskell @FilePath@ to the Nix path,
345355
nvPath' :: Applicative f
346356
=> FilePath
347357
-> NValue' t f m r
348358
nvPath' = NValue . pure . NVPathF
349359

350360

351-
-- | Haskell [] to the Nix [],
352361
pattern NVList' l <- NValue (extract -> NVListF l)
362+
-- | Haskell @[]@ to the Nix @[]@,
353363
nvList' :: Applicative f
354364
=> [r]
355365
-> NValue' t f m r
@@ -385,6 +395,9 @@ nvBuiltin' :: (Applicative f, Functor m)
385395
nvBuiltin' name f = NValue $ pure $ NVBuiltinF name f
386396

387397

398+
-- So above we have maps of Hask subcategory objects to Nix objects,
399+
-- and Hask subcategory morphisms to Nix morphisms.
400+
388401
-- * @__NValue__@: Nix language values
389402

390403
-- | 'NValue t f m' is

0 commit comments

Comments
 (0)