Contact/support | Changelog

demo

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
    data PublicationType
      = Issue
      | Proceedings
        deriving (Show,Enum,Read,Eq)

    instance GetValue PublicationType where
      getValue = getValueWith readEnum "PublicationType"

    instance ShowConstant PublicationType where
      showConstant = showConstant . showEnum

    field "PublicationType" "publicationType" "type" [t|Types.PublicationType|]

    table "publication" "eudl.publication"
      ['id
      ,'title
      ,'description
      ,'acronym
      ,'published
      ,'publicationType
      ,'publicationStatus
      ,'parent]

    -- | Get all journals.
    getJournals :: Model [Journal]
    getJournals = do
      bind (mapM makeJournal . sortBy (comparing (!F.title)) . uniq) $ query $ do
        publication <- table T.publication
        restrict $ publication!F.publicationType .==. val PublicationType.Issue
        project
          $ F.id      << publication!F.id
          # F.title   << publication!F.title
          # F.acronym << publication!F.acronym
27:19: Error: Redundant do
Found:
do bind (mapM makeJournal . sortBy (comparing (! F.title)) . uniq)
$
query $
do publication <- table T.publication
restrict $
publication ! F.publicationType .==. val PublicationType.Issue
project $
F.id << publication ! F.id # F.title << publication ! F.title #
F.acronym
<< publication
! F.acronym
Why not:
bind (mapM makeJournal . sortBy (comparing (! F.title)) . uniq) $
query $
do publication <- table T.publication
restrict $
publication ! F.publicationType .==. val PublicationType.Issue
project $
F.id << publication ! F.id # F.title << publication ! F.title #
F.acronym
<< publication
! F.acronym