Thread
#arrow-meta
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Now, I did remember to include the imports for the test, and I included the annotations and core data dependencies within the configs!
    Rachel

    Rachel

    2 years ago
    Hi Amanda, the reason of the first error .../sources/Example.kt: (2, 19): Unresolved reference: extensions:
    arrow.core.extensions
    are provided by arrow-meta artifact which is not being included in the configuration
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    the arrow-meta artifact?
    Rachel

    Rachel

    2 years ago
    this directory comes from arrow repository:
    ./modules/meta/arrow-meta/src/main/java/arrow/core/extensions/
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    how would I include that module as an artifact?
    Rachel

    Rachel

    2 years ago
    I think it's not necessary for the example, just importing arrow.extension
    Please, @amanda.hinchman-dominguez, upload your branch to check this code and help you, thanks!!
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Hi @Rachel - it's up in the arrow-meta project as a WIP branch. Feel free to take a look!
    Rachel

    Rachel

    2 years ago
    Thanks Amanda! I think it's not the same example:
    @Test
      fun `simple_case_function`() {
        assertThis(CompilerTest(
          config = {
            listOf(addCompilerPlugins(ComprehensionsTest.compilerPlugin))
          },
          code = {
            """
            | object Id
            | 
            | @extension
            | fun IdEq() : Eq<Id> = Id.eq().run {
            |   Id.eqv(Id)
            | }
            | val x = Id == Id
            | 
            """.source
          },
          assert = {
            compiles
          }
        ))
        assert(true)
      }
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Oh! Maybe I forgot to update
    Rachel

    Rachel

    2 years ago
    Maybe I'm not looking at the right place
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    I'm almost home, I will check in a little bit
    No I think you are! It's me haha
    Did you see the code I pasted at least?
    Rachel

    Rachel

    2 years ago
    haha no hurry, when you have time!
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    @Rachel I got the update up! I just forgot to commit and push 😅
    Rachel

    Rachel

    2 years ago
    Amanda, hi! I have some things for you:
    1. The example would have this content:
    val compilerPlugin = CompilerPlugin("Arrow Meta", listOf(Dependency("compiler-plugin")))
        val arrowAnnotations = Dependency("arrow-annotations:0.10.3-SNAPSHOT")
    
        assertThis(CompilerTest(
          config = {
            addCompilerPlugins(compilerPlugin) + addDependencies(arrowAnnotations)
          },
          code = {
            """
            | import arrow.extension
            | 
            | object Id
            |
            | @extension
            | fun IdEq() : Eq<Id> = Id.eq().run {
            |   Id.eqv(Id)
            | }
            | val x = Id == Id
            | 
            """.source
          },
          assert = {
            compiles
          }
        ))
    2. I think it would be necessary to take a look at one existing test previous your changes, because it's failing now: the test for TypeClassesPlugin
    3. We're going to fix arrow-annotations in order not to get the error with extension annotation
    Oh, and if your branch is rebased with
    master
    , you'll get a way to avoid "0.10.3-SNAPSHOT" or any other specific version
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    I'll be sure to update, thank you @Rachel!
    I'll take a look at the first comments a little closer haha
    How do we know which snapshots we should be using?
    Rachel

    Rachel

    2 years ago
    The one which is in the main
    gradle.properties
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Thanks!
    did the updates to the master make your builds feel a lot slower?
    I'm still waiting on my tests
    Rachel

    Rachel

    2 years ago
    Maybe, it's growing a lot in the last few days
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    interesting, yeah it got really noticable for me today!
    It's not a big deal yet
    @Rachel kind of going off what I've learned so far, does it made sense to import
    arrow
    as a dependency so that my tests may recognize
    Eq
    and so on?
    Rachel

    Rachel

    2 years ago
    I'm going to explain what I was doing to answer your question
    I think it will be useful for you
    Now you're looking for
    Eq
    So I was looking for
    Eq
    in Arrow
    I found:
    ./modules/core/arrow-core-data/src/main/kotlin/arrow/typeclasses/Eq.kt
    So the dependency will be
    arrow-core-data
    and the import
    arrow.typeclasses.Eq
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    oh weird, I had that in there. So I had the import wrong then?
    Thank you for providing clarification!
    Rachel

    Rachel

    2 years ago
    Oh, right, you had
    arrow-core-data
    before, sorry. The problem was the import:
    import arrow.core.extensions.*
    I think it could be a good idea to solve every error step by step
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Oh my gosh thank you so much. All this has been so helpful. I'm still waiting on the build but pushed up the changes - but I've added documentation from what I've learned - does it all seem correct? https://github.com/arrow-kt/arrow-meta/blob/a15b929cdcdc8c488650555c73aaf017cf805e3a/compiler-plugin/src/test/kotlin/arrow/meta/plugins/eq/EqOperatorTest.kt
    Rachel

    Rachel

    2 years ago
    I see that now you're not including @extensionannotation, so
    arrow-annotations
    dependency is not necessary
    And 0.10.3-SNAPSHOTcould be avoided
    Look at ... just a second
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    I see. A good point, I can do that.
    Rachel

    Rachel

    2 years ago
    arrow-meta/compiler-plugin/src/test/kotlin/arrow/meta/plugins/higherkind/HigherkindTest.kt
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    Unfortunately I had to take it out because it turns out we cannot mark independent functions with
    @extension
    !
    We had to add the snapshot version for
    arrow-core-data
    though, right?
    Rachel

    Rachel

    2 years ago
    Not exactly right now, please, look at
    arrow-meta/compiler-plugin/src/test/kotlin/arrow/meta/plugins/higherkind/HigherkindTest.kt
    and about
    @extension
    , let me check because the last version of arrow-annotations is published
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    okay, so that was a change we made. gotcha gotcha gotcha
    Rachel

    Rachel

    2 years ago
    and instead of
    0.10.3-SNAPSHOT
    use
    ${System.getProperty("CURRENT_VERSION")}
    because if we write hardcoded versions it will be difficult to maintain the tests
    amanda.hinchman-dominguez

    amanda.hinchman-dominguez

    2 years ago
    oh interesting, so it would be like
    val arrowCoreData = Dependency("arrow-core-data: ${System.getProperty("CURRENT_VERSION")}")
    ?
    Rachel

    Rachel

    2 years ago
    without the whitespace
    val arrowCoreData = Dependency("arrow-core-data:${System.getProperty("CURRENT_VERSION")}")
    the format is
    artifactId:version