Skip to content

Commit 9fb1df4

Browse files
Merge #842: Value: Organization & Docs; Atom: Organization & Docs
2 parents 803af1b + 1f90760 commit 9fb1df4

File tree

3 files changed

+397
-144
lines changed

3 files changed

+397
-144
lines changed

src/Nix/Atoms.hs

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,33 @@
77
module Nix.Atoms where
88

99
#ifdef MIN_VERSION_serialise
10-
import Codec.Serialise
10+
import Codec.Serialise ( Serialise )
1111
#endif
12-
import Control.DeepSeq
13-
import Data.Data
12+
13+
import Control.DeepSeq ( NFData )
14+
import Data.Data ( Typeable
15+
, Data)
1416
import Data.Fixed ( mod' )
15-
import Data.Hashable
17+
import Data.Hashable ( Hashable )
1618
import Data.Text ( Text
1719
, pack
1820
)
19-
import GHC.Generics
21+
import GHC.Generics ( Generic )
2022
import Data.Binary ( Binary )
21-
import Data.Aeson.Types ( FromJSON, ToJSON )
23+
import Data.Aeson.Types ( FromJSON
24+
, ToJSON
25+
)
2226

23-
-- | Atoms are values that evaluate to themselves. This means that
27+
-- | Atoms are values that evaluate to themselves.
28+
-- In other words - this is a constructors that are literals in Nix.
29+
-- This means that
2430
-- they appear in both the parsed AST (in the form of literals) and
25-
-- the evaluated form.
31+
-- the evaluated form as themselves.
32+
-- Once HNix parsed or evaluated into atom - that is a literal
33+
-- further after, for any further evaluation it is in all cases stays
34+
-- constantly itself.
35+
-- "atom", Ancient Greek \( atomos \) - "indivisible" particle,
36+
-- indivisible expression.
2637
data NAtom
2738
-- | An URI like @https://example.com@.
2839
= NURI Text
@@ -35,8 +46,17 @@ data NAtom
3546
| NBool Bool
3647
-- | Null values. There's only one of this variant: @null@.
3748
| NNull
38-
deriving (Eq, Ord, Generic, Typeable, Data, Show, Read, NFData,
39-
Hashable)
49+
deriving
50+
( Eq
51+
, Ord
52+
, Generic
53+
, Typeable
54+
, Data
55+
, Show
56+
, Read
57+
, NFData
58+
, Hashable
59+
)
4060

4161
#ifdef MIN_VERSION_serialise
4262
instance Serialise NAtom
@@ -46,7 +66,7 @@ instance Binary NAtom
4666
instance ToJSON NAtom
4767
instance FromJSON NAtom
4868

49-
-- | Translate an atom into its nix representation.
69+
-- | Translate an atom into its Nix representation.
5070
atomText :: NAtom -> Text
5171
atomText (NURI t) = t
5272
atomText (NInt i) = pack (show i)

0 commit comments

Comments
 (0)