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?

Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top