Diagrams.Core.Types option does not compile in LTS 17.01

35 views
Skip to first unread message

Alistair Wall

unread,
Jul 3, 2021, 7:40:53 AMJul 3
to diagrams-discuss

Trying to install diagrams, but failed with compilation errors. I suspect it is because in GHC 8.10, Option has been replaced with an upgraded Maybe (see note at https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-Semigroup.html#t:Option).

diagrams-core                    > /tmp/stack-c3f270f7d9c5ab5c/diagrams-core-1.4.2/src/Diagrams/Core/Types.hs:227:19: error:
diagrams-core                    >     • Couldn't match type ‘Maybe (Transformation v n :+: Style v n)’
diagrams-core                    >                      with ‘Option (Transformation v n :+: n0)’
diagrams-core                    >       Expected type: DownAnnots v n -> Transformation v n
diagrams-core                    >         Actual type: (Option (Transformation v n :+: n0), Name ::: ())
diagrams-core                    >                      -> Transformation v n
diagrams-core                    >     • In the expression: option mempty killR . fst
diagrams-core                    >       In an equation for ‘transfFromAnnot’:
diagrams-core                    >           transfFromAnnot = option mempty killR . fst
diagrams-core                    >     • Relevant bindings include
diagrams-core                    >         transfFromAnnot :: DownAnnots v n -> Transformation v n
diagrams-core                    >           (bound at src/Diagrams/Core/Types.hs:227:1)
diagrams-core                    >     |
diagrams-core                    > 227 | transfFromAnnot = option mempty killR . fst
diagrams-core                    >     |                   ^^^^^^^^^^^^^^^^^^^^^^^^^
diagrams-core                    >   
diagrams-core                    > /tmp/stack-c3f270f7d9c5ab5c/diagrams-core-1.4.2/src/Diagrams/Core/Types.hs:350:42: error:
diagrams-core                    >     • Couldn't match type ‘Maybe a0’ with ‘Option u'’
diagrams-core                    >       Expected type: u -> Option u'
diagrams-core                    >         Actual type: u -> Maybe a0
diagrams-core                    >     • In the second argument of ‘(.)’, namely ‘get’
diagrams-core                    >       In the second argument of ‘maybe’, namely
diagrams-core                    >         ‘(option mempty id . get)’
diagrams-core                    >       In the first argument of ‘(.)’, namely
diagrams-core                    >         ‘maybe mempty (option mempty id . get)’
diagrams-core                    >     • Relevant bindings include
diagrams-core                    >         getU' :: D.DUALTree d u a l -> u'
diagrams-core                    >           (bound at src/Diagrams/Core/Types.hs:350:1)
diagrams-core                    >     |
diagrams-core                    > 350 | getU' = maybe mempty (option mempty id . get) . D.getU

Brent Yorgey

unread,
Jul 3, 2021, 7:42:50 AMJul 3
to Alistair Wall, diagrams-discuss
How are you building diagrams?  Which version are you using?  This is supposed to have been fixed already.

--
You received this message because you are subscribed to the Google Groups "diagrams-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/diagrams-discuss/16e32459-efe8-4156-af18-ef20166cf9a0n%40googlegroups.com.

Brent Yorgey

unread,
Jul 3, 2021, 3:21:34 PMJul 3
to Alistair Wall, diagrams-discuss
Ah, I think I have a guess: I haven't updated the 'diagrams' package itself even though most of the components have been updated.  Try listing the individual diagrams packages you need (probably diagrams-core + diagrams-lib + a backend such as diagrams-svg or diagrams-rasterific + possibly diagrams-contrib) instead of the 'diagrams' package.

Indika Piyasena

unread,
Jul 12, 2021, 8:51:48 AMJul 12
to diagrams-discuss
Hi. I'm glad that this group is still active. I was looking forward to learning Haskell again with diagrams and this happened to me as well. I'm on OSX.


With resolver: lts-16.0

```
diagrams-lib> configure
diagrams-lib> Configuring diagrams-lib-1.4.3...
diagrams-lib> build
diagrams-lib> Preprocessing library for diagrams-lib-1.4.3..
diagrams-lib> Building library for diagrams-lib-1.4.3..
diagrams-lib> [ 1 of 73] Compiling Diagrams.Attributes
diagrams-lib> [ 2 of 73] Compiling Diagrams.Attributes.Compile
diagrams-lib> [ 3 of 73] Compiling Diagrams.CubicSpline.Internal
diagrams-lib> [ 4 of 73] Compiling Diagrams.Names
diagrams-lib> [ 5 of 73] Compiling Diagrams.Parametric
diagrams-lib> [ 6 of 73] Compiling Diagrams.Parametric.Adjust
diagrams-lib> <command line>: can't load framework: Cocoa (not found)
```

Apparently the above issue has been resolved in a newer version of Haskell, so I tried with
resolver: lts-17.2

```
Error: While constructing the build plan, the following exceptions were encountered:

In the dependencies for diagrams-core-1.5.0:
    dual-tree must match >=0.2 && <0.3, but the stack configuration has no specified version  (latest matching version is 0.2.3.0)
    monoid-extras must match >=0.3 && <0.7, but the stack configuration has no specified version  (latest matching version is 0.6)
needed due to reason-0.1.0.0 -> diagrams-core-1.5.0

In the dependencies for diagrams-lib-1.4.4:
    active must match >=0.2 && <0.3, but the stack configuration has no specified version  (latest matching version is 0.2.0.15)
    dual-tree must match >=0.2 && <0.3, but the stack configuration has no specified version  (latest matching version is 0.2.3.0)
    monoid-extras must match >=0.6 && <0.7, but the stack configuration has no specified version  (latest matching version is 0.6)
needed due to reason-0.1.0.0 -> diagrams-lib-1.4.4

In the dependencies for diagrams-svg-1.4.3:
    monoid-extras must match >=0.3 && <0.7, but the stack configuration has no specified version  (latest matching version is 0.6)
    svg-builder must match >=0.1 && <0.2, but the stack configuration has no specified version  (latest matching version is 0.1.1)
needed due to reason-0.1.0.0 -> diagrams-svg-1.4.3
```

These are the dependencies I included:
- diagrams-lib
- diagrams-svg
- diagrams-core

What options are possible? I could use Docker, but that would be a pain? Will learning Nix resolve this?

Indika

Alistair Wall

unread,
Jul 12, 2021, 10:58:46 AMJul 12
to diagrams-discuss
currently working with resolver: nightly-2021-07-07 and allow-newer: true.

I have a long list of extra-deps which I added as prompted.

Indika Piyasena

unread,
Jul 14, 2021, 10:47:24 AMJul 14
to diagrams-discuss
I'm compiling again, and excited again. Thank you.

Alistair Wall

unread,
Jul 15, 2021, 6:56:44 AMJul 15
to diagrams-discuss
For anyone else who has problems, I have documented my installation at https://alistairwall.com/2021/07/15/installing-diagrams/

rea...@googlemail.com

unread,
Aug 6, 2021, 12:02:47 PMAug 6
to diagrams-discuss
I am also trying to install on MacOs 11.5 with latest Stack.
Is there any advice on which LTS to use?

I tried 18/5 (ghc 8.10.4) and added extra-deps as stack build suggested, but got unresolved conflicts:

   In the dependencies for diagrams-core-1.4.2:
   base-4.14.1.0 from stack configuration does not match >=4.2 && <4.14  (latest matching version is 4.13.0.0)
   monoid-extras-0.6 from stack configuration does not match >=0.3 && <0.6  (latest matching version is 0.5.1)

rea...@googlemail.com

unread,
Aug 9, 2021, 6:05:52 AMAug 9
to diagrams-discuss
Solved:  I did manage to get a build with LTS 18.5 (ghc 8.10.4) using extra-deps suggested by stack build BUT
with diagrams-core-1.5.0 (as suggested by Brent).  I had to remove diagrams>=1.4 from dependencies
leaving just - diagrams-lib  - diagrams-contrib - diagrams-svg.

Brent Yorgey

unread,
Aug 9, 2021, 9:39:39 AMAug 9
to rea...@googlemail.com, diagrams-discuss
That makes sense.  Note that the 'diagrams' package itself is only a convenient wrapper enabling the others to be installed with a single install command, so it is rarely helpful to list it in a .cabal or stack.yaml file.

--
You received this message because you are subscribed to the Google Groups "diagrams-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to diagrams-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages