https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
arrow-meta
  • t

    tavish pegram

    10/21/2021, 5:26 PM
    Is there any notion of introducing some kind of algebraic effect system with arrow meta like with Frank, Unison, or some of the Haskell libraries like Freer-Simple? I’d be very interested in something like that 👀
    r
    s
    • 3
    • 6
  • n

    Nathan Bedell

    11/13/2021, 2:56 PM
    I'm curious: Has anyone tried making use of kotlinpoet for codegen in an arrow meta plugin? I am attempting to do this currently -- yet am having some issues with the interactions between the Psi API and kotlinpoet. Asking on the kotlinpoet repo I've found some help with this issue, but I was thinking if there's anyone else who has tried this in arrow meta, I might be able to dog up some more helpful examples/utilities.
    r
    • 2
    • 1
  • s

    Shan

    11/14/2021, 11:51 PM
    Hey. Does anyone have a working example of using Arrow-Meta with Kotlin 1.5.3 I could take a look at? I'm having tremendous build issues trying to get this working. Thanks.
    r
    j
    • 3
    • 20
  • t

    Teodor Penkov

    11/19/2021, 9:27 AM
    Hey, I’m trying to run the optics compiler plugin with 3rd party generated code. The tricky part is that I don’t have control over the 3rd party generated code so I can’t add
    @optics
    annotation to the data classes. I started creating custom plugin based on the optics compiler plugin, so I can look for the classes that I want (e.g.
    is a data class && it's in specific location
    ) but that doesn’t seem like the right thing to do. What would you suggest for the 3rd party code? pp. I’ve managed to generate some code, but then I stumbled upon errors such as unresolved references etc.
    s
    • 2
    • 7
  • n

    Nathan Bedell

    12/03/2021, 12:21 AM
    Hello. Does anyone have any examples they could point me to for a gradle project (either groovy or .kts) making use of the arrow proofs plugin? I understand it is not yet released just yet -- but I wanted to try it out for myself before then in some of my projects. I know there are tests showing how the plugin is used in the arrow-meta repository, but I am trying to figure out how to use the plugin in an actual standalone gradle project.
    👀 2
    s
    r
    • 3
    • 10
  • n

    Nathan Bedell

    12/08/2021, 11:53 PM
    Hey all. I've finally got my first arrow-meta plugin to the point where I'm ready to depend on it in other projects. I've tried to copy the structure of the plugins in the
    arrow-meta
    repo in order to setup a gradle plugin for loading my arrow-meta plugin, and I can build a jar for the gradle plugin fine -- but I'm not entirely sure how to test the result. Usually for a library I'd use
    publishToMavenLocal
    , and then use
    mavenLocal()
    as a repository in some other project to make sure the maven config is working properly. Is it possible to do the same for a gradle plugin? How would I set up maven to publish a gradle plugin? I tried skimming through the gradle files in the
    arrow-meta
    repo to see what would be of help, but no luck so far. Can someone point me in the right direction?
    r
    • 2
    • 4
  • n

    Nathan Bedell

    12/11/2021, 5:10 PM
    I have a question about what's possible (or what will be possible in the future) with compiler plugins: Java annotations have limitations as to what arguments they can take. For instance, annotations can't take functions as arguments. Would it be possible to have code like the following compile with a compiler plugin?
    @Rule {
        if (parentOf(X,Y) && parentOf(Y,Z)
            grandparentOf(X,Z)
    }
    As it should be clear from the example here -- the idea for this is for a logic programming compiler plugin, and in particular, supporting anonymous top-level rules, rather than having to annotate e.x a top level function or val, which we would then have to name.
    r
    • 2
    • 3
  • b

    bloder

    01/04/2022, 6:39 PM
    Hi all! I have a question about refined types plugin, are collections with primitive types acceptable in its compile time resolution? I'm trying to validade a simple predicate with a list:
    val list = listOf(1)
    
    data class FilledList private constructor(val value: List<Int>) {
        companion object : Refined<List<Int>, FilledList>(::FilledList, { ensure((it.isNotEmpty()) to "list cannot be empty") })
    }
    
    val filledList = FilledList(list)
    And is popping:
    val list = listOf(1) can't be verified at compile time. Use `Predicate.orNull(val list = listOf(1))` for safe access or `Predicate.require(val list = listOf(1))` for explicit unsafe instantiation
    If I remove this list reference from the property and put its instance directly on FilledList invoke call site (
    FilledList(listOf())
    ), nothing happens and its refinement occurs in runtime. I'm missing something or is not supported? If is not supported is there a typeclass / applicative or something that I can integrate with collections to make it work?
    r
    o
    • 3
    • 15
  • b

    bloder

    01/05/2022, 4:55 AM
    Another question but this time about Arrow Analysis, I'm trying to run in compile time a pre condition with collections, but I'm getting an error, I'm just trying to copy / paste the documentation example:
    fun average(xs: List<Int>): Int {
      pre(xs.isNotEmpty()) { "list not empty" }
      TODO()
    }
    
    val x = average(listOf(1))
    pre-condition `list not empty` is not satisfied in `average(listOf(1))`
      -> unsatisfiable constraint: `listOf(1).isNotEmpty`
    The curious thing here is, pre / pos conditions with primitive values (like
    PositiveInt
    sample) works but not with collections, I've already tried to create value classes wrappers, Laws, but only works with primitive types, not collections... Am I missing anything? Current using Kotlin 1.6.10 and arrow analysis 2.0-SNAPSHOT
    r
    • 2
    • 14
  • s

    server

    01/13/2022, 9:38 PM
    quick question, I saw there is a plugin for IntelliJ. However I cannot find it in marketplace (https://plugins.jetbrains.com/plugin/14291-arrow-meta). why?
    r
    • 2
    • 8
  • m

    mcpiroman

    01/20/2022, 2:23 PM
    Hi. I wonder what value does arrow-meta bring for writing backend IR plugins. I have not found any examples of such usage, only the api, from which it looks like there is not much invention here. Can someone point me why should I use arrow-meta over plain kotlin IR plugin or where are some docs/examples?
    r
    • 2
    • 1
  • n

    Nathan Bedell

    01/31/2022, 11:10 PM
    I just saw on the website that arrow proofs is no longer in development. What's the story there? Is the project totally scrapped? Delayed? Are we waiting for language/compiler infrastructure developments?
    r
    • 2
    • 1
  • j

    Jack Darlington

    02/02/2022, 11:33 PM
    Trying to use Meta, and I get the error
    Caused by: java.lang.AbstractMethodError: Receiver class package.MyMetaPlugin does not define or inherit an implementation of the resolved method 'abstract void registerProjectComponents(com.intellij.mock.MockProject, org.jetbrains.kotlin.config.CompilerConfiguration)' of interface org.jetbrains.kotlin.compiler.plugin.ComponentRegistrar.
    I assume it is something to do with the default implementation not getting picked up from Meta interface?
    a
    j
    • 3
    • 28
  • b

    Big Chungus

    02/02/2022, 11:49 PM
    Is arrow meta now ready to be used in mpp context with IR?
    r
    • 2
    • 6
  • j

    Jack Darlington

    02/03/2022, 11:09 PM
    Seen as 1.6.0 removes all the "quotes" extensions. Is there an updated example for the hello world example?
    ➕ 1
    r
    j
    • 3
    • 2
  • j

    Jack

    02/04/2022, 2:16 PM
    Ok, so I have checked out the last version that had the "quotes" extensions in, just to try and move my existing plugin over, and trying to replace stubbed functions like the hello world example Everything builds and runs and the plugin appears to be being called: -
    val Meta.helloWorld: CliPlugin get() =
        "Hello World" { 
            meta(
                namedFunction(this, { true } ) { c ->
                    println("remove")
                    Transform.remove(c.element)
                }
            )
        }
    
    
    
    @AutoService(ComponentRegistrar::class)
    class MetaPlugin: Meta {
        override fun intercept(ctx: CompilerContext): List<CliPlugin> =
            listOf(helloWorld)
    }
    • 1
    • 2
  • b

    Big Chungus

    02/07/2022, 9:09 AM
    Are there any docs on getting started with arrow-meta IR? Can't find any. Also is arrow-meta MPP-ready yet?
    a
    b
    • 3
    • 3
  • m

    Milse113

    02/11/2022, 7:38 AM
    What are the best ways to get started with Arrow Meta? I’ve gone over some medium articles but they’re all outdated and have old versions of the API
    r
    • 2
    • 4
  • d

    Dirk van Wijk

    02/21/2022, 1:07 PM
    Hey, my knowledge of compilers is very limited, but the extra checks that arrow analysis provides seem very interesting. Is there going to be a maven compiler plugin as well? As I can only find gradle examples.
    r
    • 2
    • 2
  • k

    Karin-Aleksandra Monoid

    02/21/2022, 6:04 PM
    Hey everyone, do you have a list of required minimum/exact Kotlin and Gradle versions for Arrow Analysis? I'm running into class not found after applying the plugin
    * What went wrong:
    org/gradle/util/internal/VersionNumber
    > org.gradle.util.internal.VersionNumber
    Changing the Gradle version to 7.0.2/7.2/7.4 didn't solve the problem for me (this was suggested in a thread with the same problem).
    a
    • 2
    • 3
  • t

    Tim Abil

    03/10/2022, 7:19 PM
    Does arrow-meta provide any utils to resolve a type of
    KtExpression
    r
    • 2
    • 39
  • b

    Babin Ruslan

    03/16/2022, 11:26 PM
    Hello. I'm trying to write a plugin, which counts size in bytes of data classes. In
    irClass {...}
    i'm modifying function body, but i don't know, how to return updated
    irClass
    😞
    val Meta.GenerateShallowSize: CliPlugin
        get() = "Generate shallowSize method" {
            meta(
                classDeclaration(this, { element.isData() }) { declaration ->
                    Transform.replace(
                        replacing = declaration.element,
                        newDeclaration =
                            """|$`@annotations` $kind $name $`(typeParameters)` $`(params)` : $supertypes {
                               |   $body
                               |   fun shallowSize(): Unit
                               |}""".`class`
                    )
                },
                irClass { clazz ->
                    {
                        val function = clazz.functions.find { it.name.asString() == "shallowSize" }!!
                        with(DeclarationIrBuilder(pluginContext, function.symbol)) {
                                function.body = irBlockBody {
                                    irInt(clazz.fields.map { it.type.byteSize() }.sum())
                                }
                        }
                        return clazz.
                    }
                }
            )
        }
    r
    • 2
    • 4
  • d

    dalexander

    03/18/2022, 4:39 PM
    Does Arrow-Meta support front end source code generation at all at the moment with the removal of the quotes system? I was using it for source code generation and it's looking like I should migrate away from arrow-meta if quotes was removed without a replacement.
    r
    • 2
    • 1
  • m

    Miłosz Korman

    03/23/2022, 3:14 PM
    Hey 👋 I wanted to try out the new arrow-analysis plugin in one of my projects, but seem to be getting an internal exception
    kotlin.NotImplementedError: An operation is not implemented: Missing impl for throw RuntimeException(ex) .../DatabaseConfiguration.kt (org.jetbrains.kotlin.psi.KtThrowExpression)
    a
    • 2
    • 6
  • m

    Miłosz Korman

    03/23/2022, 10:29 PM
    Hello again 😄 I’ve been experimenting a little bit with arrow-analysis and I’m wondering whether I could change something in this example for the
    v1 > v2 => Positive(v1) > Positive(v2)
    and
    Positive(v1) > Positive(v2) => Positive(v1).value > Positive(v2).value
    implications to hold
    a
    • 2
    • 3
  • t

    Ties

    04/04/2022, 2:04 PM
    In doing some experimentation I found something that is not very intuative:
    @JvmInline
    value class String5till10(val value: String) {
    	init {
    		require(value.length >= 5) { "String should be minimal 5 characters" }
    		require(value.length <= 10) { "String should be maximum 10 characters" }
    	}
    }
    
    
    // This works
    val value = getRandomString()
    if (value.length > 6) {
    	if (value.length < 10) {
    		StringExamples.String5till10(value)
    	}
    }
    
    //This does not
    val value = getRandomString()
    if (value.length > 6 && value.length < 10) {
    	StringExamples.String5till10(value)
    }
    a
    • 2
    • 7
  • c

    Cornelius Wichering

    04/22/2022, 7:59 PM
    Hi! I want to dynamically add (or replace) annotations to Methods. For example if I annotate a Method in my source like this:
    @OneAnnotation(value = "someDetail")
    fun methodA() { ... }
    I want my plugin to add another annotation like this
    @AnotherAnnotation(value = "someDetail") // value taken from "original" annotation
    @OneAnnotation(value = "someDetail")
    fun methodA() { ... }
    Do you think arrow-meta is a good fit for this task? Any hints on how to do it?
    r
    • 2
    • 6
  • r

    rkeazor

    05/02/2022, 7:55 PM
    Does ArrorMeta allow u to work with actual variables instances
    r
    • 2
    • 1
  • t

    than_

    05/13/2022, 8:41 AM
    Hi, what's the status of arrow-analysis? The 2.0 version officially promoted on the arrow website have some severe problems. Those are fixed in the snapshot versions. Will there be a stable release of 2.0.2 in the near future, or is there some blocker?
    a
    • 2
    • 3
  • t

    Tim Abil

    05/24/2022, 7:21 PM
    I'm trying to read moshi's
    @Json
    property annotation that overrides serialized property names while visiting class properties with
    DeclarationDescriptorVisitor
    from
    declarationChecker{..}
    . When
    visitPropertyDescriptor
    is invoked
    descriptor.annotations
    is always empty.
    e
    • 2
    • 7
Powered by Linen
Title
t

Tim Abil

05/24/2022, 7:21 PM
I'm trying to read moshi's
@Json
property annotation that overrides serialized property names while visiting class properties with
DeclarationDescriptorVisitor
from
declarationChecker{..}
. When
visitPropertyDescriptor
is invoked
descriptor.annotations
is always empty.
import com.squareup.moshi.Json

data class Sample(
    val a: Color,
    @Json(name="json_name") <-- not visible from declaration checker
    val b: More,
)
e

ephemient

05/24/2022, 7:32 PM
@Json
doesn't declare applicable targets (therefore all are allowed): https://square.github.io/moshi/1.x/moshi/moshi/com.squareup.moshi/-json/index.html which means it'll be treated as
@param:Json
in this usage by default: https://kotlinlang.org/docs/annotations.html#annotation-use-site-targets
t

Tim Abil

05/24/2022, 7:44 PM
ahh i see, any way to get a reference to those from PropertyDescriptor?
e

ephemient

05/24/2022, 7:45 PM
can you change the code to declare the annotation target explicitly instead?
@property:Json(...) val
t

Tim Abil

05/24/2022, 7:47 PM
hmm i might not have the access to change the class definitions tho
i guess i need to somehow be able to access @Documented string
@raulraja thoughts?
View count: 10