Type issue in new yesod

35 views
Skip to first unread message

Magicloud Magiclouds

unread,
Apr 2, 2013, 1:09:18 AM4/2/13
to yeso...@googlegroups.com
Hi,
  I have a yesod project that used to be compilable. Now when I migrate it to latest yesod, it failed compiling.

  The failed part is here: http://pastebin.com/pWn5FdeS .
  And the error message is:

Handler/FetchProcessPathRollup.hs:27:30:
    No instance for (Data.CSV.Conduit.CSV
                       Data.ByteString.Internal.ByteString
                       (containers-0.5.0.0:Data.Map.Base.Map a0 Text))
      arising from a use of `intoCSV'
    The type variable `a0' is ambiguous
    Possible fix: add a type signature that fixes these type variable(s)
    Note: there is a potential instance available:
      instance (Data.CSV.Conduit.CSV
                  s (csv-conduit-0.5.1:Data.CSV.Conduit.Types.Row s'),
                Ord s', Data.String.IsString s) =>
               Data.CSV.Conduit.CSV s (MapRow s')
        -- Defined in `Data.CSV.Conduit'
    Possible fix:
      add an instance declaration for
      (Data.CSV.Conduit.CSV
         Data.ByteString.Internal.ByteString
         (containers-0.5.0.0:Data.Map.Base.Map a0 Text))
    In the first argument of `(=$=)', namely `intoCSV defCSVSettings'
    In the second argument of `($$+-)', namely
      `(intoCSV defCSVSettings
        =$= parsePPR (zonedTimeToUTC day) k =$ sinkPersist)'
    In a stmt of a 'do' block:
      responseBody src
      $$+-
        (intoCSV defCSVSettings
         =$= parsePPR (zonedTimeToUTC day) k =$ sinkPersist)

Handler/FetchProcessPathRollup.hs:27:57:
    No instance for (PersistUnique
                       (Data.Conduit.Internal.ConduitM
                          (containers-0.5.0.0:Data.Map.Base.Map a0 Text)
                          ProcessPathRollup
                          (ResourceT
                             (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App)))))
      arising from a use of `parsePPR'
    Possible fix:
      add an instance declaration for
      (PersistUnique
         (Data.Conduit.Internal.ConduitM
            (containers-0.5.0.0:Data.Map.Base.Map a0 Text)
            ProcessPathRollup
            (ResourceT
               (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App)))))
    In the first argument of `(=$)', namely
      `parsePPR (zonedTimeToUTC day) k'
    In the second argument of `(=$=)', namely
      `parsePPR (zonedTimeToUTC day) k =$ sinkPersist'
    In the second argument of `($$+-)', namely
      `(intoCSV defCSVSettings
        =$= parsePPR (zonedTimeToUTC day) k =$ sinkPersist)'

--
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

Michael Snoyman

unread,
Apr 2, 2013, 2:50:16 AM4/2/13
to yeso...@googlegroups.com
This doesn't look like it's anything to do with Yesod; it looks like a problem with the usage of conduit and csv-conduit. Did you try following the GHC recommendation and adding a type signature to parsePPR?


--
You received this message because you are subscribed to the Google Groups "Yesod Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yesodweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Magicloud Magiclouds

unread,
Apr 2, 2013, 4:18:43 AM4/2/13
to yeso...@googlegroups.com
Sorry, the first error about CSV was due to parsePPR's type. If I set it type, then CSV error was gone. And the error of PersistUnique reported on first getKey call, instead of processPPR call.

Magicloud Magiclouds

unread,
Apr 2, 2013, 4:35:14 AM4/2/13
to yeso...@googlegroups.com
BTW, I am reading your articles about new changes in Conduit. Hoping I could find the answer. :-)

Michael Snoyman

unread,
Apr 2, 2013, 7:32:29 AM4/2/13
to yeso...@googlegroups.com
Can you provide the new source code and the new compiler error message?

Magicloud Magiclouds

unread,
Apr 2, 2013, 9:32:31 AM4/2/13
to yeso...@googlegroups.com
Sure.
The error message is as following. And the new code is here: http://pastebin.com/sqCkeY2q

[12 of 13] Compiling Handler.FetchProcessPathRollup ( Handler/FetchProcessPathRollup.hs, dist/build/Handler/FetchProcessPathRollup.o )

Handler/FetchProcessPathRollup.hs:43:16:
    No instance for (PersistUnique
                       (Data.Conduit.Internal.ConduitM
                          (containers-0.5.0.0:Data.Map.Base.Map Text Text)
                          ProcessPathRollup
                          (ResourceT
                             (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App)))))
      arising from a use of `getKey'
    Possible fix:
      add an instance declaration for
      (PersistUnique
         (Data.Conduit.Internal.ConduitM
            (containers-0.5.0.0:Data.Map.Base.Map Text Text)
            ProcessPathRollup
            (ResourceT
               (Database.Persist.GenericSql.Raw.SqlPersist (GHandler App App)))))
    In a stmt of a 'do' block:
      reportKey <- getKey
                     (UniqueReport (t "Report")) (Report (t "Report"))
    In the expression:
      do { let t = (!) r
               d = liftM fst . double . t
               ....;
           reportKey <- getKey
                          (UniqueReport (t "Report")) (Report (t "Report"));
           lineitemKey <- getKey
                            (UniqueLineitem (t "LineItem Name") (t "LineItem Id"))
                            (Lineitem (t "LineItem Id") (t "LineItem Name"));
           mainProcessKey <- getKey
                               (UniqueMainProcess (t "Main Process"))
                               (MainProcess (t "Main Process"));
           .... }
    In the second argument of `($)', namely
      `\ r
         -> do { let ...;
                 reportKey <- getKey
                                (UniqueReport (t "Report")) (Report (t "Report"));
                 .... }'

Michael Snoyman

unread,
Apr 3, 2013, 12:59:07 AM4/3/13
to yeso...@googlegroups.com
Not sure if this will help at all, but try replacing =$= with =$. Otherwise I'm out of ideas.

Magicloud Magiclouds

unread,
Apr 3, 2013, 1:20:46 AM4/3/13
to yeso...@googlegroups.com
Sadly, same error....


--
You received this message because you are subscribed to the Google Groups "Yesod Web Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to yesodweb+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Magicloud Magiclouds

unread,
Apr 3, 2013, 3:24:09 AM4/3/13
to yeso...@googlegroups.com
I am not quite familiar with types used in Yesod (including persistence and conduit). So by a glance to the documents, I made this to make it compilable. But I am not sure if this is the correct behavior.

instance (PersistStore m, PersistUnique (Data.Conduit.Internal.Pipe i i o () m)) => PersistUnique (Data.Conduit.Internal.ConduitM i o m) where
  getBy = Data.Conduit.Internal.ConduitM . getBy
Reply all
Reply to author
Forward
0 new messages