Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Maybe.fromJust: Nothing" error when connecting translated small diagram #147

Closed
chauser opened this issue Jan 24, 2014 · 1 comment
Closed

Comments

@chauser
Copy link

chauser commented Jan 24, 2014

The code below produces
crash: Maybe.fromJust: Nothing
on the console and the program exits.

{-# LANGUAGE NoMonomorphismRestriction #-}                                                                                               

import Diagrams.Prelude                                                                                                                  
import Diagrams.Backend.Cairo.CmdLine                                                                                                    
import Graphics.SVGFonts.ReadFont                                                                                                        
qtest :: Diagram B R2                                                                                                                    
anchor = r2 (1/2, -1/2)                                                                                                                  
d1 = circle 0.005 # named "foo"                                                                                                          
d2 = circle 0.005 # translate anchor # named "bar"                                                                                       
d2' = circle 0.005 # named "bar" # translate anchor                                                                                      
qtest = (d1 ||| d2) # connectOutside "foo" "bar"                                                                                         
main = mainWith qtest
  • Using d2' instead of d2 in qtest works
  • Using circle 1 instead of circle 0.005 for d1 and d2 works
  • Omitting the connectOutside works

Following short discussion on IRC byorgey asked that this be posted as a bug so it can be tested against changes already made in HEAD. Hopefully it can then be closed immediately. Thanks.

@byorgey
Copy link
Member

byorgey commented Jan 24, 2014

OK, I can confirm that this works as expected in HEAD; in particular it does not crash.

Note that named attaches a name to the local origin of a diagram. So ... # translate anchor # named "bar" and ... # named "bar" # translate anchor are quite different. The expected behavior for the diagram that used to crash on fromJust is that no arrow is drawn at all, because the line between the two local origins does not intersect both circles.

@byorgey byorgey closed this as completed Jan 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants