module Unison.DataDeclaration.ConstructorId
  ( ConstructorId,
    fromNumConstructors,
  )
where

import Data.Word (Word64)

type ConstructorId = Word64

-- | Return a list of constructor ids from the number of constructors a decl has.
fromNumConstructors :: Int -> [ConstructorId]
fromNumConstructors :: Int -> [ConstructorId]
fromNumConstructors Int
n
  | Int
n Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
<= Int
0 = []
  | Bool
otherwise = [ConstructorId
0 .. Int -> ConstructorId
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
1)]