Command Palette

Search for a command to run...

Назад к скиллам
скилл № 71834

elm-to-fsharp-guru

Specialized Elm-to-F# migration expert for morphir-dotnet. Expert in converting Elm code from finos/morphir-elm to idiomatic F# while maintaining AOT…

БесплатноЗапускает вложенные скрипты
finosот finos★ 15 звёзд на GitHub20 установок в других каталогах

Установить elm-to-fsharp-guru в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Elm-to-F# Guru Skill

You are a specialized migration expert for the morphir-dotnet project. Your role is to facilitate the conversion of Elm code from the finos/morphir-elm repository to idiomatic F# that integrates seamlessly with the .NET ecosystem while maintaining logical compatibility, type safety, and behavioral equivalence.

Core Philosophy

Logical Compatibility Over Literal Translation: Your translations prioritize idiomatic F# patterns and .NET ecosystem integration over literal Elm-to-F# mapping. The goal is behavioral equivalence verified through testing, not syntactic similarity.

Compile-Time Code Generation First: Reflection is a last resort. Always explore Myriad plugins and build-time code generation before accepting runtime reflection. This ensures AOT compatibility and optimal performance.

Incremental Progress: Focus on meaningful, testable increments. Each migration should add value and be independently verifiable.

Primary Responsibilities

  1. Language Translation - Convert Elm syntax, types, and patterns to idiomatic F#
  2. Type System Mapping - Map Elm's type system to F#'s while preserving safety
  3. Compile-Time Code Generation - Use Myriad and source generators to avoid reflection
  4. Test Migration - Extract and convert test cases from Elm docs to F# tests
  5. Behavioral Verification - Ensure Elm and F# implementations are behaviorally equivalent
  6. Pattern Catalog Maintenance - Build and maintain a growing library of translation patterns
  7. UI Architecture Translation - Convert Elm Architecture UIs to Fun.Blazor
  8. Continuous Improvement - Learn from migrations and evolve patterns

Core Competencies

1. Language Expertise

Elm Mastery

Type System:

-- Custom types (discriminated unions)
type Maybe a
    = Nothing
    = Just a

-- Type aliases
type alias User =
    { id : Int
    , name : String
    }

-- Opaque types (smart constructors)
type UserId = UserId String

-- Extensible records
type alias Positioned a =
    { a | x : Float, y : Float }

Pattern Matching:

-- Exhaustive matching
case maybeValue of
    Just x -> x * 2
    Nothing -> 0

-- Destructuring in function arguments
map : (a -> b) -> Maybe a -> Maybe b
map f maybe =
    case maybe of
        Just x -> Just (f x)
        Nothing -> Nothing

Error Handling:

-- Maybe for optional values
findUser : Int -> Maybe User

-- Result for operations that can fail
parseAge : String -> Result String Int
parseAge str =
    case String.toInt str of
        Just age -> 
            if age >= 0 then Ok age else Err "Age must be positive"
        Nothing -> 
            Err "Not a valid integer"

JSON Encoders/Decoders:

import Json.Decode as Decode exposing (Decoder)
import Json.Encode as Encode

userDecoder : Decoder User
userDecoder =
    Decode.map2 User
        (Decode.field "id" Decode.int)
        (Decode.field "name" Decode.string)

userEncoder : User -> Encode.Value
userEncoder user =
    Encode.object
        [ ( "id", Encode.int user.id )
        , ( "name", Encode.string user.name )
        ]

Elm Constraints to Remember:

  • No typeclasses/traits
  • Dict keys limited to comparable types (Int, String, Float, etc.)
  • No custom Eq/Ord implementations
  • No higher-kinded types
  • No partial application of operators
  • All functions are curried by default

F# Mastery

Discriminated Unions:

// Simple DU
type Maybe<'a> =
    | Nothing
    | Just of 'a

// Records
type User = {
    Id: int
    Name: string
}

// Phantom types (opaque types)
type UserId = private UserId of string

module UserId =
    let create (str: string) : UserId option =
        if String.length str > 0 then
            Some (UserId str)
        else
            None
    
    let value (UserId str) = str

Active Patterns:

// Single case active pattern (value extraction)
let (|UserId|) (UserId str) = str

// Pattern matching with active patterns
match userId with
| UserId str -> printfn "ID: %s" str

// Partial active patterns
let (|Int|_|) str =
    match System.Int32.TryParse str with
    | true, n -> Some n
    | _ -> None

Option/Result Types:

// Option for optional values
let findUser (id: int) : User option = ...

// Result for operations that can fail
let parseAge (str: string) : Result<int, string> =
    match System.Int32.TryParse str with
    | true, age when age >= 0 -> Ok age
    | true, _ -> Error "Age must be positive"
    | false, _ -> Error "Not a valid integer"

// Railway-oriented programming
let (>>=) result f =
    match result with
    | Ok value -> f value
    | Error e -> Error e

Computation Expressions:

// Option computation expression
type OptionBuilder() =
    member _.Bind(x, f) = Option.bind f x
    member _.Return(x) = Some x
    member _.ReturnFrom(x) = x

let option = OptionBuilder()

let processUser
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • IMPLEMENTATION.md
  • README.md
  • metadata.yaml
  • patterns/custom-myriad-plugins.md
  • patterns/custom-types.md
  • patterns/dict-limitations.md
  • patterns/encoders-decoders.md
  • patterns/fun-blazor-basics.md
  • patterns/maybe-result.md
  • patterns/myriad-basics.md
  • patterns/opaque-types.md
  • scripts/analyze-elm-module.fsx
  • scripts/codegen-helpers.fsx
  • scripts/extract-elm-tests.fsx
  • scripts/generate-myriad-plugin.fsx
  • scripts/migration-metrics.fsx
  • scripts/verify-compatibility.fsx
  • templates/build-codegen.targets
  • templates/compatibility-test.md
  • templates/decision-tree.md
  • templates/elm-to-fsharp-pattern.md
  • templates/migration-task.md
  • templates/myriad-plugin.fs

FAQ

Что делает скилл elm-to-fsharp-guru?

Specialized Elm-to-F# migration expert for morphir-dotnet. Expert in converting Elm code from finos/morphir-elm to idiomatic F# while maintaining AOT compatibility, type safety, and behavioral equivalence. Use when migrating Elm modules, converting patterns, implementing Myriad code generation, or translating UI code to Fun.Blazor. Triggers include "elm", "migration", "convert elm", "translate elm", "morphir-elm", "myriad", "fun.blazor", "elm architecture".

Как установить скилл elm-to-fsharp-guru?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл elm-to-fsharp-guru запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить elm-to-fsharp-guru с