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
  • y

    Youssef Shoaib [MOD]

    02/15/2021, 11:28 PM
    Okay okay wow so I've been pulling my hair over Arrow Meta just not working at all in my project recently until right now when I realised that it's because it doesn't work with any package that has dots in it 🤦‍♂️ . Could there possibly be a better error message for that?
    b
    • 2
    • 3
  • a

    Ahmed Mourad

    02/17/2021, 6:53 PM
    Hey everyone! So I have a
    SimpleFunctionDescriptor
    , obtained from:
    bindingContext.getSliceContents(BindingContext.FUNCTION)//.first()
    I'm trying to get the body or the statements of this function, but I can't find the method to do so?
    r
    • 2
    • 1
  • m

    Max Härtwig

    02/18/2021, 12:48 PM
    Hi everyone, I'm seeing some weird behavior when printing the body of named functions that span multiple lines.
    fun test() {
        println("Testing...")
        val a = 1
        val b = 2
    }
    
    val Meta.myPlugin: CliPlugin
        get() =
            "Plugin" {
                meta(namedFunction(this, { name == "test" }) { function ->
                    error(body)
                })
            }
    prints
    println("Testing...")
        val a = 1
        val b = 2
    }
    {
        println("Testing...")
        val a = 1
        val b = 2
    }
    {
        println("Testing...")
        val a = 1
        val b = 2
    Apparently, it's printing the function's body as many times as it has lines with
    }
    and
    {
    in between. Is that a known issue?
    r
    • 2
    • 3
  • n

    Nikita Klimenko [JB]

    02/26/2021, 12:22 AM
    Hi everyone! Correct me if this question should be posted on github instead. Are there updates on
    typed quotes
    PR? It's been around for a while now. Seems fully functional, but merge is blocked by conflicts.
    r
    b
    r
    • 4
    • 13
  • n

    Nikita Klimenko [JB]

    03/07/2021, 4:23 PM
    Hi! How to register your own IDE plugin via MetaIde? I'm at the stage when Meta IDE plugin successfully resolves, tests ran. (Thanks to
    arrow-meta-examples
    ). But IDE didn't register plugins ><
    r
    i
    • 3
    • 12
  • m

    mattmoore

    03/08/2021, 4:56 PM
    Hello. While building from the latest arrow-meta, I found this failed as it doesn’t exist? https://github.com/arrow-kt/arrow-meta/blob/master/build.gradle#L59 - for now I’ve commented it out on my branch but curious about that.
    r
    r
    • 3
    • 4
  • a

    Ahmed Mourad

    03/12/2021, 3:05 AM
    Hi, I'm using the
    classDeclaration
    Quote and I'd like to check if the class is annotated with an annotation using the annotation's fqname. However, when I loop over the its
    annotationEntries
    all their `name`s seem to be null and only `shortName`s are available, also the
    isAnnotatedWith
    function seems to only match for the short name.
    r
    • 2
    • 1
  • m

    MaHDi

    03/14/2021, 11:38 AM
    Hello, I want want to do some contributions. I don't know where to start from. plz let me know what can I do in arrow-meta. thanks beforehand.
    r
    • 2
    • 2
  • a

    Andrew Handley-Marsh

    03/17/2021, 4:40 PM
    Hi all! Asynchronously dropping this here: The docs on https://meta.arrow-kt.io/setup.html are a little out of date, with the Gradle Plugin Portal being a dead link (https://plugins.gradle.org/plugin/io.arrow-kt.arrow). Does anyone know what the correct link would be? (Will swing by tomorrow but afk for now.)
    r
    m
    r
    • 4
    • 11
  • t

    Tatum Alenko

    04/07/2021, 4:18 AM
    Hi there 👋 Likely noob question here but I managed to built a compiler plugin that generates code and when I run it, it behaves as expected; however, IntelliJ highlights the injected code as an
    Unresolved reference
    . Is that normal and if so, how does one go about fixing these reference errors? I am using
    Transform.replace(..)
    To be specific in case it is needed, my plugin generates a companion object for abstract classes annotated with
    @TableName
    and creates the same named properties in the companion object with the value being what is passed inside the
    @ColumnName
    annotation. The code runs fine but IntelliJ highlights it as an error:
    r
    • 2
    • 3
  • r

    Rachel

    04/08/2021, 2:13 PM
    ℹ️ Hi 👋 Please, the OSS JFrog repository for SNAPSHOT versions:
    maven { url "<https://oss.jfrog.org/artifactory/oss-snapshot-local/>" }
    has been replaced by:
    maven { url "<https://oss.sonatype.org/content/repositories/snapshots/>" }
    1.4.10-SNAPSHOT
    artifacts will be removed from the old repository to avoid misunderstandings in the next few minutes. Thanks!!
    👍 1
    d
    • 2
    • 4
  • s

    stojan

    04/30/2021, 11:45 AM
    https://twitter.com/relizarov/status/1387833892497932297?s=19
    👏 4
    s
    r
    • 3
    • 3
  • r

    Rachel

    05/05/2021, 3:07 PM
    ℹ️ Hi 👋 @here In case the latest version under development
    1.5.0-SNAPSHOT
    is being used. Some changes were introduced today!
    compiler-plugin
    has been moved to
    compiler-plugin-core
    and there is a new artifact for every compiler plugin. You can find more details in `arrow-meta-examples` repository and setup
    compiler-plugin
    for
    1.5.0-SNAPSHOT
    will be removed tomorrow to avoid misunderstandings. Thanks for your interest!
    👏 4
    r
    d
    b
    • 4
    • 5
  • g

    George Pandian

    06/04/2021, 10:09 AM
    I came here from Amanda’s talk about AST which led me to Ale’s post both very interesting having said that NGL  - I have not finished both till the end. Need more learning or refresher on former.  In Ale’s post I am struggling to understand the below two assumptions that I took or understood it that way: 1. Operand = Expression      The above stands true  if the LHS is equated to RHS       However RHS is not a constant as is evaluated by applying principles of BODMAS to LHS. 2. I am struggling to understand the necessity of 2 languages (apologies if it sounds otherwise intended) as I feel Kotlin allows us to do it perhaps?      I am not an expert but my understanding is the parser (say designed for Kotlin language)   a. From the intermediate class identify the patterns or classify regex and do recursive process of elimination   b. If the patterns matches the keyword and operands [stored in appropriate Data Structure] of the language (then removed them / push).   - Pass 1   c. Read the file LTR, get the constants away (i.e. remove them / push) - Pass 2   d. Read the file LTR, get the variables (i.e. remove them / push) - Pass 3 Then pop and using S-expression apply BODMAS = Voila ? If I have missed something or misunderstood please guide me.
    r
    • 2
    • 1
  • r

    Rachel

    06/10/2021, 9:06 AM
    ℹ️ Hi 👋 Arrow Meta Gradle Plugin: •
    id: io.arrow-kt.arrow
    was replaced by a specific Gradle Plugin for every Compiler Plugin: •
    io.arrow-kt.refined-types
    •
    io.arrow-kt.proofs
    •
    io.arrow-kt.optics
    • ... • more coming The artifact of the old Arrow Meta Gradle Plugin for the latest version under development
    1.5.0-SNAPSHOT
      will be removed tomorrow to avoid misunderstandings. Sorry for the inconveniences and thanks for your interest! 🙌
    👏 11
    s
    • 2
    • 1
  • t

    than_

    06/29/2021, 12:14 PM
    Hi, when trying to define my own refined types I'm getting an
    java.lang.IllegalArgumentException: object is not an instance of declaring class : package.PositiveInt2.Companion.invoke
    This happens just by defining new refined type. I tried to copy
    PositiveInt
    and just change the name
    class PositiveInt2 private constructor(val value: Int) {
        companion object : Refined<Int, PositiveInt2>(::PositiveInt2, {
            ensure((it > 0) to "$it should be > 0")
        })
    }
    is it a bug in a
    io.arrow-kt:arrow-refined-types-gradle-plugin:1.5.0-SNAPSHOT
    or am I missing something?
    r
    • 2
    • 8
  • m

    Mitchell Skaggs

    07/10/2021, 3:02 AM
    I can't seem to get
    arrow-optics-gradle-plugin
    working with Kotlin Multiplatform. It uses a Kotlin compiler plugin, so it should work, right? The properties in the companion object are never generated though, whether I put the data class in
    commonMain/kotlin
    or
    jvmMain/kotlin
    .
    • 1
    • 1
  • n

    Nathan Bedell

    08/08/2021, 1:22 AM
    Hey all! I'm really excited about the prospect of using Arrow meta to write compiler plugins for Kotlin. To get started learning arrow-meta, I tried writing a simple compiler plugin recently to try to add a simple Haskell-like "deriving" mechanism that adds statements to an existing class body to automatically implement a particular interface for data classes. I'm using kotlin-poet to generate the new statements, and the code I'm using looks like (some sections elided for brevity):
    /** Kotlin compiler plugin to automatically derive a Buildable instance for any class
     * annotated Buildable. */
    val Meta.genBuildable: CliPlugin get() =
        "GenBuildable" {
            meta(
                classDeclaration(
                    ctx = this,
                    match = {
                        // ...
                    },
                    map = { (c, d) ->
                        val dataClass = classAsDataClass(c)!!
                        Transform.replace(
                            replacing = c,
                            newDeclaration = c
                                .text.`class`.syntheticScope.value!!.also { it ->
                                    it.addDeclaration(
                                        generatePartialClass(dataClass)
                                            .toString()
                                            .declaration<KtDeclaration>()
                                            .value!!
                                    )
                                    it.addDeclaration(
                                        generateCtx(dataClass)
                                            .toString()
                                            .declaration<KtDeclaration>()
                                            .value!!
                                    )
                                    it
                                }.text
                                .`class`
                        )
                    }
                )
            )
        }
    I've tried this, as well as a few similar things. However, every time I try to run my plugin, I get the error:
    java.lang.IllegalArgumentException: Missing extension point: org.jetbrains.kotlin.com.intellij.treeCopyHandler in container org.jetbrains.kotlin.com.intellij.core.CoreApplicationEnvironment$1@757c71a1
    	at org.jetbrains.kotlin.com.intellij.openapi.extensions.impl.ExtensionsAreaImpl.getExtensionPoint(ExtensionsAreaImpl.java:260)
    I didn't see any examples like what I'm trying to do in the
    arrow-meta-examples
    , so I was wondering if someone could point me in the right direction with this. I'm planning on making this an open-source project when finished, so I'd be happy to provide the full source code if someone wants to take a closer look -- but any help would be much appreciated!
    👀 2
    r
    • 2
    • 9
  • t

    than_

    08/16/2021, 12:16 PM
    https://kotlinlang.slack.com/archives/C5UPMM0A0/p1629114668062700?thread_ts=1629049630.061900&amp;cid=C5UPMM0A0 Always wanted to ask why for example Either is not implemented as a value class. Is this the reason?
    s
    • 2
    • 2
  • p

    pablisco

    08/28/2021, 10:04 PM
    Has anyone come across this problem? I’m trying to give this meta plugin a go 🙂
    r
    • 2
    • 6
  • p

    pablisco

    08/31/2021, 9:28 AM
    I have another thought @raulraja I’m wondering what
    ExtensionPhase
    to use to do a check when any function is called. Would it be
    dotQualifiedExpression
    ?
    r
    • 2
    • 4
  • b

    Benoît

    09/09/2021, 9:47 AM
    Hey guys, is it okay to use arrow-meta's unionTypes? It's not very documented and I can't find examples online. What's the best way to consume then?
    👀 1
    r
    j
    • 3
    • 7
  • d

    Dr. Florian Schmidt

    09/10/2021, 6:52 PM
    Wow, arrow meta is a really powerful and amazing tool! It just cannot be underestimated! If you think about monads and stuff in a mathmeatical way, most of the functions involved arise from natural transformations, which should be implemented as static functions - just like Monad.return(): (T)->Monad<T>, or Monad.multilply(): Monad<Monad<<T>>->Monad<T>. Do you think it is possible to trick the kotlin compiler with some meta-plugin to accept something like """interface { @Companion fun ... }""" to implement "static interfaces"?
    r
    y
    • 3
    • 6
  • g

    Gamadril

    09/19/2021, 12:53 PM
    Hi all. Please tell me the right direction to go... I try to create a kotlin compiler plugin which should automatically add "@kotlinx.serializable.Serializable" annotation to specific classes BEFORE the kotlinx-serialization plugin will process them. I tried it without arrow meta as pure kotlin compiler plugin using "DelegatingClassBuilder/defineClass" but it seems it's too late in the build process, because no serializers are generated for the classes by the the kotlinx plugin although the annotations are definitely present in the generated class files. So what would be the right way to do/try it using arrow-meta?
    r
    • 2
    • 3
  • n

    Nathan Bedell

    09/24/2021, 12:00 AM
    Hey all. It's been awhile since I've been able to work on my "buildable" project using arrow meta -- but I recently created a project on github for it, and started working on it again. For some reason, I can no longer get my project, which is based off of the arrow-meta-examples/generate-sources example, to work. Right now I have three modules:
    generate-sources
    for the actual compiler plugin,
    interfaces
    for the interfaces generated by the plugin, and the annotation used, and
    testmod
    to test out the plugin. To check if the plugin is loaded while building
    testmod
    , I currently have a single error message that should get called whenever running the plugin in
    generate-sources
    -- yet
    testmod
    builds successfully without showing this compiler error, so it seems like my plugin isn't getting loaded in
    testmod
    -- but I can't see why (I was able to get this working before, but unfortunately that was before I checked anything into git). Could someone take a look at my project and see what I'm missing? https://github.com/Sintrastes/buildable-kt
    r
    • 2
    • 3
  • n

    Nathan Bedell

    09/26/2021, 5:27 PM
    Alright, I know this isn't an arrow-meta question specifically, but I figured the folks here might be able to help: Does anyone know how to grab the package path where a class is located from a
    KtClass
    ? Closest I've been able to get so far is
    ktClass.parent
    , which (assuming the
    KtClass
    sits at top level), I believe gives me a
    PsiElement
    that represents the file that the class sits in. However, even there, I can't see any way to get the package path where the class resides. I'm not seeing anything in the methods of either
    KtClass
    or
    PsiElement
    that would be helpful here. Any ideas?
    r
    • 2
    • 6
  • l

    Lukasz Kalnik

    10/12/2021, 1:19 PM
    Hi, I'm preparing a short presentation to highlight the features of Arrow 1.0 at my company. I have a question about refined types: are they included in the 1.0 release? What other meta-programming features are production ready in 1.0?
    r
    • 2
    • 5
  • j

    jimn

    10/14/2021, 6:44 AM
    "We don’t recommend you use Arrow meta for compiler development until the IR backend is announced stable in 1.5.0 and we have a better idea of what compiler plugins look there. I expect 1.5.0 if it supports compiler plugins to have the corresponding IDE integration which is what currently make many compiler plugins not possible." Kicking the can down the road is the new normal.😒miling_face_with_tear:
    r
    e
    • 3
    • 4
  • j

    jimn

    10/14/2021, 1:14 PM
    i found this in (and only in) google cache about FIR. ipfs://bafybeihiop2r3cgdvuvsz52q4lsddems6svm5rx5wqbv2ab6zz3snmthkq/
    s
    • 2
    • 4
  • n

    Nathan Bedell

    10/15/2021, 2:04 PM
    Alright, I know people have a lot of mixed feelings about "checked exceptions", but I'm curious, has anyone made/attempted to make a compiler plugin that emulates them in Kotlin? Maybe not necessarily as errors, but as warnings? I'm just thinking about circumstances in production where an unchecked call to
    .first()
    that should have been a
    .firstOrNull()
    that snuck past code review leads to an application crash. Since
    .first()
    is annotated
    @Throws
    I'd at least like to be warned of the possibility of an unhandled exception there that can either be handled, or explicitly suppressed if I can reason to myself it can never happen (Of course, then I'd ideally want to use a
    NonEmptyList
    🙂 -- but the desire to have a plugin like this still stands).
    r
    p
    • 3
    • 16
