agocorona / MFlow

(Haskell) Web application server with stateful, type safe user interactions and widget combinators
http://mflowdemo.herokuapp.com
Other
100 stars 12 forks source link

Malformed mflow.config causing Prelude.read parse error #24

Closed blgeorge closed 10 years ago

blgeorge commented 10 years ago

I originally had MFlow-0.3.3 installed but recently upgraded to MFlow-0.4.2.

I attempted to recompile a small MFlow example, "example.hs"...

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

import MFlow.Wai.Blaze.Html.All

main= runNavigation "navString" . step $ ask $ do
  (h1 "H1 content")
  ++> stop

...which compiled without error. However, running the example now gave me the following output:

bgeorge@server:~/mflow$ ./example 8112
using port 8112
Using configuration:
sync...examples: Prelude.read: no parse

I made a completely new directory and compiled the same code as above and it ran fine with no problems.

I eventually tracked down the offending "read" call to an attempt to print 'config', and realized that the content of .tcachedata/mflow.config was different in my recompiled directory and my new copy.

The content of the being printed upon starting the application in the new directory is:

Config {cadmin = "admin", cjqueryScript = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", cjqueryCSS = "//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", cjqueryUI = "//code.jquery.com/ui/1.10.3/jquery-ui.js", cnicEditUrl = "//js.nicedit.com/nicEdit-latest.js"}

The content of the mflow.config file in the original directory (which produces the 'read' parse error) was simply:

Config "admin"

Manually overwriting the old mflow.config with the new Config data structure caused the application to work correctly without any recompilation necessary.

Conclusion I believe that the original mflow.config data was from the earlier version of the MFlow library that persisted after my reinstallation. Perhaps, if possible, it would be better to regenerate the mflow.config file after every recompilation, or perhaps even on startup on an application, to ensure that the config file is generated according to the specifications current version of the MFlow library. At the least, it might be advisable to warn users that on upgrading, the mflow.config file from old programs must be removed and regenerated.

agocorona commented 10 years ago

Hi, blgeorge:

Thank you very much for using MFlow.

Yo are right. Apologies for the inconvenience.

I had to upload the last version as soon as possible without proper documentation due to some incompatibility with the last version of a new library. As a result the documentation is not as good as it should be.

The question is that I´m solving some bugs. After that I will create a configuration file that will be user defined and version-change proof. But it would take some time.

Apart from that, What is your experience with MFlow? It is easy and fun or otherwise?

2014-03-23 8:58 GMT+01:00 blgeorge notifications@github.com:

I originally had MFlow-0.3.3 installed but recently upgraded to MFlow-0.4.2.

I attempted to recompile a small MFlow example, "example.hs"...

{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE ScopedTypeVariables #-} import MFlow.Wai.Blaze.Html.All main= runNavigation "navString" . step $ ask $ do (h1 "H1 content") ++> stop

...which compiled without error. However, running the example now gave me the following output:

bgeorge@server:~/mflow$ ./example 8112 using port 8112 Using configuration: sync...examples: Prelude.read: no parse

I made a completely new directory and compiled the same code as above and it ran fine with no problems.

I eventually tracked down the offending "read" call to an attempt to print 'config', and realized that the content of .tcachedata/mflow.config was different in my recompiled directory and my new copy.

The content of the being printed upon starting the application in the new directory is:

Config {cadmin = "admin", cjqueryScript = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", cjqueryCSS = "//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", cjqueryUI = "//code.jquery.com/ui/1.10.3/jquery-ui.js", cnicEditUrl = "//js.nicedit.com/nicEdit-latest.js"}

The content of the mflow.config file in the original directory (which produces the 'read' parse error) was simply:

Config "admin"

Manually overwriting the old mflow.config with the new Config data structure caused the application to work correctly without any recompilation necessary.

Conclusion I believe that the original mflow.config data was from the earlier version of the MFlow library that persisted after my reinstallation. Perhaps, if possible, it would be better to regenerate the mflow.config file after every recompilation, or perhaps even on startup on an application, to ensure that the config file is generated according to the specifications current version of the MFlow library. At the least, it might be advisable to warn users that on upgrading, the mflow.config file from old programs must be removed and regenerated.

Reply to this email directly or view it on GitHubhttps://github.com/agocorona/MFlow/issues/24 .

Alberto.

blgeorge commented 10 years ago

Hi Alberto,

Thanks for the fast reply. I like MFlow very much so far. It's a bit confusing (I'm actually a biologist and only an amateur Haskell programmer), but I still find it less confusing and less tedious than the other web libraries I've tried.

The most confusing part so far is that the docs don't have many simple examples, so I have some trouble figuring out what exactly each of the many ascii functions does and how they all fit together (I get confused with all the << ++> <\ <+> <|>). I'm actually working on making a list of examples comparing the Haskell/MFlow code and the HTML that they generate so that it's easier to understand exactly how each function affects the output. I was collecting these examples to help a friend of mine to better understand MFlow, but I'll be happy to forward it to you if you're interested in possibly including them in the docs or in one of your example blog posts.

Thanks again and I look forward to getting some use out of your library soon!

Ben

On Sun, Mar 23, 2014, at 16:17, agocorona wrote:

Hi, blgeorge:

Thank you very much for using MFlow.

Yo are right. Apologies for the inconvenience.

I had to upload the last version as soon as possible without proper

documentation due to some incompatibility with the last version of a new

library. As a result the documentation is not as good as it should be.

The question is that I´m solving some bugs. After that I will create a

configuration file that will be user defined and version-change proof. But

it would take some time.

Apart from that, What is your experience with MFlow? It is easy and fun

or otherwise?

2014-03-23 8:58 GMT+01:00 blgeorge notifications@github.com:

I originally had MFlow-0.3.3 installed but recently upgraded to

MFlow-0.4.2.

I attempted to recompile a small MFlow example, "example.hs"...

{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE ScopedTypeVariables

-}

import MFlow.Wai.Blaze.Html.All

main= runNavigation "navString" . step $ ask $ do

(h1 "H1 content")

++> stop

...which compiled without error. However, running the example now gave me

the following output:

bgeorge@server:~/mflow$ ./example 8112

using port 8112

Using configuration:

sync...examples: Prelude.read: no parse

I made a completely new directory and compiled the same code as above and

it ran fine with no problems.

I eventually tracked down the offending "read" call to an attempt to print

'config', and realized that the content of .tcachedata/mflow.config was

different in my recompiled directory and my new copy.

The content of the being printed upon starting the application in the new

directory is:

Config {cadmin = "admin", cjqueryScript = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", cjqueryCSS = "//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", cjqueryUI = "//code.jquery.com/ui/1.10.3/jquery-ui.js", cnicEditUrl = "//js.nicedit.com/nicEdit-latest.js"}

The content of the mflow.config file in the original directory (which

produces the 'read' parse error) was simply:

Config "admin"

Manually overwriting the old mflow.config with the new Config data

structure caused the application to work correctly without any

recompilation necessary.

Conclusion

I believe that the original mflow.config data was from the earlier version

of the MFlow library that persisted after my reinstallation. Perhaps, if

possible, it would be better to regenerate the mflow.config file after

every recompilation, or perhaps even on startup on an application, to

ensure that the config file is generated according to the specifications

current version of the MFlow library. At the least, it might be advisable

to warn users that on upgrading, the mflow.config file from old programs

must be removed and regenerated.

Reply to this email directly or view it on GitHubhttps://github.com/agocorona/MFlow/issues/24

.

Alberto.

Reply to this email directly or [1]view it on GitHub. [6565154__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMTE4MTgyO SwiZGF0YSI6eyJpZCI6MjgzMTM4MTR9fQ==--4df15b90296938c24e25a807690e14956d e51a64.gif]

Ben George blgeorge@fastmail.fm

References

  1. https://github.com/agocorona/MFlow/issues/24#issuecomment-38376727
agocorona commented 10 years ago

2014-03-23 13:28 GMT+01:00 blgeorge notifications@github.com:

Hi Alberto,

Thanks for the fast reply. I like MFlow very much so far. It's a bit confusing (I'm actually a biologist and only an amateur Haskell programmer), but I still find it less confusing and less tedious than the other web libraries I've tried.

The most confusing part so far is that the docs don't have many simple examples, so I have some trouble figuring out what exactly each of the many ascii functions does and how they all fit together (I get confused with all the << ++> <\ <+> <|>). I'm actually working on making a list of examples comparing the Haskell/MFlow code and the HTML that they generate so that it's easier to understand exactly how each function affects the output. I was collecting these examples to help a friend of mine to better understand MFlow, but I'll be happy to forward it to you if you're interested in possibly including them in the docs or in one of your example blog posts.

That is awersome!. I was thinking about doing it for myself, but I didn't find enough time. If you do it, please forward it to me and I will post it in the documentation.

I finally uploaded a new version to github and to Hackage that solves the issue.

Thanks again and I look forward to getting some use out of your library soon!

Ben

On Sun, Mar 23, 2014, at 16:17, agocorona wrote:

Hi, blgeorge:

Thank you very much for using MFlow.

Yo are right. Apologies for the inconvenience.

I had to upload the last version as soon as possible without proper

documentation due to some incompatibility with the last version of a new

library. As a result the documentation is not as good as it should be.

The question is that I´m solving some bugs. After that I will create a

configuration file that will be user defined and version-change proof. But

it would take some time.

Apart from that, What is your experience with MFlow? It is easy and fun

or otherwise?

2014-03-23 8:58 GMT+01:00 blgeorge notifications@github.com:

I originally had MFlow-0.3.3 installed but recently upgraded to

MFlow-0.4.2.

I attempted to recompile a small MFlow example, "example.hs"...

{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE ScopedTypeVariables

-}

import MFlow.Wai.Blaze.Html.All

main= runNavigation "navString" . step $ ask $ do

(h1 "H1 content")

++> stop

...which compiled without error. However, running the example now gave me

the following output:

bgeorge@server:~/mflow$ ./example 8112

using port 8112

Using configuration:

sync...examples: Prelude.read: no parse

I made a completely new directory and compiled the same code as above and

it ran fine with no problems.

I eventually tracked down the offending "read" call to an attempt to print

'config', and realized that the content of .tcachedata/mflow.config was

different in my recompiled directory and my new copy.

The content of the being printed upon starting the application in the new

directory is:

Config {cadmin = "admin", cjqueryScript = "//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js", cjqueryCSS = "//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css", cjqueryUI = "//code.jquery.com/ui/1.10.3/jquery-ui.js", cnicEditUrl = "//js.nicedit.com/nicEdit-latest.js"}

The content of the mflow.config file in the original directory (which

produces the 'read' parse error) was simply:

Config "admin"

Manually overwriting the old mflow.config with the new Config data

structure caused the application to work correctly without any

recompilation necessary.

Conclusion

I believe that the original mflow.config data was from the earlier version

of the MFlow library that persisted after my reinstallation. Perhaps, if

possible, it would be better to regenerate the mflow.config file after

every recompilation, or perhaps even on startup on an application, to

ensure that the config file is generated according to the specifications

current version of the MFlow library. At the least, it might be advisable

to warn users that on upgrading, the mflow.config file from old programs

must be removed and regenerated.

Reply to this email directly or view it on GitHubhttps://github.com/agocorona/MFlow/issues/24

.

Alberto.

Reply to this email directly or [1]view it on GitHub. [6565154__eyJzY29wZSI6Ik5ld3NpZXM6QmVhY29uIiwiZXhwaXJlcyI6MTcxMTE4MTgyO SwiZGF0YSI6eyJpZCI6MjgzMTM4MTR9fQ==--4df15b90296938c24e25a807690e14956d e51a64.gif]

Ben George blgeorge@fastmail.fm

References

  1. https://github.com/agocorona/MFlow/issues/24#issuecomment-38376727

Reply to this email directly or view it on GitHubhttps://github.com/agocorona/MFlow/issues/24#issuecomment-38381021 .

Alberto.