typerep-map icon indicating copy to clipboard operation
typerep-map copied to clipboard

Use 'inspection-testing' to guarantee that implementation for `TMap` is as efficient as for `TypeRepMap`

Open chshersh opened this issue 6 years ago • 8 comments

chshersh avatar Jul 09 '18 14:07 chshersh

@ChShersh @vrom911 is this still a valid/wanted task? If so I'll like to give it a go.

qoelet avatar Feb 14 '19 15:02 qoelet

@qoelet Sure, go for it! But I would like you to add some documentation while you work on this. I never used inspection-testing by myself, so looking just at the code might be a little bit difficult to review.

chshersh avatar Feb 15 '19 01:02 chshersh

I've been taking a look at this issue, read the blog post to find out more about the library. But I'm not grasping what Tmap is as efficient as TypeRepMap?

Also been looking at the inspection-testing examples to try and find something that might fit the problem but with no luck.

I also saw the use in stan but that didn't give me clues either 😄

Cmdv avatar Sep 23 '20 20:09 Cmdv

Hi @Cmdv! TypeRepMap is parametrized by a polymorphic type variable, and TMap is special case of TypeRepMap with Identify instead of the f type variable.

However, despite being a specialization of TypeRepMap, TMap implements almost all functions separately, e.g. insert.

inspection-testing is a Haskell library for checking, wether two functions are compiled to the same code in the end. And we want to check this for similar functions of TMap and TypeRepMap. I haven't used inspections-testing before, so this task requires some research :slightly_smiling_face:

chshersh avatar Sep 24 '20 17:09 chshersh

@chshersh ah cool, so do I'd want to check for example: https://github.com/kowainik/typerep-map/blob/22af85834199e41ec7edefe48a6f45dc3abde751/src/Data/TMap.hs#L95-L96 https://github.com/kowainik/typerep-map/blob/22af85834199e41ec7edefe48a6f45dc3abde751/src/Data/TypeRepMap/Internal.hs#L184-L191

making sure they compile to the same code? do you test agains the empty function or is it against its results when being run?

Cmdv avatar Sep 24 '20 17:09 Cmdv

@Cmdv Yes, you got the idea right :+1: Checking just functions without applying them to any arguments should be enough.

chshersh avatar Sep 24 '20 19:09 chshersh

Perfect I'll give it a go 😄

Cmdv avatar Sep 24 '20 20:09 Cmdv

After spending best part of the day trying to use haskell-language-server things seem to compile but they aren't working the the ./test dir for some reason.

I've tried both with cabal and stack but can't seem to get around it. 😢

Will try pick it up if I can get things working 😄

Cmdv avatar Sep 25 '20 19:09 Cmdv