agrafix / agrafix/elm-bridge

Good way to deal with Persistent's Entity?

Aberta
#30 9 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Elm
Estrelas
107
Forks
28
Métricas de merge de PRs
Nenhum PR com merge em 30d

Descrição

Im adapting to Yesod Persistent. Thus my old Game type becomes "[Entity](https://hackage.haskell.org/package/persistent-2.8.1/docs/Database-Persist-Types.html#t:Entity) Game" that is constructed as "Entity GameId Game" where type GameId = Key Game (or something like that).

ive managed to make stuff work by adding a wrapper that can be incorpoarated in elm-bridge, but it feels clumsy

`data Ent a b = Ent { _key :: a, _val :: b } deriving (Show,Generic)`

Incase you are familiar with Persistent, how would one incorporate encoding of (nested) entity types in elm-bridge.

trying to get :

`deriveBoth defaultOptions { fieldLabelModifier = drop 1} ''PS.Entity`

..to compile gives :

`Can't derive this sum: ForallC [] [AppT (ConT Database.Persist.Class.PersistEntity.PersistEntity) (VarT record_7566047373982557936)] (RecC Database.Persist.Class.PersistEntity.Entity [(Database.Persist.Class.PersistEntity.entityKey,Bang NoSourceUnpackedness NoSourceStrictness,AppT (ConT Database.Persist.Class.PersistEntity.Key) (VarT record_7566047373982557936)),(Database.Persist.Class.PersistEntity.entityVal,Bang NoSourceUnpackedness NoSourceStrictness,VarT record_7566047373982557936)])`

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.