{-# LANGUAGE FlexibleInstances #-}

-- | A module for data types that can have a file extension inferred. e.g. A @Javac@ data type compiles source files with a @java@ file extension.
module Lastik.Extension(
                        ext',
                        Extension(..)
                       ) where

import Lastik.Output
import Lastik.Compile

-- | A class of data types that can have a file extension inferred.
class Extension e where
  ext :: e -> String

instance Extension [Char] where
  ext = id

-- | Prepends a @"."@ to the given extension.
ext' :: (Extension e) => e -> String
ext' e = '.' : ext e