diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,10 @@
+# yamlet-1.0.0.2 (2026-11-17)
+* A `FromYaml` instance derived via `GenericYaml` for a type with named fields,
+  and a `ToYaml` instance for a record, compile faster with optimization, more
+  so for a type with more fields.
+* `parseFieldMaybe` is faster, and so is a `ToYaml` instance derived via
+  `GenericYaml` with `omitNullFields`.
+
 # yamlet-1.0.0.1 (2026-10-12)
 * Allow text-iso8601 0.1.1.2, so that yamlet builds together with packages
   that do not support text-iso8601 0.2 yet. With text-iso8601 0.1, a time of
diff --git a/bench/Yamlet/Bench/Derive.hs b/bench/Yamlet/Bench/Derive.hs
--- a/bench/Yamlet/Bench/Derive.hs
+++ b/bench/Yamlet/Bench/Derive.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE AllowAmbiguousTypes #-}
+
 -- | The benchmarks that compare generic instances with written ones.
 module Yamlet.Bench.Derive
   ( checkDerived
@@ -7,23 +9,46 @@
 import Control.DeepSeq
 import Control.Monad
 import Data.ByteString qualified as BS
+import Data.Text qualified as T
 import Test.Tasty.Bench
 
 import Yamlet
+import Yamlet.Bench.Derive.Fields
 import Yamlet.Bench.Derive.Generic qualified as G
 import Yamlet.Bench.Derive.Manual qualified as M
 
--- | Fail if the two versions of a type give different YAML.
+-- | Fail if the two versions of a type give different YAML, or decode the
+-- YAML with missing keys to different values.
 checkDerived :: IO ()
 checkDerived = do
   same "contents" G.mkX M.mkX
   same "flat" G.mkF M.mkF
+  same "record" (fields G.A) (fields M.A)
+  same "parameter" (fields (G.P @Int)) (fields (M.P @Int))
+  same "omit null" (fields G.O) (fields M.O)
+  same "omit default" (fields G.E) (fields M.E)
+  sameMissing @G.A @M.A "null" nullInput
+  sameMissing @G.D @M.D "default" defaultInput
+  sameMissing @(G.P Int) @(M.P Int) "parameter" parameterInput
   where
     same :: (ToYaml g, ToYaml m) => String -> (Int -> g) -> (Int -> m) -> IO ()
     same name mkG mkM =
       unless (encode (map mkG values) == encode (map mkM values)) $
         fail ("the generic and the written instances differ: " ++ name)
 
+    sameMissing
+      :: forall g m
+       . (FromYaml g, ToYaml g, FromYaml m, ToYaml m)
+      => String
+      -> Node
+      -> IO ()
+    sameMissing name yaml =
+      unless (encode (parsed @g) == encode (parsed @m)) $
+        fail ("the generic and the written instances decode differently: " ++ name)
+      where
+        parsed :: FromYaml a => [a]
+        parsed = either (error . show) id (runParser parseYaml yaml)
+
 -- | The benchmarks of each format, grouped by the operation, so that the
 -- times of the two versions are next to each other.
 deriveBenchmarks :: Benchmark
@@ -32,6 +57,19 @@
     "derive"
     [ format "contents" G.mkX M.mkX
     , format "flat" G.mkF M.mkF
+    , format "record" (fields G.A) (fields M.A)
+    , format "parameter" (fields (G.P @Int)) (fields (M.P @Int))
+    , bgroup
+        "missing"
+        [ missing @G.A @M.A "null" nullInput
+        , missing @G.D @M.D "default" defaultInput
+        , missing @(G.P Int) @(M.P Int) "parameter" parameterInput
+        ]
+    , bgroup
+        "omit"
+        [ omit "null" (fields G.O) (fields M.O)
+        , omit "default" (fields G.E) (fields M.E)
+        ]
     ]
   where
     format
@@ -79,5 +117,88 @@
         bs :: BS.ByteString
         bs = encode gs
 
+    -- Only the decoders, because the encoders write each key.
+    missing
+      :: forall g m
+       . (NFData g, FromYaml g, NFData m, FromYaml m)
+      => String
+      -> Node
+      -> Benchmark
+    missing name yaml =
+      bgroup
+        name
+        [ bgroup
+            "parseYaml"
+            [ bench "generic" $ nf (runParser (parseYaml @[g])) yaml
+            , bench "manual" $ nf (runParser (parseYaml @[m])) yaml
+            ]
+        , bgroup
+            "decode"
+            [ bench "generic" $ nf (either (error . show) id . decode @[g]) bs
+            , bench "manual" $ nf (either (error . show) id . decode @[m]) bs
+            ]
+        ]
+      where
+        bs :: BS.ByteString
+        bs = encode yaml
+
+    -- Only the encoders, because leaving out null fields changes only them.
+    omit
+      :: forall g m
+       . (ToYaml g, ToYaml m)
+      => String
+      -> (Int -> g)
+      -> (Int -> m)
+      -> Benchmark
+    omit name mkG mkM =
+      bgroup
+        name
+        [ bgroup
+            "toYaml"
+            [ bench "generic" $ nf toYaml gs
+            , bench "manual" $ nf toYaml ms
+            ]
+        , bgroup
+            "encode"
+            [ bench "generic" $ nf encode gs
+            , bench "manual" $ nf encode ms
+            ]
+        ]
+      where
+        gs :: [g]
+        gs = map mkG values
+
+        ms :: [m]
+        ms = map mkM values
+
 values :: [Int]
 values = [1 .. 1000]
+
+-- | The records without the keys of the fields of type 'Maybe', which decode
+-- as null.
+nullInput :: Node
+nullInput = withoutKeys ["a02", "a05", "a08"] (toYaml (map (fields G.A) values))
+
+-- | The records without the keys of the fields with a default.
+defaultInput :: Node
+defaultInput = withoutKeys (defaultKeys 'd') (toYaml (map (fields G.D) values))
+
+-- | 'defaultInput' for the type with a parameter.
+parameterInput :: Node
+parameterInput =
+  withoutKeys (defaultKeys 'p') (toYaml (map (fields (G.P @Int)) values))
+
+-- | The keys of the fields with a default, for the prefix of the field names.
+defaultKeys :: Char -> [T.Text]
+defaultKeys prefix = [T.pack (prefix : n) | n <- ["02", "03", "05", "06", "08", "09"]]
+
+-- | The sequence of mappings without the keys.
+withoutKeys :: [T.Text] -> Node -> Node
+withoutKeys keys n = case view n of
+  SequenceView items -> toYaml (map dropKeys items)
+  _ -> n
+  where
+    dropKeys :: Node -> Node
+    dropKeys item = case view item of
+      MappingView kvs -> mapping [kv | kv@(k, _) <- kvs, view k `notElem` map StringView keys]
+      _ -> item
diff --git a/bench/Yamlet/Bench/Derive/Generic.hs b/bench/Yamlet/Bench/Derive/Generic.hs
--- a/bench/Yamlet/Bench/Derive/Generic.hs
+++ b/bench/Yamlet/Bench/Derive/Generic.hs
@@ -6,6 +6,10 @@
   , C (..)
   , X (..)
   , F (..)
+  , D (..)
+  , P (..)
+  , O (..)
+  , E (..)
   , mkX
   , mkF
   ) where