Powered by Linen
Title
n

Nathan Bedell

10/15/2021, 2:04 PM
Alright, I know people have a lot of mixed feelings about "checked exceptions", but I'm curious, has anyone made/attempted to make a compiler plugin that emulates them in Kotlin? Maybe not necessarily as errors, but as warnings? I'm just thinking about circumstances in production where an unchecked call to
.first()
that should have been a
.firstOrNull()
that snuck past code review leads to an application crash. Since
.first()
is annotated
@Throws
I'd at least like to be warned of the possibility of an unhandled exception there that can either be handled, or explicitly suppressed if I can reason to myself it can never happen (Of course, then I'd ideally want to use a
NonEmptyList
🙂 -- but the desire to have a plugin like this still stands).
And of course,
Either
is the more functional way of doing this, but here I'm thinking of something in the stdlib or a third-party library. My current approach is to define a detekt rule that warns against problematic unsafe functions -- but I feel like it would be better if there were a more comprehensive solution.
r

raulraja

10/15/2021, 2:27 PM
Hi @Nathan Bedell we are working on the problem from a different angle
https://github.com/arrow-kt/arrow-meta/blob/main/plugins/analysis/kotlin-plugin/src/test/kotlin/arrow/meta/plugins/analysis/AnalysisTests.kt
https://github.com/arrow-kt/arrow-meta/blob/main/plugins/analysis/laws/src/commonMain/kotlin/arrow/analysis/laws/kotlin/Collections.kt#L47
the second link demonstrates how you define a Law over an existing third party function
The plugin analyzes the dataflow and lets you know when you are about to open a posibility for an exception to happen based on the expressed constraints
Arrow Analysis will keep in mind and track @Throws and others, currently is focused in the custom DSL for pre, post and invariants and support third party functions such kotlin.require.
ETA for first release is end of the year
💯 2
p

