diff --git a/music-sibelius.cabal b/music-sibelius.cabal
--- a/music-sibelius.cabal
+++ b/music-sibelius.cabal
@@ -1,6 +1,6 @@
 
 name:                   music-sibelius
-version:                1.6.2
+version:                1.7
 author:                 Hans Hoglund
 maintainer:             Hans Hoglund <hans@hanshoglund.se>
 license:                BSD3
@@ -23,13 +23,13 @@
 library                    
     build-depends:      base                     >= 4 && < 5,
                         semigroups               >= 0.13.0.1 && < 1,
-                        lens                     >= 4.0 && < 4.1,
+                        lens				            >= 4.1.2 && < 4.2,
                         monadplus,
                         unordered-containers,
                         bytestring,
-                        music-score              == 1.6.2,
-                        music-pitch-literal      == 1.6.2,
-                        music-preludes           == 1.6.2,
+                        music-score              == 1.7,
+                        music-pitch-literal      == 1.7,
+                        music-preludes           == 1.7,
                         aeson
     exposed-modules:    Music.Sibelius
                         Music.Score.Import.Sibelius
diff --git a/src/Music/Score/Import/Sibelius.hs b/src/Music/Score/Import/Sibelius.hs
--- a/src/Music/Score/Import/Sibelius.hs
+++ b/src/Music/Score/Import/Sibelius.hs
@@ -3,132 +3,132 @@
              ConstraintKinds, FlexibleContexts #-}
 
 module Music.Score.Import.Sibelius (
-        IsSibelius(..),
-        fromSibelius,
-        readSibelius,
-        readSibeliusMaybe,
-        readSibeliusEither
+        -- IsSibelius(..),
+        -- fromSibelius,
+        -- readSibelius,
+        -- readSibeliusMaybe,
+        -- readSibeliusEither
   ) where
 
