This import:
import Data.Singletons.TH
(
FalseSym0,
FromEnum,
MaxBound,
MinBound,
PEq,
PShow,
ShowsPrec,
ShowStringSym0,
SShow,
ToEnum,
TrueSym0,
sShowsPrec,
sShowString
)
fails with the following error:
error:
Cannot find type of method Data.Singletons.Prelude.Enum.toEnum
|
23 | $(singletons [d|
| ^^^^^^^^^^^^^^...
error: Q monad failure
|
23 | $(singletons [d|
| ^^^^^^^^^^^^^^...
When the import is changed to:
import Data.Singletons.TH
everything works just fine.
Adding toEnum
to the import list for Data.Singletons.TH
will fail with:
error:
Module ‘Data.Singletons.TH’ does not export ‘toEnum’
|
21 | toEnum
| ^^^^^^
From what I can tell the part of the code the caused this is here:
$(singletons [d|
data DoorState :: Type where
Opened :: DoorState
Closed :: DoorState
Locked :: DoorState
deriving (Bounded, Data, Enum, Eq, Show, Typeable)
|])
$(singletons [d|
class Cycle a where
next :: a -> a
prev :: a -> a
|])
instance forall a. (Bounded a, Enum a, Eq a) => Cycle a where
next x
| x == maxBound = minBound
| otherwise = succ x
prev x
| x == minBound = maxBound
| otherwise = pred x
What is the function that actually needs to be added to the import list for everything to work correctly? Why is this function not being reported in the error message.