Skip to content

Named subdiagrams lose their names after being looked up #43

@byorgey

Description

@byorgey
{-# LANGUAGE NoMonomorphismRestriction #-}

import           Diagrams.Prelude

aCircleNamedBob :: D R2
aCircleNamedBob = circle 1 # named "bob"

whatIsTheNameOfThisCircle
  = case lookupName "bob" aCircleNamedBob of
      Nothing -> error "this doesn't happen"
      Just c  -> getSub c

itTurnsOutTheCircleAboveHasNoName
  = case lookupName "bob" whatIsTheNameOfThisCircle of
      Nothing  -> putStrLn "wah!"
      Just bob -> putStrLn "found bob"

main = itTurnsOutTheCircleAboveHasNoName

I would argue that the above program ought to print found bob, though I am open to other opinions. This bit me when building some animations via keyframing---the diagrams used to build the actual animation are looked-up subdiagrams, so one can no longer use frames of the animation as keyframes for building further animations (since there are no longer any names to match up).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions