مُصَيِّغ كود هاسكيل (نُسخة Fourmolu / Ormolu)

مطورنص
إعلان · حذف؟

أو
Lines longer than this are flagged in the report (Ormolu / Fourmolu default is 100).
إعلان · حذف؟

مرشد

Haskell Code Formatter (Fourmolu / Ormolu Style)

مُصَيِّغ كود هاسكيل (نُسخة Fourmolu / Ormolu)

Paste raw Haskell source and get back code formatted to a deterministic, Fourmolu / Ormolu-inspired style — with consistent operator spacing, sorted LANGUAGE pragmas, grouped imports, and tabs normalized to spaces. Everything runs locally in your browser, so your source code never leaves your machine.

كيفية استخدام

  1. Upload a .hs file or paste your Haskell source into the input box (use the “Try an example” link for a quick sample).
  2. Pick your indent size — 2 spaces (Fourmolu default) or 4 spaces (Ormolu default).
  3. Set the max line length used to flag overly long lines in the validation summary (defaults to 100).
  4. تبديل فرز الاستيرادات, Sort & deduplicate LANGUAGE pragmasو، و دمج السطور الفارغة to match your project’s house style.
  5. The formatted output appears automatically with syntax highlighting; use Copy or Download to grab the result.

خصائص

  • Deterministic spacing — adds canonical spaces around =, ::, ->, <-, =>, $, ++, comparison operators, and Applicative / Monad combinators like <$>, <*>, >>=.
  • Pragma normalization — pulls every {-# LANGUAGE ... #-} pragma to the top of the file, splits combined pragmas into one extension per line, sorts them alphabetically, and removes duplicates.
  • ترتيب التصنيفات — sorts consecutive import statements alphabetically by module name while preserving the unqualified / qualified grouping convention.
  • Layout-safe — preserves the user’s leading indentation (Haskell’s layout rule is significant) while converting tabs to spaces using the chosen indent width.
  • Comment-safe tokenizer — correctly handles line comments (--), nested block comments ({- ... -}), pragmas, strings with escapes, and character literals so operator characters inside them are never mangled.
  • Bracket + block validation — flags unbalanced parentheses, brackets, braces, and unterminated block comments with line numbers.
  • Long-line report — highlights any line that exceeds your configured maximum width so you can refactor before review.
  • 100% من جانب العميل — your code is processed entirely in the browser; nothing is uploaded, logged, or stored.

التعليمات

  1. What is the difference between Ormolu and Fourmolu?

    Ormolu is a strict, opinionated Haskell formatter with effectively no configuration — every project formatted by Ormolu looks the same. Fourmolu is a fork of Ormolu that exposes a handful of style knobs (indentation size, comma placement, leading-vs-trailing commas, record-brace spacing) for teams that want a consistent style that is not identical to upstream Ormolu. Both share the same parser and AST-driven approach, so they produce reliably valid Haskell.

  2. Why is Haskell formatting hard for general-purpose AI?

    Haskell uses the off-side rule — indentation is semantically significant and determines where blocks like let, where, do, and case ... of begin and end. A formatter must understand the parse tree, not just the token stream, to re-indent safely without changing program meaning. General-purpose language models reason about code as text and routinely produce indentation that compiles differently from the input, especially for nested where-clauses and multi-line lambdas.

  3. What is a LANGUAGE pragma?

    A LANGUAGE pragma is a directive of the form {-# LANGUAGE ExtensionName #-} placed at the top of a Haskell source file to enable a GHC language extension for that module — for example OverloadedStrings, ScopedTypeVariables, or TypeApplications. Pragmas can be combined ({-# LANGUAGE A, B, C #-}) but most style guides recommend one extension per line and alphabetical sorting for easy diffs.

  4. Why are qualified imports usually grouped separately?

    Convention groups qualified imports (import qualified Data.Map as M) after plain imports (import Data.List) so a reader can scan unqualified names first and see at a glance which modules are accessed through aliases. This is the layout produced by stylish-haskell, Ormolu, and Fourmolu by default, and it keeps merge conflicts localized when a project adds or removes qualified aliases.

هل تريد حذف الإعلانات؟ تخلص من الإعلانات اليوم

تثبيت ملحقاتنا

أضف أدوات IO إلى متصفحك المفضل للوصول الفوري والبحث بشكل أسرع

أضف لـ إضافة كروم أضف لـ امتداد الحافة أضف لـ إضافة فايرفوكس أضف لـ ملحق الأوبرا

وصلت لوحة النتائج!

لوحة النتائج هي طريقة ممتعة لتتبع ألعابك، يتم تخزين جميع البيانات في متصفحك. المزيد من الميزات قريبا!

إعلان · حذف؟
إعلان · حذف؟
إعلان · حذف؟

ركن الأخبار مع أبرز التقنيات

شارك

ساعدنا على الاستمرار في تقديم أدوات مجانية قيمة

اشتري لي قهوة
إعلان · حذف؟