{"action":"created","issue":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/1957","repository_url":"https://api.github.com/repos/commercialhaskell/stack","labels_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1957/labels{/name}","comments_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1957/comments","events_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1957/events","html_url":"https://github.com/commercialhaskell/stack/issues/1957","id":143881059,"number":1957,"title":"Running Haskell script with Stack uses multiple versions of one package","user":{"login":"pharpend","id":3221699,"avatar_url":"https://avatars.githubusercontent.com/u/3221699?v=3","gravatar_id":"","url":"https://api.github.com/users/pharpend","html_url":"https://github.com/pharpend","followers_url":"https://api.github.com/users/pharpend/followers","following_url":"https://api.github.com/users/pharpend/following{/other_user}","gists_url":"https://api.github.com/users/pharpend/gists{/gist_id}","starred_url":"https://api.github.com/users/pharpend/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pharpend/subscriptions","organizations_url":"https://api.github.com/users/pharpend/orgs","repos_url":"https://api.github.com/users/pharpend/repos","events_url":"https://api.github.com/users/pharpend/events{/privacy}","received_events_url":"https://api.github.com/users/pharpend/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/commercialhaskell/stack/labels/further%20investigation%20required","name":"further investigation required","color":"d4c5f9"}],"state":"closed","locked":false,"assignee":{"login":"harendra-kumar","id":5860491,"avatar_url":"https://avatars.githubusercontent.com/u/5860491?v=3","gravatar_id":"","url":"https://api.github.com/users/harendra-kumar","html_url":"https://github.com/harendra-kumar","followers_url":"https://api.github.com/users/harendra-kumar/followers","following_url":"https://api.github.com/users/harendra-kumar/following{/other_user}","gists_url":"https://api.github.com/users/harendra-kumar/gists{/gist_id}","starred_url":"https://api.github.com/users/harendra-kumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harendra-kumar/subscriptions","organizations_url":"https://api.github.com/users/harendra-kumar/orgs","repos_url":"https://api.github.com/users/harendra-kumar/repos","events_url":"https://api.github.com/users/harendra-kumar/events{/privacy}","received_events_url":"https://api.github.com/users/harendra-kumar/received_events","type":"User","site_admin":false},"assignees":[{"login":"harendra-kumar","id":5860491,"avatar_url":"https://avatars.githubusercontent.com/u/5860491?v=3","gravatar_id":"","url":"https://api.github.com/users/harendra-kumar","html_url":"https://github.com/harendra-kumar","followers_url":"https://api.github.com/users/harendra-kumar/followers","following_url":"https://api.github.com/users/harendra-kumar/following{/other_user}","gists_url":"https://api.github.com/users/harendra-kumar/gists{/gist_id}","starred_url":"https://api.github.com/users/harendra-kumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harendra-kumar/subscriptions","organizations_url":"https://api.github.com/users/harendra-kumar/orgs","repos_url":"https://api.github.com/users/harendra-kumar/repos","events_url":"https://api.github.com/users/harendra-kumar/events{/privacy}","received_events_url":"https://api.github.com/users/harendra-kumar/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/commercialhaskell/stack/milestones/8","html_url":"https://github.com/commercialhaskell/stack/milestones/Support","labels_url":"https://api.github.com/repos/commercialhaskell/stack/milestones/8/labels","id":1208081,"number":8,"title":"Support","description":"Issues without clear work items for the codebase","creator":{"login":"snoyberg","id":49415,"avatar_url":"https://avatars.githubusercontent.com/u/49415?v=3","gravatar_id":"","url":"https://api.github.com/users/snoyberg","html_url":"https://github.com/snoyberg","followers_url":"https://api.github.com/users/snoyberg/followers","following_url":"https://api.github.com/users/snoyberg/following{/other_user}","gists_url":"https://api.github.com/users/snoyberg/gists{/gist_id}","starred_url":"https://api.github.com/users/snoyberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snoyberg/subscriptions","organizations_url":"https://api.github.com/users/snoyberg/orgs","repos_url":"https://api.github.com/users/snoyberg/repos","events_url":"https://api.github.com/users/snoyberg/events{/privacy}","received_events_url":"https://api.github.com/users/snoyberg/received_events","type":"User","site_admin":false},"open_issues":20,"closed_issues":188,"state":"open","created_at":"2015-07-14T20:38:48Z","updated_at":"2016-08-16T14:06:02Z","due_on":null,"closed_at":null},"comments":34,"created_at":"2016-03-28T03:07:22Z","updated_at":"2016-08-17T05:07:38Z","closed_at":"2016-08-16T14:06:02Z","body":"Hello, there\r\n\r\nIn Snowdrift, we have a database setup script called `sdb.hs`. It uses\r\n`stack` along with the `turtle` package to run as a quasi-shell script.\r\n\r\nWhen I tried to run it today to start the database server, I got this\r\nerror message:\r\n\r\n```\r\n\r\nsdb.hs:70:47:\r\n    Couldn't match type ‘T.Text’\r\n                   with ‘Text’\r\n    NB: ‘T.Text’\r\n          is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.1’\r\n        ‘Text’ is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.0’\r\n    Expected type: String -> Text\r\n      Actual type: String -> T.Text\r\n    In the first argument of ‘map’, namely ‘T.pack’\r\n    In the second argument of ‘procs’, namely ‘(map T.pack as')’\r\n\r\nsdb.hs:140:37:\r\n    Couldn't match type ‘T.Text’\r\n                   with ‘Text’\r\n    NB: ‘T.Text’\r\n          is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.1’\r\n        ‘Text’ is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.0’\r\n    Expected type: Char -> Text\r\n      Actual type: Char -> T.Text\r\n    In the first argument of ‘(<$>)’, namely ‘T.singleton’\r\n    In the second argument of ‘(>>)’, namely\r\n      ‘(T.singleton <$> (char '#' <|> newline))’\r\n\r\nsdb.hs:221:41:\r\n    Couldn't match type ‘T.Text’\r\n                   with ‘Text’\r\n    NB: ‘T.Text’\r\n          is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.1’\r\n        ‘Text’ is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.0’\r\n    Expected type: Char -> Text\r\n      Actual type: Char -> T.Text\r\n    In the second argument of ‘(.)’, namely ‘T.singleton’\r\n    In the first argument of ‘fmap’, namely ‘(Just . T.singleton)’\r\n```\r\n\r\nAs you can see, stack is using multiple versions of `text`, and coming up with this ridiculous error.\r\n\r\n## Bulleted information:\r\n\r\n*   Script URL: <https://git.gnu.io/pharpend/snowdrift/blob/mech-sibling/sdb.hs>\r\n*   `stack --version`:\r\n\r\n        Version 1.0.5, Git revision 51492566184b4f98106de0e8199c8962dace567e x86_64\r\n\r\n*   Steps to reproduce:\r\n\r\n        git clone https://git.gnu.io/pharpend/snowdrift.git -b mech-sibling\r\n        cd snowdrift\r\n        ./sdb.hs init\r\n"},"comment":{"url":"https://api.github.com/repos/commercialhaskell/stack/issues/comments/240314745","html_url":"https://github.com/commercialhaskell/stack/issues/1957#issuecomment-240314745","issue_url":"https://api.github.com/repos/commercialhaskell/stack/issues/1957","id":240314745,"user":{"login":"harendra-kumar","id":5860491,"avatar_url":"https://avatars.githubusercontent.com/u/5860491?v=3","gravatar_id":"","url":"https://api.github.com/users/harendra-kumar","html_url":"https://github.com/harendra-kumar","followers_url":"https://api.github.com/users/harendra-kumar/followers","following_url":"https://api.github.com/users/harendra-kumar/following{/other_user}","gists_url":"https://api.github.com/users/harendra-kumar/gists{/gist_id}","starred_url":"https://api.github.com/users/harendra-kumar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harendra-kumar/subscriptions","organizations_url":"https://api.github.com/users/harendra-kumar/orgs","repos_url":"https://api.github.com/users/harendra-kumar/repos","events_url":"https://api.github.com/users/harendra-kumar/events{/privacy}","received_events_url":"https://api.github.com/users/harendra-kumar/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T05:07:37Z","updated_at":"2016-08-17T05:07:37Z","body":"Yeah we can externally determine the set of exact package-ids to use. But it requires invoking other programs like ghc-pkg which is not usually a big deal though but it would be more convenient if ghc itself has a simple way of achieving the same thing since it anyway goes through the dbs. \r\n\r\nFor `stack` the way pkg databases are stacked, the rule is really simple, we just need to choose packages in order in the pkgdb stack. So your proposed behavior for 8.2 should be sufficient for that. I need a few clarifications on that:\r\n* What does `stack` mean in `LAST in stack`? When GHC_PACKAGE_PATH is specified would it be that? When package dbs are specified on the command line, the order in which they are specified? When both are specified?\r\n* Will it work the same way even when no `-package` option is specified?\r\n\r\nOne of the problems in running scripts reliably is to specify the consistent versions of all packages used in the script. One way to achieve that would be to first determine all dependencies of the script and then pass correct versions of each package to GHC by first determining those externally. I do not know of a convenient way to determine the packages used (GHC API?, ghc -M?) in the script. On the other hand, if we have a way to tell ghc to always pick the packages in a certain order (e.g. GHC_PACKAGE_PATH) then this problem will be solved nicely for `stack`. We do not have to determine dependencies or right versions of packages externally. That's the reason I asked the second question above. Maybe we can pass a new flag to ghc to tell it to pick them in order instead of the old behavior."}}
{"actor":{"display_login":"harendra-kumar"}}