-import Control.Lens
-import Music.Sibelius
-import Music.Score
-import Data.Aeson
-import Music.Pitch.Literal (IsPitch)
-
-import qualified Music.Pitch.Literal as Pitch
-import qualified Data.ByteString.Lazy as ByteString
-
--- |
--- Convert a score from a Sibelius representation.
---
-fromSibelius :: IsSibelius a => SibeliusScore -> Score a
-fromSibelius (SibeliusScore title composer info staffH transp staves systemStaff) =
-    foldr (</>) mempty $ fmap fromSibeliusStaff staves
-    -- TODO meta information
-
-fromSibeliusStaff :: IsSibelius a => SibeliusStaff -> Score a
-fromSibeliusStaff (SibeliusStaff bars name shortName) =
-    removeRests $ scat $ fmap fromSibeliusBar bars
-    -- TODO bar length hardcoded
-    -- TODO meta information
-    -- NOTE slur pos/dur always "stick" to an adjacent note, regardless of visual position
-    --      for other lines (cresc etc) this might not be the case
-    -- WARNING key sig changes goes at end of previous bar
-
-fromSibeliusBar :: IsSibelius a => SibeliusBar -> Score (Maybe a)
-fromSibeliusBar (SibeliusBar elems) = 
-    fmap Just (pcat $ fmap fromSibeliusChordElem chords) <> return Nothing^*1
-    where
-        chords   = filter isChord elems
-        tuplets  = filter isTuplet elems -- TODO use these
-        floating = filter isFloating elems
-
-fromSibeliusChordElem :: IsSibelius a => SibeliusBarObject -> Score a
-fromSibeliusChordElem = go where
-    go (SibeliusBarObjectChord chord) = fromSibeliusChord chord
-    go _                         = error "fromSibeliusChordElem: Expected chord"
-
--- handleFloatingElem :: IsSibelius a => SibeliusBarObject -> [Score a] -> [Score a]
-
-isChord (SibeliusBarObjectChord _) = True
-isChord _                     = False
-
-isTuplet (SibeliusBarObjectTuplet _) = True
-isTuplet _                      = False
-
-isFloating x = not (isChord x) && not (isTuplet x) 
-    
-
-fromSibeliusChord :: IsSibelius a => SibeliusChord -> Score a
-fromSibeliusChord (SibeliusChord pos dur voice ar strem dtrem acci appo notes) = 
-    showVals $ setTime $ setDur $ every setArt ar $ tremolo strem $ pcat $ fmap fromSibeliusNote notes
-    where     
-        showVals = text (show pos ++ " " ++ show dur) -- TODO DEBUG
-        -- WARNING for tuplets, positions are absolute (sounding), but durations are relative (written)
-        -- To retrieve sounding duration we must find floating tuplet objects and use
-        -- the duration/playedDuration fields
-        setTime = delay (fromIntegral pos / kTicksPerWholeNote)
-        setDur  = stretch (fromIntegral dur / kTicksPerWholeNote)
-        setArt Marcato         = marcato
-        setArt Accent          = accent
-        setArt Tenuto          = tenuto
-        setArt Staccato        = staccato
-        setArt a               = error $ "fromSibeliusChord: Unsupported articulation" ++ show a        
-    -- TODO tremolo and appogiatura/acciaccatura support
-
-fromSibeliusNote :: IsSibelius a => SibeliusNote -> Score a
-fromSibeliusNote (SibeliusNote pitch diatonicPitch acc tied style) =
-    (if tied then fmap beginTie else id)
-    $ fmap (up' (fromIntegral pitch - 60)) Pitch.c
-    -- TODO spell correctly if this is Common.Pitch (how to distinguish)
-    where
-        up' x = pitch' %~ (+ x)
-        -- up' x = mapPitch' (+ x)
-
--- |
--- Read a Sibelius score from a file. Fails if the file could not be read or if a parsing
--- error occurs.
+-- import Control.Lens
+-- import Music.Sibelius
+-- import Music.Score
+-- import Data.Aeson
+-- import Music.Pitch.Literal (IsPitch)
 -- 
-readSibelius :: IsSibelius a => FilePath -> IO (Score a)
-readSibelius path = fmap (either (\x -> error $ "Could not read score " ++ x) id) $ readSibeliusEither path
-
--- |
--- Read a Sibelius score from a file. Fails if the file could not be read, and returns
--- @Nothing@ if a parsing error occurs.
+-- import qualified Music.Pitch.Literal as Pitch
+-- import qualified Data.ByteString.Lazy as ByteString
 -- 
-readSibeliusMaybe :: IsSibelius a => FilePath -> IO (Maybe (Score a))
-readSibeliusMaybe path = fmap (either (const Nothing) Just) $ readSibeliusEither path
-
--- |
--- Read a Sibelius score from a file. Fails if the file could not be read, and returns
--- @Left m@ if a parsing error occurs.
+-- -- |
+-- -- Convert a score from a Sibelius representation.
+-- --
+-- fromSibelius :: IsSibelius a => SibeliusScore -> Score a
+-- fromSibelius (SibeliusScore title composer info staffH transp staves systemStaff) =
+--     foldr (</>) mempty $ fmap fromSibeliusStaff staves
+--     -- TODO meta information
 -- 
-readSibeliusEither :: IsSibelius a => FilePath -> IO (Either String (Score a))
-readSibeliusEither path = do
-    json <- ByteString.readFile path
-    return $ fmap fromSibelius $ eitherDecode' json
-
--- |
--- This constraint includes all note types that can be constructed from a Sibelius representation.
---
-type IsSibelius a = (
-    IsPitch a, 
-    HasPart' a, 
-    Enum (Part a), 
-    HasPitch' a, 
-    Num (Pitch a), 
-    HasTremolo a, 
-    HasArticulation a,
-    HasText a,
-    Tiable a
-    )
-
-
--- Util
-
-every :: (a -> b -> b) -> [a] -> b -> b
-every f = flip (foldr f)
-
-kTicksPerWholeNote = 1024 -- Always in Sibelius
+-- fromSibeliusStaff :: IsSibelius a => SibeliusStaff -> Score a
+-- fromSibeliusStaff (SibeliusStaff bars name shortName) =
+--     removeRests $ scat $ fmap fromSibeliusBar bars
+--     -- TODO bar length hardcoded
+--     -- TODO meta information
+--     -- NOTE slur pos/dur always "stick" to an adjacent note, regardless of visual position
+--     --      for other lines (cresc etc) this might not be the case
+--     -- WARNING key sig changes goes at end of previous bar
+-- 
+-- fromSibeliusBar :: IsSibelius a => SibeliusBar -> Score (Maybe a)
+-- fromSibeliusBar (SibeliusBar elems) = 
+--     fmap Just (pcat $ fmap fromSibeliusChordElem chords) <> return Nothing^*1
+--     where
+--         chords   = filter isChord elems
+--         tuplets  = filter isTuplet elems -- TODO use these
+--         floating = filter isFloating elems
+-- 
+-- fromSibeliusChordElem :: IsSibelius a => SibeliusBarObject -> Score a
+-- fromSibeliusChordElem = go where
+--     go (SibeliusBarObjectChord chord) = fromSibeliusChord chord
+--     go _                         = error "fromSibeliusChordElem: Expected chord"
+-- 
+-- -- handleFloatingElem :: IsSibelius a => SibeliusBarObject -> [Score a] -> [Score a]
+-- 
+-- isChord (SibeliusBarObjectChord _) = True
+-- isChord _                     = False
+-- 
+-- isTuplet (SibeliusBarObjectTuplet _) = True
+-- isTuplet _                      = False
+-- 
+-- isFloating x = not (isChord x) && not (isTuplet x) 
+--     
+-- 
+-- fromSibeliusChord :: IsSibelius a => SibeliusChord -> Score a
+-- fromSibeliusChord (SibeliusChord pos dur voice ar strem dtrem acci appo notes) = 
+--     showVals $ setTime $ setDur $ every setArt ar $ tremolo strem $ pcat $ fmap fromSibeliusNote notes
+--     where     
+--         showVals = text (show pos ++ " " ++ show dur) -- TODO DEBUG
+--         -- WARNING for tuplets, positions are absolute (sounding), but durations are relative (written)
+--         -- To retrieve sounding duration we must find floating tuplet objects and use
+--         -- the duration/playedDuration fields
+--         setTime = delay (fromIntegral pos / kTicksPerWholeNote)
+--         setDur  = stretch (fromIntegral dur / kTicksPerWholeNote)
+--         setArt Marcato         = marcato
+--         setArt Accent          = accent
+--         setArt Tenuto          = tenuto
+--         setArt Staccato        = staccato
+--         setArt a               = error $ "fromSibeliusChord: Unsupported articulation" ++ show a        
+--     -- TODO tremolo and appogiatura/acciaccatura support
+-- 
+-- fromSibeliusNote :: IsSibelius a => SibeliusNote -> Score a
+-- fromSibeliusNote (SibeliusNote pitch diatonicPitch acc tied style) =
+--     (if tied then fmap beginTie else id)
+--     $ fmap (up' (fromIntegral pitch - 60)) Pitch.c
+--     -- TODO spell correctly if this is Common.Pitch (how to distinguish)
+--     where
+--         up' x = pitch' %~ (+ x)
+--         -- up' x = mapPitch' (+ x)
+-- 
+-- -- |
+-- -- Read a Sibelius score from a file. Fails if the file could not be read or if a parsing
+-- -- error occurs.
+-- -- 
+-- readSibelius :: IsSibelius a => FilePath -> IO (Score a)
+-- readSibelius path = fmap (either (\x -> error $ "Could not read score " ++ x) id) $ readSibeliusEither path
+-- 
+-- -- |
+-- -- Read a Sibelius score from a file. Fails if the file could not be read, and returns
+-- -- @Nothing@ if a parsing error occurs.
+-- -- 
+-- readSibeliusMaybe :: IsSibelius a => FilePath -> IO (Maybe (Score a))
+-- readSibeliusMaybe path = fmap (either (const Nothing) Just) $ readSibeliusEither path
+-- 
+-- -- |
+-- -- Read a Sibelius score from a file. Fails if the file could not be read, and returns
+-- -- @Left m@ if a parsing error occurs.
+-- -- 
+-- readSibeliusEither :: IsSibelius a => FilePath -> IO (Either String (Score a))
+-- readSibeliusEither path = do
+--     json <- ByteString.readFile path
+--     return $ fmap fromSibelius $ eitherDecode' json
+-- 
+-- -- |
+-- -- This constraint includes all note types that can be constructed from a Sibelius representation.
+-- --
+-- type IsSibelius a = (
+--     IsPitch a, 
+--     HasPart' a, 
+--     Enum (Part a), 
+--     HasPitch' a, 
+--     Num (Pitch a), 
+--     HasTremolo a, 
+--     HasArticulation a,
+--     HasText a,
+--     Tiable a
+--     )
+-- 
+-- 
+-- -- Util
+-- 
+-- every :: (a -> b -> b) -> [a] -> b -> b
+-- every f = flip (foldr f)
+-- 
+-- kTicksPerWholeNote = 1024 -- Always in Sibelius
 
diff --git a/src/Music/Sibelius.hs b/src/Music/Sibelius.hs
--- a/src/Music/Sibelius.hs
+++ b/src/Music/Sibelius.hs
@@ -4,310 +4,310 @@
 
 module Music.Sibelius (
 
-        -- * Scores and staves
-        SibeliusScore(..),
-        SibeliusStaff(..),
-        SibeliusBar(..),
-        
-        -- * Bar objects
-        SibeliusBarObject(..),
-
-        -- ** Notes
-        SibeliusChord(..),
-        SibeliusNote(..),
-
-        -- ** Lines
-        SibeliusSlur(..),
-        SibeliusCrescendoLine(..),
-        SibeliusDiminuendoLine(..),
-
-        -- ** Tuplets
-        SibeliusTuplet(..),
-        SibeliusArticulation(..),
-        readSibeliusArticulation,
-
-        -- ** Miscellaneous
-        SibeliusClef(..),
-        SibeliusKeySignature(..),
-        SibeliusTimeSignature(..),
-        SibeliusText(..),
+        -- -- * Scores and staves
+        -- SibeliusScore(..),
+        -- SibeliusStaff(..),
+        -- SibeliusBar(..),
+        -- 
+        -- -- * Bar objects
+        -- SibeliusBarObject(..),
+        -- 
+        -- -- ** Notes
+        -- SibeliusChord(..),
+        -- SibeliusNote(..),
+        -- 
+        -- -- ** Lines
+        -- SibeliusSlur(..),
+        -- SibeliusCrescendoLine(..),
+        -- SibeliusDiminuendoLine(..),
+        -- 
+        -- -- ** Tuplets
+        -- SibeliusTuplet(..),
+        -- SibeliusArticulation(..),
+        -- readSibeliusArticulation,
+        -- 
+        -- -- ** Miscellaneous
+        -- SibeliusClef(..),
+        -- SibeliusKeySignature(..),
+        -- SibeliusTimeSignature(..),
+        -- SibeliusText(..),
 
   ) where
 
-import Control.Monad.Plus
-import Control.Applicative
-import Data.Semigroup
-import Data.Aeson
-
-import qualified Data.HashMap.Strict as HashMap
-
-
-{-
-setTitle :: String -> Score a -> Score a
-setTitle = setMeta "title"
-setComposer :: String -> Score a -> Score a
-setComposer = setMeta "composer"
-setInformation :: String -> Score a -> Score a
-setInformation = setMeta "information"
-setMeta :: String -> String -> Score a -> Score a
-setMeta _ _ = id
--}
-
-
-data SibeliusScore = SibeliusScore {
-            scoreTitle             :: String,
-            scoreComposer          :: String,
-            scoreInformation       :: String,
-            scoreStaffHeight       :: Double,
-            scoreTransposing       :: Bool,
-            scoreStaves            :: [SibeliusStaff],
-            scoreSystemStaff       :: ()
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusScore where
-    parseJSON (Object v) = SibeliusScore
-        <$> v .: "title" 
-        <*> v .: "composer"
-        <*> v .: "information"
-        <*> v .: "staffHeight"
-        <*> v .: "transposing"
-        <*> v .: "staves"          
-        -- TODO system staff
-        <*> return ()
-
-
-data SibeliusStaff = SibeliusStaff {
-            staffBars                :: [SibeliusBar],
-            staffName                :: String,
-            staffShortName           :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusStaff where
-    parseJSON (Object v) = SibeliusStaff
-        <$> v .: "bars"
-        <*> v .: "name"
-        <*> v .: "shortName"
-
-data SibeliusBar = SibeliusBar {
-            barElements            :: [SibeliusBarObject]
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusBar where
-    parseJSON (Object v) = SibeliusBar
-        <$> v .: "elements"
-
-data SibeliusBarObject 
-    = SibeliusBarObjectText SibeliusText
-    | SibeliusBarObjectClef SibeliusClef
-    | SibeliusBarObjectSlur SibeliusSlur
-    | SibeliusBarObjectCrescendoLine SibeliusCrescendoLine
-    | SibeliusBarObjectDiminuendoLine SibeliusDiminuendoLine
-    | SibeliusBarObjectTimeSignature SibeliusTimeSignature
-    | SibeliusBarObjectKeySignature SibeliusKeySignature
-    | SibeliusBarObjectTuplet SibeliusTuplet
-    | SibeliusBarObjectChord SibeliusChord
-    deriving (Eq, Ord, Show)
--- TODO highlights, lyric, barlines, comment, other lines and symbols
-
-instance FromJSON SibeliusBarObject where
-    parseJSON x@(Object v) = case HashMap.lookup "type" v of    
-        -- TODO
-        Just "text"      -> SibeliusBarObjectText <$> parseJSON x
-        Just "clef"      -> SibeliusBarObjectClef <$> parseJSON x
-        Just "slur"      -> SibeliusBarObjectSlur <$> parseJSON x
-        Just "cresc"     -> SibeliusBarObjectCrescendoLine <$> parseJSON x
-        Just "dim"       -> SibeliusBarObjectDiminuendoLine <$> parseJSON x
-        Just "time"      -> SibeliusBarObjectTimeSignature <$> parseJSON x
-        Just "key"       -> SibeliusBarObjectKeySignature <$> parseJSON x
-        Just "tuplet"    -> SibeliusBarObjectTuplet <$> parseJSON x
-        Just "chord"     -> SibeliusBarObjectChord <$> parseJSON x
-        _                -> mempty -- failure
-
-data SibeliusText = SibeliusText {
-            textVoice               :: Int,
-            textPosition            :: Int,
-            textText                :: String,
-            textStyle               :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusText where
-    parseJSON (Object v) = SibeliusText
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "text"
-        <*> v .: "style"
-     
-data SibeliusClef = SibeliusClef {
-            clefVoice               :: Int,
-            clefPosition            :: Int,
-            clefStyle               :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusClef where
-    parseJSON (Object v) = SibeliusClef
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "style"
-
-data SibeliusSlur = SibeliusSlur {
-            slurVoice               :: Int,
-            slurPosition            :: Int,
-            slurDuration            :: Int,
-            slurStyle               :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusSlur where
-    parseJSON (Object v) = SibeliusSlur
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "duration"
-        <*> v .: "style"
-
-data SibeliusCrescendoLine = SibeliusCrescendoLine {  
-            crescVoice               :: Int,
-            crescPosition            :: Int,
-            crescDuration            :: Int,
-            crescStyle               :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusCrescendoLine where
-    parseJSON (Object v) = SibeliusCrescendoLine
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "duration"
-        <*> v .: "style"
-
-data SibeliusDiminuendoLine = SibeliusDiminuendoLine {
-            dimVoice               :: Int,
-            dimPosition            :: Int,
-            dimDuration            :: Int,
-            dimStyle               :: String
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusDiminuendoLine where
-    parseJSON (Object v) = SibeliusDiminuendoLine
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "duration"
-        <*> v .: "style"
-
-data SibeliusTimeSignature = SibeliusTimeSignature {
-            timeVoice               :: Int,
-            timePosition            :: Int,
-            timeValue               :: Rational,
-            timeIsCommon            :: Bool,
-            timeIsAllaBreve         :: Bool
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusTimeSignature where
-    parseJSON (Object v) = SibeliusTimeSignature
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> fmap (\[x,y] -> (x::Rational) / (y::Rational)) (v .: "value")
-        <*> v .: "common"
-        <*> v .: "allaBreve"
-
-data SibeliusKeySignature = SibeliusKeySignature {
-            keyVoice               :: Int,
-            keyPosition            :: Int,
-            keyMajor               :: Bool,
-            keySharps              :: Int,
-            keyIsOpen              :: Bool
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusKeySignature where
-    parseJSON (Object v) = SibeliusKeySignature
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "major"
-        <*> v .: "sharps"
-        <*> v .: "isOpen"
-
-data SibeliusTuplet = SibeliusTuplet {
-            tupletVoice               :: Int,
-            tupletPosition            :: Int,
-            tupletDuration            :: Int,
-            tupletPlayedDuration      :: Int,
-            tupletValue               :: Rational
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusTuplet where
-    parseJSON (Object v) = SibeliusTuplet 
-        <$> v .: "voice" 
-        <*> v .: "position"
-        <*> v .: "duration"
-        <*> v .: "playedDuration"
-        <*> (v .: "value" >>= \[x,y] -> return $ x / y) -- TODO unsafe
-
-data SibeliusArticulation
-    = UpBow
-    | DownBow
-    | Plus
-    | Harmonic
-    | Marcato
-    | Accent
-    | Tenuto
-    | Wedge
-    | Staccatissimo
-    | Staccato
-    deriving (Eq, Ord, Show, Enum)
-
-readSibeliusArticulation :: String -> Maybe SibeliusArticulation
-readSibeliusArticulation = go
-    where
-        go "upbow"          = Just UpBow
-        go "downBow"        = Just DownBow
-        go "plus"           = Just Plus
-        go "harmonic"       = Just Harmonic
-        go "marcato"        = Just Marcato
-        go "accent"         = Just Accent
-        go "tenuto"         = Just Tenuto
-        go "wedge"          = Just Wedge
-        go "staccatissimo"  = Just Staccatissimo
-        go "staccato"       = Just Staccato
-        go _                = Nothing
-    
-data SibeliusChord = SibeliusChord { 
-            chordPosition            :: Int,
-            chordDuration            :: Int,
-            chordVoice               :: Int,
-            chordArticulations       :: [SibeliusArticulation], -- TODO
-            chordSingleTremolos      :: Int,
-            chordDoubleTremolos      :: Int,
-            chordAcciaccatura        :: Bool,
-            chordAppoggiatura        :: Bool,
-            chordNotes               :: [SibeliusNote]
-    }
-    deriving (Eq, Ord, Show)
-
-instance FromJSON SibeliusChord where
-    parseJSON (Object v) = SibeliusChord 
-        <$> v .: "position" 
-        <*> v .: "duration"
-        <*> v .: "voice"
-        <*> fmap (mmapMaybe readSibeliusArticulation) (v .: "articulations")
-        <*> v .: "singleTremolos"
-        <*> v .: "doubleTremolos"
-        <*> v .: "acciaccatura"
-        <*> v .: "appoggiatura"
-        <*> v .: "notes"
-
-data SibeliusNote = SibeliusNote {
-            notePitch               :: Int,
-            noteDiatonicPitch       :: Int,
-            noteAccidental          :: Int,
-            noteTied                :: Bool,
-            noteStyle               :: Int -- not String?
-    }
-    deriving (Eq, Ord, Show)
-instance FromJSON SibeliusNote where
-    parseJSON (Object v) = SibeliusNote 
-        <$> v .: "pitch" 
-        <*> v .: "diatonicPitch"
-        <*> v .: "accidental"
-        <*> v .: "tied"
-        <*> v .: "style"
-
-
-
-    
+-- import Control.Monad.Plus
+-- import Control.Applicative
+-- import Data.Semigroup
+-- import Data.Aeson
+-- 
+-- import qualified Data.HashMap.Strict as HashMap
+-- 
+-- 
+-- {-
+-- setTitle :: String -> Score a -> Score a
+-- setTitle = setMeta "title"
+-- setComposer :: String -> Score a -> Score a
+-- setComposer = setMeta "composer"
+-- setInformation :: String -> Score a -> Score a
+-- setInformation = setMeta "information"
+-- setMeta :: String -> String -> Score a -> Score a
+-- setMeta _ _ = id
+-- -}
+-- 
+-- 
+-- data SibeliusScore = SibeliusScore {
+--             scoreTitle             :: String,
+--             scoreComposer          :: String,
+--             scoreInformation       :: String,
+--             scoreStaffHeight       :: Double,
+--             scoreTransposing       :: Bool,
+--             scoreStaves            :: [SibeliusStaff],
+--             scoreSystemStaff       :: ()
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusScore where
+--     parseJSON (Object v) = SibeliusScore
+--         <$> v .: "title" 
+--         <*> v .: "composer"
+--         <*> v .: "information"
+--         <*> v .: "staffHeight"
+--         <*> v .: "transposing"
+--         <*> v .: "staves"          
+--         -- TODO system staff
+--         <*> return ()
+-- 
+-- 
+-- data SibeliusStaff = SibeliusStaff {
+--             staffBars                :: [SibeliusBar],
+--             staffName                :: String,
+--             staffShortName           :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusStaff where
+--     parseJSON (Object v) = SibeliusStaff
+--         <$> v .: "bars"
+--         <*> v .: "name"
+--         <*> v .: "shortName"
+-- 
+-- data SibeliusBar = SibeliusBar {
+--             barElements            :: [SibeliusBarObject]
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusBar where
+--     parseJSON (Object v) = SibeliusBar
+--         <$> v .: "elements"
+-- 
+-- data SibeliusBarObject 
+--     = SibeliusBarObjectText SibeliusText
+--     | SibeliusBarObjectClef SibeliusClef
+--     | SibeliusBarObjectSlur SibeliusSlur
+--     | SibeliusBarObjectCrescendoLine SibeliusCrescendoLine
+--     | SibeliusBarObjectDiminuendoLine SibeliusDiminuendoLine
+--     | SibeliusBarObjectTimeSignature SibeliusTimeSignature
+--     | SibeliusBarObjectKeySignature SibeliusKeySignature
+--     | SibeliusBarObjectTuplet SibeliusTuplet
+--     | SibeliusBarObjectChord SibeliusChord
+--     deriving (Eq, Ord, Show)
+-- -- TODO highlights, lyric, barlines, comment, other lines and symbols
+-- 
+-- instance FromJSON SibeliusBarObject where
+--     parseJSON x@(Object v) = case HashMap.lookup "type" v of    
+--         -- TODO
+--         Just "text"      -> SibeliusBarObjectText <$> parseJSON x
+--         Just "clef"      -> SibeliusBarObjectClef <$> parseJSON x
+--         Just "slur"      -> SibeliusBarObjectSlur <$> parseJSON x
+--         Just "cresc"     -> SibeliusBarObjectCrescendoLine <$> parseJSON x
+--         Just "dim"       -> SibeliusBarObjectDiminuendoLine <$> parseJSON x
+--         Just "time"      -> SibeliusBarObjectTimeSignature <$> parseJSON x
+--         Just "key"       -> SibeliusBarObjectKeySignature <$> parseJSON x
+--         Just "tuplet"    -> SibeliusBarObjectTuplet <$> parseJSON x
+--         Just "chord"     -> SibeliusBarObjectChord <$> parseJSON x
+--         _                -> mempty -- failure
+-- 
+-- data SibeliusText = SibeliusText {
+--             textVoice               :: Int,
+--             textPosition            :: Int,
+--             textText                :: String,
+--             textStyle               :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusText where
+--     parseJSON (Object v) = SibeliusText
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "text"
+--         <*> v .: "style"
+--      
+-- data SibeliusClef = SibeliusClef {
+--             clefVoice               :: Int,
+--             clefPosition            :: Int,
+--             clefStyle               :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusClef where
+--     parseJSON (Object v) = SibeliusClef
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "style"
+-- 
+-- data SibeliusSlur = SibeliusSlur {
+--             slurVoice               :: Int,
+--             slurPosition            :: Int,
+--             slurDuration            :: Int,
+--             slurStyle               :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusSlur where
+--     parseJSON (Object v) = SibeliusSlur
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "duration"
+--         <*> v .: "style"
+-- 
+-- data SibeliusCrescendoLine = SibeliusCrescendoLine {  
+--             crescVoice               :: Int,
+--             crescPosition            :: Int,
+--             crescDuration            :: Int,
+--             crescStyle               :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusCrescendoLine where
+--     parseJSON (Object v) = SibeliusCrescendoLine
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "duration"
+--         <*> v .: "style"
+-- 
+-- data SibeliusDiminuendoLine = SibeliusDiminuendoLine {
+--             dimVoice               :: Int,
+--             dimPosition            :: Int,
+--             dimDuration            :: Int,
+--             dimStyle               :: String
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusDiminuendoLine where
+--     parseJSON (Object v) = SibeliusDiminuendoLine
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "duration"
+--         <*> v .: "style"
+-- 
+-- data SibeliusTimeSignature = SibeliusTimeSignature {
+--             timeVoice               :: Int,
+--             timePosition            :: Int,
+--             timeValue               :: Rational,
+--             timeIsCommon            :: Bool,
+--             timeIsAllaBreve         :: Bool
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusTimeSignature where
+--     parseJSON (Object v) = SibeliusTimeSignature
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> fmap (\[x,y] -> (x::Rational) / (y::Rational)) (v .: "value")
+--         <*> v .: "common"
+--         <*> v .: "allaBreve"
+-- 
+-- data SibeliusKeySignature = SibeliusKeySignature {
+--             keyVoice               :: Int,
+--             keyPosition            :: Int,
+--             keyMajor               :: Bool,
+--             keySharps              :: Int,
+--             keyIsOpen              :: Bool
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusKeySignature where
+--     parseJSON (Object v) = SibeliusKeySignature
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "major"
+--         <*> v .: "sharps"
+--         <*> v .: "isOpen"
+-- 
+-- data SibeliusTuplet = SibeliusTuplet {
+--             tupletVoice               :: Int,
+--             tupletPosition            :: Int,
+--             tupletDuration            :: Int,
+--             tupletPlayedDuration      :: Int,
+--             tupletValue               :: Rational
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusTuplet where
+--     parseJSON (Object v) = SibeliusTuplet 
+--         <$> v .: "voice" 
+--         <*> v .: "position"
+--         <*> v .: "duration"
+--         <*> v .: "playedDuration"
+--         <*> (v .: "value" >>= \[x,y] -> return $ x / y) -- TODO unsafe
+-- 
+-- data SibeliusArticulation
+--     = UpBow
+--     | DownBow
+--     | Plus
+--     | Harmonic
+--     | Marcato
+--     | Accent
+--     | Tenuto
+--     | Wedge
+--     | Staccatissimo
+--     | Staccato
+--     deriving (Eq, Ord, Show, Enum)
+-- 
+-- readSibeliusArticulation :: String -> Maybe SibeliusArticulation
+-- readSibeliusArticulation = go
+--     where
+--         go "upbow"          = Just UpBow
+--         go "downBow"        = Just DownBow
+--         go "plus"           = Just Plus
+--         go "harmonic"       = Just Harmonic
+--         go "marcato"        = Just Marcato
+--         go "accent"         = Just Accent
+--         go "tenuto"         = Just Tenuto
+--         go "wedge"          = Just Wedge
+--         go "staccatissimo"  = Just Staccatissimo
+--         go "staccato"       = Just Staccato
+--         go _                = Nothing
+--     
+-- data SibeliusChord = SibeliusChord { 
+--             chordPosition            :: Int,
+--             chordDuration            :: Int,
+--             chordVoice               :: Int,
+--             chordArticulations       :: [SibeliusArticulation], -- TODO
+--             chordSingleTremolos      :: Int,
+--             chordDoubleTremolos      :: Int,
+--             chordAcciaccatura        :: Bool,
+--             chordAppoggiatura        :: Bool,
+--             chordNotes               :: [SibeliusNote]
+--     }
+--     deriving (Eq, Ord, Show)
+-- 
+-- instance FromJSON SibeliusChord where
+--     parseJSON (Object v) = SibeliusChord 
+--         <$> v .: "position" 
+--         <*> v .: "duration"
+--         <*> v .: "voice"
+--         <*> fmap (mmapMaybe readSibeliusArticulation) (v .: "articulations")
+--         <*> v .: "singleTremolos"
+--         <*> v .: "doubleTremolos"
+--         <*> v .: "acciaccatura"
+--         <*> v .: "appoggiatura"
+--         <*> v .: "notes"
+-- 
+-- data SibeliusNote = SibeliusNote {
+--             notePitch               :: Int,
+--             noteDiatonicPitch       :: Int,
+--             noteAccidental          :: Int,
+--             noteTied                :: Bool,
+--             noteStyle               :: Int -- not String?
+--     }
+--     deriving (Eq, Ord, Show)
+-- instance FromJSON SibeliusNote where
+--     parseJSON (Object v) = SibeliusNote 
+--         <$> v .: "pitch" 
+--         <*> v .: "diatonicPitch"
+--         <*> v .: "accidental"
+--         <*> v .: "tied"
+--         <*> v .: "style"
+-- 
+-- 
+-- 
+--     
