https://kotlinlang.org logo
Join SlackCommunities
Powered by
# arrow-meta
  • b

    Brett Byler

    06/13/2022, 8:25 PM
    I don’t know if this is supported, but something like (though this breaks)
  • b

    Brett Byler

    06/13/2022, 8:26 PM
    Untitled.kt
    Untitled.kt
  • b

    Brett Byler

    06/13/2022, 8:27 PM
    I get a syntax error (on the
    formulae
    section - I’m admittedly not very familiar with native Z3 syntax). The test I linked above is the only example I could find of a
    @Post
    condition. Would this help in any way? Or is there more support needed from the AA backend?
  • a

    Alejandro Serrano Mena

    06/13/2022, 8:39 PM
    the problem here is that for this to work
    map
    would need something which says "for every element of this list, this formula holds", which cannot be expressed easily in Z3
  • a

    Alejandro Serrano Mena

    06/13/2022, 8:40 PM
    the suggested way to help arrow analysis as of today is to use a wrapper type, as explained in https://arrow-kt.io/docs/analysis/wrappers/#collections
  • a

    Alejandro Serrano Mena

    06/13/2022, 8:41 PM
    basically, you change your function to look like
    Copy code
    val okShouldBeAccepted = listOf(-1)
    	.map { Positive(absoluteValue(it)) }
    	.first { it.value }
        .post({ it >= 0 }) { "result is non-negative" }
  • b

    Brett Byler

    06/13/2022, 8:45 PM
    I see, thanks! Z3 does support quantifiers, though I’d need to experiment with them before going further along with anything concrete in relation to AA Appreciate the help! Sorry for this question being covered by the docs. I’ll see if I can learn more with the
    @Post
    syntax in the meantime
  • a

    Alejandro Serrano Mena

    06/14/2022, 7:59 AM
    Be aware that Z3’s support for quantifiers is not what you might me expecting, in particular you cannot throw a bunch of foralls and make them work
  • r

    rcd27

    07/25/2022, 11:44 AM
    Created a new
    issue
    for samples, ready to take it myself: https://github.com/arrow-kt/arrow-meta-examples/issues/58
    ❤️ 1
    r
    • 2
    • 6
  • r

    rcd27

    08/19/2022, 5:09 PM
    Greetings, what is about https://arrow-kt.io/apidocs/arrow-refined-types/index.html and refined types in
    Meta
    ? I need refined types, guys ❤️
    r
    • 2
    • 2
  • r

    rcd27

    10/18/2022, 7:00 PM
    Hello everyone. Trying to register my arrow-meta plugin as Gradle plugin:
    Copy code
    build.gradle.kts:
    
    ...
    gradlePlugin {
        plugins {
            create("my-plugin") {
                id = "com.github.rcd2772.plugin"
                implementationClass = "com.github.rcd2772.plugin.MetaPlugin"
            }
        }
    }
    Where
    MetaPlugin
    implements
    Meta
    interface. And all is done like in (meta-samples)[https://github.com/arrow-kt/arrow-meta-examples]. The only difference is that I add all plugin logic and its runtime dependencies to
    buildSrc
    . In order to add it in my
    app
    module via
    plugins { id("com.github.rcd2772.plugin") }
    However gradle-plugin stuff(the one responsible for registering plugin with
    create
    DSL) says: 'com.github.rcd2772.plugin.MetaPlugin' is neither a plugin or a rule source and cannot be applied Is there a way to register Meta plugin with
    gradlePlugin
    ?
    r
    • 2
    • 5
  • s

    Sushobh

    11/01/2022, 2:14 AM
    Hi Team, I am planning to write a post on Kotlin Compiler plugin built with Arrow meta. I had a few questions. 1. Does Arrow meta operate on the output of the compiler frontend or the backend? i.e are we modifying the tree after frontend process is completed or the tree after backend IR is completed? 2. How much of an impact will the upcoming new Kotlin FIR have on the arrow meta api? 3. What advantages does arrow meta bring to the table over creating a compiler plugin directly without using it? I know this question requires a long summary so feel free to skip this question. 4. I have created a gradle plugin which downloads the arrow meta jar and adds it to the kotlin options of the consumer project. This is how I have been using my plugin. Is it a technically sound approach? Thanks for your help.
    a
    r
    • 3
    • 9
  • k

    Karim Houari

    11/29/2022, 11:05 AM
    Hello, I would like to generate a class IR as part of the backend IR process. Are there any examples on how to do this? E.g. if I had a class
    Copy code
    class Foo {
        val abc = "abc"
    
        fun hello() = "Hello World"
    }
    and then wanted to create the following, but not modifying Foo class
    Copy code
    class Bar {
        fun hello(name: String) = "Hello $name"
    }
    Resulting in a Foo.class and a Bar.class If there are no examples, any advice would be great please.
    r
    d
    • 3
    • 19
  • j

    Jörg Winter

    12/05/2022, 10:21 AM
    Hi, debugging a compiler extension plugin using IR Api with an implementation of AnalysisHandlerExtension and IrGeneratorExtension, I see that IR Generation comes after analysis. Is there any extension point, that runs after generation, so one could analyse all effective sources ? So that any generated/transformed sources are again available for introspection/analysis. Is this possible in arrow-meta already ?
    r
    • 2
    • 5
  • j

    Jörg Winter

    01/09/2023, 4:55 PM
    Hi all, having a compile-time-checked annotation "Pure" is a wonderful idea.. although it seems difficult to introduce purity in a non-pure language like Kotlin. But anyway.. wouldn't it be a better way to restrict allowed calls by having a white-list instead of a black-list ? That way, one maybe could include the "domain" packages of an application (plus java.lang and similar.. if needed) I am referring to this: https://github.com/arrow-kt/arrow-reflection/blob/6b8caa1c21861eb8a753f155b76af326[…]-reflect-annotations/src/main/kotlin/arrow/meta/samples/Pure.kt Of course this is currently a proof-of-concept anyway, if I understand correctly (?)... so my question is not a feature request in this sense.
    j
    r
    • 3
    • 2
  • t

    Tiago

    02/13/2023, 10:53 AM
    good morning 🙂 just discovered Arrow Analysis and it sounds amazing do I really need to use
    org.jetbrains.kotlin.multiplatform
    or
    org.jetbrains.kotlin.jvm
    is good enough? I am getting a weird error trying to set it up: java.lang.NoClassDefFoundError:
    Copy code
    org/jetbrains/kotlin/resolve/jvm/extensions/AnalysisHandlerExtension$DefaultImpls
    	at arrow.meta.internal.registry.InternalRegistry$registerPostAnalysisContextEnrichment$1$1.analysisCompleted(InternalRegistry.kt:123)
    	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:115)
    	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:125)
    	at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:99)
    .....
    * What went wrong:
    Execution failed for task ':project:compileKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
       > Internal compiler error. See log for more details
    r
    • 2
    • 13
  • r

    Raehat Singh Nanda

    03/16/2023, 1:05 PM
    I tried following https://medium.com/@heyitsmohit/writing-kotlin-compiler-plugin-with-arrow-meta-cf7b3689aa3e I spent like 4 days figuring out how to add compileOnly “com.github.arrow-kt.arrow-metacompiler plugin-SNAPSHOT" in my project nothing seems to work I tried every possible version tried to look for a solution on forums but none found even chat gpt couldn't help
    a
    f
    m
    • 4
    • 18
  • r

    Raehat Singh Nanda

    03/16/2023, 1:05 PM
    can anyone help me here
  • r

    Raehat Singh Nanda

    03/16/2023, 1:05 PM
    how should I add arrow meta compiler plugin to my build.gradle?
  • r

    Raehat Singh Nanda

    03/16/2023, 7:57 PM
    can someone help me here? I really need some help regarding this issue!
  • r

    Raehat Singh Nanda

    03/16/2023, 11:04 PM
    I found that I can use
    Copy code
    implementation 'io.arrow-kt:arrow-meta:1.6.0'
    But I still can't resolve
    Copy code
    import arrow.meta.quotes
    If only this resolve issue is solved, everything will work just fine I looked into the downloaded arrow meta package and found arrow.meta.quotes doesn't even exist
    r
    • 2
    • 14
  • a

    appmattus

    03/29/2023, 4:57 PM
    hey, so i’m currently in the process of writing a kotlin compiler plugin using meta, although struggling with my approach for modifying IR.
    r
    • 2
    • 5
  • p

    Piotr Krzemiński

    04/30/2023, 5:48 PM
    Hi, I own a library where I'd like to enforce using named args in every API possible. I have a solution (sort of) how to achieve it for a single function (example), now I'd like to either have a reusable annotation that will leave the function signature intact, or have a way to emit such code for my whole Gradle module. I thought about a compiler plugin and arrow-meta as a tool that can make it easier. However, I don't really know where to start, if I need to publish something or it's fine to create something within my repo, and generally if it's a good path to solve my problem. Thoughts? :)
    y
    a
    • 3
    • 9
  • d

    dephinera

    05/21/2023, 1:18 PM
    I want to build a library that will require code generation based on a DSL that will be executed runtime. It seems that I can’t do that with KSP, as it doesn’t provide access to function bodies or expressions. So it seems that the next option is analysing the AST. Can I use meta for that? I saw that Arrow has a new website now, that doesn’t provide information about meta. I only need the information from the static analysis, I don’t plan on doing any IR modifications.
    y
    • 2
    • 9
  • c

    conner

    08/21/2023, 11:34 AM
    Sorry if this is an obvious question, but where is
    arrow-reflect-compiler-plugin
    published? I'm attempting to use it from a build system that isn't gradle, but I can't find it in maven. Tangentially, is using
    arrow-reflect
    recommended right now, or should I use
    arrow-meta
    directly?
    r
    a
    • 3
    • 39
  • c

    conner

    08/21/2023, 6:38 PM
    Is there any way to get source information from IR? Search is failing me. For example, I’d like to know the method that an irCall exists in
    • 1
    • 1
  • t

    Travis Miehm

    11/29/2023, 4:11 PM
    We are trying to update our project to Kotlin 1.9.21, but are blocked on a dependency on a arrow-meta plugin. I’ve seen some mention about pausing development while JetBrains stabilized the K2 Compiler API, but now arrow-meta is not mentioned in the docs https://apidocs.arrow-kt.io/index.html Is development still just paused? I haven’t followed K2 much, so I don’t know if it’s stabilized yet, or if that’s coming in Kotlin 2.0. Is there appetite for a PR updating arrow-meta to support 1.9.21?
    j
    r
    d
    • 4
    • 3
  • t

    Travis Miehm

    12/11/2023, 2:23 PM
    I’ve opened a PR to upgrade to kotlin 1.9.21. Happy to make additional changes. After updating my other project to point to my branch, it built and passed all tests after being upgraded to kotlin 1.9.21. It uses a pretty small subset of features though. Looking forward to your feedback.
    m
    r
    • 3
    • 3
  • n

    Nathan Bedell

    05/20/2024, 7:16 PM
    I'm curious, has anyone thought about doing an "applicative syntax" plugin with arrow-meta? I'm thinking this would be incredibly useful for things like Flows, for instance:
    Flow.ap { aFlow + bFlow }
    Would translate into something like:
    aFlow.combine(bFlow) { a, b -> a + b }
    Similarly, a syntax for arrows would be really nice as well. This comes up surprisingly often with some DSLs I have at work. For instance, I have a little "progress task" DSL for functions that have a notion of "progress tracking" associated with them, but they are not monadic as each function has some metadata associated with it denoting the amount of "steps" it takes to complete a task.
  • t

    Travis Miehm

    07/31/2024, 5:16 PM
    Is anybody looking at Kotlin 2.0 support?