Skip to content

How to open .LHS files on Android

To open .LHS files on Android, open it with a text-editor app as plain text; for compiling/running with GHC, transfer it to a desktop or Linux environment (GHC toolchains are typically used on desktop/server platforms).

Step-by-step instructions

  1. Open it with a text-editor app as plain text; for compiling/running with GHC, transfer it to a desktop or Linux environment (GHC toolchains are typically used on desktop/server platforms).

Common issues

The file opens, but the code parts look wrong

Literate Haskell relies on specific conventions to distinguish documentation from code; viewing it in a word processor or with incorrect text settings can make the code blocks hard to identify.

  1. Open the file in a plain-text/code editor rather than a word processor.
  2. If you are compiling, use GHC (it applies the literate pre-processor for .lhs) and confirm the file follows literate conventions described in the Haskell report.

Compilation fails because it is treated like normal .hs source

If the toolchain is not using a literate-aware compilation path, the documentation lines can be interpreted as code and cause errors.

  1. Compile with GHC using the .lhs file directly so the literate pre-processor stage is applied.
  2. Confirm you did not rename a .hs file to .lhs (or vice versa) without adjusting the file’s content to match literate conventions.

My system does not recognize .lhs / opens it with the wrong app

File-type associations vary by platform; some systems may not have a built-in association for Literate Haskell.

  1. Use “Open with…” and choose a text editor, then set it as the default for .lhs if desired.
  2. On Linux desktops, recognition can depend on the shared MIME database installed on the system.

Still can’t open your .LHS file?

Recover a deleted or lost .LHS file

If the file was deleted by mistake or the drive was formatted, data recovery software may be able to get it back. Stop writing to that drive right away, because new data can overwrite what you want to recover.

We may earn a commission when you use affiliate links. This supports our free file extension guides.

Security note

.lhs files are plain text, but they can contain Haskell code that may run arbitrary actions when compiled/executed; treat untrusted .lhs files like any other source code you might run.

Did this guide help?

Back to .LHS extension page