https://kotlinlang.org logo
Docs
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
  • c

    CLOVIS

    06/06/2020, 8:22 PM
    From the demos, it appears Arrow Meta will display ‘aliases' of types in IntelliJ, eg. showing ‘`Union2<A|B>``, and I really like this feature because it makes the language way easier to read but doesn't change the syntax at all so it's quite safe. I would love if this was expanded to other boilerplate, for example to replace function composition by ∘ (
    val h = g ∘ f)
    . In Julia, they actually define many functions as unicode directly, I think it's a good compromise to just let the IDE display those as such. What do you think?
    👍 1
    r
    i
    • 3
    • 4
  • d

    dephinera

    06/10/2020, 7:57 PM
    How can I print messages from a meta compiler plugin so that I can see them during compilation? Simple println() didn't work...
    r
    • 2
    • 2
  • s

    shikasd

    06/10/2020, 9:54 PM
    Hey, I am curious if the source of demos you have presented on Kotliners (or similar) is available somewhere, would be amazing to check it out!
    s
    r
    d
    • 4
    • 5
  • r

    raulraja

    06/15/2020, 12:56 PM
    https://twitter.com/raulraja/status/1272512506347565056
    :arrow: 5
    🙌 4
    d
    • 2
    • 1
  • r

    Robert

    06/15/2020, 1:10 PM
    Where can I read up on Coercion Projection and Liquid Types ? as they will be used in ArrowMeta @raulraja
    r
    • 2
    • 1
  • d

    dephinera

    06/17/2020, 7:19 PM
    Hello, is there an API for rename refactor of a PsiElement? Basically to rename a property and update its usages or the only way is to do that manually?
    r
    • 2
    • 2
  • r

    rt

    06/21/2020, 8:28 PM
    Hi. How do I get 
    //metadebug
     -annotated classes to be displayed on compilation? is there some compiler switch or something? I cloned the arrow-meta-examples project but nothing gets printed into compiler output even though 
    //metadebug
      is clearly there
    r
    s
    • 3
    • 9
  • c

    CLOVIS

    06/22/2020, 8:45 AM
    In the type proofs demo of the Twitter username, the casts returned nullables to model that a String was not a valid Twitter username. Wouldn't it be better if it returned a
    Validated
    , so it's possible to get the reason why it failed?
    i
    r
    • 3
    • 8
  • r

    rt

    06/23/2020, 3:05 PM
    @raulraja @simon.vergauwen i noticed that
    lenses
    plugin in meta is commented out, not sure what the reason is. i've experimented with adding support for type parameters on case classes (wrt lenses): usage https://github.com/tkroman/poptix/blob/master/poptix-gradle-plugin-test/src/main/kotlin/com/tkroman/poptix/PoptixExample.kt#L13 src https://github.com/tkroman/poptix/blob/master/poptix-gradle-plugin/src/main/kotlin/com/tkroman/poptix/PoptixTransformation.kt#L85 does this look like something useful for the mainline? i'm not really confident about the quality of implementation but would love to help out (with proper guidance) if you would accept this contribution
    r
    b
    • 3
    • 11
  • r

    raulraja

    06/24/2020, 10:59 AM
    https://twitter.com/raulraja/status/1275744359019929600
    🤯 1
    👌 4
    🤘 2
    j
    m
    • 3
    • 10
  • a

    Archie

    07/05/2020, 7:33 AM
    Hi guys, I was wondering how I should learn about functional programming. Do you guys have any recommendations? A good book perhaps? Course? How do I start? Should I study Category Theory first? Thank you very much
    s
    r
    • 3
    • 10
  • d

    dcampogiani

    08/03/2020, 2:58 PM
    Could be arrow meta also used to resolve instance of Kotlinx.Serialization (some context in comments) at compile time?
    s
    • 2
    • 14
  • t

    tavish pegram

    08/05/2020, 2:39 PM
    I’m trying to mess around with arrow-meta on one of my other projects (I wanted to try some of the stuff from the ArrowFx and Meta talk that @raulraja and @simon.vergauwen did) but when I try to follow the example here https://github.com/arrow-kt/arrow-meta-examples/blob/master/use-arrow-meta-compiler-plugin/build.gradle I get compilation errors. A section from my build.gradle which I think contains everything from that example
    buildscript {
        repositories {
            maven {
                url '<https://oss.jfrog.org/artifactory/oss-snapshot-local/>'
            }
        }
        dependencies {
            classpath "io.arrow-kt:gradle-plugin:1.3.61-SNAPSHOT"
        }
    }
    
    plugins {
        id "org.jetbrains.kotlin.jvm" version "1.3.61"
        id "org.jetbrains.kotlin.plugin.jpa" version "1.3.61"
        id "org.jetbrains.kotlin.plugin.spring" version "1.3.61"
        id "org.springframework.boot" version "2.1.7.RELEASE"
        id "com.adarshr.test-logger" version "2.0.0"
    }
    
    apply plugin: "java"
    apply plugin: "war"
    apply plugin: "kotlin"
    apply plugin: "kotlin-spring"
    apply plugin: "kotlin-jpa"
    apply plugin: "kotlin-kapt"
    apply plugin: "org.springframework.boot"
    apply plugin: "io.spring.dependency-management"
    apply plugin: "jacoco"
    apply plugin: "io.arrow-kt.arrow"
    
    repositories {
        jcenter()
        mavenCentral()
        maven { url "<https://splunk.jfrog.io/splunk/ext-releases-local>" }
        maven { url "<https://dl.bintray.com/arrow-kt/arrow-kt/>" }
        maven {
            url '<https://oss.jfrog.org/artifactory/oss-snapshot-local/>'
        }
    }
    dependencies {
        ...other dependencies 
        // Arrow
        implementation Dependencies.ArrowOptics
        implementation Dependencies.ArrowSyntax
        implementation Dependencies.ArrowFx
        kapt Dependencies.ArrowMeta
        compileOnly "io.arrow-kt:arrow-meta-prelude:1.3.61-SNAPSHOT"
    }
    The error message doesn’t seem super useful to me, but am I making a common mistake here or any suggestions on how to debug this? Thanks!
    r
    • 2
    • 6
  • s

    Slava Kornienko

    08/07/2020, 6:55 AM
    Hello there! I’m wanna to contribute, from which i can start?
    r
    • 2
    • 2
  • s

    Slava Kornienko

    08/11/2020, 4:50 PM
    Do expect behavior if the Gradle buildMeta task launch fails with test passing errors?
    r
    • 2
    • 30
  • c

    CLOVIS

    08/17/2020, 3:24 PM
    Does Arrow Meta in Kotlin 1.4 mean that all
    .fix()
    and
    .k()
    calls will be unnecessary?
    r
    • 2
    • 14
  • y

    Youssef Shoaib [MOD]

    08/19/2020, 9:32 PM
    Is the source code for the keep-87 plugin available anywhere? cuz IIRC it's based on Arrow Meta, right? I wanted to draw some inspiration from it to make a compiler plugin myself, but the only plugins in the arrow meta plugin package seem to be the higherkind, proof, optics, etc. ones, but not the typeclasses/extension interfaces one.
    t
    t
    +2
    • 5
    • 19
  • a

    arnaud.giuliani

    08/28/2020, 7:57 AM
    anything I could do? 🤔
    s
    • 2
    • 4
  • h

    Hanno

    08/31/2020, 9:02 AM
    Hey guys, maybe you know Something: is there any news, discussion or whatever regarding the support for bundled ide plugins with compiler plugins, so that the user doesn't need to install ide Support manually?
    r
    y
    • 3
    • 8
  • y

    Youssef Shoaib [MOD]

    08/31/2020, 11:50 AM
    Is there a snapshot version available of the gradle plugin for 1.4 yet? or even for one of the M versions? The only one that I can see is for 1.3.61
    r
    • 2
    • 1
  • h

    Hanno

    09/01/2020, 6:45 PM
    Hey ho, i recently tested the "given" construct (however it is called now) with meta compiler plugin, which is SO nice, this is so much what kotlin needs for type extensions :) However, i found sth i am not sure whether i misunderstood it or not. When i have an interface over a type T and two implementations as top level object, it always resolves to the first declared instance, even though the generic type should prevent that. Is this expected? I could give my example when it's not clear what i mean.
    r
    i
    • 3
    • 19
  • y

    Youssef Shoaib [MOD]

    09/04/2020, 12:44 PM
    Arrow meta itself is multiplatform, right? but the arrow-meta-prelude, which has all the annotations for some of the plugins like the type proofs one and also all the Union classes and stuff, is JVM only. Is this intentional, or just a slight oversight? and are there any plans to make it mp? because it looks like there isn't really anything JVM specific in the prelude.
    👍 1
    r
    • 2
    • 5
  • a

    Anastasia Birillo [JB]

    09/08/2020, 10:02 AM
    Hi everyone! I have a question about the resolving step in the kotlin compiler plugin. I try to use arrow meta to develop a plugin, but I am not sure how can I get a fully qualified name. I have found a good example in addition to the hello world example for getting started, but if I right understand it works during the parsing step and I can not get the fully qualified name like
    io.arrowkt.example.MyObject
    instead of a short one like
    MyObject
    . I use
    dotQualifiedExpression
    in meta param. My final goal is to find a dotQualifiedExpression like
    MyObject.myFunction
    and get all children if it is possible. For example, if I found
    MyObject.myFunction
    and originally it is 
    MyObject.myFunction.children
    , I would like to get all children and I would like to be sure it is MyObject from
    io.arrowkt.example.MyObject
    . Could you help me, please?
    i
    r
    +2
    • 5
    • 44
  • a

    Anastasia Birillo [JB]

    09/09/2020, 2:14 PM
    Hi everyone again! Sorry for my newbie question, but I can not find the place where
    MessageCollector
    writes the messages (the filed of
    CompilerContext
    ). Maybe I did not understand clearly, but the
    arrow meta
    uses
    NONE
    MessageCollector, which does nothing. Can I override it? I would like to receive my logs. I tried to run the @raulraja example with
    bindingContext
    :
    val Meta.example: CliPlugin
        get() =
            "Hello World" {
                meta(
                    analysis(
                        doAnalysis = { project, module, projectContext, files, bindingTrace, componentProvider ->
                            null
                        },
                        analysisCompleted = { project, module, bindingTrace, files ->
                            val slice: ImmutableMap<PsiElement, DeclarationDescriptor> =
                                bindingTrace.bindingContext.getSliceContents(BindingContext.DECLARATION_TO_DESCRIPTOR)
                            slice.forEach { (psi, descriptor) ->
                                if (psi is KtProperty && descriptor is PropertyDescriptor) {
                                    messageCollector?.report(
                                        CompilerMessageSeverity.WARNING,
                                        "${psi.text} -> Type: ${descriptor.returnType}"
                                    )
                                }
                            }
                            null
                        }
                    )
                )
            }
    r
    • 2
    • 13
  • a

    Ahmed Mourad

    09/11/2020, 6:21 AM
    Since meta is still in 1.3.61-snapshot, does that mean we can't use it with Kotlin 1.4 yet?
    👀 2
    m
    • 2
    • 4
  • c

    CLOVIS

    09/12/2020, 11:57 AM
    Hi! I've asked this question about the different implementation/use-cases of typeclasses in Kotlin, and Mr. Raja redirected me to here to discuss those. Please tell me if I'm not making sense, it's a quite new concept to me ^^
    r
    • 2
    • 14
  • a

    Ahmed Mourad

    09/13/2020, 3:59 PM
    Is it possible to evaluate a non
    const
    property of a companion object at compile time?
    r
    r
    • 3
    • 47
  • m

    melatonina

    09/16/2020, 11:26 AM
    I can't use Kotlin 1.3.70 because of Arrow Meta, so I'm stuck with Kotlin serialization 0.16.0 which is mostly undocumented and I don't know how to write some more-than-basic custom serializers... I hope you will be able to switch to Kotlin 1.4.0 soon.
    y
    h
    r
    • 4
    • 4
  • n

    Nikita Klimenko [JB]

    09/19/2020, 12:36 PM
    Hi there! Is it possible to process non-kt files during compilation? I would like to provide types from files such as open api specification. Can think of 2 possible ways to do it: gradle plugin and compiler plugin. Gradle clearly has access to resource files in source sets, but lacks syntax and semantics checks, and it is less obvious how to provide IDEA support. As for compiler, i really have no clue :(
    f
    j
    • 3
    • 3
  • a

    Ahmed Mourad

    09/23/2020, 10:19 PM
    Hi everyone! So I'm still playing with
    eval
    , is there a way to use the classpath of the plugin consumer during the evaluation?
    r
    • 2
    • 12
Powered by Linen
Title
a

Ahmed Mourad

09/23/2020, 10:19 PM
Hi everyone! So I'm still playing with
eval
, is there a way to use the classpath of the plugin consumer during the evaluation?
As in, if the consumer writes something like this:
I'd like to be able to use
Password
during the evaluation.
r

raulraja

09/23/2020, 10:28 PM
Password is not resolved when that gets evaluated at compile time. This is why the validate function in the type refinements in meta is pure
And only refers to types that are available in the compiler classpath
In this case it would expect the receiver to be a String and that's all you can resolve at compile time because the compiler classpath includes the std lib.
You can workaround this limitations with your own types if they come from already compiled modules and you expose those in the kotlinCompilerClasspath but not with the same type you are refining in a local module.
TLDR you can use third party compiled libs inside eval but not local module types you are refining in place
😓 1
If you figure it out then we want it in meta too 🙏
:arrow: 1
a

Ahmed Mourad

09/24/2020, 12:12 AM
How unfortunate. I'll see what I can do, if I find something, I'll let you know.
r

raulraja

09/24/2020, 8:19 AM
You can potentially use your type on eval if you add a version of it to the eval session as a declaration. That is declare Password and eval it without the constrains once in the session
🤔 1
Then use the lightweight declaration in the compile time validation.
a

Ahmed Mourad

09/24/2020, 11:54 AM
Sounds interesting, the only problem would be if
Password
used other locally declared classes. But I guess I could through those recursively as well until only third party types are left.
View count: 2