@@ -63,6 +67,129 @@
   deriving stock (Generic)
   deriving anyclass (NFData, GenericYamlOptions)
   deriving (FromYaml, ToYaml) via GenericYaml C
+
+-- | A record with a default for the fields of type 'Maybe' and 'Int'.
+data D = D
+  { d01 :: T.Text
+  , d02 :: Maybe Int
+  , d03 :: Int
+  , d04 :: T.Text
+  , d05 :: Maybe Int
+  , d06 :: Int
+  , d07 :: T.Text
+  , d08 :: Maybe Int
+  , d09 :: Int
+  , d10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving anyclass (NFData)
+  deriving (FromYaml, ToYaml) via GenericYaml D
+
+instance GenericYamlOptions D where
+  yamlDefault =
+    Just
+      D
+        { d01 = requiredField
+        , d02 = Nothing
+        , d03 = 0
+        , d04 = requiredField
+        , d05 = Nothing
+        , d06 = 0
+        , d07 = requiredField
+        , d08 = Nothing
+        , d09 = 0
+        , d10 = requiredField
+        }
+
+-- | 'D' with a type parameter. The default depends on the 'Num' instance of
+-- the parameter.
+data P a = P
+  { p01 :: T.Text
+  , p02 :: Maybe a
+  , p03 :: a
+  , p04 :: T.Text
+  , p05 :: Maybe a
+  , p06 :: a
+  , p07 :: T.Text
+  , p08 :: Maybe a
+  , p09 :: a
+  , p10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving anyclass (NFData)
+
+deriving via GenericYaml (P a) instance (FromYaml a, Num a) => FromYaml (P a)
+
+deriving via GenericYaml (P a) instance (ToYaml a, Num a) => ToYaml (P a)
+
+instance Num a => GenericYamlOptions (P a) where
+  yamlDefault =
+    Just
+      P
+        { p01 = requiredField
+        , p02 = Nothing
+        , p03 = 0
+        , p04 = requiredField
+        , p05 = Nothing
+        , p06 = 0
+        , p07 = requiredField
+        , p08 = Nothing
+        , p09 = 0
+        , p10 = requiredField
+        }
+
+-- | A record that leaves out its null fields.
+data O = O
+  { o01 :: T.Text
+  , o02 :: Maybe Int
+  , o03 :: Int
+  , o04 :: T.Text
+  , o05 :: Maybe Int
+  , o06 :: Int
+  , o07 :: T.Text
+  , o08 :: Maybe Int
+  , o09 :: Int
+  , o10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving (ToYaml) via GenericYaml O
+
+instance GenericYamlOptions O where
+  yamlOptions = defaultYamlOptions {omitNullFields = True}
+
+-- | 'O' with the default of 'D'. The encoder leaves out a null field only if
+-- its default is null.
+data E = E
+  { e01 :: T.Text
+  , e02 :: Maybe Int
+  , e03 :: Int
+  , e04 :: T.Text
+  , e05 :: Maybe Int
+  , e06 :: Int
+  , e07 :: T.Text
+  , e08 :: Maybe Int
+  , e09 :: Int
+  , e10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving (ToYaml) via GenericYaml E
+
+instance GenericYamlOptions E where
+  yamlOptions = defaultYamlOptions {omitNullFields = True}
+  yamlDefault =
+    Just
+      E
+        { e01 = requiredField
+        , e02 = Nothing
+        , e03 = 0
+        , e04 = requiredField
+        , e05 = Nothing
+        , e06 = 0
+        , e07 = requiredField
+        , e08 = Nothing
+        , e09 = 0
+        , e10 = requiredField
+        }
 
 -- | A sum of records with the default encoding.
 data X = X1 A | X2 B | X3 C
diff --git a/bench/Yamlet/Bench/Derive/Manual.hs b/bench/Yamlet/Bench/Derive/Manual.hs
--- a/bench/Yamlet/Bench/Derive/Manual.hs
+++ b/bench/Yamlet/Bench/Derive/Manual.hs
@@ -5,6 +5,10 @@
   , C (..)
   , X (..)
   , F (..)
+  , D (..)
+  , P (..)
+  , O (..)
+  , E (..)
   , mkX
   , mkF
   ) where
@@ -146,6 +150,148 @@
       <*> parseFieldMaybe o "c08"
       <*> parseField o "c09"
       <*> parseField o "c10"
+
+data D = D
+  { d01 :: T.Text
+  , d02 :: Maybe Int
+  , d03 :: Int
+  , d04 :: T.Text
+  , d05 :: Maybe Int
+  , d06 :: Int
+  , d07 :: T.Text
+  , d08 :: Maybe Int
+  , d09 :: Int
+  , d10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving anyclass (NFData)
+
+instance ToYaml D where
+  toYaml x =
+    mapping
+      [ "d01" .= x.d01
+      , "d02" .= x.d02
+      , "d03" .= x.d03
+      , "d04" .= x.d04
+      , "d05" .= x.d05
+      , "d06" .= x.d06
+      , "d07" .= x.d07
+      , "d08" .= x.d08
+      , "d09" .= x.d09
+      , "d10" .= x.d10
+      ]
+
+instance FromYaml D where
+  parseYaml = withMapping $ \o ->
+    D
+      <$> parseField o "d01"
+      <*> parseFieldMaybe o "d02"
+      <*> parseFieldDefault o "d03" 0
+      <*> parseField o "d04"
+      <*> parseFieldMaybe o "d05"
+      <*> parseFieldDefault o "d06" 0
+      <*> parseField o "d07"
+      <*> parseFieldMaybe o "d08"
+      <*> parseFieldDefault o "d09" 0
+      <*> parseField o "d10"
+
+data P a = P
+  { p01 :: T.Text
+  , p02 :: Maybe a
+  , p03 :: a
+  , p04 :: T.Text
+  , p05 :: Maybe a
+  , p06 :: a
+  , p07 :: T.Text
+  , p08 :: Maybe a
+  , p09 :: a
+  , p10 :: T.Text
+  }
+  deriving stock (Generic)
+  deriving anyclass (NFData)
+
+instance ToYaml a => ToYaml (P a) where
+  toYaml x =
+    mapping
+      [ "p01" .= x.p01
+      , "p02" .= x.p02
+      , "p03" .= x.p03
+      , "p04" .= x.p04
+      , "p05" .= x.p05
+      , "p06" .= x.p06
+      , "p07" .= x.p07
+      , "p08" .= x.p08
+      , "p09" .= x.p09
+      , "p10" .= x.p10
+      ]
+
+instance (FromYaml a, Num a) => FromYaml (P a) where
+  parseYaml = withMapping $ \o ->
+    P
+      <$> parseField o "p01"
+      <*> parseFieldMaybe o "p02"
+      <*> parseFieldDefault o "p03" 0
+      <*> parseField o "p04"
+      <*> parseFieldMaybe o "p05"
+      <*> parseFieldDefault o "p06" 0
+      <*> parseField o "p07"
+      <*> parseFieldMaybe o "p08"
+      <*> parseFieldDefault o "p09" 0
+      <*> parseField o "p10"
+
+-- | A record that leaves out its null fields.
+data O = O
+  { o01 :: T.Text
+  , o02 :: Maybe Int
+  , o03 :: Int
+  , o04 :: T.Text
+  , o05 :: Maybe Int
+  , o06 :: Int
+  , o07 :: T.Text
+  , o08 :: Maybe Int
+  , o09 :: Int
+  , o10 :: T.Text
+  }
+
+instance ToYaml O where
+  toYaml x =
+    mapping $
+      ["o01" .= x.o01]
+        ++ present "o02" x.o02
+        ++ ["o03" .= x.o03, "o04" .= x.o04]
+        ++ present "o05" x.o05
+        ++ ["o06" .= x.o06, "o07" .= x.o07]
+        ++ present "o08" x.o08
+        ++ ["o09" .= x.o09, "o10" .= x.o10]
+
+-- | 'O' with a default. Only the generic encoder uses it.
+data E = E
+  { e01 :: T.Text
+  , e02 :: Maybe Int
+  , e03 :: Int
+  , e04 :: T.Text
+  , e05 :: Maybe Int
+  , e06 :: Int
+  , e07 :: T.Text
+  , e08 :: Maybe Int
+  , e09 :: Int
+  , e10 :: T.Text
+  }
+
+instance ToYaml E where
+  toYaml x =
+    mapping $
+      ["e01" .= x.e01]
+        ++ present "e02" x.e02
+        ++ ["e03" .= x.e03, "e04" .= x.e04]
+        ++ present "e05" x.e05
+        ++ ["e06" .= x.e06, "e07" .= x.e07]
+        ++ present "e08" x.e08
+        ++ ["e09" .= x.e09, "e10" .= x.e10]
+
+-- | The entry of a field that is not 'Nothing'.
+present :: ToYaml a => T.Text -> Maybe a -> [(Node, Node)]
+present key = maybe [] (\v -> [key .= v])
 
 -- | A sum of records with the default encoding.
 data X = X1 A | X2 B | X3 C
diff --git a/src/Yamlet/Generic.hs b/src/Yamlet/Generic.hs
--- a/src/Yamlet/Generic.hs
+++ b/src/Yamlet/Generic.hs
@@ -1,4 +1,5 @@
 {-# LANGUAGE AllowAmbiguousTypes #-}
+{-# LANGUAGE CPP #-}
 
 -- | Instances of t'Yamlet.Decode.FromYaml' and t'Yamlet.Encode.ToYaml' from
 -- the t'GHC.Generics.Generic' representation of a type.
@@ -600,11 +601,13 @@
 
   gDatatypeName = symbolVal (Proxy @name)
 
--- | The names and the number of the constructors of a representation.
+-- | The constructors of a representation: their names, if there are several,
+-- and if none has fields.
 class GConstructors f where
   gConstructorNames :: [String]
 
-  gConstructorCount :: Int
+  -- | The representation has more than one constructor.
+  gSum :: Bool
 
   -- | No constructor has fields.
   gNullary :: Bool
@@ -612,14 +615,14 @@
 instance (GConstructors f, GConstructors g) => GConstructors (f :+: g) where
   gConstructorNames = gConstructorNames @f ++ gConstructorNames @g
 
-  gConstructorCount = gConstructorCount @f + gConstructorCount @g
+  gSum = True
 
   gNullary = gNullary @f && gNullary @g
 
 instance GConstructors V1 where
   gConstructorNames = []
 
-  gConstructorCount = 0
+  gSum = False
 
   gNullary = True
 
@@ -632,7 +635,7 @@
   where
   gConstructorNames = [symbolVal (Proxy @name)]
 
-  gConstructorCount = 1
+  gSum = False
 
   gNullary = gArity @f == 0
 
@@ -738,7 +741,10 @@
   EitherShape (UnnamedField a) (UnnamedField _) = UnnamedField a
 
 isTagged :: forall f. GConstructors f => YamlOptions -> Bool
-isTagged opts = opts.tagSingleConstructors || gConstructorCount @f > 1
+-- GHC knows the value of 'gSum' at once. It would compare a number of
+-- constructors only in a later pass. Until then, it would keep the fields of
+-- a record once for each way to write the tag, which takes longer to compile.
+isTagged opts = gSum @f || opts.tagSingleConstructors
 
 constructorTag :: YamlOptions -> String -> T.Text
 constructorTag opts = T.pack . opts.constructorTagModifier
@@ -1413,19 +1419,57 @@
   => GFromFields (S1 (MetaSel (Just name) u s d) (Rec0 a))
   where
   gFromObject opts def o =
-    M1 . K1 <$> case M.lookup key o.index of
+    M1 . K1 <$> case lookupIndex key o of
       Just entry -> parseEntry entry
       Nothing -> case def of
-        Just (M1 (K1 d))
-          | Just x <- defaultField d -> x <$ findKey o key
-          | otherwise -> missingKey o key
+        -- For a type without parameters, GHC computes the value once, not at
+        -- each missing key.
+        Just (M1 (K1 d)) -> missingField (defaultField d) o key
         -- A missing field is null, if its type accepts null.
-        Nothing ->
-          maybe (missingKey o key) (<$ findKey o key) (succeeds parseYaml nullNode)
+        Nothing -> missingField (nullValue @a) o key
     where
       key :: T.Text
       key = fieldKey @name opts
   {-# INLINE gFromObject #-}
+
+-- The functions below are not in the instance above, because GHC copies the
+-- instance into the decoder of each field. Taken out, they make the Core of a
+-- derived decoder of a large record much smaller and faster to compile.
+--
+-- The comments on their pragmas come from two measurements. One compiles the
+-- derived decoders of records with 10 to 100 fields with -O1. The other is
+-- the derive benchmarks.
+
+-- | The entry of a string key in a mapping.
+lookupIndex :: T.Text -> Object -> Maybe (S.Node, S.Node)
+lookupIndex key o = M.lookup key o.index
+
+-- Without NOINLINE, the derived decoder of a record decodes slower, more so
+-- with missing keys. GHC 9.12 needs INLINE instead. Without it, the derived
+-- decoders of small records with a field of type 'Maybe' keep the generic
+-- representation, and their inspection tests fail.
+#if __GLASGOW_HASKELL__ == 912
+{-# INLINE lookupIndex #-}
+#else
+{-# NOINLINE lookupIndex #-}
+#endif
+
+-- | The field of a missing key from its value, e.g. from the default or the
+-- value of null, or an error without a value.
+missingField :: Maybe a -> Object -> T.Text -> Parser a
+missingField value o key = maybe (missingKey o key) (<$ findKey o key) value
+-- Without the pragma, GHC copies the function into the decoder of each field,
+-- which then takes longer to compile. With OPAQUE instead, the decoders compile
+-- a little faster, but each missing key allocates more.
+{-# NOINLINE missingField #-}
+
+-- | The value of null for the type, if the type accepts null.
+nullValue :: FromYaml a => Maybe a
+nullValue = succeeds parseYaml nullNode
+-- Without the pragma, GHC copies the decoder of the type into the decoder of
+-- each field. The derived decoders of records without a default then take
+-- longer to compile, and missing keys decode slower.
+{-# NOINLINE nullValue #-}
 
 instance FromYaml a => GFromFields (S1 (MetaSel Nothing u s d) (Rec0 a)) where
   gFromValue n = M1 . K1 <$> parseNode parseYaml n
diff --git a/src/Yamlet/Internal/FromYaml.hs b/src/Yamlet/Internal/FromYaml.hs
--- a/src/Yamlet/Internal/FromYaml.hs
+++ b/src/Yamlet/Internal/FromYaml.hs
@@ -88,6 +88,7 @@
 import Data.UUID.Types qualified as UUID
 import Data.Void
 import Data.Word
+import GHC.Exts (oneShot)
 import GHC.Real
 import Numeric.Natural
 
@@ -129,6 +130,11 @@
 -- ends with 'pure' into '<*>'. Then they collect errors.
 newtype Parser a = Parser (S.Offset -> Result a)
 
+-- | The parser of the function. GHC treats the function as called at most
+-- once, so it can move work into the function instead of sharing it.
+mkParser :: (S.Offset -> Result a) -> Parser a
+mkParser f = Parser (oneShot f)
+
 -- | The errors of a parser and its value. The value of a parser with errors
 -- is 'failed', so the field of the value is lazy.
 --
@@ -167,14 +173,14 @@
 failure off msg = Result (OneError off msg []) failed
 
 instance Functor Parser where
-  fmap f (Parser g) = Parser $ \off -> case g off of
+  fmap f (Parser g) = mkParser $ \off -> case g off of
     Result e a -> Result e (f a)
 
 -- '<*>' differs from 'ap', and '>>' differs from '*>', in the errors, but not
 -- in the results.
 instance Applicative Parser where
-  pure a = Parser $ \_ -> Result NoErrors a
-  Parser f <*> Parser g = Parser $ \off -> case f off of
+  pure a = mkParser $ \_ -> Result NoErrors a
+  Parser f <*> Parser g = mkParser $ \off -> case f off of
     Result e1 h -> case g off of
       Result e2 a -> Result (bothErrors e1 e2) (h a)
 
@@ -182,12 +188,12 @@
 -- index into a list after the check of its length. The default of '>>' uses
 -- '>>=', which stops there.
 instance Monad Parser where
-  Parser g >>= k = Parser $ \off -> case g off of
+  Parser g >>= k = mkParser $ \off -> case g off of
     Result NoErrors a -> let Parser h = k a in h off
     Result e _ -> Result e failed
 
 instance MonadFail Parser where
-  fail msg = Parser $ \off -> failure off msg
+  fail msg = mkParser $ \off -> failure off msg
 
 -- | Run a parser on a node. Each error is the offset of the node that caused
 -- it and the message. The errors are in the order of the offsets, and equal
@@ -248,7 +254,7 @@
 -- | The parser with the note after each of its errors at the offset, e.g. to
 -- say how the decoder read the node of the error.
 withNote :: S.Offset -> (S.Offset, String) -> Parser a -> Parser a
-withNote off note (Parser g) = Parser $ \o -> case g o of
+withNote off note (Parser g) = mkParser $ \o -> case g o of
   r@(Result NoErrors _) -> r
   Result e a -> Result (addNote e) a
   where
@@ -260,11 +266,11 @@
 
 -- | Run a parser on a node, so that 'fail' points to the node.
 parseNode :: (S.Node -> Parser a) -> S.Node -> Parser a
-parseNode f n = let Parser g = f n in Parser $ \_ -> g n.offset
+parseNode f n = let Parser g = f n in mkParser $ \_ -> g n.offset
 
 -- | Fail with an error that points to the given node.
 failAt :: S.Node -> String -> Parser a
-failAt n msg = Parser $ \_ -> failure n.offset msg
+failAt n msg = mkParser $ \_ -> failure n.offset msg
 
 -- | Fail with an error that the node is not of the expected kind, e.g.
 -- @typeMismatch "a list" n@ gives "expected a list, but got a string".
@@ -304,7 +310,7 @@
 -- 1 | [80]
 --   | ^
 orElse :: Parser a -> Parser a -> Parser a
-orElse (Parser g) (Parser h) = Parser $ \off -> case g off of
+orElse (Parser g) (Parser h) = mkParser $ \off -> case g off of
   r@(Result NoErrors _) -> r
   _ -> h off
 
@@ -460,7 +466,7 @@
 -- the errors and the values are in accumulators until the end. A decoder of
 -- a list is @withSequence (parseItems parseYaml)@.
 parseItems :: forall a. (S.Node -> Parser a) -> [S.Node] -> Parser [a]
-parseItems p xs0 = Parser $ \off -> go off NoErrors [] xs0
+parseItems p xs0 = mkParser $ \off -> go off NoErrors [] xs0
   where
     go :: S.Offset -> Errors -> [a] -> [S.Node] -> Result [a]
     go off !errs acc = \case
@@ -486,7 +492,7 @@
     -- reads the value of the first key.
     (errs, o) ->
       let Parser g = f o
-      in Parser $ \off -> case g off of
+      in mkParser $ \off -> case g off of
            Result e _ -> Result (bothErrors errs e) failed
   _ -> typeMismatch "a mapping" n
   where
@@ -781,7 +787,7 @@
 -- 'findKey', a key with the same text that is not a string is the error
 -- instead.
 missingKey :: Object -> T.Text -> Parser a
-missingKey o key = Parser $ \off ->
+missingKey o key = mkParser $ \off ->
   let Parser g = findKey o key
   in case g off of
        Result NoErrors _
@@ -1035,7 +1041,7 @@
     -- The value is built lazily. The copy visits a node once per alias of
     -- it, as the limit of 'prepareWithin' allows.
     Right r -> pure $! copy r
-    Left ((off, msg) NE.:| notes) -> Parser $ \_ -> Result (OneError off msg notes) failed
+    Left ((off, msg) NE.:| notes) -> mkParser $ \_ -> Result (OneError off msg notes) failed
     where
       -- The value in normal form, with copies of its texts.
       copy :: Value -> Value
@@ -1311,7 +1317,7 @@
   -> [a]
   -> Parser s
 insertUnique node item key insert start msg note xs =
-  Parser $ \off -> go off start NoErrors [] [] 0 xs
+  mkParser $ \off -> go off start NoErrors [] [] 0 xs
   where
     -- The duplicates and the positions of the failed items are in reverse.
     -- The items in a copy of an alias share one offset, so an offset cannot
diff --git a/src/Yamlet/Internal/Schema.hs b/src/Yamlet/Internal/Schema.hs
--- a/src/Yamlet/Internal/Schema.hs
+++ b/src/Yamlet/Internal/Schema.hs
@@ -10,6 +10,7 @@
   , resolvePlainExact
   , resolveTaggedExact
   , startsNumber
+  , isNull
   , isPlainString
   , isPlainSafe
   , isPlainPortable
@@ -115,6 +116,8 @@
 isPlainPortable :: T.Text -> Bool
 isPlainPortable t = isPlainSafe t && not (isYaml11NonString t)
 
+-- | The text of a null, e.g. @~@ or @null@, in a plain scalar or with the
+-- null tag.
 isNull :: T.Text -> Bool
 isNull t = T.null t || t == "~" || t == "null" || t == "Null" || t == "NULL"
 
diff --git a/src/Yamlet/Internal/View.hs b/src/Yamlet/Internal/View.hs
--- a/src/Yamlet/Internal/View.hs
+++ b/src/Yamlet/Internal/View.hs
@@ -84,8 +84,13 @@
 
 -- | The node is null.
 isNullNode :: S.Node -> Bool
-isNullNode n = case view n of
-  NullView -> True
+isNullNode n = case n.content of
+  -- The cases of 'scalarValue' that give null, without resolving the other
+  -- scalars, e.g. a number.
+  S.ScalarContent style t -> case n.props.tag of
+    S.NoTag -> style == S.Plain && isNull t
+    S.NonSpecificTag -> False
+    S.Tag tag -> tag == nullTag && isNull t
   _ -> False
 
 -- | The text of a string node.
diff --git a/yamlet.cabal b/yamlet.cabal
--- a/yamlet.cabal
+++ b/yamlet.cabal
@@ -1,7 +1,7 @@
 cabal-version:      3.8
 build-type:         Simple
 name:               yamlet
-version:            1.0.0.1
+version:            1.0.0.2
 license:            BSD-3-Clause
 license-file:       LICENSE
 category:           YAML
