darcs patch: ObjectIO Data.FiniteMap -> Data.Map fix

Krasimir Angelov kr.angelov at gmail.com
Mon Aug 14 12:04:49 EDT 2006


No objections from me. Go ahead.

Cheers,
  Krasimir

On 8/14/06, Esa Ilari Vuokko <eivuokko at gmail.com> wrote:
> Hi Krasimir,
>
> (I'm CCing libraries@ because that's where darcs send would send this)
>
> Nightly builds for ghc/mingw32 have been recently failing because
> ObjectIO-package won't build now that FiniteMap has been removed.
> Attached is a patch that uses Data.Map instead.  I have not tried
> if it works, merely that it compiles.
>
> (I guess I will apply the patch myself unless there's objections)
>
> Best regards,
> --Esa Ilari Vuokko
>
>
>
>
> New patches:
>
> [Use Data.Map instead of Data.FiniteMap
> Esa Ilari Vuokko <ei at vuokko.info>**20060814143706] {
> hunk ./Graphics/UI/ObjectIO/Control/Validate.hs 29
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Control/Validate.hs 101
> -               it1           = addListToFM it [(id,idParent) | id<-ids]
> +               it1           = foldr (\id tbl -> Map.insert id idParent tbl) it ids
> +
> hunk ./Graphics/UI/ObjectIO/Id.hs 35
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Id.hs 52
> -type   IdTable = FiniteMap Unique IdParent             -- all Id entries
> +type   IdTable = Map.Map Unique IdParent               -- all Id entries
> hunk ./Graphics/UI/ObjectIO/Id.hs 106
> -       = noDuplicates ids && not (any (\key -> elemFM key tbl) ids)
> +       = noDuplicates ids && not (any (\key -> elem key $ Map.keys tbl) ids)
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 40
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 99
> -                               let it1 = addToFM it menuId (IdParent{idpIOId=ioId,idpDevice=MenuDevice,idpId=menuId})
> +                               let it1 = Map.insert menuId (IdParent{idpIOId=ioId,idpDevice=MenuDevice,idpId=menuId}) it
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 313
> -                       Just id -> delFromFM it (fromJust mItemId)
> +                       Just id -> Map.delete (fromJust mItemId) it
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 334
> -       | otherwise             = delFromFM it (fromJust mItemId)
> +       | otherwise             = Map.delete (fromJust mItemId) it
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 336
> -       delFromFM it rId
> +       Map.delete rId it
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 341
> -       in maybe it1 (delFromFM it1) mRadioId
> +       in maybe it1 (flip Map.delete it1) mRadioId
> hunk ./Graphics/UI/ObjectIO/Menu/Create.hs 343
> -       maybe it (delFromFM it) mSepId
> +       maybe it (flip Map.delete it) mSepId
> hunk ./Graphics/UI/ObjectIO/Menu/Device.hs 35
> -import  Data.FiniteMap(lookupFM)
> +import  qualified Data.Map as Map (lookup)
> hunk ./Graphics/UI/ObjectIO/Menu/Device.hs 146
> -                                       let Just idParent = lookupFM (ioContextGetIdTable iocontext) rId
> +                                       let Just idParent = Map.lookup rId (ioContextGetIdTable iocontext)
> hunk ./Graphics/UI/ObjectIO/Menu/Handle.hs 26
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Menu/Handle.hs 114
> -       else Just (addListToFM it (map (\id->(id,IdParent{idpIOId=ioId,idpDevice=MenuDevice,idpId=menuId})) ids))
> +       else Just (foldr insMap it ids)
> hunk ./Graphics/UI/ObjectIO/Menu/Handle.hs 116
> +        insMap id tbl = Map.insert id IdParent {idpIOId=ioId, idpDevice=MenuDevice, idpId=menuId} tbl
> hunk ./Graphics/UI/ObjectIO/Menu/Internal.hs 38
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Menu/Internal.hs 109
> -                                                                               ioStSetIdTable (closeMenuIds ioid mH (delFromFM it id))
> +                                                                               ioStSetIdTable (closeMenuIds ioid mH (Map.delete id it))
> hunk ./Graphics/UI/ObjectIO/Menu/Items.hs 32
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Menu/Items.hs 320
> -                                                                       let it1 = delFromFM it (fromJust mSepId)
> +                                                                       let it1 = Map.delete (fromJust mSepId) it
> hunk ./Graphics/UI/ObjectIO/Menu/Items.hs 327
> -                                                               else return (containsItem,iNr,delFromFM it rId,ids,itemH,keys)
> +                                                               else return (containsItem,iNr,Map.delete rId it,ids,itemH,keys)
> hunk ./Graphics/UI/ObjectIO/Menu/Items.hs 475
> -                                                               let it1 = delFromFM it (fromJust mSepId)
> +                                                               let it1 = Map.delete (fromJust mSepId) it
> hunk ./Graphics/UI/ObjectIO/Menu/Items.hs 483
> -                                               else return (containsItem,iNr,indices,delFromFM it rId,recH,keys)
> +                                               else return (containsItem,iNr,indices,Map.delete rId it,recH,keys)
> hunk ./Graphics/UI/ObjectIO/OS/MenuEvent.hs 40
> -import  Data.FiniteMap(lookupFM)
> +import  Data.Map as Map (lookup)
> hunk ./Graphics/UI/ObjectIO/OS/MenuEvent.hs 84
> -               case lookupFM (ioContextGetIdTable iocontext) rId of
> +               case Map.lookup rId (ioContextGetIdTable iocontext) of
> hunk ./Graphics/UI/ObjectIO/OS/ReceiverEvent.hs 26
> -import Data.FiniteMap(lookupFM)
> +import qualified Data.Map as Map (lookup)
> hunk ./Graphics/UI/ObjectIO/OS/ReceiverEvent.hs 41
> -       case lookupFM (ioContextGetIdTable iocontext) rId of
> +       case Map.lookup rId (ioContextGetIdTable iocontext) of
> hunk ./Graphics/UI/ObjectIO/OS/TimerEvent.hs 30
> -import  Data.FiniteMap(lookupFM)
> +import  Data.Map as Map (lookup)
> hunk ./Graphics/UI/ObjectIO/OS/TimerEvent.hs 68
> -                       case lookupFM (ioContextGetIdTable iocontext) rId of
> +                       case Map.lookup rId (ioContextGetIdTable iocontext) of
> hunk ./Graphics/UI/ObjectIO/OS/WindowEvent.hs 37
> -import Data.FiniteMap(lookupFM)
> +import qualified Data.Map as Map (lookup)
> hunk ./Graphics/UI/ObjectIO/OS/WindowEvent.hs 103
> -                       case lookupFM (ioContextGetIdTable iocontext) rId of
> +                       case Map.lookup rId (ioContextGetIdTable iocontext) of
> hunk ./Graphics/UI/ObjectIO/Process/IOState.hs 72
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Process/IOState.hs 241
> -                     , ioidtable         = emptyFM
> +                     , ioidtable         = Map.empty
> hunk ./Graphics/UI/ObjectIO/Receiver/Device.hs 26
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Receiver/Device.hs 69
> -                       ioStSetIdTable (delListFromFM idtable rIds);
> +                       ioStSetIdTable (foldr Map.delete idtable rIds);
> hunk ./Graphics/UI/ObjectIO/Receiver/Device.hs 99
> -                       let Just idParent = lookupFM it rId
> +                       let Just idParent = Map.lookup rId it
> hunk ./Graphics/UI/ObjectIO/StdControl.hs 109
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdControl.hs 128
> -       let maybeParent = lookupFM idtable id
> +       let maybeParent = Map.lookup id idtable
> hunk ./Graphics/UI/ObjectIO/StdControl.hs 136
> -       let parentIds  = map (lookupFM idtable . getId) xs
> +       let parentIds  = map (flip Map.lookup idtable . getId) xs
> hunk ./Graphics/UI/ObjectIO/StdControl.hs 323
> -                       ioStSetIdTable (delListFromFM it (freeIds))
> +                       ioStSetIdTable (foldr Map.delete it (freeIds))
> hunk ./Graphics/UI/ObjectIO/StdControl.hs 343
> -                               ioStSetIdTable (delListFromFM it freeIds)
> +                               ioStSetIdTable (foldr Map.delete it freeIds)
> hunk ./Graphics/UI/ObjectIO/StdId.hs 29
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdId.hs 72
> -       return (fmap idpId (lookupFM it id))
> +       return (fmap idpId (Map.lookup id it))
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 79
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 131
> -                               return (if elemFM id idtable then Nothing else Just id)
> +                               return (if Map.member id idtable then Nothing else Just id)
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 282
> -       (case lookupFM it mId of
> +       (case Map.lookup mId it of
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 303
> -       (case lookupFM it sId of
> +       (case Map.lookup sId it of
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 324
> -       (case lookupFM idtable rId of
> +       (case Map.lookup rId idtable of
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 334
> -                                          let idtable1 = addListToFM idtable (map (\id->(id,IdParent{idpIOId=ioId,idpDevice=MenuDevice,idpId=mId})) radioIds)
> +                                          let  insMap id tbl = Map.insert id IdParent{idpIOId=ioId,idpDevice=MenuDevice,idpId=mId} tbl
> +                                               idtable1 = foldr insMap idtable radioIds
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 353
> -       (case lookupFM idtable mId of
> +       (case Map.lookup mId idtable of
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 363
> -       (case lookupFM idtable sId of
> +       (case Map.lookup sId idtable of
> hunk ./Graphics/UI/ObjectIO/StdMenu.hs 374
> -       (case lookupFM idtable rId of
> +       (case Map.lookup rId idtable of
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 45
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 66
> -       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,lookupFM it id)) ids)
> +       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,Map.lookup id it)) ids)
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 75
> -       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,lookupFM it id)) ids)
> +       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,Map.lookup id it)) ids)
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 120
> -       let ids_mIds = filterMap (isOkMenuElementId ioId) (map (\id -> (id,lookupFM it id)) ids)
> +       let ids_mIds = filterMap (isOkMenuElementId ioId) (map (\id -> (id,Map.lookup id it)) ids)
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 129
> -       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,lookupFM it id)) ids)
> +       let ids_mIds  = filterMap (isOkMenuElementId ioId) (map (\id -> (id,Map.lookup id it)) ids)
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 147
> -       let id_titles_mIds  = filterMap (isOkMenuElementId ioId) (map (\id_t@(id,_) -> (id_t,lookupFM it id)) id_titles)
> +       let id_titles_mIds  = filterMap (isOkMenuElementId ioId) (map (\id_t@(id,_) -> (id_t,Map.lookup id it)) id_titles)
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 168
> -       let maybeParent = lookupFM it id
> +       let maybeParent = Map.lookup id it
> hunk ./Graphics/UI/ObjectIO/StdMenuElement.hs 204
> -       let maybeParent = lookupFM it id
> +       let maybeParent = Map.lookup id it
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 51
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 73
> -                       if   elemFM id idtable
> +                       if   Map.member id idtable
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 85
> -                                       ioStSetIdTable (addToFM idtable id (IdParent {idpIOId=ioId,idpDevice=ReceiverDevice,idpId=id}));
> +                                       ioStSetIdTable (Map.insert id (IdParent {idpIOId=ioId,idpDevice=ReceiverDevice,idpId=id}) idtable);
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 110
> -                       if   elemFM id idtable
> +                       if   Map.member id idtable
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 122
> -                                       ioStSetIdTable (addToFM idtable id (IdParent {idpIOId=ioId,idpDevice=ReceiverDevice,idpId=id}));
> +                                       ioStSetIdTable (Map.insert id (IdParent {idpIOId=ioId,idpDevice=ReceiverDevice,idpId=id}) idtable);
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 175
> -                                       ioStSetIdTable (delFromFM idtable id);
> +                                       ioStSetIdTable (Map.delete id idtable);
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 270
> -       unless (elemFM (rIdtoId rid) it) (throwGUI ErrorUnknownObject)
> +       unless (Map.member (rIdtoId rid) it) (throwGUI ErrorUnknownObject)
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 284
> -       unless (elemFM (rIdtoId rid) it) (throwGUI ErrorUnknownObject)
> +       unless (Map.member (rIdtoId rid) it) (throwGUI ErrorUnknownObject)
> hunk ./Graphics/UI/ObjectIO/StdReceiver.hs 298
> -       unless (elemFM (r2IdtoId rid) it) (throwGUI ErrorUnknownObject)
> +       unless (Map.member (r2IdtoId rid) it) (throwGUI ErrorUnknownObject)
> hunk ./Graphics/UI/ObjectIO/StdTimer.hs 34
> -import  Data.FiniteMap
> +import  qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdTimer.hs 67
> -                               let it1 = addToFM it id IdParent{idpIOId=pid,idpDevice=TimerDevice,idpId=id}
> +                               let it1 = Map.insert id IdParent{idpIOId=pid,idpDevice=TimerDevice,idpId=id} it
> hunk ./Graphics/UI/ObjectIO/StdTimer.hs 98
> -                               (if elemFM id it then throwGUI ErrorIdsInUse
> +                               (if Map.member id it then throwGUI ErrorIdsInUse
> hunk ./Graphics/UI/ObjectIO/StdTimer.hs 130
> -                                       in (removeTimerFromTimerTable teLoc tt1,delFromFM it1 (tId tH))
> +                                       in (removeTimerFromTimerTable teLoc tt1,Map.delete (tId tH) it1)
> hunk ./Graphics/UI/ObjectIO/StdWindow.hs 83
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/StdWindow.hs 150
> -                                                       ioStSetIdTable (addToFM it okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}))
> +                                                       ioStSetIdTable (Map.insert okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}) it)
> hunk ./Graphics/UI/ObjectIO/StdWindow.hs 175
> -                                                       ioStSetIdTable (addToFM it okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}))
> +                                                       ioStSetIdTable (Map.insert okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}) it)
> hunk ./Graphics/UI/ObjectIO/StdWindow.hs 196
> -                                                       ioStSetIdTable (addToFM it okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}))
> +                                                       ioStSetIdTable (Map.insert okId (IdParent {idpIOId=ioId,idpDevice=WindowDevice,idpId=okId}) it)
> hunk ./Graphics/UI/ObjectIO/Timer/Access.hs 23
> -import  Data.FiniteMap
> +import  Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Timer/Access.hs 39
> -                       | elemFM rid it = Nothing
> -                       | otherwise = Just (addToFM it rid (IdParent{idpIOId=pid,idpDevice=TimerDevice,idpId=timerid}))
> +                       | Map.member rid it = Nothing
> +                       | otherwise = Just (insert rid (IdParent{idpIOId=pid,idpDevice=TimerDevice,idpId=timerid}) it)
> hunk ./Graphics/UI/ObjectIO/Timer/Access.hs 64
> -                       (removeTimerFromTimerTable teLoc tt,delFromFM it rId)
> +                       (removeTimerFromTimerTable teLoc tt,Map.delete rId it)
> hunk ./Graphics/UI/ObjectIO/Timer/Device.hs 28
> -import  Data.FiniteMap
> +import  Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Timer/Device.hs 75
> -                       in (removeTimerFromTimerTable teLoc tt,delFromFM it tId)
> +                       in (removeTimerFromTimerTable teLoc tt,delete tId it)
> hunk ./Graphics/UI/ObjectIO/Window/Device.hs 50
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Window/Device.hs 112
> -                       ioStSetIdTable (delListFromFM idtable (concat freeIdss))
> +                       ioStSetIdTable (foldr Map.delete idtable (concat freeIdss))
> hunk ./Graphics/UI/ObjectIO/Window/Device.hs 146
> -                       let Just idParent = lookupFM it rId
> +                       let Just idParent = Map.lookup rId it
> hunk ./Graphics/UI/ObjectIO/Window/Dispose.hs 34
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Window/Dispose.hs 90
> -                               ioStSetIdTable (delListFromFM idtable ids);
> +                               ioStSetIdTable (foldr Map.delete idtable ids);
> hunk ./Graphics/UI/ObjectIO/Window/Validate.hs 43
> -import Data.FiniteMap
> +import qualified Data.Map as Map
> hunk ./Graphics/UI/ObjectIO/Window/Validate.hs 65
> -               if   elemFM id idtable
> +               if   Map.member id idtable
> }
>
> Context:
>
> [TAG Initial conversion from CVS complete
> John Goerzen <jgoerzen at complete.org>**20060112154134]
> Patch bundle hash:
> 1cfda5a076b0c429075eb36bea6f66c7f05caa61
>
>
>


More information about the Libraries mailing list