Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Possible bug in filter #33

Closed
tibbe opened this Issue · 2 comments

1 participant

@tibbe
Owner

The following example should print True twice:

test.hs

{-# LANGUAGE DeriveDataTypeable #-}
import Data.Data
import Data.Protobuf.AST
import Data.Protobuf.Types

import qualified Data.HashSet as Set

main :: IO ()
main = do
    let h1 = Set.fromList $ good
        h2 = Set.filter (`elem` good) h1  -- same as h1
    print $ Set.member (head good) h1
    print $ Set.member (head good) h2


good = [typeOf (undefined :: [ProtobufFile Namespace])
       ,typeOf (undefined :: Message)
       ,typeOf (undefined :: [Message])
       ]

Data/Protobuf/AST.hs

{-# LANGUAGE DeriveDataTypeable #-}
module Data.Protobuf.AST where

import Data.Data


data ProtobufFile n
  = ProtobufFile [Message] n
    deriving (Show,Typeable,Data)

data Message = Message
               (Identifier)
               [MessageField]
               [Identifier]
               deriving (Show,Typeable,Data)

data MessageField
  = MessageField Field
  | Nested Message
  deriving (Show,Typeable,Data)

data Field = Field
             deriving (Show,Typeable,Data)

newtype Identifier = Identifier String
    deriving (Typeable,Data,Show)

Data/Protobuf/Types.hs

{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveFunctor #-}
-- | Data types for transformations
module Data.Protobuf.Types (
    Namespace
  , emptyNamespace
  ) where


import Data.Data                 (Typeable,Data)
import qualified Data.Map      as Map
import           Data.Map        (Map)

-- | Namespace
newtype Namespace = Namespace (Map String Int)
                  deriving (Typeable,Data)

-- | Empty namespace
emptyNamespace :: Namespace
emptyNamespace = Namespace Map.empty
@tibbe tibbe closed this issue from a commit
@tibbe Don't collapse singleton BitmapIndexed nodes in filter
This (incorrect) attempt at an optimization could cause a
BitmapIndexed node to move to another level, where its bitmap wasn't
valid.  Closes #33
23b86f8
@tibbe tibbe closed this in 23b86f8
@tibbe
Owner

I will make a new release that includes this bugfix in the next few days.

@tibbe
Owner

I've released 0.2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.