The function natVal :: forall n proxy. KnownNat n => proxy n -> Integer associates a type level natural with an Integer value. Using DataKinds, TypeApplications language extensions one can do
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}
module Derp where
import Data.Proxy ( Proxy(..) )
import GHC.TypeLits ( natVal )
foo :: Integer
foo = natVal (Proxy @1337)
How would one associate a 'Maybe Nat to a value? e.g. a Maybe Integer
foo2 :: Maybe Integer
foo2 = maybeNatVal (Proxy @(Just 1337))