Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8211933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:35:40+00:00 2026-06-07T10:35:40+00:00

Another question on Emacs 24.1 and Haskell. I’ve noticed that it does indenting for

  • 0

Another question on Emacs 24.1 and Haskell. I’ve noticed that it does indenting for me and it does very basic highlighting for me (types are in green, for example). But out-of-box Emacs 24.1 doesn’t highlight commonly used functions like foldr, map, etc. Is there an ability for Emacs and haskell-mode to highlight commonly used functions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T10:35:42+00:00Added an answer on June 7, 2026 at 10:35 am

    Fundamentally, standard library functions are just that–functions. In fact, depending on your imports, any of them could be user-supplied rather than from the standard prelude! This actually happens often–for example, if you want to use Control.Category you usually hide id and replace it with a polymorphic version.

    So in short, there is no real reason to highlight standard functions. So I really doubt this functionality is present in the standard Haskell mode.

    That said, this is Emacs. You can easily add anything you want. If you have a list of all the function names you want to highlight, it should not be difficult to add that to the Haskell mode.

    You can add your new functions to the haskell-mode highlighting with code something like this in your .emacs file:

    (font-lock-add-keywords 'haskell-mode 
                            '(("\\<\\(map\\|foldr\\|foldl\\)\\>" 1 
                               '(:foreground "#3366FF") t)))
    

    The weird looking string is an Emacs-style regular expression. \< and \> are like \b and \(, \| and \) are for alternation inside a group. Since there are no regex literals, every \ has to be escaped inside the string. The regex would be more readable as \<\(map\|foldr\|foldl\)\>. You can easily add other function names by adding new cases to the expression.

    The (:foreground "#3366FF") just sets the color of the text to a rather fetching shade of blue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Another question related to this one . I have a List<SortableObjects> that is the
Another question of mine about optimizing Objective C programs inspired the following: does anyone
From another question I recently posted, it seems that Classic ASP might not be
In another question, the answer states that on Unixes with /proc , the really
In another question , the accepted answer suggested replacing a (very cheap) if statement
Another question following on from this thread . The only remaining item that I
In another question I was worried about using a web service that takes a
Using Emacs/Magit, I had first a very smooth git experience in another project, but
In another question , a user pointed out that the new keyword was dangerous
For another question, I'm running into a misconception that seems to arise here at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.