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

  • Home
  • SEARCH
  • 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 357863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:14:43+00:00 2026-05-12T12:14:43+00:00

I’m looking into LINQ and the query language appears (at least on the surface)

  • 0

I’m looking into LINQ and the query language appears (at least on the surface) to be nothing more than an implementation of map and/or list comprehensions as found in Haskell and other FP languages (particularly the generalisation of ‘map’ and ‘for’ in Scala). Is this correct? Is there more to the syntax than this? From the breathless tone of the book I’m reading (“Essential LINQ”) it would seem like there’s something new or innovative here.

There’s the whole back-end, pipeline, first-order expression trees and types etc to implement LINQ but my question is about the query language itself.

Cheers

Joe

  • 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-05-12T12:14:44+00:00Added an answer on May 12, 2026 at 12:14 pm

    Functionally spoken, LINQ is nothing but a syntactic simplification of expressing monads. Linq to Objects (List-comprehensions – even this would already be extremely useful), which you have been talking about, is just one possible application of this (similar to the List-Monad in Haskell).

    If you write

    from x in expr1
    from y in expr2
    select x + y
    

    it’s nothing but

    do
        x <- expr1
        y <- expr2
        return $ x + y
    

    in Haskell.

    The concrete thing that is done depends on user-defined Linq-providers (Extension-Methods) of which Linq.Enumerable is just one implementation involving IEnumerables.

    By providing one, you can create completely new LINQ-semantics for your types.

    Example: Given an Option type for computations that may fail (nullable values), one could define a Linq-provider for querying over them.

    public static class MaybeExtensions
    {
    public static Option<T> ToMaybe<T>(this T value)
    {
        return Option<T>.Some(value);
    }
    
    public static Option<U> SelectMany<T, U>(
        this Option<T> m, 
        Func<T, Option<U>> k)
    {
        return !m.IsNone ? Option<U>.None : k(m.Value);
    }
    
    public static Option<V> SelectMany<T, U, V>(
        this Option<T> m, 
        Func<T, Option<U>> k, 
        Func<T, U, V> s)
    {
        return m.SelectMany(x => k(x).SelectMany(y => s(x, y).ToMaybe()));
    }
    } 
    

    This would now allow us to write such code:

    var sum = from x in ReadNumber("x")
              from y in ReadNumber("y")
              select x + y; 
    

    The computation will only return a value if all computations succeeded and will otherwise fail at the first failing one.

    In combination with expression trees, Linq can be extremely powerful and allows you to express –

    1. Database accesses
    2. Asynchronous programm flow
    3. Maybe-Monads
    4. List comprehensions
    5. Recursive descent parsers
    6. Continuations
    7. Mini-languages
    8. Parallel computations (PLinq)

    Some links:

    • List of linq providers
    • Marvels of monads
    • Linq or language integrated monads
    • Linq parser library
    • Another explanation of monads (F#)

    Combined with fixed-point combinators, Linq provides a complete functional mini-language (Linq raytracer).

    Note that Scala and F# both have similar concepts in for-comprehensions and computation expressions both being monadic abstractions:

    Scala:

    for (x <- expr1
         y <- expr2) yield x + y
    

    F#:

    monad {
        let! x = expr1
        let! y = expr2
        return x + y
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 236k
  • Answers 236k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Shift+J removes the line change character from the current line,… May 13, 2026 at 6:20 am
  • Editorial Team
    Editorial Team added an answer Static variable values are shared across all threads in an… May 13, 2026 at 6:20 am
  • Editorial Team
    Editorial Team added an answer You don't have to handle differing tax rates per municipality?… May 13, 2026 at 6:20 am

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want use html5's new tag to play a wav file (currently only supported
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I've got a string that has curly quotes in it. I'd like to replace
In order to apply a triggered animation to all ToolTip s in my app,

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.