Import the * operator of type level naturals

Viewed 64

Follow-up to Import a type family that is an operator in Haskell.

This works:

import GHC.TypeLits (type (+))

This is a parse error in GHC 9.0:

import GHC.TypeLits (type (*))

See for example:

ghci -XTypeOperators
GHCi, version 9.0.2: https://www.haskell.org/ghc/  :? for help
ghci> import GHC.TypeLits (type (+))
ghci> import GHC.TypeLits (type (*))

<interactive>:2:28: error: parse error on input ‘*’

How do I import type level natural number multiplication?

1 Answers

It is necessary to activate the language extension NoStarIsType, then it will work. Otherwise, * is going to be interpreted as Type.

Related