pdvrieze

10/18/2021, 10:31 AM
Kotlin's
Result
is now allowed to be used outside of coroutines, so is a stdlib compatible alternative to
Either
(in some cases)
n

Nathan Bedell

11/13/2021, 1:31 AM
@raulraja Will this first release also include compiler-plugin support for HKTs?
r

raulraja

11/13/2021, 10:36 AM
@Nathan Bedell a kinds plugin if its possible with FIR will come later. The first two plugins we are gonna release is the Arrow Analysis plugin and the Arrow Proofs plugin which will support materialization of the with/run automatically for multiple receivers but will most likely remove regular argument injection from the current prototype so it will be even simpler than what’s on the Context tests now. We are looking into supporting multiple receivers when they come out instead of implicit arg injection. The proofs plugin will later expand with automatic derivation for sealed and data classes. Multiple receivers + implicit run/with for N types in the context solves type classes, DI and its simpler to maintain and code than injected args.
n

Nathan Bedell

11/13/2021, 2:48 PM
@raulraja Thanks. That makes sense. I was mainly wondering because I am working on a UI framework similar to Bow Arch yet based off Jetpack Compose, and so due to the current deprecation of kinds in Arrow, I have been making use of KindedJ in my library instead. Would there be any interest in an interim "arrow-kinds" package making use of KindedJ, including a lot of the old HKT code in pre-0.13 Arrow, refactored to use KindedJ in the interim for people to be able to depend on before support is added back in for kinds (if it is added back in) via a compiler plugin? Perhaps such a library could be released under the "arrow incubator" branding, and not widely advertised. I'd be happy to do the actual work of digging up the old source code and refactoring it. I've noticed that there's a PR in the main arrow repo for profunctor optics that perhaps we could incorporate as well. Before I noticed this, I actually started implementing a lot of the same code for myself as part of my project.
r

