13

Playing with purescript and running into an odd problem with string concatenation. I've loaded and imported the Prelude, Data.List, Data.Maybe, and Data.String (also, tried importing Data.Array) but the PSCi still doesn't recognize (++). This would suggest that either, (++) is not contained in any of my imported modules (in which case a pointer to the appropriate module(s) to import would be appreciated), or there was some weird problem when I installed purescript and set my enviornment. I find the latter unlikely but hey I'll keep my considerations open.

Thanks in advance!

Tshimanga
  • 845
  • 6
  • 16

1 Answers1

19

Newer versions of PureScript (since 0.9 I think) have abandoned ++ in favor of <>. That operator should work out of the box, since it is contained in purescript-prelude.

Thanks @gb. for the clarification. Edited the incorrect part of my answer.

stholzm
  • 3,395
  • 19
  • 31
  • 6
    Almost right! `(++)` and `(<>)` were both aliases for `Semigroup`'s `append`, but we decided to do away with having multiple operators for the same thing. `(<>)` came out as the favourite in the GitHub issue for it. – gb. Aug 26 '16 at 02:03
  • Ah, I see. Thanks! – Tshimanga Aug 26 '16 at 16:27
  • @gb. which github issue? – Ron Mar 20 '20 at 13:54
  • 1
    @Ron I had to do some excavating, at one point it did seem like `(++)` was favoured: https://github.com/purescript/purescript-prelude/issues/40, but eventually I found this: https://github.com/purescript/purescript-prelude/pull/52#issuecomment-172279525 - so looks like I wasn't quite right, in that it happened on IRC rather than in a GH issue. – gb. Mar 20 '20 at 17:20
  • 1
    Thanks @gb. Still wondering how did `(<>)` won. Even the PR initially picked `(++)` -- “`(<>)` was dropped in favour of `(++)` ... reasons: `(++)` is more suggestive of appending when dealing with things like strings, arrays. Almost all other operators based around `(<>)` are for functorial types.” ¯\_(ツ)_/¯ – Ron Mar 21 '20 at 04:30