Question

I'm using Yesod to design a website, and I'd like to use the PersistMap data type to map entries to text names. However, I can't seem to find any examples of how to declare a PersistMap field in the config/models file.

When I try

entryName [Text] Map

it seems to just make a [Text] variable, but when I do

entryName (Text, Text) Map

or

entryName [(Text, Text)] Map

I get a syntax error.

How can I declare a PersistMap entry in my config/models file?

Was it helpful?

Solution

In your Haskell code, you can declare a type synonym, e.g.:

type TextPairs = [(Text, Text)]

Then use that synonym in your model definition.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top