raulraja

11/13/2021, 3:09 PM
As an org we want to stay away from promoving a kind encoding that is far from ideal and requires things in user code like fix(). Having said that we would like to find an alternative for kinded types as a compiler plugin. If you are interested what I’d like to offer is that we explore together a strategy for a compiler plugin that can support kinds. Something that can be done from the point of view of a compiler plugin is ad-hoc add super types to any type which in this model is making them implment the kind interface. Another thing it can be done is apply implicit conversions between Kind<F, A> and actual F<A>. Also it can be explored how the kind runtime its completely erased and left with the known concrete impls in all call sites that are not polymorphic.
We could start with some small example as to “what would higher kinded types look like in Kotlin if supported by the compiler” and go from there.
n

Nathan Bedell

11/13/2021, 3:19 PM
@raulraja I'd definitely be interested in that. I think the difficulty for me there would be my lack of understanding of the Kotlin compiler plugin architecture and FIR -- I think I would need that so that I could get a better idea of what sort of things might be possible, and I'm not sure where the best resources for gaining that understanding might be.
r

raulraja

11/13/2021, 6:04 PM
I think regardless of the compiler internals or impl details the first thing would be to come up with a small set of examples of kinds used in declarations and at call sites. Feel free to ping me on DM if you are interested or in #arrow-contributors and we can discuss what that would look like. For example in this new plugin hows does Functor.map look like?
View count: 1